Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I start to compile a TeX file with wrong syntax, LaTeX complains. The first thing that I try is to stop (kill) the LaTeX compilation. However, nothing works. I have tried Ctrl+C, Ctrl+q, quit, exit, q, quit()... At the end I need to use top-command from Linux to kill the process. Is there a civilized way to kill LaTeX?

share|improve this question
3  
Which editor you are using? It will have some options. –  Harish Kumar Nov 28 '13 at 7:15
1  
With most command-line programs, EOF (ctrl+d) is normally a good first guess –  sapi Nov 28 '13 at 12:29
    
On windows, Ctrl-Z will normally work. –  Dan Nov 28 '13 at 20:47
    
In TeXnicCenter (under Windows) it allows you to stop a build. –  Werner Nov 29 '13 at 0:55

1 Answer 1

Personal Statement

I am a command-line human and (blissfully) ignorant of LaTeX IDEs (front ends) and editor specific compilations. I do my typing in emacs using AUCTeX, and compile in a terminal. So, my answer is focused in the command-line area.


The Solution

Actually, there is a civilized way to kill LaTeX, as asked by you.

Enter x at the prompt, then press Enter. Pressing Ctrl-d may be even faster. Most terminals send en end-of-file with this keystroke, which makes LaTeX react in the same way as if x was entered.

(The above two are not exactly identical. In case of x, LaTeX will tell about, "No pages of output...". In case of Ctrl-d, it will be treated as, "Emergency stop. .... Fatal error". I wish I could be more specific about the nuances of these two.)

Consider the following example. I have intentionally introduced a syntax error in my file.

enter image description here

LaTeX stops and complains about "Undefined control sequence". I type x and then press Enter. There is a clean exit.

If I press Ctrl-d under a similar situation, there is again an exit, with slightly different messages.

enter image description here

If you want to know more about your available options, enter ? while in the LaTeX prompt and press Enter. This gives,

? ?
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.

Additional but Helpful

Additionally, learning the following helps (may be Linux/command line specific).

  • To interrupt a long compilation, press Ctrl-c, that gives you the prompt mentioned above.
  • If LaTeX is waiting for an input file which does not exist,
! I can't find file `nosuchfile.tex'.
l.5 \input nosuchfile.tex

(Press Enter to retry, or Control-D to exit)
Please type another input file name:

press Ctrl-d.

share|improve this answer
4  
Front ends (or IDE, if you prefer) usually call the typesetting engine with the --interaction=nonstopmode command line option (or equivalent method). –  egreg Nov 28 '13 at 16:52
    
x+Enter works for Notepad++ too! This has bugged me forever –  Kevin C Nov 29 '13 at 0:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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