Why is the LaTeX / pdflatex compiler so "funky" with multiple compilers, necessary and false error messages, etc., compared to C ++?

Is there a simple explanation as to why the latex / pdflatex compiler is scared in the following two ways:

1) N multiple compilations are needed until you reach the "steady state" version. N seems to grow to about 5 or 6 if I use lots of packages and links.

2) Error messages are almost always useless. The actual error is not flagged. Example:

  \begin{itemize} % Line 499
    % Comment: error: forgot to close the enumerate block 
    \item This is a bullet point. 
  \end{itemize}   % Line 503


Result: "Error on line 1 while scanning \ begin {document}", not very useful.

I understand that there is a separate "tex exchange", but I am wondering if someone knowledgeable about C ++, java or other compilers can give an idea of ​​how they support uniform compilation and correct error localization.

Edit: This document looks like a disclosure justifying hacks in the latex implementation, but what about the syntax / language properties of latex make the strange implementation necessary? http://tug.org/texlive/Contents/live/texmf-dist/doc/generic/knuth/tex/tex.pdf


source to share

2 answers

From a LaTeX perspective:

  • You need to require at least 3 (... maybe 4) to reach steady state. It doesn't depend on the number of packages, but on possible layout changes in your document. The layout changes cause the links to move and those links must be correct (hence recompile while they are not moving).

  • Placement in the environment is permitted (although this does not directly address your problem). In addition, macros act as replacement text for your input. So, despite what you write \end{itemize}

    , it actually morphs into a bunch of other / different (primitive) macros, removing the obvious person structure and hence also the weird error message. This is why some error messages are difficult to interpret.



WRT. point (2): Given that most of the bugs are picked up when parsing macro reversals that expand, I guess the bugs would not be helpful to the user, even if they contained locales and specific reasons, because they didn't translate well into what you see when you look at the code.

However, it would be helpful if they were a little more explicit: /



All Articles