I'm trying to use start-tex (v0.4) to parse this formula
`$x_{n+1}=x_{n}-\frac{f(x_{n})}{f'(x_{n})}$` but it fails with
```
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))
! Undefined control sequence.
l.3 $$x_{n+1}=x_{n}-\frac
{f(x_{n})}{f'(x_{n})}$$
[1] )
(see the transcript file for additional information)
Output written on output.dvi (1 page, 536 bytes).
Transcript written on output.log.
```
I also downloaded the repo and found that in my local env (Macbook Pro
i9 with MacOS Sonoma 14.5) if I add all the tex files to the test
list:
```
func TestProcess(t *testing.T) {
...
for _, name := range []string{
"../../testdata/hello.tex",
"../../testdata/pages.tex",
"../../testdata/xcolor.tex",
} {
...
```
it fails with this
```
$ go test ./...
--- FAIL: TestProcess (0.07s)
--- FAIL: TestProcess/pages.tex (0.02s)
main_test.go:55: DVI files compare different
--- FAIL: TestProcess/xcolor.tex (0.04s)
main_test.go:55: DVI files compare different
FAIL
FAIL star-tex.org/x/tex/cmd/star-tex 0.653s
FAIL
```
I would like to collaborate on fixing this, so, do you have any
thoughts on where I can start looking?
--
Patricio Díaz G.
En la red: twitter, linkedin, google, telegram, blog
Hello Patricio,
(apologies for the belated answer, I was off the grid for the better part of the summer)
On Sun Aug 4, 2024 at 23:38 CET, Patricio Diaz wrote:
> I'm trying to use start-tex (v0.4) to parse this formula
> `$x_{n+1}=x_{n}-\frac{f(x_{n})}{f'(x_{n})}$` but it fails with
> ```
> 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))
> ! Undefined control sequence.
> l.3 $$x_{n+1}=x_{n}-\frac
> {f(x_{n})}{f'(x_{n})}$$
> [1] )
> (see the transcript file for additional information)
> Output written on output.dvi (1 page, 536 bytes).
> Transcript written on output.log.
> ```
yes, that's expected: right now, star-tex is "just" a TeX engine.
it doesn't have support for LaTeX (which, IIRC, has the tooling for handling such math expressions and syntax).
the planned course of action to fix this limitation is to have an engine that can handle LaTeX.
that's:
- https://todo.sr.ht/~sbinet/star-tex/20
- https://todo.sr.ht/~sbinet/star-tex/16
- https://todo.sr.ht/~sbinet/star-tex/13 (LaTeX support)
the main unblocker would be to be able to generate the TeX engine code from XeTeX instead of the original TeX one from D. Knuth.
(that's #16 and https://gitlab.com/cznic/web2go/-/issues/2)
> I also downloaded the repo and found that in my local env (Macbook Pro
> i9 with MacOS Sonoma 14.5) if I add all the tex files to the test
> list:
> ```
> func TestProcess(t *testing.T) {
> ...
> for _, name := range []string{
> "../../testdata/hello.tex",
> "../../testdata/pages.tex",
> "../../testdata/xcolor.tex",
> } {
> ...
> ```
> it fails with this
> ```
> $ go test ./...
> --- FAIL: TestProcess (0.07s)
> --- FAIL: TestProcess/pages.tex (0.02s)
> main_test.go:55: DVI files compare different
> --- FAIL: TestProcess/xcolor.tex (0.04s)
> main_test.go:55: DVI files compare different
> FAIL
> FAIL star-tex.org/x/tex/cmd/star-tex 0.653s
> FAIL
> ```
> I would like to collaborate on fixing this, so, do you have any
> thoughts on where I can start looking?
for this one, I suspect that's coming from different floating point rounding (we've got a lot of these in Gonum when testing Gonum on the "new" macOS M1 (IIRC)).
but one way to make sure is to compare the textual output of the .dvi files, with 'star-tex.org/x/cmd/dvi-dump' for example.
$> dvi-dump ./testdata/pages_golden.dvi > ref.dvi.txt
$> dvi-dump ./testdata/pages.dvi > chk.dvi.txt
$> diff -urN ./ref.dvi.txt ./chk.dvi.txt
(and perhaps have these steps integrated into cmd/star-tex testing scaffolding...)
cheers,
-s