How do I figure out what line the latex starts looking for a missing brace or..... I would prefer not to include my latex code

Excluding 'comment' comment.)

Runaway argument? ! File ended while scanning use of \next. \par <*> ./EvenCycleTransversal.tex

I suspect you have forgotten a }', causing me to read past where you wanted me to stop. I'll try to recover; but if the error is serious, you'd better type E' or `X' now and fix your file.

! Emergency stop. <*> ./EvenCycleTransversal.tex

*** (job aborted, no legal \end found)

p.s. what does the type E or X mean? how would I do that?

  • You (or your editor) is running tex in batch mode so you can not interact with the error to type e (open an editor) or x (stop) hence the "emergency stop". Often if your editor matches braces iit is simplest just to type a closing } at the end of the file, if your editor shows a matching opening brace then that is what you are looking for. Oct 23, 2020 at 9:00

1 Answer 1


Answering the question as asked:

Tools to track mismatched brace errors:

  • Insert \errorcontextlines=10, which is useful for clarifying many error messages
  • Run with e-TeX (automatic for almost all cases) and insert tracinggroups=1 \tracingnesting=1
  • Look in the log file

You are probably running TeX/LaTeX from within an editor, or an app, or on a website, so you can't interact with it. Run it by opening a terminal window and typing pdflatex myfile.tex, for example. Then, at each error, the run will pause for instructions. But they aren't very useful, except for "X" to exit without continuing. Typing "?" at the prompt gives you a list:

? ?
Type <return> to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something, E to edit your file,
1 or ... or 9 to ignore the next 1 to 9 tokens of input,
H for help, X to quit.

Note "Q" means "Quiet", not "Quit"; and "E" is unlikely to open the editor the way you want.

  • Sorry I don't understand how to use \errorcontextlines=10 do I put it in the latex preamble or... it doesn't seem to make a difference for me Also don't understand what run with E-Tex means
    – Hao S
    Oct 23, 2020 at 19:57
  • If assigning \tracinggroups=1 was accepted without error, then you are running eTeX already. See this old question tex.stackexchange.com/questions/60099/who-doesnt-use-e-tex. Oct 23, 2020 at 21:47
  • \errorcontextlines is basic TeX, and sets the levels of context displayed at an error, if there are nested macro expansions in play. Oct 23, 2020 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.