In LaTeX commands are usually prefixed with a backslash, "\". Some commands have different options that you can specify when you type the command - these options are called "arguments".
Optional arguments (things you can choose to tell the command) usually go inside square brackets [ and ], and mandatory arguments (things you have to tell the command) usually go inside curly braces { and }.
Every LaTeX document starts by defining what kind of document this
is going to be, and this section of the document is called the preamble.
We do this with the \documentclass
command, e.g.
\documentclass[a4paper,11pt]{book}
The standard classes
are article
, report
, book
, letter
,
and slides
though you can define your own, and most
journals have their own class file (class files have the
extension .cls
). We shall be concentrating on the three
most useful classes to scientific
writing: article
, report
and book
.
The \documentclass
command also has a number of
optional arguments, including:
a4paper
selects A4 paper size. The default
is letter
, which is probably not what you want. Useful
alternatives are a5paper
and b5paper
.
11pt
selects an 11pt font size. Alternatives are
usually 10pt
and 12pt
, though
the slides
class is a bit different.
landscape
sets the paper orientation (the default is
portrait).
twocolumn
prints the text in two columns (default is onecolumn
).
After the preamble comes the main body of the document, and this is
enclosed by the
\begin{document}...\end{document}
commands. This is where
the bulk of the information is contained; within this region all of
your text, equations, images, tables and lists are described.
The \begin{document}...\end{document}
LaTeX commands
are an example of an environment. Environments are always
entered with a \begin{}
command and exited via
a \end{}
command. They define particular typesetting
features so that you can set out different parts of your document in
different ways, according to its content and purpose.
As with all computer code, it is important to ensure your LaTeX is well commented. Whilst simple documents can be self-explanatory, LaTeX documents have a tendency to grow in an organic fashion rather than remaining well-structured documents and this can lead to confusing source code. Not only that, but you may forget what certain LaTeX definitions or commands are and do, or why you used them instead of others.
In LaTeX anything after a percentage sign "%" is treated as a comment, and will not appear in your document.
\documentclass
, and other bits of "preamble"
\begin{document}
and ends with \end{document}
Previous page | Next page |