8

I consider myself quite experienced in this field by now. But today I am totally stumped. I have a .tex file where LaTeX truncates anything after page 7. It used to be that I had a \newpage in the middle of page 7 but if I remove that thing it will nicely place the things that should be on top of page 8 on the bottom of page 7 and then refuse to do page 8 so there is nothing at that specifik place ending the document. Rather it seems something else is going on. But how do I try to figure it out?

I have searched the log file for warnings and errors and all I have are a few warnings about fonts being loaded multiple times and some not being found so it uses fall backs. That can hardly be it I am thinking...


EDIT:

I have tried for a while now and decided to share my code: https://gist.github.com/jonalv/6305c13c491b65bf4d8e6cb709a41f18

in the hope that someone can figure it out...

jonalv
  • 11,466
  • 10
    Make a copy and then start to remove things until you find the culprit. – Ulrike Fischer Jan 20 '21 at 10:43
  • Do you get any warning and/or error messages? If so, what do they say? – Mico Jan 20 '21 at 10:51
  • tex only stops and finalizes the PDF if it executes \@@end which means in latex usually either \end{document} or \stop so you are executing one of those somewhere around page 7... – David Carlisle Jan 20 '21 at 11:15
  • @DavidCarlisle Or there is an unbalanced brace that makes TeX to read everything up to the end and to give up; but in this case an error message would be issued. – egreg Jan 20 '21 at 11:19
  • @DavidCarlisle or an unbalanced \iffalse gobbling up the rest of the document. – Skillmon Jan 20 '21 at 11:43
  • @Skillmon if it is completely unbalanced the document wouldn't finalize and the pdf wouldn't be usable, so only I think if there is a matching \fi (or the user does something at the * prompt to finish up manually – David Carlisle Jan 20 '21 at 11:54
  • 2
    \let\clearpage\relax is not a good idea ..., even more if you forget to close the group meant to keep this local. – Ulrike Fischer Jan 20 '21 at 13:41
  • Wow how did that get there? thanks! – jonalv Jan 20 '21 at 13:44
  • It usually gets there as people want \include without forcing a page break, but it always breaks latex. – David Carlisle Jan 20 '21 at 17:23

2 Answers2

18

You are getting a warning in the log:

(\end occurred inside a group at level 1)

simple group (level 1) entered at line 70 ({)

bottom level

This indicates something is wrong. And if one looks at line 70 one can see the culprit:

{\let\clearpage\relax\chapter*{Databases exercise 1}

You are redefining \clearpage to do nothing but don't close the group as a brace is missing, and so \clearpage is missing at end document (where it is really needed).

Ulrike Fischer
  • 327,261
1

Well, this is not the most elegant solution, but I added a \newpage just before \end{document} and it compiles all the pages as intended.

Andreina
  • 987