Don't know how to do something in LATEX ? Look here first. Below is an index of various LATEX constructs.
In order to use this index, just look for an English term (either manually scroll through in alphabetical order, or use your browser's Find facility) which describes what you want to do.
bar (math):
To get, say, "Y bar", use \bar{Y}. However, the bar will be rather short. To get a wider one, use \overline. For example,
\overline{(\bar{A}+\bar{C}+\bar{D})(\bar{B}+\bar{E})}
will generate
____________
_ _ _ _ _
(A+C+D)(B+E)
bibliographies:
\begin{thebibliography}{}
\bibitem{anderson}
T. Anderson {\it et al}. ``A Case for Networks of Workstations,''
{\it IEEE Micro}, 54-64, February 1995.
\bibitem{mpi}
M. Snir. {\it MPI: the Complete Reference}, MIT Press, 1996.
\bibitem{trivedi}
K.S. Trivedi, {\it Probability and Statistics with Reliability,
Queuing and Computer Science Applications}. Prentice-Hall, 1982.
\end{thebibliography}
Here is an example of references to bibliography items:
In the last few years there has been a tremendous growth in interest
in the use of networks of workstations (NOWs) as engines forparallel.
processing \cite{anderson}. Among the most important advantages of NOWs
is their economic feasibility; they are constructed from off-the-shelf,
``commodity'' components; new nodes can be added very easily; and good
infrastructure software is available, such as \cite{mpi}.
To cite the number of a specific page, section or whatever, precede the
citation name with the desired information in brackets, e.g.
Durrett \cite[page 76]{durrett} references a model due to Chung and Lu,
binomial coefficients:
\usepackage{amsmath}
near the beginning of your file. But then \cases must be changed if one
has that too. So, I think it's best just to use arrays, e.g.
The notation $ \left (
\begin{array}{c}
8 \\
3
\end{array}
\right )$
means ``n choose k.''
blank space:
Suppose you wish to put a single-character blank in your document, say a blank entry in a table. Use `\ ', i.e. a backslash followed by a blank space. This also works to suppress extra space after the period after an abbreviation, i.e. to tell LATEX not to consider this the end of a sentence.
Use \hspace to insert a variable amount of blank space.
{\boldmath $x^2$}
If you are already in math mode, use \mathbf, etc.
braces:
cases (mathematical):
Here is how one could express more symbolically the statement, "1 sub Q (t) is equal to 1 or 0, according to whether t is a member of the set Q":
1_Q(t) =
\cases{
1, & if $t \in Q$\cr
0, & if $t \notin Q$\cr
}
If you are using the amsmath package, then change the above to
1_Q(t) =
\begin{cases}
1, & \text{if $t \in Q$}\
0, & \text{if $t \notin Q$}\
\end{cases}
Include a line like
\usepackage{color}
Then for example
\color{blue}
will make all text (and figures, etc.) from here onward blue. There is also \pagecolor for background color, \textcolor for a one-time text-color change, etc. Several primary colors are predefined (red, green, blue, cyan, magenta, yellow, black and white), and you can use \definecolor to make use of X11 windows colors, "mix" your own colors from the primaries, etc.
Note that the colors may not show up with xdvi but will show up in the Postscript or PDF files.
date ("article" style):
double-spacing:
\renewcommand{\baselinestretch}{2}
"dropped" (occupies several lines of text, as in an old-fashioned novel) initial capital letter in a paragraph:
\dropping{3}{O} nce upon a time, there was...
will produce a large `O' which extends through the first 3 lines of the paragraph.
enlarging the font size:
Do {\LARGE NOT} wait until you are finished writing your program to add
comments to it.
equations (math):
\begin{equation}
\end{equation}
The resulting equation will be numbered. If you don't want numbering,
use eqnarray and
\nonumber.
escaping special characters:
floor, ceiling (math):
Use \hat, or \widehat.
hyperlinks:
You can get hyperlinks within your document--in the table of contents, equation references etc., as well as to external Web links--by including a line
\usepackage{hyperref}
near the beginning of your document. By the way, if you use \tableofcontents make sure to use it in that form instead of \tableofcontents{}.
implication arrow:Suppose you have an PDF file. x.pdf. (JPEG is OK too.) Then at the beginning of your document, tell LATEX to use the graphicx package:
\usepackage{graphicx}
At the place in the document at which you wish to insert your figure, type, for example:
\begin{figure}[tb]
\centerline{
\includegraphics[width=3.2in]{x.pdf}
}
\caption{your caption} % optional
\label{label} % optional
\end{figure}
Note the width option for \includegraphics. The latter command has various other options, including angle for rotation of the image, e.g. angle 180 for a reversal.
Run pdflatex instead of latex.
infinity (math symbol):
integrals (math):
\int_0^T x(t) dt
In evaluating an indefinite integral at a certain value, using the "vertical bar" notation, do as in this example:
\frac{x^2+1}{x+1} \Big |_{x=1}
"landscape" (as opposed to "portrait") printing:
The LATEX command is
\usepackage{landscape}
Margins which are stated to be horizontal (\oddsidemargin and \evensidemargin) will now be vertical and vice versa. However, \textwidth and \textheight still refer to the lines of text themselves.
letterhead, skipping over:
limits (math):
To get a nice-looking limit, use \lim, e.g.
\lim_{n \rightarrow \infty} z_n
limits on integrals, sums etc. (math):
Limits on an integral, sum and so on can be produced by using ordinary sub- and superscript operations. This looks good for inline math within text, but for displayed expressions the \limits operator can be used to place limits directly above and below the integral, instead of to the "northeast" and "southeast." For example, to write the integral from 0 to 1 in this manner,
\int\limits_0^1line break:
If an equation is too long to fit on a line, you can try using eqnarray to break it up. Or use the amsmath package's split environment, as follows:
\begin{split}
first part of long equation \\
second part
\end{split}
math symbols:
matrices (math):
\begin{equation}
\begin{pmatrix}
1 & 0 \\
0 & 1
\end{pmatrix}
\end{equation}
There are lots of variations.
This must be accompanied by a line
\usepackage{amsmath}
before your \begin{document}.
If you don't use that package, just use arrays:
\begin{equation}
\left (
\begin{array}{cc}
1 & 0 \\
0 & 1
\end{array}
\right )
\end{equation}
min, max, log etc. (math)
\max_i x_iwill result in the i going underneath "max" instead of to the side. the multline and eqnarry environments (math):
\usepackage{amsmath}
before your \begin{document}. Here is an example of
use of the environment:
\begin{multline}
q(v) = q(v_{1},...,v_{d-1}) \\
= P(Y = 1 | X^{(j)} = v_{1},...,X^{(d-1)} = v_{d-1})
\end{multline}
Note the \\ signal to go to a new line.
If you want the equal signs to be aligned, a nicer choice is eqnarray, e.g.
\begin{eqnarray}
q(v) & =& q(v_{1},...,v_{d-1}) \\
& = & P(Y = 1 | X^{(j)} = v_{1},...,X^{(d-1)} = v_{d-1})
\end{eqnarray}
The ampersands are used here to align the equal signs. And they need
not be equal signs; anything between the ampersands--including a
blank--will line up with the others.
If you want, say, only the last line to be numbered:
\begin{eqnarray}
q(v) & =& q(v_{1},...,v_{d-1}) \nonumber \\
& = & P(Y = 1 | X^{(j)} = v_{1},...,X^{(d-1)} = v_{d-1})
\end{eqnarray}
LATEX may place the equal sign in the above example further to the right
than you wish. If so, try \lefteqn{}:
\begin{eqnarray}
\lefteqn{q(v) & =& q(v_{1},...,v_{d-1})} \nonumber \\
& = & P(Y = 1 | X^{(j)} = v_{1},...,X^{(d-1)} = v_{d-1})
\end{eqnarray}
norm, vector (math):
\parallel u+v \parallel"not equals" sign (math):
page numbering:
paragraph indentation:
plus-or-minus (math symbol):
quotation marks:
Do not use the ASCII quotation mark character for quotes. Use `` for opening quotations and '' for closing them. (These are pairs of left single-quote and right single-quote characters.)
If you have a quote within a quote, so that the latter needs the single-quote marks, use ``\,` to open and '\,'' to close.
rotating text, including making it upside-down:
\usepackage[dvips]{graphics}
Then for the rotated text, have:
\rotatebox{angle, in degrees counterclockwise}{text to be rotated}
(The effect will show up only after use dvips, not xdvi.)
.sty files:
If you need to use a style file, say x.sty, include a line
\usepackage{x}
in your LATEX source file. If it is not already part of your installed LATEX system, you will need to add its directory, say /u/v/w (full path name), to the search path:
setenv TEXINPUTS .:/u/v/w:
(The final colon is crucial.)
subscripts, superscripts (math):
{(x_{ij})}^2
will produce the square of x with a subscript ij.
sums (math):
tabbing:
\begin{tabbing}
set $F_1$ to the set of 1-item itemsets whose support exceeds the
threshold \\
for \= i = 2 to b \\
\> $F_{i} = \phi$ \\
\> for \= each I in $F_{i-1}$ \\
\> \> for \= each K in $F_1$ \\
\> \> \> $Q = I \cup K$ \\
\> \> \> if \= support(Q) exceeds support threshold \\
\> \> \> \> add Q to $F_{i}$ \\
\> if $F_{i}$ is empty break \\
return $\cup_i F_i$
\end{tabbing}
Each \= establishes a tab mark, and each \> means to move to the next tab position. The \\ mean to start a new line.
table of contents:
\begin{tabular}{|r|r|}
\hline
~ & 1011 \\ \hline
AND & 1101 \\ \hline
\hline
~ & 1101 \\ \hline
\end{tabular}
Without vertical lines:
\begin{tabular}{rr}
~ & 1011 \\
AND & 1101 \\
\hline
~ & 1001 \\
\end{tabular}
Without vertical or horizontal lines:
\begin{tabular}{rr}
~ & 1011 \\
AND & 1101 \\
~ & 1001 \\
\end{tabular}
With a wide column at the top:
\begin{tabular}{|r|r|}
\hline
\multicolumn{2}{|c|}{spans the full width of the table} \\ \hline
~ & 1011 \\ \hline
AND & 1101 \\ \hline
\hline
~ & 1101 \\ \hline
\end{tabular}
Note: If a table entry should be blank, just put in a tile (~).
tilde (math):
title page ("article" style):
union, intersection, subset, superset (math):