Closed marcschulder closed 1 year ago
you shouldn't do typesetting in the preamble, not all font and language related setup is already done there (\settowidth stores the content in a box and so does typesetting). If you move it into the begindocument/end hook it works:
\documentclass{article}
\usepackage{babel}
\babelprovide[import]{japanese}
\newlength{\testwidth}
\AddToHook{begindocument/end}{\settowidth{\testwidth}{.}}
\begin{document}
Test \the\testwidth
\end{document}
Thank you, I didn't realise that! This has indeed resolved the issue.
I am running into an error when trying to compile a document in LuaLaTeX that both imports East Asian script support for babel and uses the
\settowidth
command.Minimal example:
Error message:
I have confirmed this for Japanese, Chinese and Korean. Removing either the
\settowidth
or the\babelprovide
command resolves the issue. I tried some other language imports with different script needs, such as Hebrew and Arabic, but those compile fine. It also compiles under XeLaTeX and pdfLaTeX.I'm running the MacTeX 2023 distribution and updated all packages on 29 June. Babel is at version 3.90. I have also reproduced the issue on Overleaf, using their TeXLive 2022 distribution (although Overleaf initially did not report the issue until I turned off force-compile).