×Top 20 recent searches

Formatting information
An introduction to typesetting with LATEX

About this book

 
Copyright © 2010 Silmaril Consultants, version 5.5 (2011-05-30)

About this book

This book originally accompanied a 2-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 as the basis for a 1-day intensive introductory course. It is aimed at users of Linux, Apple Macintosh, or Microsoft Windows systems, but it can be used with LATEX on any platform, including other Unix workstations, mainframes, and even some Personal Digital Assistant (PDA)s.

ToCWho needs this book?

The course was originally designed for computer-literate professionals in business, academic, 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.

ToCSkills needed

LATEX is a very easy system to learn, and requires no specialist knowledge to get started, although it's useful if you understand something about formatting and readability. However, you do need to be completely familiar with using your own computer, which means knowing the following topics thoroughly. Note that none of these is specialist; they're fundamental, standard computer skills that everyone should know:

  • how to point and click with your mouse to select text and pick from a menu (or to use keyboard shortcuts to do the same) 1.1.4–1.1.6, 1.3.1, 1.4.1–1.4.2,
  • how to create, open, save, close, rename, copy, move, and delete files and folders (directories) 2.3
  • where to find all 95 of the printable ASCII characters on your keyboard and what they mean, and how to type accents and symbols, if you need them 3.2.1.2
  • how to use a good plain-text editor1 2.1.3
  • how to use your Web browser and/or file transfer program to download and save files from the Internet 7.3.1.6
  • how to uncompress and unwrap (unzip or detar) compressed files 2.3.7
  • how to install software, both manually and using automated installers;

  • how to read and follow instructions 1.7

If you don't know how to do these things yet, it's important to go and learn them first. 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.

It is important to understand 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. They are included in the European Computer Driving Licence (ECDL) course: the relevant sections of the ECDL syllabus are noted in the margin above.

  1. Not a wordprocessor like OpenOffice, Lotus Notes, Corel WordPerfect, or Microsoft Word, and not a ‘dumb’ editor like Apple TextEdit or Microsoft Notepad.

ToCObjectives of this book

By the end of this book, you should be 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.

ToCSynopsis

The original course covered the following topics as separate sessions, and I have kept to this structure in the book as chapters:

  1. Where to get and how to install LATEX (using the TEX Users Group's TEX Collection DVD): you can skip this chapter if LATEX is already correctly installed on your computer and you are already familiar with using a plaintext editor suitable for LATEX work;

  2. How to create LATEX documents (with a Quick-Start Guide for the impatient);

  3. Basic document structures (the Document Class Declaration and its layout options; the document environment with sections and paragraphs);

  4. Typesetting, viewing, and printing;

  5. Using packages and CTAN to adapt formatting to your needs;

  6. Other document structures (lists, tables, figures, images, and verbatim text);

  7. Textual tools (footnotes, marginal notes, cross-references, indexes and glossaries, and bibliographic citations);

  8. Typographic considerations (white-space and typefaces; inline markup and font changes; extra font installation and automation);

  9. Programmability and automation (macros and modifying LATEX's behaviour);

  10. Conversion and compatibility with other systems (XML, Word, etc.).

I have made a few 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.

ToCWhere's the math?

Please understand that this document does not cover mathematical typesetting, complex tabular material, the design of large-scale macros and 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 are several other guides, introductions, and ‘get-started’ documents on the Web and on CTAN which cover these topics and more in great detail. Among the more popular are:

  • Getting Started with TEX, LATEX, and friends, where all beginners should start;

  • The (Not So) Short Guide to LATEXε: LATEXε in 131 Minutes is a good beginner's tutorial;

  • A Gentle Introduction to TEX: A Manual for Self-Study is a classic tutorial on Plain TEX (not LATEX);

  • Using imported graphics in LATEXε shows you how to do (almost) anything with graphics: side-by-side, rotated, etc.;

  • Short Math Guide for LATEX gets you started with the American Math Society's extensions;

  • A comprehensive list of symbols in TEX shows over 2,500 symbols available.

This list was taken from the CTAN search page. There are also lots of books published about TEX and LATEX: the most important of these for users of this document are listed in the last paragraph in the Foreword.

ToCAvailability of LATEX systems

The standard implementations of TEX and related systems are in the TEX Collection, published annually on DVD by the TUG. These are all derived from Knuth's master versions, and adapted for all major platforms (Unix and Unix-like systems such as GNU/Linux and Apple Mac OS X; and Microsoft Windows). The DVD is sent free to all TUG members and can be obtained from your local user group. You can also download the ISO image file from CTAN to burn your own copy.

Commercial implementations are listed in section 6.5.

ToCSystems included on the TEX Collection DVD
ProTEXt (Windows)

This is the popular MiKTEX implementation plus the TEXnicCenter editor and the Yap and GSView WYSIWYG previewers.

MacTEX (OS X)

This is TEX Live plus the TEXshop editor (the Mac's built-in Preview is used for the WYSIWYG display).

TEX Live (Unix and GNU/Linux)

Generic TEX Live for systems without a built-in package distribution. Users of Red Hat and Debian/Ubuntu systems should use their package manager instead (yum and RPM, or apt and Synaptic) to install the complete RPM or DEB package versions provided by their supplier's repository.

Because the TEX program (the internal ‘engine’ which does the actual typesetting) is independent of 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.

ToCGraphical interfaces

Most users run LATEX with a graphical editor which has a toolbar and menus like other windowing applications. All the common formatting features of LATEX plus writing tools like spellchecking, indexing, and bibliographic citation are run the same way. Text-only interfaces are available for use on servers and automated production systems (see section 6.3).

The Windows and Mac systems described in section 6 come with a recommended editor (TEXnicCenter and TEXshop respectively), but you can install any other suitable editor you prefer. The Unix and GNU/Linux distribution does not install any editor because these systems usually have their own software repositories with suitable editors already available, such as Emacs, vi, and Kile.

ToCCommand-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 LATEX is running in the background, unattended, where there is no human to click on buttons. In fact, the TEX typesetting engine is a Command-Line Interface (CLI) program, which can be used from a console or ‘Command’ window. You can type the command latex followed by the name of your document file (see Figure 4.1 in section 4.1.1 for an example).

Commands like these let you run LATEX in an automated environment like a Common Gateway Interface (CGI) script on a web server or a batch file on a document system. All the popular distributions for all systems, both free and commercial, include this CLI interface as standard.

ToCWYSIWYG displays

LATEX usually displays your typeset results in a separate window, updated automatically every time the document is refreshed, because the typesetting is kept separate from the editing. This is called ‘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 which reformats the document. You are probably already familiar with this idea if you have used a spreadsheet, where the ReCalc button (F9) does the same thing.

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. Some popular examples are LYX (all platforms), Textures (Mac), BaKoMa TEX (Windows), and Scientific Word (Windows) (see Table 1).

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-synchro­nous WYSIWYG display. These include Jonathan Fine's Instant Preview and the TEX daemon, and David Kastrup's preview-latex package for embedding typographic fragments from the typeset display back into the editor window.

What You See Is What You Get (WYSIWYG) refers to the accuracy of the typographical display. Most modern ones are pretty good, given the fact that your screen is probably only a fraction of the accuracy of your printer (96 dots to the inch on your screen as opposed to 600 to the inch on your printer, or 1200 or more in photo-quality).

ToCCommercial distributions

Although the TEX Collection is available free of charge, there are several excellent commercial implementations of TEX and LATEX, with enhanced support and additional features. If these are of benefit to you, I urge you to support them and buy their products. In most cases their companies, founders, and staff have been good friends of the TEX and LATEX communities for many years.2

Table 1Popular commercial implementations of TEX systems
Product Platform Company URI
PCTEX MS-Windows Personal TEX, Inc http://www.pctex.com/
BaKoMa TEX MS-Windows Basil K Malyshev http://www.bakoma-tex.com/
TrueTEX MS-Windows True TEX http://truetex.com/
Textures Apple Mac Blue Sky Research http://www.bluesky.com/
Scientific Word MS-Windows Mackichan Software http://www.mackichan.com/
VTEX MS-Windows, Linux, OS/2 MicroPress, Inc http://www.micropress-inc.com/

ToCSymbols and conventions

There are several typographic conventions about how you represent computer-related material in print, which are shown in Table 1. It is common to show typed commands, keywords, examples of input, and related text in a fixed-width (monospace) font, like an old typewriter, because that's how programs used to be printed, and how most programmers prefer to edit them. Special values, like numeric quantities represented by a name or symbol, are in italics, like they would be if they were mathematics. Terms or references to products, programs, packages, and other components of LATEX are given their own typographic form. Finally there are some symbols like keyboard keys and menus, which are shown graphically.

Table 1Typographic notations used in this document
Notation Meaning
\command LATEX commands (control sequences) that you type which perform an action like \clearpage, or identify your text like \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 term or acronym (indexed)
environment A LATEX formatting or identification environment, like quotation
package A LATEX add-on package (available from CTAN), like footmisc
product A program or product name
typewriter type Literal examples
mybook or 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
Ctrlx  Two keys pressed together, not separately
Escq Two keys pressed one after another
Submit An on-screen button to click
MenuSubmenuItem A drop-down menu with items;

ToCProduction note

This document is written and maintained in XML, using a customized version of the DocBook DTD. Conversions were made to HTML and LATEX using XSLT scripts and Michael Kay's Saxon processor.

The complete source, with all ancillary files, is available online at http://www.ctan.org/tex-archive/info/beginlatex/src/. If you want to try processing it yourself you will need Java (from Sun, IBM, or a number of others) and Saxon (from http://saxon.sourceforge.net/), in addition to a full installation of LATEX.

This document is published under the terms and conditions of the GNU Free Documentation License. Details are in this appendix.