L^{A}TEX

T. Ford

October 31, 2000

Abstract

In 1970s Donald E. Knuth of Stanford University wrote a typesetting system called TEX (τϵχ). TEX was unique in its ability to produce professionally typeset documents and books on a low powered computer. However, in order to use TEX properly it was generally necessary to be Donald E. Knuth. Hence in the 1980s Leslie Lamport wrote a set of macros allowing mere mortals to utilise some of the power of TEX. L^{A}TEX is now at version 2e and has been for many years.

L^{A}TEX takes quite a different approach to word processors such as Microsoft Word. One selects a class of document, for example a letter or report, adds the text and L^{A}TEX does the majority of the formatting on one’s behalf.

1 Basic formatting

Single line feeds in paragraphs do not appear in the L^{A}TEX output.

This paragraph was, however, separated from the last with a blank line and is hence a new paragraph.

Line breaks may be forced with the character.

2 L^{A}TEX tabs

L^{A}TEX tabs fall into two categories:

• those which have \begin and \end delimiters.

These are environments.

• those which are a single tag.

These typically are macros defined by the environment.

Examples: small caps italics

type-writer text

emboldened text some emphasized text

3 Sectioning

This is a new section.

3.1 Subsection title

This is a subsection.

3.1.1 Subsubsection title This is a subsubsection.

3.2 Subsection 2

Numberless subsubsection No number today.

Another numberless subsubsection

4 Mathematical Formulae

In my experience the Physics department’s recommended way of producing formulae (using \over a lot) is very difficult, I use the following.

Numbered formulae:

E = \frac{m_{0}c^{2}}{\sqrt{1 − \frac{v^{2}}{c^{2}}}}  (1)

Unnumbered formulae:

cos 2x = 1 − 2 sin^{2} x

Subscript and Superscript:

x = y^{2}

Fractions:

\frac{a}{b} = 12

Square roots:

\sqrt{\frac{a}{b}} = \sqrt{12}

Units:

p = 1.34 ± 0.0018 × 10^{−3} Ω m

Partial differentials:

(\frac{∂H}{∂T} )_{p} = C_{p}

Use of Roman subscripts for non-variables and bold for vectors:

B_{C} = 0.0104 ± 0.0001 T

G = U − T S − B.M

Expectation values and integrals, including Roman text (note extra spacing):

⟨E⟩ = ∫_{0}^{∞} Φ^{∗}ĤΦ dτ

Ultra pedantic multiple integrals

∫∫_{D} g(x, y) dx dy

Equation arrays

α ≫ δ^{ϵ}  (2)
β × γ ≪ χ  (3)

Non-obvious symbols

\!  -  reduce spacing
,   -  increase spacing slightly
\   -  increase spacing more

Formulae can also be embedded directly ⟨E⟩ = ∫_{−b}^{a} rdr into the text.

5 Miscellaneous Formatting

L^{A}TEX • is not Word.

• can look great.

• is popular amongst the people who mark pracs. but also

• can be annoyingly inconsistent.

• is not whitespace independent (but, hey, nor is C++).

• is a right nightmare if you don’t want one of the three standard documents.

Figure 1: A psfig picture

6 Pictures

Embedding images, notably diagrams, into your documents is handled primarily by the psfig package. This package can cope with standard Postscript and embedded Postscript files. The pictures appear in a logical position in your document.

If, like me, you’re scared of xfig and like to do diagrams the old-fashioned way, make a Postscript file containing a single white pixel and set width and height to the size of the gap you need to stick on your diagram.

7 Cross References

L^{A}TEX is very good at maintaining references to marked parts of your document. Normally this is used for pictures and equations:

The tux pic is Figure 1. The following equation is numbered 4.

L = r × p  (4)

If you want to know about Cross References, refer to Section 7 on page 4. You can also cite the bibliography:

“Beware of bugs in the above code; I have only proved it correct, not tried it.”[1]

8 Tables

L^{A}TEX tables use similar autopositioning to pictures.

A tabular is a table nested directly into the document.

Trees Cats
1  2
2  6
3  8

Note the use of the center environment.

Temperature (K) Resistance (Ω)
4.231  1.352 × 10^{−4}
4.098  1.150 × 10^{−4}
3.996  1.138 × 10^{−4}
3.920  1.138 × 10^{−4}
3.850  1.123 × 10^{−4}
3.792  1.117 × 10^{−4}
3.729  9.901 × 10^{−5}
3.695  6.647 × 10^{−5}
3.640  1.112 × 10^{−5}
3.594  1.440 × 10^{−6}
3.532  1.030 × 10^{−6}
3.452  1.030 × 10^{−6}

Table 1: Resistance of tin wire, superconductive transition

9 Useful packages

Much of the L^{A}TEX functionality is via add on packages.

• psfig Embedded PS and EPS pictures

• url Useful for URLs (shock) and filepaths

10 Kit

To use L^{A}TEX you need the L^{A}TEX interpreter, a DVI viewer and some means of getting output.

• TeTeX The standard UNIX distribution. Should come with your Linux distribution.

– latex - interpreter

Usage: latex filename.tex

– xdvi - dvi viewer

Usage: xdvi filename.dvi &

– dvips - dvi→ps converter

Usage: dvips -o filename.ps

– ps2pdf - ps→pdf converter

Usage: ps2pdf filename.ps

• MikTeX The standard MSDOS/Windows distribution.

ftp://ftp.tex.ac.uk/tex-archive/systems/win32/miktex/1.20/index.
html

The “Level 1” tools contain more than I’ve ever used!

– latex - interpreter

    Usage: latex filename.tex

– yap - Yet Another Previewer (can also print)

    Usage: yap filename.dvi

– dvips - dvi→ps converter

    Usage: dvips -o filename.ps

11 Further information

Standard L^{A}TEX distributions come with an overwhelming amount of documentation so much, in fact, that it is frequently difficult to know where to begin.

I recommend the following documents, the locations given are for my Red-Hat 6.2ish system:

• /usr/share/texmf/doc/newhelpindex.html

by Keith Refson from Earth Sciences, a decent index to the TeTeX documentation.

• /usr/share/texmf/doc/latex/general/lshort.dvi
http://wso.williams.edu/how/lshort2e/

although it styles itself as a L^{A}TEX introduction, this always seemed to me to be more like a FAQ for stupidly complicated things. Invaluable if you’re traumatised about the excessive space between your double integrals.

• /usr/share/texmf/doc/latex/latex2e-html/ltx-2.html
http://www-ccs.ucsd.edu/latex/

A good reference manual.

• http://www.tex.ac.uk/cgi-bin/texfaq2html

A TEX and L^{A}TEX FAQ.

• http://xent.ics.uci.edu/FoRK-archive/feb98/0307.html

A history of L^{A}TEX and TEX.

References

[1] Donald E. Knuth, March 29 1977, Notes on the van Emde Boas construction of priority deques: An instructive use of recursion