Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

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:
    360
    Whoa, I missed the notification

    1) The hyphen (-) currently doesn't make word splits. You still need to use spaces.
    2) The auto scale was available in 4.x but gone in 5.x, Currently I have no plan to revive it back due to technical difficulties.

    Indeed. I'm gonna investigate this.
     
  2. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
    I am using spaces and not - to produces spaces, that was just a hyphen in a word. It's used to show the words have a combined meaning.

    On further testing, the white spacing only seems to occur so far when the text out-scales the box. So auto-scaling would fix this but:

    So I'll try and figure something out that scales the text and hopefully the white spacing goes away too.
    Cheers for the response
     
  3. ritwiksaikia

    ritwiksaikia

    Joined:
    Jan 27, 2019
    Posts:
    1
    First of all thanks a lot for the major 5.x upgrade for 2019 LTS, specially for URP. I tried out the new version, and facing these two issues while using "TEXDraw 3D" component

    1. Alignment of symbols is not correct,
    Code (csharp):
    1.  
    2. \left( \sum_{k=1}^n a_k b_k \right)^{\!\!2} \leq
    3.      \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
    4.  
    Check the attachment for the render.

    2. I get a NullReferenceException while hitting the play button
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TEXDraw3DRenderer.Repaint () (at Assets/Plugins/TEXDraw/Script/TEXDraw3DRenderer.cs:45)
    3. TEXDraw3D.Redraw () (at Assets/Plugins/TEXDraw/Script/TEXDraw3D.cs:244)
    4. TEXDraw3D.OnEnable () (at Assets/Plugins/TEXDraw/Script/TEXDraw3D.cs:174)
    5.  
     

    Attached Files:

  4. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    You have to use math mode, either enclose them using $ or $$

    Yeah, I admit some users have problems using it. I will investigate.
     
  5. sebjwallace

    sebjwallace

    Joined:
    Feb 18, 2018
    Posts:
    7
    Hello, I have just purchased the asset and I've loaded up the showcase scene. It seems almost all the examples are broken. I'm using Unity 2019.3.11f1 and 2D project. What could I do about this?

    texdraw.png textdrawerrors.png textdrawerrors1.png
     
    Last edited: Sep 2, 2020
  6. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Actually the asset itself is fine. It's just that the examples there are not updated since latest 5.x breaking version. The first few example scenes in the folder is the new one, they should be fine.
     
  7. jw727727

    jw727727

    Joined:
    Sep 12, 2020
    Posts:
    2
    I have just bought TEXDraw, if I create a TEXDraw gameobject I get the exception:
    "MissingComponentException: There is no 'CanvasRenderer' attached to the "TEXDraw Renderer" game object, but a script is trying to access it."
     
  8. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Hi, You probably just add TEXDraw without Canvas, then drag it inside. What you probably need to do is disable-then-enable the component, it should works then.
     
  9. jw727727

    jw727727

    Joined:
    Sep 12, 2020
    Posts:
    2
    I don't know how to do this, it seems to automatically put the TEXDraw in the canvas when created, if I create one in a scene without a canvas it will create a canvas automatically and put the TEXDraw into the canvas. In either case there's no CanvasRenderer component, and if I add one manually there's no option to enable/disable it. Am I using the wrong version of Unity or something? I'm using 2020.1.5f1.
     
  10. mleonard36

    mleonard36

    Joined:
    Jul 31, 2020
    Posts:
    4
    I am running into an issue where the TexDraw renders differently when built out to WebGL. It seems to add a ton of space before lines of a paragraph. Is there any suggestions for how to fix this?
     
  11. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    I have no idea. I will check it soon.
     
  12. mleonard36

    mleonard36

    Joined:
    Jul 31, 2020
    Posts:
    4
    For more reference, the text is being loaded in and rendered fine within unity. it is just a centered string that wraps within the component. When built out however, each line of the wrap has a ton of space before it. This even happens if the text is 1 line.
     
  13. mleonard36

    mleonard36

    Joined:
    Jul 31, 2020
    Posts:
    4
    It seems to be an issue in the WebGL build when the canvas scales to a different resolution. Setting the canvas to constant pixel fixes the problem but causes many issues when it comes to my UI.
     
  14. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Hi folks,

    So it's been a while since TEXDraw 5.x came out but I haven't figure a good time to continue on adding features yet. If you used 4.x in the past and then 5.x recently, you can see in the difference that besides I tried to continue to support it for Unity 2019.x and up, I tried to rewrite the engine from the groundup just to make this product compatible with other LaTeX software like JSMath, MathJax, etc. This has the cost that many features are not been able to migrated fully and many users seem like missing it already.

    So in order to make TEXDraw fun again I will try to spend more time again, but I need your feedback about what's most important feature that you feel missing, or maybe what's make you held back with 4.x.

    I keep thinking to finish the documentation first but I kept held back in circle because I feel the product itself is missing something. I can tell a few, like more customizable table, the layout system, or input system. Still doesn't clear to me because I can't figure which feature need to get done first and what's not.
     
  15. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
    Feature request: Automatic text resizing would be SO useful!
     
    WillNode likes this.
  16. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    TEXDraw 5.1, next major update to current TEXDraw is available in Asset Store. You should check it out :)
     
  17. Nefahl

    Nefahl

    Joined:
    Feb 20, 2017
    Posts:
    11
    I get several missing type or namespace right after importing 5.1:
    Assets\Plugins\TEXDraw\Core\TexImporterSDF.cs(65,46): error CS0246: The type or namespace name 'TMP_FontAsset' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Plugins\TEXDraw\Core\TexImporterSDF.cs(65,105): error CS0246: The type or namespace name 'Action<>' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Plugins\TEXDraw\Core\TexImporterSDF.cs(65,112): error CS0246: The type or namespace name 'TMP_FontAsset' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Plugins\TEXDraw\Core\TexFontSigned.cs(23,16): error CS0246: The type or namespace name 'TMP_FontAsset' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Plugins\TEXDraw\Core\TexFontSigned.cs(25,19): error CS0246: The type or namespace name 'Dictionary<,>' could not be found (are you missing a using directive or an assembly reference?)


    If I let them automatically be resolved there are still some new missing symbols, especially in the TexImporterSDF:
    Assets\Plugins\TEXDraw\Core\TexImporterSDF.cs(504,33): error CS0103: The name 'ISetProp' does not exist in the current context
    Assets\Plugins\TEXDraw\Core\TexImporterSDF.cs(520,33): error CS0103: The name 'ICall' does not exist in the current context

    Edit: Okay I checked out an older version of the project, disabled TextMeshPro Integration, removed the Asset and imported it completely, no Errors until I Activate the TMP Integration again.
    Which version of TMP is the asset depending on?
     
    Last edited: Nov 23, 2020
  18. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Whoa, I didn't aware this. I was doing automatic "using namespace" cleanup but didn't enable TMP Integration so all "using" in those files gone. Sorry my mistake, the fix has been rolled out in Git but in asset store it can take couple days to appear in asset store.
     
  19. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
    @WillNode is there any plans for automatic text resizing? Or suggestions for a quick work-around?
     
  20. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Not really sure but hope I can spare sometime this holiday in Jan to work on the feature.
     
    L_A_R likes this.
  21. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
    Ok wonderful, thank you very much
     
  22. tylkomat

    tylkomat

    Joined:
    Jun 17, 2019
    Posts:
    12
    @WillNode I just bought the newest version 5.1.1 from the asset store and imported in. I enabled the TextMeshPro integration.

    I get lots of validation errors in the following schema:
    Code (CSharp):
    1. PlayerSettings Validation: Requested build target group (0) doesn't exist; #define symbols for scripting won't be added.
    2. UnityEditor.PlayerSettings:SetScriptingDefineSymbolsForGroup(BuildTargetGroup, String)
    3. TEXEditorMenus:SetDefined(String, Boolean, BuildTargetGroup) (at Assets/Plugins/TEXDraw/Editor/TEXEditorMenus.cs:572)
    4. TEXEditorMenus:SetDefined(String, Boolean, Boolean) (at Assets/Plugins/TEXDraw/Editor/TEXEditorMenus.cs:542)
    5. TEXEditorMenus:SetTextMeshProIntegration() (at Assets/Plugins/TEXDraw/Editor/TEXEditorMenus.cs:372)
    The same message is shows multiple times with just "build target group " changing 0, 2, 5, 6, 15, 16, 17, 18, 20, 22, 23, 24 and 26.

    When I add a UI->Textdraw Element to the scene and use one example
    $$-b \pm \sqrt{b^2 - 4ac} \over 2a$$
    it looks like this:
    texdraw.png

    the lines on squareroot and line separator are missing. Also the color can't be changed.
     
  23. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
    @tylkomat whilst running the game in play mode, if you increase the height of your textbox manually does the square root line show properly in your quadratic formula?
     
  24. tylkomat

    tylkomat

    Joined:
    Jun 17, 2019
    Posts:
    12
    No, I already played around with that.
     
  25. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    I just spotted that there's some changes in TMP that makes importing progress got corrupt. Will try to fix it soon.
     
    tylkomat likes this.
  26. ericthecyclist

    ericthecyclist

    Joined:
    Feb 10, 2020
    Posts:
    8
    Hi,
    I just purchased TEXDraw over Christmas so it should be the latest version.
    I'm trying to get a block of text that is externally centered, but internally left aligned.
    ie, something like this:
    first line is this
    second line
    third
    My googling for tex suggests I should be able to do it with
    \begin{center}
    \begin{minipage}
    first line is this \\
    second line \\
    third
    \end{minipage}
    \end{center}

    With just the \begin{minipage}, the text is left aligned, but when I add the \begin{center},
    the internal left alignment is lost. Any suggestions? Thank you.
     
  27. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    TEXDraw doesn't support \begin{minipage}.

    You can try to set alignment as center in inspector, then use \begin{flushleft}...\end{flushleft} for specific text. Relevant information in the manual.
     
  28. ericthecyclist

    ericthecyclist

    Joined:
    Feb 10, 2020
    Posts:
    8
    Ah, my example of what I'm trying to achieve seemed to have been broken by the forums formatting getting rid of my spacing. I'll try this again, with underscores instead of spaces.
    What I'm looking for is something like:
    __________First line is this__________
    __________second line_____________
    __________third___________________

    Using the \begin{flushleft} pushed everything to the left, but didn't start a new block that was centered by the \begin{center}.

    Following the manual you referenced, I was able to use:
    \begin{center}
    \begin{tabular}{l}
    First line is this \\
    second line\\
    third\\
    \end{tabular}
    \end{center}
    but it does triple spacing between lines.
    Is there a way to override the line spacing?
    I tried stuff from the older manual (\meta and \htable) but that didn't seem to be supported any longer.
     
  29. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    I found an 'ugly' hack for this. I don't know if this is a feature or bug yet.

    upload_2021-1-24_7-21-21.png

    Next time I will make a proper minipage.
     
  30. tylkomat

    tylkomat

    Joined:
    Jun 17, 2019
    Posts:
    12
    @WillNode Thank you. Do you have an idea when it will be available?
     
  31. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    I have uploaded the fix in GitLab repo. But I still hold to publish it in asset store as I'm working with few other features right now. Probably it'll done this week.
     
    tylkomat likes this.
  32. Nefahl

    Nefahl

    Joined:
    Feb 20, 2017
    Posts:
    11
    @WillNode Does this also fix the Tools->TEXDraw->Rebuild Font Data described below?

    Tried to remove the iconic sprite-font(removing unused stuff on the project) and Rebuild.
    It makes all fonts go black and blurry, also tried it on an older project version without changing anything besides using the rebuild menu-entry, same result.


    RebuildBlur.png
     
  33. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    I didn't know that. I'll make sure it will addressed as well.
     
    Nefahl likes this.
  34. ericthecyclist

    ericthecyclist

    Joined:
    Feb 10, 2020
    Posts:
    8
    I'll give that a try! Thank you.
     
  35. Mighty_One

    Mighty_One

    Joined:
    Apr 13, 2019
    Posts:
    4
    I am running into an issue where the TexDraw erases all resources after rebuilding. (TMP integration is enabled) I tried to reimport it but the result is still the same. upload_2021-2-5_0-5-36.png

    After that
    upload_2021-2-5_0-6-35.png

    TexDraw was bought two days ago
     
  36. vieraacademy

    vieraacademy

    Joined:
    Dec 7, 2018
    Posts:
    3
    How to autosize TexDrawUI to match a RectTransfrom area?
     
  37. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    For the time being, downgrade your TMP to 2.0.1 (using Package Manager)

    It's not supported yet.
     
    vieraacademy likes this.
  38. vieraacademy

    vieraacademy

    Joined:
    Dec 7, 2018
    Posts:
    3
    Thanks for your answer! I read some previous comments, I love this Asset, I have used it for 2 years and I am very happy to have it. I decided to update it because a lot of LaTeX features are missing from the previous version. And others that I implemented, like a $ and $$ math context, using the above Complement system and some other HTML tags.
    I can handle some of the new features that are missing compared to previous versions. But I need AutoSize to update the project because it is very important and is used in all my applications.
    So the question is, do you plan to do it in no time? Or is it at the bottom of the stack?
     
  39. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Since 5.x was out autosizing has been #1 requested feature so I understand how important it is. But in 5.x it's way harder to implement (because now it's similar with how most LaTeX software works) than 4.x. I'm still working on it.

    By the way, I have pushed new version (5.2) recently, it's under review right now. I thought I can finish the autosizing at this time but then we got urgent fix because TMP internal changes that break things, so it didn't come with that.

    By the time it's available i'll annouce it here anyway.
     
    vieraacademy likes this.
  40. vieraacademy

    vieraacademy

    Joined:
    Dec 7, 2018
    Posts:
    3
    Hello @WillNode, here's another problem. The text is aligned to the left, but when RectTransform adds width, the spacing between the words increases. You can see it on the Video included

    EDITED

    I think that the best behavior is that words just stay with the words spacing fixed, and when the space is enough then another word is added from the next line. But without this dynamic space on the first.
     

    Attached Files:

  41. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    LaTeX default behavior is justified by default, so do TEXDraw. But you can uncheck this so then it's turned off by default.

    upload_2021-2-5_14-3-32.png

    You can also turn off justification individually using \raggedleft
     
  42. Mighty_One

    Mighty_One

    Joined:
    Apr 13, 2019
    Posts:
    4
    I still get these errors trying to enable TMP upload_2021-2-5_9-1-19.png
     
  43. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    They're harmless error actually
     
  44. Mighty_One

    Mighty_One

    Joined:
    Apr 13, 2019
    Posts:
    4
    But after that, I still get the previous error
     
  45. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Wait, you might be confused with versions.

    There's TEXDraw v5.2 you can download right now. That's should work with latest version of TMP (v2.3.1). (update both via Package Manager).
     
  46. Mighty_One

    Mighty_One

    Joined:
    Apr 13, 2019
    Posts:
    4
    Thank you. It works :D
     
    WillNode likes this.
  47. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Good news, I have finished this feature and it's available to use in GitLab repo.

    I need to update couple of things (and the documentation need improvements really) before releasing new version. Probably it'll be done next week.
     
    tylkomat likes this.
  48. LuigiAndMario

    LuigiAndMario

    Joined:
    Dec 1, 2020
    Posts:
    1
    Hi there!

    I'm currently running into a problem with TEXDraw: When I try to update the contents of a TEXDraw3D object, there sometimes are "leftovers" from the previous content. I joined a picture to explain my point a little better.

    What I do is to update the value of myTExDraw3D.text. I tried
    • replacing that value with an empty string first before putting the new one,
    • calling the Redraw() function,
    • even deleting the TEXDraw3D and creating a new one
    but in spite of all of that, the leftovers persist. Do you know what this could be due to, and how to fix this ?

    Thanks!!


    Here's what it looks like. In this case, the tex attribute is set to $\square$, but right before setting it to that it contained a larger formula with brackets involved
     
  49. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Thanks for your report. Unfornatunely I don't understand how is that even possible. It works as usually for me. Maybe you can send an example project? We can continue the conversation in email if you want.
     
  50. tylkomat

    tylkomat

    Joined:
    Jun 17, 2019
    Posts:
    12
    Hello @WillNode, thank you for your efforts to make it running with TMP.
    Is there a way to make the fonts more crisp? Like they are with TMP, currently they look blurry.

    How do I use the \vector symbol in cmmi, doing $$\vector{F}$$ displays the arrow quite far away from the Character
     
unityunity