Note for die-hard WINDOWS Users
You can easily run LateX in Windows by getting MikTex. I recommend using
Emacs (for Windows) as an editor (and not Microsoft Word or the
likes). You can also check a more user-friendly XEmacs (for
Windows). If you want to have complete UNIX-like interface, get
Cygwin
(which I think includes Emacs together with a nice command like
prompt, etc.). Please follow the instuctions on the corresponding web
sites. I am not an expert on this except I know it is quite easy, so
please figure it out on your own (if you really want to use Windows).
The Very Basics of LaTeX
LaTeX is a typesetting programming language. The most important thing
to know if you want to write your problem sets in LaTeX is that it runs
in two modes: normal mode and math mode. In normal mode, only text is
handled. You can alter the text (for example, making it bold-face or
italic) but generally you can't use any fancy characters or typsetting
in normal mode. A new paragraph is started when you leave a blank line
in the LaTeX file.
Some normal-mode commands to know:
- "{\bf TEXT}" puts TEXT in bold face.
- "{\it TEXT}" or "{\em TEXT}" puts TEXT in italics.
- "\smallskip", "\medskip", and "\bigskip" insert various small
amounts of whitespace, in between paragraphs for example.
- Put "\begin{enumerate}" if you want to give a numbered list.
Start each element in the list with "\item", and when the list is
finished, put "\end{enumerate}"
- "\begin{itemize}" with "\item" will do the same thing without
numbering the items.
In math mode, letters are written in italics (they are assumed to be
variables or functions, not words), and more advanced typsetting is
allowed. In order to switch back and forth between math mode and
normal mode, you use the $ character. That is, if you add "$x^2$" in
the middle of a bunch of normal mode text, the first '$' changes the
mode to math mode, the 'x^2' is interpreted and typset correctly, and
then the second '$' changes the mode back to normal mode.
Some math-mode commands to know:
- $x^a$ will put "a" as an exponent of x.
- $x^{abc}$ will put "abc" as an exponent of x. If you put $x^abc$
you will get output that looks wrong.
- $x_a$ will put "a" as a subscript of x. Similarly, $x_{abc}$
should be used for longer subscripts.
- $x^{y^a}$ and $x^{y_b}$ work, et cetera.
- $\alpha$ will produce an alpha character. Give the name of a
greek letter after a '\' (the command character) to get that greek
letter.
- $\ldots$ will produce the '...' such as in "1 + 2 + ... + n"
- '{' and '}' are special characters. To get '{' or '}' to show
up, use '\{' and '\}'.
There are many other commands you can use in math mode. For a more
extensive LaTeX reference online, try The Not So Short Introduction to LaTeX 2e,
especially the List of Mathematical Symbols. You can also check
another
Getting
Started with LaTeX page. I find especially useful the
amsmath package.
One final word about math mode: When you use the single '$' to go into
math mode and then back out, this inserts your mathematical type in
the middle of the paragraph. If what you want is to give an equation
or mathematical phrase on its own, go into math mode with a double
'$$' and back out the same way. This will put that incident of math
mode on its own line, centered. Some commands will come out looking
different if you put them on their own line. For instance, if you use
$\sum_{i=0}^{n} i$, the limits on the sum will be to the right of the
sum symbol. However, if you use $$\sum_{i=0}^{n} i$$, the limits will
be on the top and the bottom.
Debugging
When you have finished writing your .tex file, run "latex ps1.tex"
from the Athena (or whatever) prompt. If you had no bugs in your LaTeX
code it'll go right through and give you an Athena prompt again.
However, you will probably have some errors. Most errors fit into one
of these few categories:
- You forgot to close something you opened. You forgot to put
enough close parentheses or curly braces, or you left off the closing
$ to go out of math mode. You may also have forgotten to put
"\end{enumerate}" after your numbered list was finished. Remember that if
you use $$ to put a math mode block on its own line, you must close with a
$$. If you close with a single $, it will cause an error.
- Similar to the above, you forgot to open something you closed.
- You used a non-existant command.
- You used a command in normal mode that is only supposed to be
used in math mode. Sometimes this can look like a #3-type problem.
Feel free to ask me questions about LaTeX over email; I'll help you if I
can. I'm not particularly good at things like importing graphics or
matrix layouts, but I get by pretty well generally.
.Dvi? What's that?
When your "latex file.tex" command goes through, it creates a file
called "file.dvi". This can now be printed by typing "dvips file.dvi"
- on Athena this will print to the default printer. DVI files can
also be used to produce postscript files. To make file.dvi into
file.ps, run "dvips file.dvi -o file.ps"
If you want to check over your file to make sure it looks right
(without printing it), you have two options. First of all, you can
use the above instructions to create a postscript file, and use
ghostview ("gv file.ps &") to view it. Or, more simply, you can just
run "xdvi file.dvi &" to view your .dvi file without changing it to
postscript.
One Final Hint
If you have a LaTeX bug that you can't figure out, if worse comes to
worse, just delete the problematic section and put a bunch of
"\bigskip"s in its place. Then, once you print out your file, just
write the solution in.