Open darianmavgo opened 11 months ago
yes, go-latex/latex
doesn't handle sub/super-scripts (among other things).
the plan is to use star-tex.org which is a pure-Go implementation of TeX.
my plan with star-tex
is to support LaTeX, eventually. (but momentum somewhat faltered on that front...)
Example latex expression that fails: \frac{d}{dx}(uv) = u\frac{dv}{dx} + v\frac{du}{dx}
Wrapping the expression in $ also fails with same error message Below is the successful output of the image from quicklatex.com:
https://quicklatex.com/cache3/b7/ql_a53f58b0fa3815e0b989f55b486570b7_l3.png ``
Error message while running on macos terminal: panic: unknown ast node *ast.Sup
goroutine 1 [running]: github.com/go-latex/latex/mtex.(visitor).Visit(0x1400017e000, {0x105264088?, 0x1400000e168?}) /Users/darianhickman/go/pkg/mod/github.com/go-latex/latex@v0.0.0-20230307184459-12ec69307ad9/mtex/parser.go:128 +0x58c github.com/go-latex/latex/mtex.(visitor).Visit(0x1400017e000, {0x105263d88?, 0x14000070340?}) /Users/darianhickman/go/pkg/mod/github.com/go-latex/latex@v0.0.0-20230307184459-12ec69307ad9/mtex/parser.go:106 +0x5a0 github.com/go-latex/latex/ast.Walk({0x105263238?, 0x1400017e000?}, {0x105263d88?, 0x14000070340?}) /Users/darianhickman/go/pkg/mod/github.com/go-latex/latex@v0.0.0-20230307184459-12ec69307ad9/ast/walk.go:22 +0x48 github.com/go-latex/latex/ast.Walk({0x105263238?, 0x1400017e000?}, {0x105263c68?, 0x1400000e258?}) /Users/darianhickman/go/pkg/mod/github.com/go-latex/latex@v0.0.0-20230307184459-12ec69307ad9/ast/walk.go:29 +0x368 github.com/go-latex/latex/mtex.(*parser).parse(0x1400007e780, {0x1400001e140, 0x1e}, 0x4038000000000000, 0x4052000000000000) /Users/darianhickman/go/pkg/mod/github.com/go-latex/latex@v0.0.0-20230307184459-12ec69307ad9/mtex/parser.go:59 +0x24c github.com/go-latex/latex/mtex.Parse({0x1400001e140, 0x1e}, 0x1051b8e31?, 0x2?, {0x105264630?, 0x1400000e0a8}) /Users/darianhickman/go/pkg/mod/github.com/go-latex/latex@v0.0.0-20230307184459-12ec69307ad9/mtex/parser.go:25 +0x31c github.com/go-latex/latex/mtex.Render({0x105263018, 0x140000122a0}, {0x1400001e140, 0x1e}, 0x1?, 0x0?, 0x0) /Users/darianhickman/go/pkg/mod/github.com/go-latex/latex@v0.0.0-20230307184459-12ec69307ad9/mtex/render.go:32 +0x4e0 main.main() /Users/darianhickman/Documents/speeddrill/gen_facts/gen_png_latex.go:70 +0x458