A Sample L TEX Article

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

A Sample L

A
T
E
X Article
John Doe
August 12, 2014
Abstract
This a sample L
A
T
E
Xdocument that explains some of the L
A
T
E
Xcommands
1 Introduction
L
A
T
E
X is a markup language designed and implemented by Leslie Lamport, based on Donald
E. Knuths typesetting language T
E
X. The markup in the source le of a L
A
T
E
X document my
appear somewhat challenging, but the compiled result of the document is certainly a pleasing
rendering of the mark-up material.
L
A
T
E
X was built on T
E
Xs foundation. An article is divided into logical units, including
an abstract, various sections and subsections, theorems, and a bibliography. The logical units
are typed independently of one another. Once all the units have been typed, L
A
T
E
X controls
the placement and formating of these elements. L
A
T
E
X automatically numbers the sections,
theorems, and equations in your article, and builds the cross-references. If any changes is made
to the article, it automatically renumbers its various parts and rebuilds the cross-references.
Packages are extensions of L
A
T
E
X. L
A
T
E
X commands, as a rule, start with a backslash (\)
and tells L
A
T
E
Xto do something special. For example, in the instruction
\emph{instructions to \LaTeX} , \emph is a L
A
T
E
X command. Another kind of instruction
is called an environment. For example, the commands \begin{flushright} and \end{flushright}
enclose a flushright environmenttexts that are typed inside this environment are right jus-
tied (lined up against the right margin) when typeset.
1
2 Typing Text
The following keys are used to type text in a L
A
T
E
X source le:
a-z A-Z 0-9
+ = * / ( ) [ ]
You may also use the following punctuation marks:
, ; . ? ! : -
and the spacebar, and the Return (or Enter) key.
There are thirteen special keys that are mostly used in L
A
T
E
X instructions:
# $ % & ~ _ ^ \ { } @ " |
If you need to use them in your document, there are commands available for typesetting these
special characters. For example, $ is typed as \$, the underscore ( ) is typed as \_, and % is
typed as \%, whereas a is typed as \"{a}, and @ is simply typed @.
In a L
A
T
E
X source le, each comment line begins with %. L
A
T
E
X will ignore everything on
the line after the % character.
The document class, declared by the command \documentclass{..}, in a L
A
T
E
X source
le controls how the document will be formatted. L
A
T
E
X, by default, fully justies the text
by placing a certain size space between wordsthe interword spaceand a somewhat larger
space between sentencesthe intersentence space. To force an interword space, you can use the
\

command (the

symbol indicates a blank space). The (tilde) command also forces an
interword space, but with a dierence: it keeps words together on the same line. It is called a
tie or non-breakable space.
When L
A
T
E
X encounters a period, it must decide whether or not it indicates the end of a
sentence. It uses the following rule: A period following a capital letter (e.g., A.) is interpreted
2
as being part of an abbreviation or an initial and will be followed by an interword space;
otherwise, it signies the end of a sentence and will be followed by an intersentence space. If
this rule causes problems in your document, you can follow the period with \

to force an
interword space, or precede the period with \@ to force an intersetence space.
In a L
A
T
E
X document source le, left double quotes are typed a (two left single quotes)
and right double quotes are type as (two right single quotes). The left single quote key
is usually in the upper-left or upper-right corner of the keyboard, and shares a key with the
tilde (~) key.
In a L
A
T
E
X command that requires an argument, the argument follows the name of the
command and is placed between { and }. Command names are case sensitive. The command
\\ (\newline is another form) breaks a line. You can use the \\ command and specify
an appropriate amount of vertical space, for example \\[1in]. Note that this command uses
square brackets rather than braces because the argument is optional. The distance/spacing may
be given in points(pt), centimenters(cm), or inches(in). To force a page break, use \newpage.
3 Typing Math
In addition to the keys listed above, you need the keys |, <, and > to type mathematical
formulas. (| is the shifted \ key on many keyboards).
There are two kinds of math formulas and environments:
1. Inline math environments open and close with $ or open with \( and close with \).
2. Displayed math environments open with \[ and close with \]. Other forms of the dis-
played environment are \begin{equation*} ... \end{equation*} and
\begin{equation} ... \end{equation}.
Within the math environment, L
A
T
E
Xuses its own spacing rules and completely ignores the
number of white spaces typed with two exceptions:
1. Spaces that delimit commands (e.g., in $\infty a$, the space is not ignored; in fact,
\inftya$ is an error)
3
2. Spaces in the arguments of commands that temporarily revert to text mode (\mbox and
\text are such commands).
In text mode, many spaces equal one space; whereas, in math mode, spaces are ignored (unless
they terminate a command). To asjust the spacing in a typeset document, use a spacing
command. The same formula may be typeset dierently depending on whether it is inline or
display. For example,

n
i=1
i
2
is inline math. The following is the same expression as displayed
math
n

i=1
i
2
.
Math symbols are invoked by commands inside a math formula or environment. The math sym-
bols are organized into tables in Appendix A of textbook. Some commands (e.g. \sqrt) need
arguments enclosed in braces ({ and }). For example, to typeset

x
2
y
2
, type $\sqrt{x^{2} y^{2}}$.
To typeset
n

x
2
y
2
, type $\sqrt[n]{x^{2} y^{2}}$. Some commends need more than one
arguments. For example to typeset
sin x
cos
2
x + tan x
type
\[
\frac{\sin x}{\cos^{2} x + \tan x}
\]
\frac is the command; sin x and cos
2
x + tan x are the arguments.
Theorem 1 This is the Pythagorean Theorem. It says
x
2
+ y
2
= z
2
. (1)
Denition 1 Earth is where life is possible.
4 References
Michael Downes Short Math Guide for L
A
T
E
X, AMS, 2002
George Gratzer, First Steps in L
A
T
E
X, Springer-Verlag, New York, 1999
4

You might also like