Use your editor to create a new, empty document
If your editor insists on filling your new document with template material, delete it all so that the file is empty
Type in a Document Class Declaration as shown above
Add a font size option if you wish
In North America, omit the a4paper option or change it to letterpaper
Save the file (make up a name) ensuring the name ends with .tex
Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document
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 a \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 white papers, magazine or journal articles, reviews, conference papers, essays, or research notes;
for books, booklets, or whole journals;
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 the quick-start document 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:
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, preprints, or proceedings;
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);
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 use packages to design it yourself, or (better) 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 TEX 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.
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 printing the PDF version of this book and then trimming the margins 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 other default settings in the built-in classes are for:
10pt type (all document classes)
two-sided printing (books and reports) or one-sided (articles and letters)
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 proofreader. 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.
In addition to any options specific to the document class, it is also possible to put package options in the \documentclass options argument instead of in the \usepackage command (see § 3.1.2), provided they are not implemented by more than one package. Packages which do not implement the named option at all are supposed to silently ignore it.
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, and app-based remote compilers.
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