TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have downloaded a template for writing thesis from MIT website, which can be found here. In the file main.tex, I have to modify the following code:

\typein [\files]{Enter file names to process, (chap1,chap2 ...), or `all' to process all files:}
\def\all{all}
\ifx\files\all \typeout{Including all files.} \else \typeout{Including only \files.} \includeonly{\files} \fi

Could someone please let me know how I should modify the above code? I have tried for example:

\typein [\files]{'all'}

but still I get errors such as Emergency Stop.

share|improve this question

\typein asks for input on run. While running the unmodified file, you'd get the following question:

Enter file names to process, (chap1,chap2 ...), or `all' to process all files:

\files=

At this point you'd have to enter all to include all files.

If you always want to include all files, replace this:

\typein [\files]{Enter file names to process, (chap1,chap2 ...), or `all' to process all files:}

with this:

\def\files{all}

This way you can always change the included files by changing the definition. It for some reason you'll never do that you can remove (or comment out) this part entirely:

\typein [\files]{Enter file names to process, (chap1,chap2 ...), or `all' to process all files:}
\def\all{all}
\ifx\files\all \typeout{Including all files.} \else \typeout{Including only \files.} \includeonly{\files} \fi
share|improve this answer
    
Thanks @Silex. What should I do with the line having \typeout? – Ahmad Feb 6 '13 at 22:30
    
@Ahmad: \typeout simply displays a message while running the file. As for the \ifx line: this either includes all files or just one file depending on the value of \files. If you want to be able to change the included files you should leave it there. – Silke Feb 7 '13 at 13:23
1  
+1 for \def\files{all} – NKN Oct 27 '14 at 14:49

In TeXstudio I commented out the typein and typeout commands and the code worked for me. The PDF was generated.

share|improve this answer

I was facing the same problem using TeXstudio with the same MIT template. After compiling with the default compiler (right from the TeXstudio GUI) I also got Emergency stop ... error.

The problem occurs because \typein interacts with the command line, so if you run the compilation inside your favourite terminal emulator directly e.g. (OSX):

/usr/texbin/pdflatex main.tex

everything works just fine. typein waits for your input and after giving your input it continues and builds the desired files. I found this feature request keyboard interaction at latex compile time, which is exactly our issue here, but unfortunately it was closed. Nevertheless in the discussion section you can find a nice workaround for this problem. You can modify the LaTeX command inside TeXstudio settings to xterm -e latex %.tex (on Unix, works like a charm) or cmd /c latex % < file (on Windows, I didn't test it but the guy from the feature request was able to use it).

So after changing the command like this a terminal window will pop up on every build and you will be able to use typein. Or you can just compile it directly from your terminal.

If you are not interested in compiling separate files and just want to compile everything, then you can just delete this whole section:

\typein [\files]{Enter file names to process, (chap1,chap2 ...), or `all' to process all files:}
\def\all{all}
\ifx\files\all \typeout{Including all files.} \else \typeout{Including only \files.} \includeonly{\files} \fi
share|improve this answer

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.