2

I'm in possession of a semi-broken LaTeX project. It's possible to compile it by ignoring lots of errors, producing a mainly OK result.

Now I want to fix the errors however, but the error messages don't seem to indicate file names or line numbers?

The main TeX file is called PROGI_ProjektnaDokumentacija.tex, these are the others:

Arhitektura.tex
Dnevnik_promjena_dokumentacije.tex
Dodatak.tex
Implementacija.tex
Literatura.tex
Opis_projektnog_zadatka.tex
Specifikacija_programske_potpore.tex
Zakljucak.tex

I compile it with either pdflatex PROGI_ProjektnaDokumentacija.tex or latexmk -pdf PROGI_ProjektnaDokumentacija.tex (but have to ignore many errors by pressing enter).

When I run latexmk -pdf PROGI_ProjektnaDokumentacija.tex, there's a lot of output produced, this is the end of the output up to the first error:

[6] (/usr/share/texmf-dist/tex/latex/kpfonts/ts1jkp.fd)

Package fancyhdr Warning: \headheight is too small (12.0pt): 
(fancyhdr)                Make it at least 14.49998pt, for example:
(fancyhdr)                \setlength{\headheight}{14.49998pt}.
(fancyhdr)                You might also make \topmargin smaller to compensate:

(fancyhdr)                \addtolength{\topmargin}{-2.49998pt}.

[7]

! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.91 
     
?

At the same point in time this is the end of the PROGI_ProjektnaDokumentacija.log file:

Overfull \hbox (3.47267pt too wide) in paragraph at lines 47--47
[][]\OT1/jkp/m/n/12 10.11.2022[] 
 []


Overfull \hbox (3.47267pt too wide) in paragraph at lines 47--47
[][]\OT1/jkp/m/n/12 11.11.2022[] 
 []


Overfull \hbox (3.47267pt too wide) in paragraph at lines 47--47
[][]\OT1/jkp/m/n/12 11.11.2022[] 
 []


Overfull \hbox (3.47267pt too wide) in paragraph at lin

Yes, the last line ends abruptly.

How to diagnose?

7
  • 2
    Remember there are errors and warnings. Fix errors first. LaTeX Error: There's no line here to end is the relevant error here and it points to line 91 in your document. Most likely there is an irrelevant \\ at that point, but as you show no code we cannot say for sure.
    – daleif
    Nov 15, 2022 at 12:38
  • Oh, so l.91 means line 91, nice, thank you! How to know what file is that line in, though? Nov 15, 2022 at 12:43
  • If you want to fix a big file I recommend you debug it from the beginning. Copy small part the document starts with and debug it, then add next few lines etc. Also note that [7] means that page 7 has been generated, so the error is somewhere on the page 8. Nov 15, 2022 at 12:49
  • 4
    To have a slightly easier life (knowing in which file to look) you can give pdflatex the -file-line-error flag, that'll change the error messages to look like <file>:<line>:<error-message>.
    – Skillmon
    Nov 15, 2022 at 12:53
  • 1
    you can see which file is open by matching ( in the log but you have not shown enough log to say. it is just after page 7 is output Nov 15, 2022 at 13:07

1 Answer 1

2

Skillmon pointed me in the right direction with the -file-line-error option for pdflatex. This option didn't seem to have any effect on its own, however then I decided to look into the manual (man pdflatex), which gave me the idea of trying the -halt-on-error option, too. This was a success (no interaction required after starting pdflatex):

$ pdflatex -file-line-error -halt-on-error PROGI_ProjektnaDokumentacija.tex 
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Arch Linux) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./PROGI_ProjektnaDokumentacija.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-04-10>
(/usr/share/texmf-dist/tex/latex/base/report.cls
Document Class: report 2021/10/04 v1.4n Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size12.clo))


[...]


[7]

./Opis_projektnog_zadatka.tex:91: LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.91 
     
./Opis_projektnog_zadatka.tex:91:  ==> Fatal error occurred, no output PDF file
 produced!
Transcript written on PROGI_ProjektnaDokumentacija.log.

When using LuaTeX instead of PDFTeX, a problem is that LuaTeX seems buggy regarding its command line options, in that it doesn't seem to support some options without an extra - prefix. Thus I repeat the same options with both - and --:

lualatex -file-line-error --file-line-error -halt-on-error --halt-on-error PROGI_ProjektnaDokumentacija.tex

With latexmk:

latexmk -g -gg -lualatex -file-line-error --file-line-error -halt-on-error --halt-on-error PROGI_ProjektnaDokumentacija.tex

Michael Fraiman's comment is also helpful:

Also note that [7] means that page 7 has been generated, so the error is somewhere on the page 8.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .