↑↑ Home | ↑ TeX tricks |
By default the TeX or LaTeX program produces some diagnostic output and interacts with the user when one of the more serious errors occurs. This is normally the desired behaviour; on the other hand you would not want to be bothered with it when, say, you forgot to download all the figures of a document but want to compile it to look at the formulas.
There are both TeX macros and command-line options for controlling how interactively LaTeX behaves. In addition you can change the level of interaction when it stops after an error. The control sequences and keys are the following:
Control sequence | Keystroke |
\errorstopmode | |
\scrollmode | S |
\nonstopmode | R |
\batchmode | Q |
The command-line option is "--interaction" followed by the name of the mode which is the same as the control sequence without the backslash. There is no keystroke for errorstopmode since you won't get the chance to enter it unless TeX is in that mode already.
The modes make TeX behave in the following way: errorstopmode stops on all errors, whether they are about errors in the source code or non-existent files. scrollmode doesn't stop on errors in the source but requests input when a more serious error like like a missing file occurs. In the somewhat misnamed nonstopmode, TeX does not request input after serious errors but stops altogether. batchmode prevents all output in addition to that (intended for use in automated scripts). In all cases, all errors are written to the log file (yourtexfile.log).
Several control sequences changing the interaction level may occur in a TeX file, so you can switch on interactive error reporting only for part of the document. There is one qualification to this statement: When an error is found in the token immediately preceding a control sequence changing the interaction mode, the more interactive mode is used.
If you find all this too complicated to remember, have a look at this section on my "unix tricks" page.
When one sets page margins to zero, the distance between the edge of the paper and the box containing the text is far from zero. But there is actually a linear correlation between the values of \oddsidemargin and \topmargin and that distance. To use the whole A4 sheet of paper, set \oddsidemargin to -72.4 pt, \topmargin to -129.4 pt, \textwidth to 210 mm and \textheight to something like 300 mm. This (or at least setting the margins to large negative distances) can be very useful when designing transparencies.
The percent sign starts a comment in TeX. What you may not have known and not cared about if you had is that the comment extends up to the beginning of the following line. This makes it easier to write long sequences of macros more readably in several lines without inserting a space (newline) character into the sequence. The \putunder macro listed at the bottom of the page was surrounded by large spaces until I inserted the percent signs. Less esoterically, this allows to set footnotes a bit apart from the text which refers to them. If you put a percent sign after the word which refers to it, you can write the \footnote in the following line of the source text. Otherwise, TeX inserts a space before the footnote number which looks funny.
In the same way, lines which contain only a comment sign help you to spread the source code out a little and make it easier to read. You cannot use completely blank lines for that since they are interpreted as the end of a paragraph in TeX.
Most people who typeset in TeX use lots of braces, many of which are superfluous. Braces are for grouping characters and therefore unnecessary when one wants to give only one character as a parameter of a macro. For instance, \frac12 and \frac a2 will produce the fractions one half and a over 2 respectively, just like \frac{1}{2} and \frac{a}{2}. The space after the \frac in the second example is necessary for TeX to realise that the name of the macro is just frac and not fraca. (Macro names may not contain numbers, so that was unnecessary for 1/2; spaces after macro names are ignored.) Since the source code for formulas takes up lots of space anyway, it pays to use the shorter version. The same is possible when the parameter is a macro itself, at least one without parameters or sub/superscripts. You can write \frac\rho2 for rho/2.