LaTeX Basics
Terms/General
LaTeX is case sensitive: use lowercase for commands unless specifically directed otherwise. LaTeX makes .dvi files, dvi stands for Device Independent.
Commands
Commands are necessary to tell LaTeX how to process your document. Commands in LaTeX always begin with a backslash: \
Simple commands must be separated from text by at least one space; for instance, \begin{center} needs one space after it before you begin typing text. But, simple commands can be separated by as much as you'd like for visual clarity, so it's often a lot easier to have a command like \begin{center} and then skip a line for text, like this:
\begin{center}
Then the text of your document.
Many commands are followed by arguments. When commands are followed by arguments, the format is:
\command{argument}
From the sample page, some examples of commands with arguments are:
\section*{My first document}
\url{http://www.silmaril.ie/downloads/}
Another example of a command with an argument is \documentclass{article} this tells LaTeX to read your work as a document, and one formatted as an article. Articles don't have separate title pages, but chapters and books do, so if you want to have separate title pages from the actual text of the work, you would do \documentclass{chapter} or \documentclass{book}.
Defining the Document
LaTeX needs the document to be defined in order to properly process the document. This is the first item defined in a LaTeX document and it's defined with the command \documentclass[options]{class}.
Document Classes:
-
article: for conference and other presentations, short reports,
anything written that's relatively small and less formatted (around 1-20 pages, no chapter breaks)
- report: for longer works containing several chapters, small books, PhD
dissertations, Master's theses
book for real books
-
slides: for slides. FoilTeX is generally viewed as a better option for this, and with FoilHTML, slides can also be converted to HTML.
Document Class Options
- 10pt, 11pt, 12pt: This sets the size of the main font in the document. If
no option is specified, 10pt is assumed.
- letterpaper, legalpaper: This defines the paper size. The default size
is letterpaper. a5paper, b5paper,
executivepaper, and legalpaper can be specified.
- fleqn: This is used for papers with mathematical formulae. This typesets displayed formulae left-aligned instead of centred.
leqno Places the numbering of formulae on the left hand side
instead of the right.
- titlepage, notitlepage: This specifies whether a new page should be
started after the document title or not. The article class does
not start a new page by default, while report and book do.
- onecolumn, twocolumn: This tells LaTeX to typeset the document in
one column or two columns and is used most often for specific typesetting needs.
- twoside, oneside: This specifies whether double or single sided output
should be generated. The classes article and report are single
sided and the book class is double sided by default. Note that
this option concerns the style of the document only. The option
twoside does not tell the printer you use that it should actually
make a two-sided printout.
- landscape: This changes the layout of the document to print in landscape
mode.
- openright, openany: This makes chapters begin either only on right
hand pages or on the next page available. This does not work
with the article class, as it does not know about chapters. The
report class by default starts chapters on the next page available
and the book class starts them on right hand pages.
Page Styles
LaTeX supports three predefined header/footer combinations, which are often called page
styles. The style parameter of the command defines which one to use. The command to call a page style is:
\pagestyle{style}
The predefined page styles are:
- plain: This prints the page numbers on the bottom of the page, in the middle
of the footer. This is the default page style.
- headings: This prints the current chapter heading and the page number in the header on each page, while the footer remains empty. (This is the style used in this document)
- empty: This sets both the header and the footer to be empty.
It is also possible to change the page style of the current page with the command:
\thispagestyle{style}
Back