Sorry for opening so many issues is a short time, but it seems that some things still need fixes. This one is about error reporting in a broken LaTeX document.
LaTeX document containing bugs
\documentclass[11pt]{article}
\usepackage{amsmath}
\begin{document}
Hello World in \LaTeX!
\buggy} %% should result in an error message!
$$ a^2 + b^2 = c^2 $$
\end{document}
local compilation with pdflatex on Ubuntu
$ pdflatex --no-shell-escape --interaction=nonstopmode --halt-on-error my.tex
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian) (preloaded format=pdflatex)
entering extended mode
(./my.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-01-22>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
No file my.aux.
! Undefined control sequence.
l.8 \buggy
} %% should result in an error message!
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on my.log.
compilation with playground.html
Compiling with pdflatex...
[...log shortened...]
=== Compilation Started ===
deferredBundleNames: ["extra-cjk","extra-misc"]
Single-pass mode: no cross-references detected
WASM ready in 25ms
VFS: Lazy loading enabled
Mounted 480 files from bundle core
Mounted 1 files from bundle fmt-pdflatex
Mounted 38 files from bundle l3
Mounted 581 files from bundle fonts-cm
Mounted 749 files from bundle fonts-misc
Mounted 596 files from bundle fonts-lm-tfm
Mounted 184 files from bundle fonts-lm-type1
Mounted 55 files from bundle dvips
Mounted 15 files from bundle extra-maps
Mounted 15 files from bundle fonts-cmextra
Mounted 15 files from bundle fonts-symbols
Mounted 29 files from bundle graphics
Mounted 30 files from bundle amsmath
Mounted 422 files from bundle cm-super
Registered 3 deferred files from bundle extra-cjk
Deferred bundle extra-cjk: mounted 3 file markers
Registered 29 deferred files from bundle extra-misc
Deferred bundle extra-misc: mounted 29 file markers
Rewrote pdftex.map: 2440 font paths resolved
VFS finalized: 3241 files
[TeX ERR] program exited (with status: 1), but keepRuntimeAlive() is set (counter=0) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)
[TeX ERR]
Checking pending deferred bundles: none
[RETRY] enableCtan=true
[RETRY] missingFiles=none
[RETRY] Found undefined commands: buggy[0]
Retry #1...
WASM ready in 8ms
VFS: Lazy loading enabled
Mounted 480 files from bundle core
Mounted 1 files from bundle fmt-pdflatex
Mounted 38 files from bundle l3
Mounted 581 files from bundle fonts-cm
Mounted 749 files from bundle fonts-misc
Mounted 596 files from bundle fonts-lm-tfm
Mounted 184 files from bundle fonts-lm-type1
Mounted 55 files from bundle dvips
Mounted 15 files from bundle extra-maps
Mounted 15 files from bundle fonts-cmextra
Mounted 15 files from bundle fonts-symbols
Mounted 29 files from bundle graphics
Mounted 30 files from bundle amsmath
Mounted 422 files from bundle cm-super
Registered 3 deferred files from bundle extra-cjk
Deferred bundle extra-cjk: mounted 3 file markers
Registered 29 deferred files from bundle extra-misc
Deferred bundle extra-misc: mounted 29 file markers
Rewrote pdftex.map: 2440 font paths resolved
VFS finalized: 3241 files
Auto-shimming 1 commands: buggy[0]
[TeX ERR] program exited (with status: 1), but keepRuntimeAlive() is set (counter=0) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)
[TeX ERR]
Checking pending deferred bundles: none
[RETRY] enableCtan=true
[RETRY] missingFiles=none
Total time: 346ms
Compilation failed: Unknown error
Observations
Comparing the error messages, the pdflatex error
! Undefined control sequence.
l.8 \buggy
} %% should result in an error message!
! ==> Fatal error occurred, no output PDF file produced!
is rather clear. However, the report of the playground ends with
Compilation failed: Unknown error
which is not helpful at all. In particular, there is no file name name and no line number. The only hint is found in the line
[RETRY] Found undefined commands: buggy[0]
Things that look odd to me:
- Why don't I get the same error as in my Ubuntu system?
- Why retry compilation in the first place? There are neither any files missing nor any references to resolve. I think that in this case the decision to retry is wrong (and I don't claim to have an ultimate logic on when retrying helps and when not).
- Why is there no concrete error in the second compiler run? When running pdflatex in bash I get the same error output each time, irrespective of whether an
aux file exists or not.
Sorry for opening so many issues is a short time, but it seems that some things still need fixes. This one is about error reporting in a broken LaTeX document.
LaTeX document containing bugs
local compilation with pdflatex on Ubuntu
compilation with playground.html
Observations
Comparing the error messages, the pdflatex error
is rather clear. However, the report of the playground ends with
which is not helpful at all. In particular, there is no file name name and no line number. The only hint is found in the line
Things that look odd to me:
auxfile exists or not.