Giter Club home page Giter Club logo

Comments (4)

RobinCoffee avatar RobinCoffee commented on September 28, 2024

Btw this formula "\frac{\sqrt{35x^{15-b^{{{{3}^{a^{b^{c^{d^{e^{f^{g^{h^{i^{j}}}}}}}}}}}}}}}}{2}" albeit very stupid crashes the program. It is valid LaTeX, I checked it several times. This is what it should look like:
Screenshot 2024-04-14 at 1 29 01 PM
Instead I get this error after running ./main:

This is TeX, Version 3.141592653 (INITEX)
**(output.tex
(TeXinputs:plain.tex Preloading the plain format: codes, registers,
parameters, fonts, more fonts, macros, math definitions, output routines,
hyphenation (TeXinputs:hyphen.tex)) [1] )
Output written on output.dvi (1 page, 564 bytes).
Transcript written on output.log.
<nil>
panic: bad command: stack is empty at position 361

goroutine 1 [running, locked to thread]:
main.drawLatex({0x1030595bc?, 0x10304b268?}, 0x14000529e00)
	/Users/24ayden.zinter/GOSTUDY-Shared/gui-playground/fyne/main.go:24 +0x130
main.main()
	/Users/24ayden.zinter/GOSTUDY-Shared/gui-playground/fyne/main.go:42 +0x200

I just checked what would happen if I removed an exponent ("\frac{\sqrt{35x^{15-b^{{{{3}^{a^{b^{c^{d^{e^{f^{g^{h^{i}}}}}}}}}}}}}}}{2}") and it ran. It looks like this tho:
Screenshot 2024-04-14 at 1 35 03 PM
I'm actually so confused, if you remove another exponent you get a similar error. For some reason rendering this exact amount of exponents doesn't crash. It doesn't start working again until the formula "\frac{\sqrt{35x^{15-b^{3^{a}}}}}{2}" it still fails to render the higher exponents:
Screenshot 2024-04-14 at 1 44 36 PM
This stuff may be related to the scaling issues, idk.

from canvas.

tdewolff avatar tdewolff commented on September 28, 2024

Yes, I've noticed similar issues as reported by #231. The problem is with the star-tex.org/x/tex library however, and I've actively looked for an improvement but there is no other library it seems. Improving the library is also difficult, it seems to be a non-trivial amount of work and the author(s) and I don't have a lot of time to fix it.

There are two options: implement font parsers for the LaTeX font formats (quite some work), or port the same library for XeTex which has unicode support (quite some work too). Rewriting a formula parser and parsing the GSUB etc tables for fonts would be even more work.

I'm happy if you can find a good alternative, but unfortunately I don't have time for such a large project right now.

from canvas.

RobinCoffee avatar RobinCoffee commented on September 28, 2024

No worries, appreciate the fast reply tho. Building with -latex is annoying but I'm willing to deal with it for the time being. I figured star-tex would be the problem.
Screenshot 2024-04-14 at 4 16 39 PM
Works fine with -tags latex. Somewhat annoying, but better than the original solution I came up with of running a KaTeX or Mathjax server locally and integrating it into my application. Maybe once I am a better programmer I can work on a parser or something. For now I will just pretend like the problem doesn't exist. Thanks for all of your help anyway :D

from canvas.

tdewolff avatar tdewolff commented on September 28, 2024

Yes, using the system's LaTeX binary will work if you control the target machine. Great to hear you have that option, and you're always welcome to try and submit PRs if you wish! Thank a lot for all the feedback and I hope this library can help you build something useful ;-)

from canvas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.