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

Section 1.5: LATEX commands

Now that you have seen LATEX working, let’s have a closer look at what it’s actually doing.

1.5.1 Commands used in the example

LATEX commands all begin with a backslash (\) and normally consist of lowercase letters only (there are a few which have uppercase letters). Going through the quickstart.tex document in Figure 1.2 above, we can see the following commands being used:


specifies the class of document (article) and the size of type for the text (12pt)


tells LATEX to use the named packages (plugins), here fontspec (to use all fonts) and url (provides a way to format URIs)


lets you give the name of the typeface to use as the main font; XCharter is an extended version of Matthew Carter’s 1987 Charter typeface, based on Pierre-Simon Fournier’s characters from the 18th century (see § 6.2 below for how to find and specify others)


sets the value of a counter, here secnumdepth, which is the depth to which sections are autonumbered. Setting it to zero prevents sections being numbered at all.


marks the beginning of an environment, here document, which contains the whole text of the document. It’s terminated by a matching \end{document} at the bottom of the file.

Everything up to this point is called the Preamble, and this is where you set up how the document looks


identifies a section heading;


typesets the LATEX logo;


typesets today’s date;


marks the beginning of an itemize environment, which is an itemized (bulleted) list. It’s terminated by a matching \end{itemize} command at the end of the list;


marks the start of a new list item;


ends an environment, here the itemized list;


identifies a subsection heading;


typesets a URL in a monospace font, allowing line-breaks only at slashes or dots;


begins another environment, center, which centres the material within it;


typesets the material in curly braces in a framed box;


typesets the material in curly braces in italic type;


ends the center environment;


ends the document environment, and thereby terminates the whole document. Anything after this line gets saved but ignored.

Backslashes and forward slashes

Do not confuse the backslash (\) with the forward slash (/). They are two different characters.

  • The forward slash is used in Unix-based systems (including Mac OS X and GNU/Linux) to separate directory names and file names;

  • The forward slash is also used on the Web to separate the directory names and file names in a URI;

  • The backslash is used to separate directory names and file names only in the Microsoft Windows file system;

  • The backslash is used to signal the start of a LATEX command in all systems.

When you refer to directory and file names in LATEX (eg image files), you MUST use the forward slash, even in Microsoft Windows.

1.5.2 Simple commands

Simple commands are just the command name on its own, after the backslash, for example:


This example is an instruction to LATEX to insert the current date at that point. You would usually use this in a draft article or report somewhere close to the beginning, so that you have a record of when it was last typeset. You don’t have to do anything else, although there are packages like datetime2 for changing the format of the date.

Other simple commands include \tableofcontents which inserts a Table of Contents, and \LaTeX, which creates the LATEX logo.

Most commands, however, need some information to work on, called an argument, which you put in curly braces after the command name.

1.5.3 Commands with arguments

Most LATEX commands are followed by one or more arguments, meaning information to be acted upon. Here are two examples, a chapter title (see § 2.6 below) and a cross-reference label (see § 5.3.1 below):

\chapter{Poetic Form}\label{pform} 
The shape of poetry when written or printed 
distinguishes it from prose.

When an argument is needed (as here) it always goes in {curly braces} like those shown above.

Exercise 1.5 — Braces or not

  1. Which of the commands listed in § 1.5.1 above do NOT need any argument in curly braces or square brackets after them?

  2. Which of the commands listed in § 1.5.1 above allow an optional argument in square brackets?


Be careful not to confuse the curly braces on your keyboard with (round) parentheses, [square] brackets, <less-than or greater-than> signs, 〈typographic angled brackets〉, or «guillemets» (French quotes, not guillemots; those are sea-birds). They are all quite different and they mean different things.

(Embarrassingly, the LATEX command for guillemets was mis-cloned as ‘guillemot’ when it was created, apparently from an earlier error by Adobe (Beeton, 2005) and no-one seems to have the nerve to change it. Albatross!)