Looks like some quirk happened here and it should be as above with
https://github.com...
> $ cd lualatex-arithmetic-overflow/sphinx-error
> $ make latexpdf
>
> As I am new to TeX, I cannot determine if this problem is due to Sphinx's
> TeX styles or a bug in LuaTeX. Any advice would be appreciated.
>
> Regards,
>
Hi,
Thanks for your test projects.
This looks like a tough one, provisory conclusion is that this is not caused by Sphinx's LaTeX styles.
I am in the midst of pressing deadlines and can't examine it more thoroughly until next week, in particular I have not tried to produce a non-Sphinx example but expect for reasons I explain below that this will be easily feasible.
here is what I can say so far (thanks to your projects).
The error is a division by zero error.
This is caused by the box \@arstrutbox having zero height. This height is queried by Sphinx in its multirow implementation.
The \@arstrutbox height is configured by the tabulary environment using \strutbox height.
The \strutbox height is unexpectedly having zero height at this location of start of tabulary.
But does not have zero height when `the` (or for that matter any Latin letter) is present at start of the preceding sectioning title.
Thus \strutbox is unexpectedly modifed by how this sectioning title looks, which is definitely not a Sphinx matter.
The \strutbox seems to have some specific Lualatex behavior which may involve the current direction of typesetting. Here is what happens if I add \showthe\ht\strutbox after this sectioning title
good case
```
> 11.19995pt.
\strutbox ...etparameter {direction}=4 \ystrutbox
\else \tstrutbox \fi \fi
l.125 \showthe\ht\strutbox
```
bad case
```
> 0.0pt.
\strutbox ...etparameter {direction}=4 \ystrutbox
\else \tstrutbox \fi \fi
l.125 \showthe\ht\strutbox
```
(line numbering is meaningless due to added debugging stuff in produced LaTeX file)
A priori and after quick check nothing in Sphinx LaTeX files will deliberately modify \strutbox.
If I have time later I will try to produce a non-Sphinx minimal example. It would go via trying to make a division by the height of the \strutbox.
I suspect a connection with direction of typesetting. Maybe in vertical typesetting the \strutbox is interpreted to provide width, not height. Unfortunately I am both very ignorant in Lualatex specifics and in non-Latin scripts especially regarding not Left to Right usage of TeX.
As per
> Currently,
docs.python.org has stopped generating PDF documents in Japanese
> due to a failure. I am trying to restart it by changing the latex engine
> from platex to LuaTeX, but I need help with the following error.
Where can one see this failure? Maybe it will be easier to fix it than trying to use lualatex without a lualatex + Japanese + Sphinx expert available.
By the way Sphinx now uses uplatex which is Unicode aware.
------------
Running 'uplatex -kanji=utf8 -recorder "foo.tex"'
------------
This is e-upTeX, Version 3.141592653-p4.0.0-u1.28-220214-2.6 (utf8.uptex) (TeX Live 2023/dev) (preloaded format=uplatex)
however I suspect the "failure" was already tested with recent Sphinx and that the uplatex does not fix it as you report using Sphinx 6.1.3 in your test of Lualatex.
Could you please open a ticket at Sphinx, something with title "LaTeX: build failure if language is Japanese when using LuaLaTex (not pLaTeX)". As I mentioned it will probably not be addressed before some time. This is for documentation, as I expect that the issue is not directly imputable to Sphinx, in view of circumstances above.
Thanks
Jean-François