This book originally accompanied a two-day course on using
the LATEX typesetting system. It was extensively revised and
updated for publication, so that it could be used for self-study
as well as in the classroom. For those with sufficient prior
knowledge of computing and authoring, it has also successfully
been used as the basis for a 1-day intensive introductory
course. It is aimed at users of Unix &
GNU/Linux, including Apple Macintosh OS X,
and Microsoft Windows systems, but it can be used with LATEX
on any platform, especially online systems such as
Overleaf, TEXPage, or
Prism (formerly
Crixet), but also including other
Unix workstations, mainframes, Android and Apple smartphones,
and even some older Personal
Digital Assistants (PDA).
Who needs this book?
The course was originally designed for computer-literate
but non-IT professionals in business, research, academic,
administrative, and nonprofit organisations. You may be in a
similar position, but you may also come from another
background entirely; you may be a hobbyist, a school or
college student, a home computer user or a volunteer worker,
or you might just be interested in high-quality automated
typesetting. However, it’s likely that you have one or more of
the following or similar objectives:
producing consistent, typeset-quality
formatting;
formatting long or complex
or highly-structured
or repetitive or
automatically-generated documents;
saving time and effort by automating common
tasks;
gaining independence from expensive and restrictive
proprietary hardware, software, or file formats;
creating robust, durable documents which will survive
changes in technology;
having fun playing around with fonts and formatting.
Skills needed
The basics of LATEX are very easy to learn, and require
no specialist knowledge to get started, although it’s useful
if you understand a little about writing, formatting, and
readability. However, you do need to be completely familiar
with using your computer, which means knowing the topics in
Table 1 below thoroughly and having a good
working knowledge of those in Table 2 below.
Note that none of these skills is in any way specialist:
they’re all basic, fundamental, standard computer skills that
everyone SHOULD know, and they
form part of the European Computer Driving
Licence (ECDL) (now the International Computer Driving
Licence (ICDL)).
Table 1: Using your computer — essential skills
| Subject | Detail | ECDL |
| Your computer | know how to turn it on, send it to sleep
(suspend or hibernate), reboot it, and turn it off
completely. | 1.2 |
| Using the mouse or touchpad | know how to point and click with your mouse or
touchpad to run programs, pick from a menu, and
highlight text (or how to use keyboard shortcuts to do
the same). | 1.1.4–1.1.6, 1.3.1,
1.4.1–1.4.2, |
| Handling files | know how to create, open, save, close,
name/rename, copy, move, and delete files and folders
(directories) using a directory browser (eg Windows:
File Explorer,
My Computer, or just
Computer; Mac:
Finder; Linux:
Nautilus,
Thunar,
Dolphin, etc) or a typed
command in a Command window (eg Windows:
Command or
PowerShell; Mac:
Terminal; Linux:
Terminal). Also see § 7 below. | 2.3 |
| Handling characters | know where to find all 95 of the printable
(ASCII) characters on your
keyboard, plus accents and symbols, if you need
them (see the appendix ‘ASCII characters’ below). | 3.2.1.2 |
| Using an editor | know how to use a good plaintext editor
(not a wordprocessor like
Microsoft Word,
Libre Office, Lotus
Notes, Apple
Pages, or Corel
WordPerfect; and
not a context-insensitive editor
like Apple TextEdit or
Microsoft Notepad). | 2.1.3 |
If you don’t know how to do these things yet, it’s
important to go and learn them first, at least the essential
ones. Trying to become familiar with basic computer skills
at the same time as learning LATEX is
not going to be as effective as doing them in the right
order.
Table 2: Using software (programs) — useful skills
| Subject | Detail | ECDL |
| Downloading files | know how to use your Web browser (eg Windows:
Edge; Mac:
Safari; Linux:
Vivaldi,
Brave,
Firefox,
Chrome/Chromium,
Opera,
Lynx, etc) to browse the
Web, search for information, and download and save
files. | 7.1.6 [7.3.1.6] |
| Unzip files | know how to uncompress and unwrap compressed
‘archive’ (zip, tar.gz, rar,
etc) files. | 2.3.8 |
| Install software | know how to install software, both manually and
using automated installers. | 2.6 |
| RTFM | know how to read and follow instructions and how
(and where) to ask for help. | 1.7 |
It is really important to repeat that these are
not specialist skills — they are
standard for anyone who uses a computer, and they form a
fundamental part of the basic knowledge of computers which
everyone needs to be familiar with.
With the exception of software installation, they are all
included in the 2000 ECDL (now the
ICDL): the relevant module and section
numbers of the original ECDL syllabus are
noted in parentheses or in the margin above (Kelly & O’Connor, 2005).
Objectives of this book
By the end of this book or course, you should have
understood and become able to undertake the following
tasks:
use your editor to create and maintain your
documents;
use LATEX markup to identify your document structure
and formatting requirements;
typeset LATEX documents, correct simple formatting
errors, and display or print the results;
identify and use additional LATEX packages (using
the Internet for downloading where necessary and
installing them)
recognise the limitations of procedural markup systems
and choose appropriate generic markup methods where
appropriate.
Synopsis
The original course covered the following topics as
separate sessions. Earlier versions of this document kept to
this structure in the book as chapters, but recent versions
have moved Installation (originally chapter 1) to Appendix A
and merged it with the details of configuration; and
Typesetting, viewing, and printing (originally chapter 4) to a
new Appendix; as the procedures in both cases have been so
much simplified that the previous level of detail is no longer
needed.
How to create LATEX documents (with a Quick-Start
Guide for the impatient);
Basic document structures (the Document Class
Declaration and its layout options; the
document environment with sections and
paragraphs);
Using packages and CTAN to adapt
formatting to your needs;
Other document structures (lists, tables, figures,
images, and verbatim text);
Textual tools (footnotes, marginal notes,
cross-references, indexes and glossaries, and
bibliographic citations);
Typographic considerations (white-space and typefaces;
inline markup and font changes; extra font installation
and automation);
Programmability and automation (macros and modifying
LATEX’s behaviour);
Conversion and compatibility with other systems
(XML, Word,
etc).
Where to get and how to install LATEX;
How to install new fonts;
Typesetting, viewing, and printing (largely obsolete
now that editors are better integrated with viewers and
printers);
User groups and the benefits of membership;
The ASCII character set;
The GNU Free Documentation
License.
I have made a few other changes in the transition to
printed and online form, but the basic structure is the same,
and the document functions as a workbook for the course as
well as a standalone self-teaching guide.
Where’s the math?
Also, where’s TikZ and where’s Lua?
Please understand that this document does not
cover mathematical typesetting, complex tabular
material, the design of large-scale macros, packages, or
document classes, or the finer points of typography or
typographic design, although it does refer to these topics in
passing on a few occasions. There is a brief example of
mathematics in § 1.11 below, but I am not a
mathematician, and there are whole books on maths in LATEX
as well as hundreds of web sites.
Two other important features of LATEX are the TikZ
graphics language and the Lua programming language. I don’t go
into either of them here because they are out of scope until
you have got used to LATEX itself.
TikZ Ist Kein
Zeichenprogramm (TikZ) and its parent, Portable
Graphics Format (PGF) are vector graphics languages
for technical illustrations. Commands are implemented as
LATEX commands, so using the tikz
package lets you use LATEX syntax to create arbitrarily
complex vector graphics in your document (much more than
the simple picture mode of the original
LATEX). See https://tikz.dev for
details.
Lua is a programming language (strictly speaking, a
scripting language) embedded in LATEX which lets you
write programs to do calculations or manipulate your data.
The results are returned within LATEX, so they can be
used immediately in your document without having to exit
LATEX run a program, and then start up or return to
LATEX again. Again, this is out of scope for this book,
but the details are at https://www.lua.org.
Availability of LATEX systems
The standard implementations of TEX and related systems
are called TEX Live and are published annually online by the
TEX Users Group (TUG). As of 2024 the former
TEX Collection DVD is no longer
distributed, but can be had on special request to
TUG. These implementations are all derived
from Knuth’s master versions, and adapted for all major
platforms (Unix & GNU/Linux,
including Apple Mac OS X; and Microsoft
Windows). You can also download the
installation image file in ISO format from
CTAN to burn your own
DVD if you need to.
Rather than install TEX Live on your laptop, desktop, or
tablet, many users prefer to use one of the online systems
such as Overleaf, TEXPage,
or Prism via a web browser.
These provide an editor and typeset display in the same way as
installed systems, but they run inside your web browser.
LATEX still works identically no matter which way you choose
to use it.
There are no longer any commercial implementations of
TEX that I am aware of. The most recently available ones are
listed in § 5 below.
Systems included in the TEX Live
distribution from TUG
- MiKTEX (Windows)
This is the MiKTEX implementation
plus the TEXStudio editor
with its own built-in PDF
viewer.
- MacTEX (OS X)
This is TEX
Live for Mac plus the TEXshop editor (the
Mac’s own built-in Preview is
used for the PDF
display).
- TEX Live (Unix &
GNU/Linux, including Apple Macintosh
OS X; and Windows)
The full TEX
Live system from
TUG.
Unix and GNU/Linux users can also
choose to install a prepackaged implementation from their
system’s repositories (see § A.2.3 below). TEX Live also runs in handheld
systems: see Figure 1 below and Figure 2 below.
Because the TEX program (the internal
‘engine’ which does the actual
typesetting) is independent of any other software, it
doesn’t have its own editor like a wordprocessor does.
Instead, you get to choose whichever editor you prefer:
there are lots available, and you can switch between them to
find one you like: see § 2 below below and § 1.2 below for details.
Figure 1: LATEX editing and processing on the Sharp Zaurus 5500
PDA
Figure 2: LATEX editing and processing in Termux on the Google
Pixel 8
Graphical interfaces (editors)
Most users run LATEX with a graphical plaintext editor
which has a toolbar and menus like other windowing
applications. These usually include all the common
formatting features of LATEX plus writing tools like
spellchecking, thesaurus, indexing, and bibliographic
citation. They generally all work in a very similar way.
Text-only interfaces are available for use on servers and
automated production systems (see § 3 below).
The Windows and Mac systems described in § 6 (this section) come with a recommended editor
(TEXStudio
and TEXshop
respectively), but you can install any other suitable editor
you prefer (see § 1.2 below). The Unix
& GNU/Linux distribution does not install any editor
because these systems usually have their own software
repositories with suitable editors already available for
installation, such as Emacs,
vi, TEXStudio, or
Kile.
Some fully synchronous typographic interfaces (editors)
were available as commercial products, but so far as is
known none of these is available any more: see item ‘Synchronous typographic displays’ below.
Command-line interfaces
While you would use a graphical interface to
set up an automated system like a web
server or e-commerce environment, it is useless where
systems have to run in the background, unattended, with no
human to click on buttons. In fact, the TEX typesetting
engine is a Command-Line
Interface (CLI) program, which can be used from any
script or console or terminal window. You can type the
command lualatex followed
by the name of your document file (see Figure B.2 below for an example).
Commands like these let you run LATEX in an automated
or scripted environment like a Common
Gateway Interface (CGI) script on a web server or a
batch file or pipeline process on a document publishing
system. All the popular distributions for all systems
include this CLI interface as
standard.
WYSIWYG displays
LATEX usually displays your typeset results in a
separate window such as a PDF viewer,
updated automatically every time the document is retypeset,
because the typesetting is kept separate from the editing.
This is called an ‘asynchronous’
display. Some systems, however, can format the typesetting
while you type each character, like a wordprocessor,
although at the expense of some flexibility. These are
called ‘synchronous’ displays.
- Asynchronous typographic displays
The WYSIWYG display is updated
when the document is reprocessed, rather than
while you are still typing, as it
would with a wordprocessor. To update the display,
just click on the button in your editor which
retypesets the document. You are probably already
familiar with this idea if you have used
HTML, where you reload the page in
a browser to see it after changes, or if you have used
a spreadsheet, where the ReCalc button (F9)
recalculates and redisplays the page.
TEX systems typeset the whole document at one
go, including all indexing, cross-references, tables
of contents, bibliographic citations, and the
placement of figures and tables. TEX also formats
whole paragraphs at a time, rather than line-by-line
as wordprocessors do, in order to get the quality of
spacing, hyphenation, and justification right. This
approach makes it much faster than a wordprocessor in
dealing with typical complex documents, as it can be
done without holding the whole document in
memory.
- Synchronous typographic displays
The WYSIWYG display is the
editing window, and it updates while you type, like a
wordprocessor, for example Scientific
Word (see item ‘Scientific Word’ below)
or VTEX (see
§ 5 below).
With a synchronous display you get Instant Textual
Gratification™, but like a wordprocessor, your
level of control is restricted to that of the system
you use, which cannot provide access to everything
that LATEX can do. For complete control of complex
material you may still need to use separate editing
and display windows as for asynchronous
implementations.
- Near-synchronous displays
There are a few systems for
very-close-to-synchronous WYSIWYG
display. These include Jonathan Fine’s
Instant Preview with the
TEX daemon, and David Kastrup’s
preview-latex package for embedding
typographic fragments from the typeset display back
into the editor window. The LYX editor is probably
as close to wordprocessor WYSIWYG
as it’s possible to get without specialist
help.
Some of the online systems provide
very-close-to-synchronous WYSIWYG
display, such as Overleaf,
TEXPage,
or Prism.
What You See Is What You
Get (WYSIWYG) refers to the accuracy with which the
typographical display shows your document. Most modern
PDF viewers are pretty good, given the
fact that your screen is probably only a fraction of the
accuracy of your printer — from 96 dots per inch (DPI) on an old desktop
screen, 140 DPI on a small laptop, 240
DPI on a high-end 4k laptop or desktop,
and up to around 300 DPI on some phones
and tablets; as opposed to 600 DPI on
your printer, or 1200 DPI or more in
photo-quality, and 3,600 DPI up to well
over 5,000 DPI on industrial digital
printers and laser phototypesetters. More commonly, what
people are really trying to express with
WYSIWYG is What
You See Is What You Mean (WYSIWYM); that is, your intent
is accurately conveyed by the formatting.
Commercial implementations
Although TEX Live is available free of
charge, there have been some excellent commercial
implementations of TEX and LATEX, mentioned below, which
provided enhanced support and additional features, and some
of these are still in use. These companies, founders, and
staff were good friends of the TEX and LATEX communities
for many years; but regrettably, all the products listed are now
at end-of-life, although they are in some cases still
available for download.
Y&Y,
Mackichan
Software, PC-TEX, Blue
Sky (Textures), True TEX,
and BaKoMa
TEX (RIP Basil K Malyshev), and
MicroPress, Inc (VTEX), who produced TEX distributions
for many years, all appear to have ceased trading.
Some of the Y&Y add-on fonts are still
distributed by the TEX Users Group (see the appendix ‘User Groups’ below), or have been replaced by Open
Source implementations, and there is a mailing list at the
TUG web site for the support of former
Y&Y users.
Picking suitable filenames
Using a computer means you are going to be dealing with
directory (folder) names and file names. This is a tip which
will save you grief and tears.
Never, never,
NEVER create directories
(folders) or file names which contain spaces or non-printing,
non-ASCII characters. Although your
operating system may support them, some don’t, and they will
only cause grief and tears, especially in automation software
like document builders, web scripts, app-based remote
compilers, and multi-author file sharing systems.
Make filenames as short or as long as you wish, but
strictly avoid spaces. Stick to upper- and lower-case letters
without accents (A–Z and a–z), the digits
0–9, the hyphen (-), the underscore
(_), and the dot [full point or
period] (.) — similar to the conventions for a
Web URI: it will let you refer to TEX
files over the Web more easily, make your files more portable,
and make it easier to use standard system utilities and
applications, as well as those distributed with TEX
Symbols and conventions
There are several typographic conventions about how you
represent computer-related material in print which are shown
in Table 3 below. Typed commands, keywords,
examples of input, and related text are in a fixed-width
(monospace) font, like a typewriter, because that’s how
program code is usually displayed and edited (this also helps
avoid ambiguities, as explained in § 4.7.1.1 below). Special values, like numeric quantities
represented by a name or symbol, are in italics, as in
mathematics. Terms or references to products, programs,
packages, and other components of LATEX have their own
typographic form. Finally there are some symbols like keyboard
keys and menus, which are shown graphically.
Table 3: Typographic notations used in this document
| Notation | Meaning |
| MUST,
MUST NOT,
REQUIRED,
SHALL,
SHALL NOT,
SHOULD,
SHOULD NOT,
RECOMMENDED,
MAY, and
OPTIONAL | These keywords have a specific mandatory meaning
when shown in THIS
STYLE (small capitals of the
prevailing font), according to RFC
2119 (Bradner, 1997). |
| \command | LATEX commands (control sequences) that you
type which perform an action or identify your text
eg \footnote{...} |
| \length | Control sequences which store a dimension (a
measurement in units), like \textwidth |
| counter | Values used for counting (whole numbers only),
like section |
| term | The defining instance of a new technical
term |
| environment | A LATEX formatting or identification
environment, like quotation |
| class | A LATEX document class (available from
CTAN), like
memoir |
| package | A LATEX add-on package (available from
CTAN), like
footmisc |
| product | A program or product name |
typewriter type | Literal examples |
| value | Mnemonic examples of things you must type, where
you have to supply real-life values of your own, like
\author{your
name} means you must
replace your name with your
own real name. |
| x | A specific key on your keyboard |
| Ctrl--x | Two or more keys pressed together, not separately |
|
Esc q
| Two keys pressed one after another |
| Submit | An on-screen button to click |
| A drop-down menu with items to select |
| ␣ | A normal space, just so it’s visible |