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 2: Basic structures

Section 2.1: The Document Class Declaration

How to tell LATEX what type of document you want

In order to set things up correctly, LATEX needs to know up front what type of document you are going to be writing. There are probably lots of different types of document you deal with: in LATEX they are called ‘classes’ of documents — ‘class’ is just the computing science word for ‘type’.

2.1.1 Document classes

To tell LATEX what class of document you are going to create, the first line of your file MUST identify it. To start a report, for example, you would type the \documentclass command like this as the first line of your document:


There are four built-in classes provided, and many others that you can download (some may already be installed for you):


for business, technical, legal, academic, or scientific reports; theses, dissertations;


for white papers, magazine or journal articles, reviews, conference papers, essays, or research notes;


for books, booklets, or whole journals;


for letters.

These default classes are fairly basic in terms of layout and design, in order to make them easier to customise by adding packages, which are the style and layout plug-ins that LATEX uses to let you automate formatting.

The article class in particular can be used (some would say ‘abused’) for almost any short piece of typesetting by simply omitting the titling and layout (see § 2.3) and adding the relevant packages — like we saw in § 1.3.

2.1.2 Extending the default classes

The built-in classes are intended as starting-points, especially for drafts, and for compatibility when exchanging documents with other LATEX users, as they come built into every installation of LATEX and are therefore guaranteed to format identically everywhere. They are not intended as final-format publication-quality layouts unmodified, and should never be used as such. For most other purposes, especially for publication, you use LATEX packages to extend these classes to do what you need. The most common ways to do this are:

  • The memoir package and the komascript bundle contain more sophisticated replacements for all the built-in classes, as well as additional ones;

  • Many academic and scientific publishers provide their own special class files for articles and books (on their Web sites for download);

  • Conference organisers may also provide class files for authors to write papers for presentations;

  • Many universities provide their own thesis document class files in order to ensure exact fulfilment of their formatting requirements (many of these are on CTAN);

  • Businesses and other organisations can provide their users with corporate classes on a central server and configure LATEX installations to look there first for packages, fonts, etc (not usually available to the public, of course);

  • There are over 195 document classes on CTAN (see

Books and journals are not usually printed on office-size paper. Although for draft purposes LATEX’s layouts fit on the standard A4 or Letter stationery in your printer, it makes them look odd: the margins are too wide and the font size is too small, because the finished job will normally be trimmed to a completely different size entirely — try trimming the margins of the PDF version of this book to make it 188 mm × 235 mm (the same as the The LATEX Companion series) and you’ll be amazed at how it changes the appearance.

The four default built-in document classes are therefore adequate for drafts or for sending to a colleague to edit, but they are not really usable for final-format publishing. For this you need to add packages or to use a class file designed by your publisher or institution (or yourself!) to fit the type of publication. Quite often these are based on the default classes for compatibility, but typeset quite different output.

2.1.3 Document class options

The default layouts were originally designed to fit as drafts on US Letter size paper. To create documents with similar margins for A4 paper, you need to specify the paper size in an optional argument in square brackets before the document class name, eg


Many systems now install the a4paper option as the default, so this may not be needed; on the contrary, North American users may now need to specify the letterpaper option instead. The geometry package, which we will see later, lets you specify other bigger and smaller paper sizes.

The other default settings are for:

  1. 10pt type (all document classes)

  2. two-sided printing (books and reports) or one-sided (articles and letters)

  3. separate title page (books and reports only)

These can be modified with the following document class options which you can add in the same set of square brackets, separated by commas (the 10pt option is the default):


to specify 11pt type (headings, footnotes, etc get scaled up or down in proportion);


to specify 12pt type (again, headings etc get scaled to match);


to format one-sided printing for books and reports;


to format articles for two-sided printing;


to force articles to have a separate title page;


makes LATEX indicate hyphenation and justification problems with a small square in the right-hand margin of the problem line so they can be located quickly by a human. This option also sets graphics to print as an empty outline (rectangle) containing just the filename of the image, so that image-heavy documents will print more quickly and use less ink or toner.

If you were using LATEX for a report to be in 12pt type on Letter paper, but printed one-sided in draft mode, you would use:


The 10pt, 11pt, and 12pt settings cover between them probably 99% of all common text-document typesetting. There are extra options for other body type sizes in the extsizes bundle of document classes (extarticle, extbook, extreport, etc), and various national and international organisations supporting the visually-impaired have special large-type document class options.

Exercise 1: Create a new document

  1. Use your editor to create a new, empty document

  2. Type in a Document Class Declaration as shown above

  3. Add a font size option if you wish

  4. In North America, omit the a4paper option or change it to letterpaper

  5. Save the file (make up a name) ensuring the name ends with .tex

  1. Readers familiar with SGML, HTML, and XML will recognise the concept as similar to the Document Type Declaration (it’s still called a ‘type’ there, not a ‘class’). 

  2. Theses and dissertations may require an Abstract, which is provided in the report class but not in the book class. Many universities provide a special thesis class of their own. 

  3. The built-in letter class is rather idiosyncratic: there are much better ones you can use which you will find in the memoir package and the komascript bundle. 

  4. Letter size is 8½″×11″, which is the trimmed size of the long-obsolete Demy Quarto, still in use in North America. The other common US office size is ‘Legal’, which is 8½″×14″, a variant cutting close to the old Foolscap (8¼″×13¼″). ISO standard ‘A’, ‘B’, and ‘C’ paper sizes, used everywhere else, are still virtually unknown in most parts of North America. 

  5. Note that the standard built-in document classes (book, article, report, or letter) only use the paper size to adjust the margins: they do not embed the paper size name in the PostScript or PDF output. For this you need the geometry package. If you are using PDFLATEX, or you intend creating PostScript output, and you want to change the default paper size, you must specify it both in the Document Class option and as an option to the geometry package (see the example ‘Read all about it’), in order to ensure that the paper size name gets embedded correctly in the output, otherwise printers may select the wrong paper tray, or reject the job.