Search Unity

TEXDraw - Create Math Expressions inside Unity!

Discussion in 'Assets and Asset Store' started by WillNode, Jan 13, 2016.

  1. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Just submitted another update V3.8 today. Starting from this version the documentation is split to two: Manual and Reference because scrolling between 60+ pages is not cool. Also complete release changes from now is only maintained in Version.txt inside the package.
     
  2. PhantomJ

    PhantomJ

    Joined:
    Mar 21, 2017
    Posts:
    9
    Hi,WillNode

    I have two alignment problems here.

    What can I do to make the index number align to the top?
    Like:
    a.png b.png
    and what can I do to make the equation set align to the left?
    Like:
    c.png d.png

    Thank you!
     
  3. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Okay @PhantomJ, It's fairly simple.

    First, To make superscript have the same level, you need to rise the superscript minimum height (aka. SupMin) in TEXDraw Preference, inside tab "Configurations".

    Second, assume you use \nfrac in that equation, then replace that with \nlfrac so it'll aligned to left, simple as that.
     

    Attached Files:

  4. PhantomJ

    PhantomJ

    Joined:
    Mar 21, 2017
    Posts:
    9

    Hi,WillNode

    Thanks for help,the first problem has been solved.

    But there comes another problem.

    9AD0DB4B-3278-4BFC-8517-9D12A8251AC2.png

    As this shows,if there is another fraction in the equation,it will become smaller.And this is not what I expect.

    So,how can I keep it showing like before and just align to the left?

    Thanks.
     
  5. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Oops. I forgot you use \matrix actually. So there's another one: \ltable[]. Sure there's lot another way to do the same thing like that.

    Screenshot (480).png
     
  6. PhantomJ

    PhantomJ

    Joined:
    Mar 21, 2017
    Posts:
    9
    Problems solved!
    Thank you!;)
     
  7. PhantomJ

    PhantomJ

    Joined:
    Mar 21, 2017
    Posts:
    9
    Hi,WillNode.

    I've met a new problem here...
    98919E71-FAF1-467F-A2EB-9C8079B0CB2E.png

    As you can see,all the things behind the "^" have become superscript.

    But what I want is the second one.
    And I found that wrapping it with "{}" can make it look normal.
    Is there any setting options to modify the default behavior to do the same thing without "{}" wrapping?

    Thanks.
     
  8. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Wow, sorry for the late reply, somehow your question doesn't make to my mailbox.

    All scripts without {} are stopped with either a whitespace or backslash. If you want to explicitly tell which is become the script, you need to add {} after script ^ symbol, e.g. (2a-b)^{2}(2x-8)
     
  9. PhantomJ

    PhantomJ

    Joined:
    Mar 21, 2017
    Posts:
    9

    OK,seems like it's the only way,I'll add {} after every ^.
    Thank you very much!;)
     
  10. cheeguan

    cheeguan

    Joined:
    Oct 1, 2015
    Posts:
    2
    Hi,WillNode.

    I would like to say TEXDraw is a very powerful plugin and developer friendly!

    Is there anyway to Rebuild font data on runtime?

    The thing I want to achieve is pack the font into asset bundle and download it when the user first time launch the app, then rebuild font data. The reason why I doing this is want to reduce the file size.

    I have read through some scripts in TEXDraw but I see a lot of function only available in Unity Editor.

    So is it possible to do that?

    Thanks.
     
  11. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Hello, cheeguan

    Thanks for that. Unfornatunely, TEXDraw is not designed to change font data at runtime. Your argument is correct, a lot of code for font importer is 'Editor only'.

    However, that's not mean it is impossible. I'm started to working on refactoring & simplifying the whole asset so I might add the feature to the future version. We can continue to the email conversation for follow up.
     
  12. cheeguan

    cheeguan

    Joined:
    Oct 1, 2015
    Posts:
    2
    Thanks for quick reply. Im looking forward for future version. :)
     
  13. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    Hi,

    Texdraw not work with ngui scrollbar.
     
    Last edited: Dec 16, 2017
  14. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Someone also have this problem recently (in email support) and I found the solution:

    In `Assets\TEXDraw\Script\NGUI` rename folder `Shaders` to `Resources` and Reimport `TexdrawIncludes.cginc` to force shader recompile. This will be included for an update in the next week. Let me know if this works for you.
     
  15. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Little bit announcement: I'm working on TEXDraw v4.0 right now.

    At this state TEXDraw codebase is little bit cumbersome, so i think it is the time for optimizations. I'll tell little bit futher next time.
     
  16. yayapeter

    yayapeter

    Joined:
    Jun 24, 2014
    Posts:
    24
    How to use TEXDraw to draw like this picture? upload_2017-12-18_0-50-10.png
    and draw like this picture? upload_2017-12-18_0-53-48.png

    I can't find to draw this from reference and manual.
     
  17. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Well that's not a simple table. Nor you can do this via other formula. The best thing I can suggest is to separate components and draw the line with something like UI Line renderer.
     
  18. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    Hello,

    I am using your Texdraw package with NGUI. Its woking fine but now I am loading my object(Texdraw) with asset bundle. its not working with asset bundle. Any solution?
     
  19. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Honestly I'd not know AssetBundle before. But really which asset is 'bundled'? TEXDraw assets (font, etc.) is not designed to be bundled from external asset bundles for now.
     
  20. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    Hi,
    Thanks for your quick reply
    Actually I have a page with the some text so I am using NGUI UILabel for text and using Texdraw for display mathematical equations. I am building the asset bundle of the page when I load this asset bundle then UILabel text displaying perfect but Texdraw text not displaying in both view(Scene and Game).

    That is best for me if you can give some solution

    Best regards,
    Play_edu
     
  21. yayapeter

    yayapeter

    Joined:
    Jun 24, 2014
    Posts:
    24
    This is TEX content below:
    \begin{tabular}{cccc}
    $a^3 b$ & $a^2 b$ & \multicolumn{1}{c|}{$c$} & \\
    & & \multicolumn{1}{c|}{} & $b$
    \cline{1-3}
    \end{tabular}

    And this is latex pdf output result.

    upload_2017-12-20_0-13-42.png

    How to use TEXDraw to draw this picture?
     
  22. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Just playing around with AssetBundle. Turns out they has nasty workflow where assets is duplicated at bundling if serialized. and texdraw does serialize the preference, which is not good. The fix is relatively easy though. Head over to email chat to get the patch.
     
  23. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    For the sake of maintaining it, TEXDraw's latex syntax is different than the original.

    This is the best way to do it: \table[001001]{a&c&b|c&d&e|f&g&h}. You can see what those numbers mean in Reference doc. If you want more flexibility then you need to hack around this feature limitation.
     
  24. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    thanks.
     
    WillNode likes this.
  25. yayapeter

    yayapeter

    Joined:
    Jun 24, 2014
    Posts:
    24
    Please help me to solve how to display the two picture below,I can't find the solution
    upload_2017-12-21_1-5-32.png upload_2017-12-21_1-6-8.png
     
  26. yayapeter

    yayapeter

    Joined:
    Jun 24, 2014
    Posts:
    24
    Can you provide the mapping table about TEXDraw syntax and LaTex syntax?
     
  27. yayapeter

    yayapeter

    Joined:
    Jun 24, 2014
    Posts:
    24
    Use TEXDraw how to draw graphp like this below or Use TexDraw to load image?
    upload_2017-12-21_10-34-52.png upload_2017-12-21_10-37-55.png
     
  28. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    that's \over{BC} {AC}^^\rightarrow

    No mapping available. But please look at the reference for available syntax and symbols. It's pretty flexible. If you think something missing I can make a note for v4.0.

    This is a way cool feature that I'd never thought before. So you can't. You need another image/UI renderer to do that.
     
  29. yayapeter

    yayapeter

    Joined:
    Jun 24, 2014
    Posts:
    24
    Please help me to solve how to display this picture below?
    upload_2017-12-21_20-15-58.png
     
  30. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    \under{BC}. Again you can see those in reference pdf.
     
  31. yayapeter

    yayapeter

    Joined:
    Jun 24, 2014
    Posts:
    24
    I know TEXDraw support to draw upload_2017-12-23_0-45-8.png by using \root
    but I can't find the solution to solve these below:
    upload_2017-12-23_0-44-43.png
    I think it should be support,because Synthetic division will use these symbol.
     

    Attached Files:

    WillNode likes this.
  32. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Well, I can add that to v4.0. Should be easy.
     
    yayapeter likes this.
  33. yayapeter

    yayapeter

    Joined:
    Jun 24, 2014
    Posts:
    24
    Does TexDraw support like this picture below?
    variable defination:
    a = 2
    b = 1

    TexDraw Example: [exp]a^3xb[/exp] x^{3} + [exp]b^2[/exp] x + [exp]a[/exp]
    It will calculate then output
    upload_2017-12-24_17-26-37.png
    and I hope TexDraw support any math expression calculation in the exp tag ,like cos 30° ...and so on.
     
  34. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    I don't know where you get the [exp] variable expression like that? Anyway it's interesting but unnessary as there's no harm to just precalculate your input via script and push "8x^2+4x+1" to TEXDraw.
     
  35. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Just submitted it. V4.0 will be available within few days. There's big improvement in codebase. Also the uncompressed bytesize of TEXDraw's resource down to 500KB from 1.3MB. Unlike the past, this version will feels like nothing changes much but trust me, TEXDraw will be so much painless to use.

    By today's standard I also lift the minimum Unity version to 5.6.0. This will make sure that no warning will popup in console in most recent Unity version. Because of this I also keep the old version in asset store, just in case until stat shows that nobody uses the old one.

    Yes, I have add this as \border. Thanks for the idea :)

    Oh, and Happy new year to all of you!
     
  36. arnold_kjun

    arnold_kjun

    Joined:
    Jan 4, 2018
    Posts:
    4
    Hi, WillNode

    Maybe you're busy now for writing documentation, I think.
    I want to know how amount change to release ver 4.0 .
    plz tell us how long you'll spend for completion your new documents you suppose?

    (I do not usually use English, my English may be strange.
    in simply words, i want docs for version 4.0)
     
  37. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Version 4.0 have been accepted in the asset store!

    The updated doc for v4.0 have been included in the package. Sorry I forgot to upload doc in the link. Will do right right away.
     
  38. arnold_kjun

    arnold_kjun

    Joined:
    Jan 4, 2018
    Posts:
    4
    thank you for your reply.
    i knew new release this morning in mail and i cannot use Unity till now today, so i cannot notice what changes in the package.

    Thank you!
     
    WillNode likes this.
  39. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Well you can check the release notes right from the asset store page ;)
     
  40. fs-a-tamura

    fs-a-tamura

    Joined:
    Jan 12, 2017
    Posts:
    2
    This asset is compatible with Unity 2017?
    Now, I use Unity5.6, but I wanna use BigInteger or BigDecimal class with this asset.
    If not, when do you support for it?
     
  41. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Yes, definitely. Just extract as usual.
     
  42. fs-a-tamura

    fs-a-tamura

    Joined:
    Jan 12, 2017
    Posts:
    2
    Thank you for quick reply, WillNode.
    All other assets I use are creating Unity2017, so I change Unity version to 2017.
    I'm grad to meet you and your great asset!!
     
    WillNode likes this.
  43. arnold_kjun

    arnold_kjun

    Joined:
    Jan 4, 2018
    Posts:
    4
    Hi, WillNode.
    I have 2 problems about font now.

    First,the default font "cmmi.ttf" makes numerical characters different height.
    Which is it dependent to ttf file or TexDraw?
    (plz see uploaded images. I like alphabet characters of this font, so I want to use it.)

    Second, on TexDrawNGUI, the font type isn't changed when I switch "Font Index" Property.
    Is my setting is sth wrong? if not, can you fix it?

    Both problems occur on Unity5.6.0f3 and Unity2017.3.0f3.

    Please solve them and help me.

    If you've already answered similar question, please tell me where the reply exists.
    I'm sorry I have no time to search in all replies in this thread.(Now is just to go to work.)

    TexDrawFontSizeDismiss.png TexDrawFontSizeDismiss-5.6.png
     
  44. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Yes, indeed. but the default it is configurable. Look at 'default typefaces' in manual.

    Quick fix: In menu bar, open tools > TEXDraw > configurations > scroll to bottom and see 'numbers'. change that to font that you like (eg. opens)
     
  45. arnold_kjun

    arnold_kjun

    Joined:
    Jan 4, 2018
    Posts:
    4
    Thank you for your reply.
    Now I try to change configuration of TexDraw, and succeed to change.
    I'm not good at English, I couldn't read manuals deeply.

    The bug TexDrawNGUI's font cannot be changed is still occurring.
    but, changing common preference apply to TexDrawNGUI's font.

    I'll learn the languages (English, C#, TexDraw, etc..) more.
     
  46. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Weird. It should works in NGUI too. Do you have try Unity UI (uGUI)?
     
  47. vichear_FE

    vichear_FE

    Joined:
    Jan 21, 2018
    Posts:
    1
    Hi, I wanna know whether if your plugin understand formula of Latex? As i test there some keyword not the same like SquareRoot. Is there any solution for this if i want to convert from my latex formula to Unity UI automatically?
     
  48. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Unfornatunely LaTeX has diverse syntax (because it's not stricted and possible to generate custom syntax with plugins), so I can't really help. I suggest to do your own conversion using online Regex tools like http://regexr.com .
     
  49. Troglodit

    Troglodit

    Joined:
    Oct 7, 2012
    Posts:
    23
    Hello! Thanks for the great asset!
    However, I need some help with colors and linebreaks

    As you can see the text breaks at the wrong place and overflow the boundaries for some reason. Is there any workaround for this case?
    Thanks
     
  50. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    @Troglodit it's a bug. Nice catch!

    I traced my gitlog and turns out the code that wraps them is commented out! I must have done something wrong :D

    You can fix it by commenting out the code at Core/Atom/RowAtom.cs line 50.