\documentclass{article}
\usepackage{fullpage}
\begin{document}
\title{Here is a Short LaTeX Document}
\author{Gregory V. Bard}
\maketitle
So here's LaTeX. Once you get used to the idea of LaTeX it is very
easy to use but hard to explain. For that reason, you're provided with
two files. One is a LaTeX file, and the other is the pdf file that it produces.
Look at one, and look at the other. Look back and forth. Compare them.
In this way, you'll figure out what all the commands do.
This is how unemployed
French military cryptologists deciphered the Egyptian hieroglyphics.
They had a stone, called the Rosetta Stone, that had Greek on it, which they
knew, and hieroglyphics, which they did not. They figured it all out by
comparisons, which was slow but fun and exciting.
When you're just typing some paragraphs, just dump
them in here. Just like that. You simply type. Be sure you do it in a plain
old boring text editor. I'm not joking. You have to write LaTeX in notepad,
or a plain text editor like it, or a custom program like TeXShop for the mac.
If you write it in MS-Word, it won't work.
As you can see
by this paragraph,
the line breaks within
a paragraph do not
matter. It is really is
all about the words,
and LaTeX manages
the spacing for you.
But on the other hand, an entire blank line in the file is an
official paragraph break. Just like what happened above.
Now let's do some math. Simple things like $x$ or
just $3x+6$ or $17x-8$ can just be typed. You simply must
enclose the formula with dollar signs. The dollar signs bring
you in and out of math mode.
Sometimes you have a big formula, and want to display it. In
order to do that, you use two dollar signs. That looks like this,
$$ ax^2 + bx + c = 17 $$
and notice how the hat makes an exponent. This is called
display-math-mode, and differs from math mode. It makes
the formula large.
Never attempt to do any math outside of math mode. It
will cause a major disaster, an error message that is hard
to understand.
Large exponents are kind of funny. Look at the difference
between $x^10$ and $x^{10}$. The curly brackets are a
grouping symbol. Likewise, the underscore has a very
special meaning too. That is how you make subscripts.
In fact, $x_0$ and $x_1$ are really common, but you
probably want to say $x_{10}$ and not $x_10$.
For parentheses and small fractions, you have two choices.
Sometimes it is okay to be simple:
$$ 2(x+5+y/2) = 2x + 10 + y $$
and see how I used the slash for the fraction, and the parentheses
keys for parentheses. Brackets are okay too, so for example
you can say $[5, 7)$ is the same thing as $5 \le x < 7$. Or
you could write that as $7 > x \ge 5$.
Notice that I just wrote an inequality. For an open interval, the
buttons for that live on
top of the comma and the period on your computer's keyboard.
For a closed interval, you have to use the commands backslash-le
and backlash-ge, which are supposed to abbreviate less-or-equal
and greater-or-equal.
Now if you want to be fancy about parentheses, then
there are two commands you should know:
$$ \left ( x/y \right ) 2y = 2x $$
and be very careful to match up the backslash-left and
backslash-right. Of course, that's only true if $y \neq 0$, and
note the use of the not-equal-to operator.
Life can become a living hell if your dollar signs
do not match up with dollar signs, or if your double dollar signs
do not match up with double dollar signs---likewise for the
backslash-left and backslash-right.
A major plus is being able to do fractions. Here is a simple one
$$ \frac{x^5}{x^2} = x^3 $$
and here is a complex one that demonstrates the square root
function as well as plus/minus
$$ x = \frac{ -b \pm \sqrt{ b^2 - 4ac} }{2a} $$
which is a formula that perhaps you have seen before\footnote{It was
known, as a method and not as a formula, to the Babylonians.}!
And that demonstrates the use of
footnotes. Notice that the footnote command, the square root, and
the fraction all make use of the curly brackets for grouping. As did
the first few commands. Oh, you might have to do an integral, and
if so, do it this way
$$ \int 3x^2 + 2x + 1 dx = x^3 + x^2 + x + C $$
LaTeX will do the typesetting very intelligently. The goal is for you
to focus on the math, and let the computer focus on the typesetting. Even
the page numbering is automatic. But you'll be amazed at how really nasty
formulas are worked out without human intervention by LaTeX.
For example (and don't let this frighten you)
$$ 1 + \frac{1}{1+ \frac{1}{1+ \frac{1}{1+ \frac{1}{1+ \frac{1}{1+ \frac{1}{1+ 1}}}}}} \approx \phi = 1.61803\ldots$$
comes out really nice, doesn't it? And that also shows you how to
show $\approx$ and how to make a Greek letter, like $\psi$ or $\pi$,
perhaps $\alpha$ or $\beta$, and my personal favorite, $\xi$. It is
merely the name of the Greek letter, preceded by a backslash.
Notice how backslash-ldots was used to make dots for a decimal fraction.
By the way, the first six commands of this document should be your
first six lines in the first LaTeX document that you ever write. And
probably the second, the third, and the fourth. You might learn how
to tweak them later, but for now, just use them as they are.
There are cool ways to typeset `quotes' or ``quotes.'' For the openers,
you use the accent mark under the squiggle or tilde in the upper-left-hand
corner of your keyboard. Use it once or twice as needed.
For the closers, use the apostrophe once or twice as needed. The quotation
mark key will not cause LaTeX to crash, but it produces the rather
hideous "quotes."
Now you've learned a bunch of commands. Many, but not all of them
have a backslash in them. So you might think that it is not possible to
just use a backslash casually. This is true. There are other keys that
\emph{you must not use casually.} Notice how I just did italics!
You can do \underline{underlining} similarly.
There are ten forbidden
symbols in LaTeX. They are: the number sign \#, the tilde or squiggle $\sim$,
the dollar sign \$, the percentage sign \%, the hat $\hat{\hspace{0.1in}}$, the
ampersand \&, the underscore \underline{\hspace{0.1in}}, the braces \{ and \}, the backslash
$\backslash$. You can produce them. In fact, I just did. But don't look at that
unless you really need to.
Okay, now you've got a LaTeX file, and you want to make it into a pdf
file. How are you going to do that? On a linux or UNIX computer,
you can type ``pdflatex yourfilenamegoeshere'' and it will make the pdf
file for you. If you're on a mac, download and use TeXShop. You might also
want to download Excalibur, a LaTeX aware spell checker. I don't have
the slightest idea what Microsoft Windows users should do. (Sorry!)
If there is an error, you'll
find that the error messages are incomprehensible. But most errors are
usually caused by one of three sins. The first sin is not matching up
the dollar signs at the start/end of a formula, or double-dollar signs,
or backslash-left and backslash-right. The second sin is using
one of the ten forbidden characters. The third sin is using math outside
of math mode. Jointly, these are 90\% of the errors
that can occur.
The last line must always be the last line of this file, which tells LaTeX
that the document is over.
\end{document}