Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

Appendix C: Commands, errors, and viewing

Section 2: Typesetting

Which LATEX command you type depends on what output you want and how you want it to be created — see the list in the Preface. Whichever way you run LATEX, it will process your file and display a log or record of what it’s doing (see Figure C.2: it looks much the same no matter what system you use).

To typeset your document:

  1. Make sure you are in the right directory (folder) in your terminal, then type the command (latex, pdflatex, or xelatex, for example; or latexmk or one of the other workflow-management commands)

  2. If you are using citation and reference commands for a bibliography, you will then need to run biber or bibtex (followed by a space and the name of your document), whichever you have chosen to use (see § 5.3.2.1)

  3. Run LATEX again as in the listitem ‘Make sure you are in the …’ so that the citations are picked up;

  4. If you are creating an index, you will then need to run makeindex (followed by a space and the name of your document)

  5. Run LATEX again as in the listitem ‘Make sure you are in the …’ so that the citations and index references are resolved.

LATEX and all the ancillary programs write a transcript of what goes, and this will be shown in the window as well as being written into a log file.

If LATEX reports any errors — easily identifiable as lines in the log beginning with an exclamation mark (!) — don’t panic! Turn to § C.3, identify what went wrong, and fix it in your input file. Then re-run LATEX.

Exercise 17: Running LATEX in a terminal or console window

  • Open a command window;

  • Type cd followed by the name of the folder where you saved your sample document;

  • Type your LATEX command followed by the name of your LATEX document.