next up previous contents
Next: special commands used in Up: how to update this Previous: finding and running LATEX   Contents

how to write a LATEX document

a LATEX document is simply a file of plain ascii text which can be interpreted by an appropriate parser. you can use any text editor you like to create a LATEX document, though it must be able to output the document as a plain text file, with no special characters. appropriate editors are things like emacs or vi on unix, simpletext on a mac, or wordpad (i think) on a pc.

i will first explain the basic format of a LATEX document, and then mention all the other commands i used (except the ones i forget) in making this document. i won't say anything about math formatting, even though that's a primary use of LATEX, because this isn't a math document, so you don't need it.

a LATEXdocument consists of text, commands, and special characters. all commands begin with the \ character, followed by alphabetic characters. commands are case sensitive. a command may have any number of mandatory arguments, which are delimited by curly braces, or optional arguments, which are delimited by square braces. (some examples will come later.)

there are three commands which must be included in a document in order for it to be processed properly. the first line of the file must be

\documentclass{someclass}
where someclass is a valid document class21 i used the article class for this, just because i'm used to it. i also used the optional argument [12pt], which puts the output in 12 point type, rather than the default of 10 point.

i'll refer to the text which appears after this line as the command section of the file. the interpreter processes every line in this section as a command, until it reaches the line

\begin{document}
is reached. the interpreter considers everything in the file after this line to be text ready for formatting (i'll refer to this as the text section), until the line
\end{document}
is reached. everything which occurs after this line is ignored.

text is simply entered in paragraphs, with a blank line inserted every time you want a new paragraph. LATEXdoes not differentiate between a space and an ordinary newline, so one paragraph of text can be input on several consecutive lines of the input file. simple text files can be easily processed in this format to produce paragraph text, as long as they do not contain any special characters.

the characters which LATEXregards as special are:

# $ % & ~ _ ^ \ { }
if you want to use any of these characters in text, you will have to put a backslash in front of it. (so \& produces the character `&'.) the exception is the backslash character itself. i created the custom command \bs for this file, which produces a backslash. it works by explicitly printing the backslash symbol from the standard LATEX font encoding. (so that command may break if you try to print this file using a different set of fonts.)


next up previous contents
Next: special commands used in Up: how to update this Previous: finding and running LATEX   Contents
Amy Marinello 2002-02-21