GeneralMore wishes - error messages

LaTeX specific issues not fitting into one of the other forums of this category.
pireddag
Posts: 28
Joined: Tue Nov 21, 2017 3:06 am

More wishes - error messages

Post by pireddag »

There are two mistakes that I make sometimes when I write in LaTeX (that is, I forget about these rules every so often and I have to re-learn them), and every time it takes me a bit to figure them out again (the last time it took more than 10 minutes for each).

It would be very, very nice if the LaTeX error messages would highlight the problem, so that I could correct it immediately.

Mistake #1.

I input an empty line inside the equation environment. LaTeX tells me as an answer that he inserted a $ sign and then the compilation fails; a more helpful error message would point out that there is an empty line in the equation environment.

Mistake #2

Sometimes it is necessary to delete the auxiliary files so that LaTeX compiles correctly. I have not yet learnt when this is necessary. The last time that happened to me was when I added the hyperref package to a document that did not have it at the beginning; the previous time was when I added a cross-reference to an equation in a document. In the case of the cross-reference, LaTeX kept telling me that there was a undefined reference. After a while I figured out that I should delete the auxiliary files.
I feel that for this case an error message would help; an error that would be triggered when these two conditions are both fulfilled: 1) there are undefined references 2) the auxiliary files are not updated by the compilation (I guess this is what is happening).

Although for this "mistake #2" I do not understand why LaTeX does not understand that it needs to update the files.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
pireddag
Posts: 28
Joined: Tue Nov 21, 2017 3:06 am

More wishes - error messages

Post by pireddag »

I realize now that this section of the forum is about "Wishes" for the forum, and not "Wishes" for LaTeX.

Perhaps LaTeX/General would be a better section???
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

More wishes - error messages

Post by Johannes_B »

I think it is all about reading the aux file. TeX, as an engine, was developed in the last 30 to 40 years. Computing power and memory was very scarce back then.

Code: Select all

\documentclass{article}
\begin{document}
\begin{equation}
	a+b

\end{equation}
\end{document}

The example above produces the log file below

Code: Select all

This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) (preloaded format=pdflatex 2018.3.6)  9 NOV 2018 16:29
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**pireddagErrors.tex
(./pireddagErrors.tex
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 84 language(s) loaded.
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(./pireddagErrors.aux)
\openout1 = `pireddagErrors.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 3.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 3.

! Missing $ inserted.
<inserted text> 
                $
l.5 
    
? 
! Display math should end with $$.
<to be read again> 
                   \par 
l.5 
    
? 
! You can't use `\eqno' in vertical mode.
\endequation ->\eqno 
                     \hbox {\@eqnnum }$$\@ignoretrue 
l.6 \end{equation}
                  
? 
! Missing $ inserted.
<inserted text> 
                $
l.6 \end{equation}
                  
? 
! Display math should end with $$.
<to be read again> 
                   \endgroup 
l.6 \end{equation}
                  
? 
[1

{/usr/local/texlive/2017/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./pireddagErrors.aux) ) 
Here is how much of TeX's memory you used:
 203 strings out of 492982
 2259 string characters out of 6132513
 54251 words of memory out of 5000000
 3855 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 23i,4n,17p,138b,107s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/local/texlive/2017/texmf-dist/fonts/type1/public/
amsfonts/cm/cmmi10.pfb></usr/local/texlive/2017/texmf-dist/fonts/type1/public/a
msfonts/cm/cmr10.pfb>
Output written on pireddagErrors.pdf (1 page, 16121 bytes).
PDF statistics:
 16 PDF objects out of 1000 (max. 8388607)
 10 compressed objects within 1 object stream
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)
The second error message hints in this case, that there is a paragraph break introduced by the blank line, which is forbidden for an equation. The third error is triggered by the fact, that you cannot use math things in normal text (TeX went back to normal mode when the paragraph break happened).

There is not much to do here for the LaTeX team.

Concerning the auxialiary files, sometimes something is written to them which isn't correct. They are only recreated properly, when the compile run is succesful. But here again, a look at the log-file will make it very clear, where the error happens and which file to delete.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
pireddag
Posts: 28
Joined: Tue Nov 21, 2017 3:06 am

More wishes - error messages

Post by pireddag »

Johannes_B wrote:I think it is all about reading the aux file. TeX, as an engine, was developed in the last 30 to 40 years. Computing power and memory was very scarce back then.
This is fair. I know it because when I was writing my Laurea thesis (1996/97) the system administrator refused me 80 Mb in hard drive quota (he did not have them). TeX was written even before.

I know that no-one is going to modify the TeX code, as far as I understand modifying it will cause a chaos.

But one could work on the LaTeX macros; I know that the LaTeX team is at work to release LaTeX3 :-)
Johannes_B wrote: The second error message hints in this case, that there is a paragraph break introduced by the blank line, which is forbidden for an equation. The third error is triggered by the fact, that you cannot use math things in normal text (TeX went back to normal mode when the paragraph break happened).

There is not much to do here for the LaTeX team.
I do not understand if with "There is not much to do here for the LaTeX team." you mean "The LaTeX team cannot do anything about this" or "The LaTeX team should not do anything about this". Of course I disagree in both cases ;-)

\{equation} is a LaTeX environment as far as I know, and the error message could be handled by LaTex. The error message should say

"LaTeX:No blank lines are allowed in the \{equation} environment".

By the way it would also be helpful if the error message would be clearly marked as coming out from LaTeX (I have written it so).
Johannes_B wrote: Concerning the auxialiary files, sometimes something is written to them which isn't correct. They are only recreated properly, when the compile run is succesful. But here again, a look at the log-file will make it very clear, where the error happens and which file to delete.
Here the puzzling thing is that the compile run looks at least partially successful: one gets a pdf with question marks in place of the reference for example.
I have the feeling that here too LaTeX could (and should, I think) do something. But it could be more complicated, as LaTeX would have to know whether the file has been regenerated or not; if it is able to do so, then it could point out that there is the possibility. Something like

"LaTeX:the aux file was not regenerated and there were undefined references; please delete the aux file and try again".

By the way there is a strong difference in "philosophy" between what I think is right and what you think is right (judging from your answer). For me the right thing to do is to make at least some error messages as clear as possible, so that they can be interpreted by reading them, without knowing how LaTeX works; which error messages then ... it is a matter of a usability analysis. As far as I see, for you (and this could be a common position in the LaTeX world) the right thing to do is that the user needs to become an expert.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

More wishes - error messages

Post by Johannes_B »

LaTeX is not throwing an error because there is a blank line. It is TeX.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
pireddag
Posts: 28
Joined: Tue Nov 21, 2017 3:06 am

More wishes - error messages

Post by pireddag »

Johannes_B wrote:LaTeX is not throwing an error because there is a blank line. It is TeX.
I get that. The point that I am raising is that the error thrown by TeX and the consequent fix in the LaTeX code is clear only for the people that know TeX; LaTeX itself could intervene and issue an error message - labelling it as a LaTeX error.

In my opinion it is fair that the LaTeX error would "superpose" itself to the TeX error in the sense that it lead necessarily to the TeX error. It would make things clearer for me and maybe for others too.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

More wishes - error messages

Post by Johannes_B »

I pinged part of the team, please see the chat transcript.

https://chat.stackexchange.com/transcri ... 1#47556311
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
pireddag
Posts: 28
Joined: Tue Nov 21, 2017 3:06 am

More wishes - error messages

Post by pireddag »

Johannes_B wrote:I pinged part of the team, please see the chat transcript.

https://chat.stackexchange.com/transcri ... 1#47556311
Thanks for this

Which one is the "right page" Ulrike Fischer is referring to?
(https://chat.stackexchange.com/transcri ... 0#47556930)
pireddag
Posts: 28
Joined: Tue Nov 21, 2017 3:06 am

More wishes - error messages

Post by pireddag »

And I also get the story of quitting with x in the aux file error.

https://chat.stackexchange.com/transcri ... 9#47556959

Probably the critical thing is to substitute S for the X that I am using.

If I do like I do (press X) then I have a corrupt aux file, that TeX will try to read again and this will cause again an error. As far as I understand.
Since this can happen, it would be nice to have it documented (IMHO).
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

More wishes - error messages

Post by Johannes_B »

pireddag wrote:Which one is the "right page" Ulrike Fischer is referring to?
(https://chat.stackexchange.com/transcri ... 0#47556930)
Probably https://www.latex-project.org/


The different things to press when an error happens, h or q, or s, or x are all documented. In the TeXbook. When you are interacting, you are interacting with TeX.

As Ulrike and David said, it is possible to make adjustments ... which will probably cause havoc in thousands of documents ... automated error parsing/detection by some guis worthless.


Maybe LaTeX3 can do something about it in the future, but no need to wait impatientely. It will take a while.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply