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

Chapter 1: Writing documents

In this chapter…

  1. Markup
  2. Choosing your LATEX processor
  3. Quick start for the impatient
  4. LATEX commands
  5. White-space in LATEX
  6. Special characters
  7. Quotation marks
  8. Accents
  9. Dimensions, hyphenation, justification, and breaking
  10. Mathematics

LATEX documents are all plaintext files. This means printable characters only (in whatever writing system is native to your language and culture), no hidden internal binary gubbins like fonts or formatting (except for spaces and linebreaks). If you haven’t seen a plaintext file before, it looks like this:

This means printable characters only (in whatever 
writing system is native to your language and 
culture), no hidden internal binary gubbins like 
fonts or formatting (except for spaces and 
linebreaks).
    

By comparison, wordprocessor files saying the same thing often actually look something like this inside:

@A@[@O@B@@@@@@@h@@PñÿB@h@@@M@D@e@f@a@u@l@t@ @S@t@y@
l@e@@@*$A3@B*@OJC@QJC@CJX@mHIXsHIXKHA@PJD@nHDHtHDHJ
E@aJX@_H9D@@@@@@@@@@@@@@@@@@@@@@F@þ_A@BAF@@@G@H@e@z
@d@i@n@g@@@M@O@S£ðA@X@OJF@QJF@CJ\@PJD@JE@aJ\@.@BPA@
BA.@@@I@T@e@x@t@ @B@o@d@kj@mHIXs@X@OJF@aJX@_H9D@@@@
    

The big advantage of plaintext is not just that it’s readable; it’s that the files can be copied, downloaded, or uploaded to any computer system running LATEX and they will typeset exactly the same. Because they are plain text they cannot corrupt your system, and they cannot be used for hiding virus infections in the way that binary (coded non-plaintext) files can be. Everything you can see is in the file and everything in the file is there for you to see: there is nothing hidden or secret and there are no manufacturers’ proprietary ‘gotchas’ like suddenly going out of date with a new version or imposing selective Digital Restrictions Management (DRM), leaving you unable to open your files.

So, you may ask, if LATEX files are all plaintext, how does LATEX know how to format them? The answer is that it uses markup: a system of labels which identifies what’s what in your document. LATEX and its packages recognise the labels and know how to format them, so you don’t usually need to add formatting by hand unless you want to do something very special or invent something out of the ordinary.

  1. Some which are straightforward are shown in Figure 1.1

  2. Embarrassingly, the LATEX command for guillemets was mis-spelled guillemot when it was created, and no-one seems to have the nerve to change it. Albatross! 

  3. Note for MacTEX users: the TEXShop editor that comes with MacTEX is not set for UTF-8 by default: see the step ‘Set the LATEX processor to XƎLATEX …’ for how to set it. 

  4. Remember not everyone is lucky enough to be able to install new software: many users on business and academic networks still use old versions of TEX because they or their system managers don’t know how to update them. Local user groups may be able to provide help and support here. 

  5. Bear in mind that the degree symbol is a non-ASCII character, so you must specify what input encoding you are using if you want to type it: see the example of the inputenc package in § 1.8. If you don’t want to use non-ASCII characters (or if you are using a system which cannot generate them), you can use the command \textdegree to get the degree sign. 

  6. You will also see dollar signs used for math mode. This is quite common but deprecated: it’s what plain TEX used in the days before LATEX, and the habit got ingrained in many mathematicians. It still works as a convenient shorthand like $x=y$, as do double-dollars for display-mode math like $$E=mc^2$$, but they are only mentioned here to warn readers seeing them in other authors’ work that \(...\) and \[...\] are the proper LATEX commands.