# A quick start

I demonstrate LaTeX on an example document. Let us start with the plain text version of an article I wrote on fractals, The importance of beings fractal. In practise, you create a document in LaTeX from the outset.

## Document classes

Saving part of the article as text looks like Src/fractals00.tex, with all formatting, mathematics and figures lost. We restore and improve the formatting and the mathematics to produce a superb final document (pdf,120K).

Around the document text that you wish to typeset, you need

\documentclass[12pt]{article}
\begin{document}
...
\end{document}

as in Src/fractals01.tex which we now typeset.

Use for processing (see Comparison of TeX editors)

Easily over the internet
Overleaf (free) which appears a very good place to get started (however, I have not investigated their reliability nor data management).

Windows PCs
editors TeXnicCenter (free) or TeXworks (free), and the LaTeX processor mikTeX (free)

Unix
editors Emacs+AuCTeX (free) and the LaTeX processor tetex (free)

Macs
perhaps TeXShop or TeXworks

Restore the paragraph structure  by introducing a blank line to indicate to LaTeX where one paragraph ends and another begins, as in Src/fractals02.tex. All other line breaks in the source are treated as simply blank characters.

Other document classes  are report (for long articles such as a dissertation), book, and letter.

Other options  are the smaller sizes of fonts: [11pt]; or none at all which gives 10pt. Additional options may be provided, such as a4paper or twocolumn, within the [] and separated by commas.

For most purposes I recommend one of the following:

• \documentclass[12pt,a4paper]{article} for many purposes;
• save paper with \documentclass[a4paper,twocolumn]{article} for an easily readable newspaper type format;
• e-book friendly typesetting, and to draft onscreen easily, and save paper by printing two pages per sheet of A4 paper, use \documentclass[12pt,a5paper]{article}, followed by \usepackage[a5paper,margin=6mm]{geometry}. This gives the same line width as the default for a4paper.
As you go through this, try some of these alternatives to see how LaTeX easily reformats the document to changing needs.

## Sectioning

See video discussion 12

The sections and subsections need to be typeset clearly. These are indicated by the

\section{section-name}

and

\subsection{subsection-name}

commands as in Src/fractals03.tex.

LaTeX automatically numbers the sections and subsections, so do not number them yourself.

The backslash or 'slosh' introduces a command in LaTeX, usually followed by an argument in enclosed in braces.

Other sectioning commands are \chapter, \subsubsection, and \paragraph.

#### When needed, use logical 'hooks'

This is one example. In typesetting assignments you want to label each question and part: how can we adapt the sectioning commands? Answer: redefine the hooks that number each section and subsection (line breaks optional).
\renewcommand{\thesection}
{Question \arabic{section}}
\renewcommand{\thesubsection}
{\thesection, Part (\alph{subsection})}
\renewcommand{\thesubsubsection}
{\thesubsection\roman{subsubsection}}

Try it and see. The 'hook' \thesection typesets the section numbers (with \arabic{section}), so here change it via \renewcommand to include the word "Question" in the section titles, and similarly for the others. Occasionally circumstances arise to do this sort of change to the physical appearance of the correct logical command.

## Titles

See video discussion 13

There are also special commands for a title. The format is

\title{title-text}
\maketitle

as in Src/fractals04.tex.

Observe that LaTeX uses today's date. Override with the \date{any-date} command anywhere before the \maketitle. (Good practice is to use \date, comment on the version, and keep the version history as comments.)

Multiple authors should be separated by \and within \author{...\and...}

Addresses and thanks by author(s) usually appear as footnotes by using \thanks{...} immediately after the author(s).

Not only are the slosh, '\', and the braces, '{' and '}', special characters to LaTeX, so is the percent sign '%'. It causes LaTeX to ignore the rest of the line, so we can comment the document if needed. Other special characters are:

• the dollar, '\$';
• the ampersand, '&';
• the underscore, '_'; and
• the hash, '#'.

To get any of these last seven characters (but not "\") to appear in the final typeset document, just precede them by a slosh (as now seen in the name of the department).

The double slosh '\\' is reserved to force a line break in certain circumstances---use it sparingly.

## Font styles

See video discussion 14

LaTeX typesets most of a document in a roman font (Computer Modern). Section and subsection titles are typeset in bold face. LaTeX has other font styles available. These are invoked by the following commands with argument the text to be affected:

• \emph{...} invokes italic for emphasis (and sometimes addresses);
• \texttt{...} typesets its argument in a fixed width teletype-like font, useful for code fragments and the like;
• \textbf{...} typesets bold face, but avoid and instead prefer logical commands.

These font styles are mainly used in the following way:

\emph{this is in italic}, but this is not.
as in Src/fractals05.tex.

These style changes are cumulative so you could have italic bold by \emph{\textbf{...}} (provided the fonts are actually available on your system!).

LaTeX's default is to number each page, centered in the footing. A more descriptive running page header is obtained by including the command

\pagestyle{headings}
in the preamble (that bit before the \begin{document} in which the title and author may also go), as in Src/fractals06.tex. To see the headings we need a wider margin, at least 13mm.

## Summary

Leave the details of typesetting to LaTeX. Just tell LaTeX the logical structure of your document and it will do the rest. Resist the temptation to meddle unless you have a very good reason.

(The same advice holds for HTML---markup the logical structure.)

For example: you are tempted to use all capitals; ask why? For a section header use \section{}, for emphasis use \emph{}, for a three letter acronym (TLA) perhaps, but \textsc{tla} is better.

For another example: you are tempted to underline; ask why? For emphasis use \emph{}, for a web address use the url package and \url{}. Avoid habits generated by 19th century technology of typewriters; move to the logic of the 21st century.

The only thing that never looks right is a rule. There is not in existence a page with a rule on it that cannot be instantly and obviously improved by taking the rule out. [George Bernard Shaw, The Dolphin, 1940]

#### Abandon that most dangerous thought, "I like"

What you like about typeset appearance is irrelevant. We typeset documents to communicate ideas with colleagues and strangers. We need to typeset in a way that is most effective for others to comprehend: this is not the same as what you like, nor indeed is it the same as what others profess to like. Instead, in general the most effective way to communicate for others to comprehend is to use, without meddling, the default logical structures that LaTeX provides.