| |
| | UT Home | Graduate School Home | |
LaTeX: from quick and dirty to style and finesseA quick and dirty start
by Tony Roberts I need to demonstrate LaTeX on an example document. I choose to start with a cut down version of a Microsoft Word article I wrote on fractals, The importance of beings fractal. In practise, you create a document in LaTeX from the outset. Contents of this sectionDocument classesSaving part of the article as text looks like fractals00.tex, with all formatting, mathematics and figures lost. We restore and improve the formatting and the mathematics to produce a superb final document (dvi,17K). Around the document text that you wish to typeset, you need \documentclass[12pt]{article}
\begin{document}
...
\end{document}
as in fractals01.tex which we now typeset. Note that the editor I use on the Mac, Alpha, is customised to work with LaTeX, as may Emacs+AuCTeX for Unix and WinEdt for PCs. For a TeX engine I recommend: OzTeX for Macs; and mikTeX for PCs. Restore the paragraph structure by introducing a blank line to indicate to LaTeX where one paragraph ends and another begins, as in 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
SectioningThe sections and subsections need to be typeset clearly. These are indicated by the \section{section-name}
and \subsection{subsection-name}
commands as in fractals03.tex. Note that LaTeX automatically numbers the sections and subsections, so do not number them yourself. Observe the use of the backslash or "slosh" to introduce a command in LaTeX, followed by an argument in enclosed in braces. Other sectioning commands are \chapter, \subsubsection, and \paragraph. TitlesThere are also special commands for a title. The format is \title{title-text}
\author{yours truly\\address}
\maketitle
as in fractals04.tex. Observe that LaTeX uses today's date. This may be overridden with the \date{any-date} command anywhere before the \maketitle. Note that 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:
To actually 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 stylesLaTeX typsets most of a document in (Computer Modern) roman font. 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:
These font styles are mainly used in the following way: \emph{this is in italic}, but this is not.
as in fractals05.tex. Note: these style changes are cumulative so you can have italic bold by \emph{\textbf{...}} (provided the fonts are actually available on your system!). Page headings and footingsLaTeX'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 fractals06.tex. You can design your own running header using \pagestyle{myheadings} in conjunction with the \markright{some-text} command. End adviceLeave 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.
3 August 1998 Professor A J RobertsDept Mathematics & Computing University of Southern Queensland Toowoomba 4350, Australia E-mail: aroberts@usq.edu.au |
Graduate School, Main Building 101, Austin, TX 78712 |