next up previous
Next: Using LATEX Up: textalk3 Previous: Introduction

Subsections


Getting Started


The Process

As we have already noted there are several steps needed to create a document in TEX .

Figure: The TEX process
\begin{figure}
\centering%
\providecommand{\myrbox}[1]{\makebox(0,0){\framebox[...
...
\put(290,80){\makebox(0,0){\framebox [32mm]{File}}}
\end{picture} \end{figure}

  1. Create the input file document.tex with a text editor. If you use a word processor, then you must be sure to save the document as plain text.

  2. Run TEX on the input file. This will produce a DeVice Independent (DVI) file document.dvi. The DVI file is not human readable.

  3. Run a DVI driver on your DVI file to either translate it to a readable form, preview it on screen, or print it.


Your first TEX document

We will now create a simple TEX document, by entering in the following text to a file called perfect.tex.


\parskip=\baselineskip \parindent=0pt \hsize=5in
\hoffset=.75in 
\centerline{\bf Unsolved Problems} \vskip 15pt

A number is said to be {\bf perfect} if it is the
sum of its divisors.  For example, $6$ is perfect
because $1+2+3=6$, and $1$, $2$ and $3$ are the
only numbers that divide evenly into $6$ (apart
from $6$ itself).

It has been shown that all even perfect numbers
have the form $$2^{p-1}(2^p-1)$$ where $p$ and $q$
are both prime.

The existence of {\it odd\/} perfect numbers is an
open question. \bye

Save the file and run TEX on it with tex perfect.tex:


rob@random:~$ tex perfect.tex
This is TeX, Version 3.14159 (Web2C 7.3)
(perfect.tex [1] )
Output written on perfect.dvi (1 page, 892 bytes).
Transcript written on perfect.log.
rob@random:~$
The output file is called perfect.dvi. We may preview this file by running the command xdvi perfect.dvi:

\epsfig{file=perfect.eps,width=6.4in,bbllx=36,bblly=143,bburx=578,bbury=749}


TEX syntax

Commands

Commands (or control sequences) are usually a backslash followed by a sequence of letters. They are case sensitive, e.g. \vskip. Control sequences end with the first non-letter. Thus \vskip2in says skip 2 inches vertically.

Arguments

Arguments to a command may be enclosed in braces to make it clear what the argument is--if the argument has spaces, then you will definitely need braces. For example in

\centerline{\bf Unsolved Problems},
the argument to \centerline is \bf Unsolved Problems.

Braces

Braces are used to enclose an argument, but also to delimit the scope of a command. For example \bf makes all the following text bold. If you only want a small amount of text bold, then you enclose the text in braces: {\bf perfect}

Special Characters

TEX has the following special or reserved characters:

Symbol Meaning Typeset with
# Parameter definition \#
$ Toggles math mode \$
% A comment \%
& Column separator \&
~ Unbreakable space or accent \~{\ }
^ Superscript or accent \^{\ }
_ Subscript \_
$ \backslash$ Begins a control sequence $\backslash$
{ Begin group \{
} End group \}
$ \vert$ em-dash (|) $|$
$ <$ Upside down ! (<) $<$
$ >$ Upside down ? (>) $>$
" No meaning \verb+"+
`` Open double quote ``
'' Close double quote ''

Mathematics

Mathematics is written in single dollar signs for inline, and double dollar signs for displayed math: $x^2+y^2=1$ gives $ x^2+y^2=1$, while $$x^2+y^2=1$$ gives

$\displaystyle x^2+y^2=1 \ .$

Accents and special characters

TEX can produce a wide range of accents and other spceial characters used in text. A few examples of these are given below.

Character Typeset Appearance
tilde \~n cañon
acute \'e résumé
circumflex \^o l'Hôpital
grave \`a á la mode
umlaut \"e Noël
cedilla \c c garçon (gar\c con)
\ae \AE Ægean, ægean (\AE gean)
\ss Weierstraß
\AA Ångstrom (\AA ngstrom)
<Si! <Si!
>Que? >Que?

Other special symbols

Dashes
TEX understands three types of dash.
Ellipses
These are the dots you can use when you run out of things to say... They can be used with \ldots
Quotes
Single and double quotes, ``He said, `Go away!' so I left.'' are written with ` and ' characters:
``He said, `Go away!' so I left.''


next up previous
Next: Using LATEX Up: textalk3 Previous: Introduction
Robert Judd
2000-12-10