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

If you already know all about editors and plaintext files and markup and how to run programs, and you know that LATEX is already fully installed (including an editor that you know how to use), you’d probably like to type something in and see LATEX do its job.

If you don’t know this stuff yet, then by all means do this section now, but treat it as part of the learning experience. Otherwise you might want to skip forward to § 1.4 and read more about how LATEX works, and come back to this section later.

### Figure 1.2: Quick-start example document text

\documentclass[12pt]{article}
\usepackage{palatino,url}
\setcounter{secnumdepth}{0}
\begin{document}

\section{My first document}

This is a short example of a \LaTeX\ document I wrote on \today. It
shows a few simple features of automated typesetting, including:

\begin{itemize}
\item setting the default font size to 12pt and specifying article'
type for formatting;
\item using the Palatino typeface and some special formatting for
\item preventing sections being numbered;
\item turning off justification for an informal document;
\item using the \LaTeX\ logo;
\item generating today's date;
\item formatting this list of items;
\item using opening and closing quotes;
\item formatting a URI;
\item arbitrary formatting: centering and italicisation;
\item autonumbering the pages.
\end{itemize}

This example was taken from the book Formatting Information',
which you can read online or in PDF format at
\url{http://latex.silmaril.ie/formattinginformation/} and use as a
teach-yourself guide.

\begin{center}
\fbox{\textit{Have a nice day!}}
\end{center}

\end{document}

1. Install LATEX on your computer

See the appendix ‘Installation’. You can check to see if it’s already installed by opening a command window and typing latex and pressing the Enter or Return key; or by looking for a LATEX editor in your Programs or Applications, or in your dock or panel.

2. Make sure your editor is set up to use XƎLATEX, not pdflatex or the original LATEX. This setting is usually in the configuration; in TEXStudio it’s under OptionsConfigure TEXStudioBuildDefault Compiler (see Figure 1.3)

3. Create a new, empty document

Start up your LATEX editor and open a new document:

Click on FileNew and if it offers you a choice of document types, pick ‘Empty File’.

Delete any template material it inserts, so that your new document is completely empty.

4. Copy the example

Copy and paste the text from Figure 1.2. Make sure you get all of it (apart from the caption), and don’t change anything yet.

If you are using the PDF or print edition of this book, copy the text from the web site.

5. Save the document

Save the document as quickstart.tex in your Documents folder (or wherever you normally keep your documents)

6. Typeset the document

Click on the Run, Build, Typeset, or TEXFile menu; or on the toolbar icon for your editor, as indicated by the black arrow in the illustrations in Figure 1.4.

7. Preview the typesetting

Some editors open the preview automatically when a new document is typeset. If this does not open automatically for you, click on the View or Preview toolbar item (usually next to the Typeset icon).

8. Print it

If you have a printer installed, you can click on the Print toolbar icon in your viewer.

If you encounter any errors, it means you do need to read the rest of this chapter after all! There is a list of common error messages in § C.3.1. You need to fix the errors in your document and click on the Typeset button again (or whatever your editor uses).

### Figure 1.4: What to click on to typeset a document

If you are using another editor, look for a menu or toolbar button marked or or or or .