# TeX capacity exceeded, sorry [input stack size=5000] error [closed]

There aren't any other errors except this. My document only compiles up to the second page and anything else is not compiled in the dvi file.

Can anyone explain this error and how should I go about fixing this? Thanks.

## closed as unclear what you're asking by AlexG, user36296, Phelype Oleinik, Bobyandbob, Stefan PinnowApr 19 '18 at 14:00

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to TeX.SX! Sorry to disappoint you, but anything in your document may be causing this. The only way for us to find out is if you show us a minimal working example (MWE) that causes the same error. – Phelype Oleinik Apr 18 '18 at 17:59
• Remove everything from the first page. Find out what it is in the second page that is causing this. – Teepeemm Apr 18 '18 at 18:30

## 1 Answer

Sorry, I was using a script that compiled all the parts of the document source. I forgot to append \end {document} . It is surprising that this mistake affects the page limit of which latex chooses to compile.

• It is good that you found the answer and that you posted it here. If someone else has this problem, they might find a way to fix it. – Foitn Apr 19 '18 at 12:55
• A forgotten \end{document} does not result in the reported error with any document. So I think this answer is of little value, and the question is too broad. A lot of other errors and reasons may lead to an input stack overflow. – AlexG Apr 19 '18 at 13:03
• @AlexG Hi, I wish I knew how to explain it but I don't. But this is the error that I got. I don't have much error logs to post besides my entire document. – user121392 Apr 19 '18 at 13:06