Unofficial LaTeX reference manual.
\LaTeX
. Where use of the logo is not
sensible, such as in plain text, write it as LaTeX.
\documentclass{article} \begin{document} Hello, \LaTeX\ world. \end{document}
\documentclass
and the \begin{document}
commands.
This area is called the preamble.
\begin{document} ... \end{document}
is a so-called
.lof
file that is used to make a list
of figures, a .lot
file used to make a list of tables, and a
.toc
file used to make a table of contents. A particular class
may create others; the list is open-ended.
\
. The name itself then consists of either
(a) a string of letters or (b) a single non-letter.
\pagebreak
differs from \Pagebreak
(the latter is not a standard command).
Most commands are lowercase, but in any event you must enter all
commands in the same case as they are defined.
{...}
. Optional arguments are
contained in square brackets, [...]
. Generally, but not
universally, if the command accepts an optional argument, it comes
first, before any required arguments.
]
) hide it inside curly braces, as
in \item[closing bracket {]}]
. Similarly, if an optional
argument comes last, with no required argument after it, then to make
the first character of the following text be an open square bracket,
hide it inside curly braces.
*
form that
is related to the form without a *
, such as \chapter
and
\chapter*
. The exact difference in behavior varies from command
to command.
*
-forms for the
commands it covers (barring unintentional omissions, a.k.a.&noeos; bugs).
\begin{environment name} ... \end{environment name}
\begin{verse}
and \end{verse}
.
\begin{verse} There once was a man from Nantucket \\ ... \end{verse}
*
); both the \begin
and \end
texts must
include the star.
\begin{tabular}[t]{r|l} ... rows of table ... \end{tabular}
\mainmatter
command
changes the setting of page numbers from roman numerals to arabic.
\makeatletter ... definition of commands with &arobase; in their name .. \makeatother
\makeatletter
makes
the at-sign character &arobase;
have the category code of a letter,
11. \makeatother
sets the category code of &arobase;
to 12,
its original value.
\
is
assigned the catcode 0, for characters that start a command. These two
commands alter the catcode assigned to &arobase;
.
&arobase;
in their name, to prevent users from accidentally defining a
command that replaces one of &latex;&textrsquo;s own. Command names consist of a
category 0 character, ordinarily backslash, followed by letters,
category 11 characters (except that a command name can also consist
of a category 0 character followed by a single non-letter symbol).
So under the default category codes, user-defined commands cannot
contain an &arobase;
. But \makeatletter
and \makeatother
allow users to define or redefine commands named with &arobase;
.
\usepackage
and \documentclass
commands set the at sign to have the character
code of a letter.
macros2e
macros2e
\makeatletter \renewcommand\section{% \&arobase;startsection{section}% Name {1}% Level: 0=part, 1=chapter, etc. {0pt}% Heading indent {-3.5ex plus -1ex minus -.2ex}% Beforeskip (if neg, no head indent) {2.3ex plus.2ex}% Afterskip (if neg, run-in heading) {\centering\normalfont\Large\bfseries}} % Style of head \makeatother
\documentclass[options]{class}
\documentclass
command by enclosing them in square brackets.
To specify more than one option, separate them with a comma, as in:
\documentclass[option1,option2,...]{class}
slides
accept the following
options for selecting the typeface size (default is 10pt
):
10pt 11pt 12pt
geometry
geometry
letterpaper
set
the print area but you must also set the physical paper size. One way
to do that is to put \pdfpagewidth=\paperwidth
and
\pdfpageheight=\paperheight
in your document&textrsquo;s preamble. The
geometry
package provides flexible ways of setting the print
area and physical page size.
slides
class.
slides
classslides
class offers the option clock
for printing
the time at the bottom of each note.
\usepackage[options]{pkg}.
\usepackage{pkg1,pkg2,...}
, or use multiple
\usepackage
commands.
\documentclass
command that are unknown
to the selected document class are passed on to the packages loaded with
\usepackage
.
smcmemo.cls
and begin your documents with
\documentclass{smcmemo}
.
Memo from the
SMC Math Department
is for a class.
&arobase;
as a
character in command names without having to surround that command with
\makeatletter
and \makeatother
. smcmemo
might have commands \smc&arobase;tolist
,
\smc&arobase;fromlist
, etc.
\NeedsTeXFormat
and
\ProvidesClass
or \ProvidesPackage
commands. (2) The
preliminary declarations part declares some commands and can also load
other files. Usually these commands will be those needed for the code
used in the next part. For example, an smcmemo
class might be
called with an option to read in a file with a list of people for the
to-head, as \documentclass[mathto]{smcmemo}
, and therefore
needs to define a command
\newcommand{\setto}[1]{\def\&arobase;tolist{#1}}
used in that
file. (3) In the handle options part the class or package declares
and processes its options. Class options allow a user to start their
document as \documentclass[option list]{class
name}
, to modify the behavior of the class. An example is when you
declare \documentclass[11pt]{article}
to set the default
document font size. Finally, (4) in the more declarations part the
class or package usually does most of its work: declaring new variables,
commands and fonts, and loading other files.
stub.cls
where &latex; can find it, for example in the same directory as the
.tex
file.
\NeedsTeXFormat{LaTeX2e} \ProvidesClass{stub}[2017/07/06 stub to start building classes from] \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions\relax \LoadClass{article}
article
class, and then loads the
article
class to provide the basis for this class&textrsquo;s code.
\textit{text}
. In the table below, the corresponding
command in parenthesis is the &textldquo;declaration form&textrdquo;, which takes no
arguments, as in {\itshape text}
. The scope of the
declaration form lasts until the next type style command or the end of
the current group.
\sffamily\bfseries
or
\bfseries\sffamily
to get bold sans serif.
\begin{ttfamily}...\end{ttfamily}
.
\nocorrlist
, which by default consists
of a period and a comma. To suppress the automatic insertion of
italic correction, use \nocorr
at the start or end of the
command argument, such as \textit{\nocorr text}
or
\textsc{text \nocorr}
.
\emph{text}
command
is semantic, for text to be emphasized, and should not be used as a
substitute for \textit
. For example, \emph{start
text \emph{middle text} end text}
will result in the
start text and end text in italics, but middle text
will be in roman.
{\cmd...}
instead of \cmd{...}
. These
are two unrelated constructs.
\em
command is the unconditional version of \emph
.
\tt
, obsolete and that only the cumulative commands
(\texttt
) should be used. Others think that both sets of
commands have their place and sometimes an unconditional font switch
is precisely what you want; for one example,
description
\mathbf{\mathit{symbol}}
does not
create a boldface and italic symbol; instead, it will just be in
italics. This is because typically math symbols need consistent
typographic treatment, regardless of the surrounding environment.
\mathversion{bold}
can be used for
switching to bold letters and symbols in
formulas. \mathversion{normal}
restores the default.
textcomp
textcomp
\oldstylenums{numerals}
will typeset
so-called &textldquo;old-style&textrdquo; numerals, which have differing heights and
depths (and sometimes widths) from the standard &textldquo;lining&textrdquo; numerals,
which all have the same height as upper-case letters. &latex;&textrsquo;s
default fonts support this, and will respect \textbf
(but not
other styles; there are no italic old-style numerals in Computer
Modern). Many other fonts have old-style numerals also; sometimes the
textcomp
package must be loaded, and sometimes package options
are provided to make them the default. FAQ entry:
\normalsize
(default)10pt
11pt
12pt
\tiny
\scriptsize
\footnotesize
\small
\normalsize
(default)
\large
\Large
\LARGE
\huge
\Huge
\begin{tiny}...\end{tiny}
.
\onecolumn
onecolumn
then this is the default
behavior (\twocolumn
\twocolumn \twocolumn[prelim one column text]
twocolumn
then this is the default
(\setlength{\columnsep}{40pt}
You must change
it before the two column environment starts; in the preamble is a good
place.
\setlength{\columnseprule}{0.4pt}
, before the two-column
environment starts.
\textwidth
. In two-column mode by default &latex; sets the
width of each of the two columns to be half of \textwidth
minus
\columnsep
.
table*
and
figure*
are two columns wide, whereas the unstarred environments
table
and figure
take up only one column (table*
or figure*
environment must not
exceed 0.7\textheight
. If the height of your starred float
environment exceeds this then you can take one of the following actions
to prevent it from floating all the way to the back of the document:
[tp]
location specifier to tell LaTeX to try to put
the bulky float on a page by itself, as well as at the top of a page.
[t!]
location specifier to override the effect of
\dbltopfraction
for this particular float.
\dbltopfraction
to a suitably large number,
to avoid going to float pages so soon.
\renewcommand{\dbltopfraction}{0.9}
.
0.5
. Change it with \renewcommand
.
12pt plus2pt minus2pt
for a document set at 10pt
or
11pt
, and 14pt plus2pt minus4pt
for a document set at
12pt
.
20pt plus2pt
minus4pt
.
2
.
\twocolumn
&textrsquo;s optional argument of to create a
title that spans the two-column article:
\documentclass[twocolumn]{article} \newcommand{\authormark}[1]{\textsuperscript{#1}} \begin{document} \twocolumn[{% inside this optional argument goes one-column text \centering \LARGE The Title \\[1.5em] \large Author One\authormark{1}, Author Two\authormark{2}, Author Three\authormark{1} \\[1em] \normalsize \begin{tabular}{p{.2\textwidth}&arobase;{\hspace{2em}}p{.2\textwidth}} \authormark{1}Department one &\authormark{2}Department two \\ School one &School two \end{tabular}\\[3em] % space below title part }] Two column text here.
\flushbottom
\raggedbottom
(textheight
to make compatible pages, or you
can add some vertical stretch glue between lines or between paragraphs,
as in \setlength{\parskip}{0ex plus0.1ex}
. Your last option
is to, in a final editing stage, adjust the height of individual pages
(\flushbottom
state is the default only if you select the
twoside
document class option (\raggedbottom
twoside
document class
option (twocolumn
is in effect (article
, report
, and book
classes is 12pt,
at all type sizes.
article
and report
classes is 25pt. In the book
class the default is: if the
document is set at 10pt then it is 0.25in, and at 11pt and 12pt
it is 0.275in.
article
and report
classes is 30pt. In the book
class the default is: when
the type size is 10pt the default is 0.35in, while at 11pt it is
0.38in, and at 12pt it is 30pt.
list
(\linewidth
is to
equal \textwidth
but for each nested list the \linewidth
is decreased by the sum of that list&textrsquo;s \leftmargin
and
\rightmargin
(\reversemarginpar
changes that (and
\normalmarginpar
changes it back).
\marginparpush
in both book
and
article
classes are: 7pt if the document is set at 12pt,
and 5pt if the document is set at 11pt or 10pt.
\marginsep
, in article
class the default is
10pt except if the document is set at 10pt and in two-column mode
where the default is 11pt.
\marginsep
in book
class the default is 10pt in
two-column mode and 7pt in one-column mode.
\marginparwidth
in both book
and article
classes, in two-column mode the default is 60% of \paperwidth
− \textwidth
, while in one-column mode it is 50% of that
distance.
\oddsidemargin
is the extra distance between the left side of
the page and the text&textrsquo;s left margin, on odd-numbered pages when the
document class option twoside
is chosen and on all pages when
oneside
is in effect. When twoside
is in effect, on
even-numbered pages the extra distance on the left is
evensidemargin
.
\oddsidemargin
is 40% of the
difference between \paperwidth
and \textwidth
, and
\evensidemargin
is the remainder.
\documentclass[a4paper]{article}
(\documentclass[a4paper]{article}
(article
or report
the default is 43\baselineskip, while for a book
it is
41\baselineskip. At a type size of 11pt the default is
38\baselineskip for all document classes. At 12pt it is
36\baselineskip for all classes.
article
or report
document, the default is 345pt
when the chosen type size is 10pt, the default is 360pt at 11pt,
and it is 390pt at 12pt. For a book
document, the default
is 4.5in at a type size of 10pt, and 5in at 11pt or 12pt.
\textwidth
remains the width of the
entire page body, while \columnwidth
is the width of one column
(\textwidth
remains the width of the
entire page body (and \columnwidth
the width of the entire
column), while \linewidth
may decrease for nested lists.
\parbox
(minipage
or \parbox
.
\hsize
is the &tex;
primitive parameter used when text is broken into lines. It should not
be used in normal &latex; documents.
\paperheight − 2in −
\headheight − \headsep − \textheight − \footskip
,
and then divided by two.
figure
(table
(figure
and table
, in
both article
and book
classes, is tbp
.
btp
has the same effect as tbp
. All that
placement does is that if a letter is not present then the
algorithm does not try that location. Thus, &latex;&textrsquo;s default of
tbp
is to try every location except placing the float where it
occurs in the source.
\clearpage
command to start a new page and
insert all pending floats. If a pagebreak is undesirable then you can
use the \afterpage{\clearpage}
. This will wait until the current page
is finished and then flush all outstanding floats.
t
specifier in
the placement parameter. If this is not desired, and deleting
the t
is not acceptable as it keeps the float from being placed
at the top of the next page, then you can prevent it by either using
the \suppressfloats[t]
, which causes floats for the top position on
this page to moved to the next page.
\renewcommand{parameter}{decimal between 0 and 1}
):
\setlength{parameter}{length expression}
):
\setcounter{ctrname}{natural number}
):
report
and book
class only)
\chapter[toctitle]{title}
*
-form of sectioning commands*
-forms that print
title as usual, but do not include a number and do not make an
entry in the table of contents. For instance:
\section*{Preamble}
\appendix
command changes the way following sectional units
are numbered. The \appendix
command itself generates no text
and does not affect the numbering of parts. The normal use of this
command is something like
\chapter{A Chapter} &dots; \appendix \chapter{The First Appendix}
secnumdepth
counter controls printing of section numbers.
The setting
\setcounter{secnumdepth}{level}
chapter
is level zero. (\label{eq:GreensThm}
and refer to it with See
equation~\ref{eq:GreensThm}
.
\label{...}
but with an
\newlabel{label}{{currentlabel}{pagenumber}}
where currentlabel is the current value of the macro
\&arobase;currentlabel
that is usually updated whenever you call
\refstepcounter{counter}
.)
\ref{key}
that
appears earlier than the associated \label{key}
; see the
example in the \pageref{...}
description. &latex; gets the
information for references from the LaTeX Warning: Label(s) may have changed. Rerun to get
cross references right.
and in the output the reference will appear as
two question marks ??, in boldface. Or, if you change some
things so the references change then you get the same warning and the
output contains the old reference information. The solution in either
case is just to compile the document a second time.
\label
\label{key}
\label{key}
assigns to key the number of the
current sectional unit. Inside an environment with numbering, such as a
table
or theorem
environment, \label{key}
assigns to key the number of that environment. Retrieve the
assigned number with the \ref{key}
command
(\label{fig:Euler}
is a label for a figure with a portrait
of the great man.
sec:test
will get the number of the
current section and the key fig:test
will get the number of the
figure. (Incidentally, put labels after captions in figures and
tables.)
\section{section name} \label{sec:test} This is Section~\ref{sec:test}. \begin{figure} ... \caption{caption text} \label{fig:test} \end{figure} See Figure~\ref{fig:test}.
\pageref{key}
\pageref{key}
\label
{key} command appears.
\label{eq:main}
is used both for the
formula number and for the page number. (Note that the two references
are forward references, so this document would need to be compiled twice
to resolve those.)
The main result is formula~\ref{eq:main} on page~\pageref{eq:main}. ... \begin{equation} \label{eq:main} \mathbf{P}=\mathbf{NP} \end{equation}
\ref{key}
\ref{key}
\label
command (\ref{popular}
produces 2. Note
that it is a forward reference since it comes before
\label{popular}
.
The most widely-used format is item number~\ref{popular}. \begin{enumerate} \item Plain \TeX \item \label{popular} \LaTeX \item Con\TeX t \end{enumerate}
\begin
and ends with \end
,
like this:
\begin{environment-name} ... \end{environment-name}
\begin{table*}...\end{table}
will cause an error like:
! LaTeX Error: \begin{table*} on input line 5 ended by
\end{table}.
abstract
abstract
abstract
\begin{abstract} ... \end{abstract}
article
and report
document classes
(article
class produces a displayed
paragraph. Document class option titlepage
causes the abstract
to be on a separate page (report
class.
\begin{abstract} We compare all known accounts of the proposal made by Porter Alexander to Robert E Lee at the Appomattox Court House that the army continue in a guerrilla war, which Lee refused. \end{abstract}
\documentclass[twocolumn]{article} ... \begin{document} \title{Babe Ruth as Cultural Progenitor: a Atavistic Approach} \author{Smith \\ Jones \\ Robinson\thanks{Railroad tracking grant.}} \twocolumn[ \begin{&arobase;twocolumnfalse} \maketitle \begin{abstract} Ruth was not just the Sultan of Swat, he was the entire swat team. \end{abstract} \end{&arobase;twocolumnfalse} ] { % by-hand insert a footnote at page bottom \renewcommand{\thefootnote}{\fnsymbol{footnote}} \footnotetext[1]{Thanks for all the fish.} }
array
array
array
\begin{array}{cols} column 1 entry &column 2 entry ... &column n entry \\ ... \end{array}
\begin{array}[pos]{cols} column 1 entry &column 2 entry ... &column n entry \\ ... \end{array}
equation
(&
). Rows are terminated with
double-backslashes (array
diverges from tabular
. The
first is that array
entries are typeset in math mode, in
textstyle (except if the cols definition specifies the column with
p{...}
, which causes the entry to be typeset in text mode).
The second is that, instead of tabular
&textrsquo;s parameter
\tabcolsep
, &latex;&textrsquo;s intercolumn space in an array
is governed
by
\arraycolsep
, which gives half the width between columns. The
default for this is 5pt.
pmatrix
for an array
surrounded by parentheses (...)
, bmatrix
for an array
surrounded by square brackets [...]
, Bmatrix
for an
array surrounded by curly braces {...}
, vmatrix
for
an array surrounded by vertical bars |...|
, and
Vmatrix
for an array surrounded by double vertical
bars ||...||
, along with a number of other array constructs.
\begin{equation} \begin{array}{cr} \sqrt{y} &12.3 \\ x^2 &3.4 \end{array} \end{equation}
\usepackage{amsmath}
is in the
preamble:
\begin{equation} \begin{vmatrix}{cc} a &b \\ c &d \end{vmatrix}=ad-bc \end{equation}
center
center
center
\begin{center} ... text ... \end{center}
center
)figure
environment.
\begin{center} A Thesis Submitted in Partial Fufillment \\ of the Requirements of \\[0.5ex] the School of Environmental Engineering \end{center}
\begin{center} My father considered that anyone who went to chapel and didn't drink alcohol was not to be tolerated.\\ I grew up in that belief. --Richard Burton \end{center}
\centering
figure
, or in a
parbox
.
center
environment, the \centering
command does
not add vertical space above and below the text.
ww {\centering xx \\ yy} zz
is
surrounded by blank lines then &latex; will create a paragraph whose
first line ww xx is centered and whose second line, not centered,
contains yy zz. Usually what is desired is for the scope of the
declaration to contain a blank line or the \end
command of an
environment such as figure
or table
that ends the
paragraph unit. Thus, if {\centering xx \\ yy\par} zz
is
surrounded by blank lines then it makes a new paragraph with two
centered lines xx and yy, followed by a new paragraph with
zz that is formatted as usual. See also the following example.
\centering
causes the graphic to be horizontally
centered.
\begin{figure} \centering \includegraphics[width=0.6\textwidth]{ctan_lion.png} \caption{CTAN Lion} \label{fig:CTANLion} \end{figure}
\centering
ends with the \end{figure}
.
description
description
description
\begin{description} \item [first label] text of first item \item [second label] text of second item ... \end{description}
\item
command (\item[\texttt{label text}]
then it will appear in bold
typewriter, if that is available. The simplest way to get non-bold
typewriter is to use declarative style: \item[{\tt label
text}]
. Similarly, to get the standard roman font, use
\item[{\rm label text}]
.
\begin{definition} \item[lama] A priest. \item[llama] A beast. \end{definition}
displaymath
displaymath
displaymath
\begin{displaymath} ... math text ... \end{displaymath}
fleqn
; see displaymath
environment no equation number is added to the
math text. One way to get an equation number is to use the
equation
environment (\[..math text..\]
is essentially a synonym for
\begin{displaymath}..math text..\end{displaymath}
but the
latter is easier to work with in the source file; for instance,
searching for a square bracket may get false positives but the word
displaymath
will likely be unique. (The construct $$..math
text..$$
from Plain &tex; is sometimes mistakenly used as a
synonym for displaymath
. It is not a synonym, because the
displaymath
environment checks that it isn&textrsquo;t started in math mode
and that it ends in math mode begun by the matching environment start,
because the displaymath
environment has different vertical
spacing, and because the displaymath
environment honors the
fleqn
option.)
\begin{displaymath} \int_1^2 x^2\,dx=7/3 \end{displaymath}
\( \int_1^2 x^2\,dx=7/3 \)
produces.
document
document
document
document
environment encloses the entire body of a document.
It is required in every &latex; document. \AtBeginDocument{code}
\begin{document}
is
executed, at the very end of the preamble. The code is executed after
the font selection tables have been set up, so the normal font for the
document is the current font. However, the code is executed as part of
the preamble so you cannot do any typesetting with it.
\AtEndDocument{code}
\end{document}
is executed,
before the final page is finished and before any leftover floating
environments are processed. If you want some of the code to be executed
after these two processes then include a \clearpage
at the
appropriate point in code.
enumerate
enumerate
enumerate
\begin{enumerate} \item [first label] text of first item \item [second label] text of second item ... \end{enumerate}
\item
command.
\begin{enumerate} \item Johnny Hayes (USA) \item Charles Hefferon (RSA) \end{enumerate}
itemize
(description
(enumeration
, up to four levels deep.
The format of the label produced depends on the place in the nesting.
This gives &latex;&textrsquo;s default for the format at each nesting level
(where 1 is the outermost level):
enumerate
environment uses the counters \enumi
through
\enumiv
counters (\item
then the counter is not incremented for that
item (\renewcommand
(\labelenumi
through \labelenumiv
. For instance, this first level list will be
labelled with uppercase letters, in boldface, and without a trailing
period:
\renewcommand{\labelenumi}{\textbf{\Alph{enumi}}} \begin{enumerate} \item eI \item bi: \item si: \end{enumerate}
\Alph
see
eqnarray
eqnarray
eqnarray
amsmath
eqnarray
eqnarray
environment is depreciated. It has
infelicities that cannot be overcome, including spacing that is
inconsistent with other mathematics elements (see the article &textldquo;Avoid
eqnarray!&textrdquo;&noeos; by Lars Madsen
align
environment.
\begin{eqnarray} first formula left &first formula middle &first formula right \\ ... \end{eqnarray}
\begin{eqnarray*} first formula left &first formula middle &first formula right \\ ... \end{eqnarray*}
eqnarray
)array
environment, with items
within a row separated by an ampersand (&
), and with rows
separated by double backslash \\
).
eqnarray
)\\*
) can also be used to separate
equations, and will disallow a page break there (eqnarray
places an equation number on every
line (using the equation
counter), unless that line contains a
\nonumber
command. The starred form eqnarray*
omits
equation numbering, while otherwise being the same.
\lefteqn
is used for splitting long formulas across
lines. It typesets its argument in display style flush left in a box of
zero width.
\begin{eqnarray*} \lefteqn{x_1+x_2+\cdots+x_n} \\ &\leq &y_1+y_2+\cdots+y_n \\ &= &z+y_3+\cdots+y_n \end{eqnarray*}
equation
equation
equation
\begin{equation} math text \end{equation}
displaymath
environment (equation
counter.
figure
figure
figure
\begin{figure}[placement] figure body \caption[loftitle]{title} \label{label} \end{figure}
\begin{figure*}[placement] figure body \caption[loftitle]{title} \label{label} \end{figure*}
figure*
is used when a document is in
double-column mode (b
in parbox
of width \textwidth
and so it can contain text, commands, etc.
\caption
command specifies caption text for the
figure. By default it is numbered. If loftitle is present, it is
used in the list of figures instead of title (\begin{figure}[t] \centering \includegraphics[width=0.5\textwidth]{CTANlion.png} \caption{The CTAN lion, by Duane Bibby} \end{figure}
filecontents
: Write an external filefilecontents
filecontents
filecontents*
filecontents*
\begin{filecontents}{filename} text \end{filecontents}
\begin{filecontents*}{filename} text \end{filecontents*}
filecontents
prefixes the
content of the created file with a header; see the example below. The
starred version filecontents*
does not include the header.
\documentclass
command. It is typically used
when a source file requires a nonstandard style or class file. The
environment will write that file to the directory containing the source
and thus make the source file self-contained. Another use is to include
bib
references in the file, again to make it self-contained.
filecontents
environment so that instead of doing
nothing in that case, it will overwrite the existing file.
\documentclass{article} \begin{filecontents}{JH.sty} \newcommand{\myname}{Jim Hef{}feron} \end{filecontents} \usepackage{JH} \begin{document} Article by \myname. \end{document}
%% LaTeX2e file `JH.sty' %% generated by the `filecontents' environment %% from source `test' on 2015/10/12. %% \newcommand{\myname}{Jim Hef{}feron}
flushleft
flushleft
flushleft
\begin{flushleft} line1 \\ line2 \\ ... \end{flushleft}
flushleft
flushleft
environment allows you to create a paragraph
consisting of lines that are flush to the left-hand margin and ragged
right. Each line must be terminated with the string \\
.
\raggedright
\raggedright
declaration corresponds to the
flushleft
environment. This declaration can be used inside an
environment such as quote
or in a parbox
.
flushleft
environment, the \raggedright
command does not start a new paragraph; it only changes how &latex;
formats paragraph units. To affect a paragraph unit&textrsquo;s format, the
scope of the declaration must contain the blank line or \end
command that ends the paragraph unit.
flushright
flushright
flushright
\begin{flushright} line1 \\ line2 \\ ... \end{flushright}
flushright
)flushright
environment allows you to create a paragraph
consisting of lines that are flush to the right-hand margin and ragged
left. Each line must be terminated with the control sequence \\
.
\raggedleft
\raggedleft
declaration corresponds to the
flushright
environment. This declaration can be used inside an
environment such as quote
or in a parbox
.
flushright
environment, the \raggedleft
command does not start a new paragraph; it only changes how &latex;
formats paragraph units. To affect a paragraph unit&textrsquo;s format, the
scope of the declaration must contain the blank line or \end
command that ends the paragraph unit.
itemize
itemize
itemize
\begin{itemize} \item item1 \item item2 ... \end{itemize}
itemize
environment produces an &textldquo;unordered&textrdquo;, &textldquo;bulleted&textrdquo;
list. Itemized lists can be nested within one another, up to four
levels deep. They can also be nested within other paragraph-making
environments, such as enumerate
(itemize
list begins with an \item
command.
There must be at least one \item
command within the environment.
itemize
environment uses the commands \labelitemi
through \labelitemiv
to produce the default label. So, you can
use \renewcommand
to change the labels. For instance, to have
the first level use diamonds:
\renewcommand{\labelitemi}{$\diamond$}
\leftmargini
through \leftmarginvi
parameters define
the distance between the left margin of the enclosing environment and
the left margin of the list. By convention, \leftmargin
is set
to the appropriate \leftmarginN
when a new level of
nesting is entered.
\setlength{\leftmargini}{1.25em} % default 2.5em
quote
,
quotation
, and verse
environments, where it is set equal
to \leftmargin
.
2pt plus1pt
minus1pt
for 10pt
documents, 3pt plus2pt minus1pt
for
11pt
, and 4.5pt plus2pt minus1pt
for 12pt
.
\itemsep
.
8pt plus2pt minus4pt
for
10pt
documents, 9pt plus3pt minus5pt
for 11pt
,
and 10pt plus4pt minus6pt
for 12pt
. These are reduced
for nested lists.
\topsep
when the list environment starts a
paragraph. The default is 2pt plus1pt minus1pt
for 10pt
documents, 3pt plus1pt minus1pt
for 11pt
, and 3pt
plus2pt minus2pt
for 12pt
.
itemize*
environment with no extra spacing between items, or between paragraphs
within a single item (\parskip
is not list-specific,
\newenvironment{itemize*}% {\begin{itemize}% \setlength{\itemsep}{0pt}% \setlength{\parsep}{0pt}}% \setlength{\parskip}{0pt}}% {\end{itemize}}
letter
environment: writing lettersletter
letter
list
list
list
list
environment is a generic environment which is used for
defining many of the more specific environments. It is seldom used in
documents, but often in macros.
\begin{list}{labeling}{spacing} \item item1 \item item2 ... \end{list}
\item
).
This argument is a piece of text that is inserted in a box to form the
label. It can and usually does contain other &latex; commands.
{}
, which leaves the default spacing.
\linewidth
(\item
: An entry in a list.\item text of item
\item[optional label] text of item
[
and ]
), to use square brackets
inside the optional argument you must hide them inside curly braces, as
in \item[Close square bracket, {]}]
. Similarly, to use an open
square bracket as first character in the text of the item, also hide it
inside curly braces. enumerate
list has two items that use the
default label and one that uses the optional label.
\begin{enumerate} \item Moe \item[sometimes] Shemp \item Larry \end{enumerate}
math
math
math
\begin{math} math \end{math}
math
environment inserts the given math within the
running text. \(...\)
and $...$
are synonyms.
minipage
minipage
minipage
\begin{minipage}[position][height][inner-pos]{width} text \end{minipage}
minipage
environment typesets its body text in a
block that will not be broken across pages. This is similar to the
\parbox
command (\parbox
,
other paragraph-making environments can be used inside a minipage.
\parbox
(minipage
environment. You can restore indentation with a command such as
\setlength{\parindent}{1pc}
command.
minipage
environment are handled in a way that is
particularly useful for putting footnotes in figures or tables. A
\footnote
or \footnotetext
command puts the footnote at
the bottom of the minipage instead of at the bottom of the page, and it
uses the \mpfootnote
counter instead of the ordinary
footnote
counter (picture
picture
picture
\begin{picture}(width,height)(xoffset,yoffset) &dots; picture commands &dots; \end{picture}
picture
environment allows you to create just about any
kind of picture you want containing text, lines, arrows and circles.
You tell &latex; where to put things in the picture by specifying
their coordinates. A coordinate is a number that may have a decimal
point and a minus sign&textmdash;a number like 5
, 0.3
or
-3.1416
. A coordinate specifies a length in multiples of the
unit length \unitlength
, so if \unitlength
has been set
to 1cm
, then the coordinate 2.54 specifies a length of 2.54
centimeters.
\unitlength
, using the
\setlength
command, outside of a picture
environment.
The default value is 1pt
.
picture
picture
picture
package redefine the picture
environment so
that everywhere a number is used in a picture commands to specify
a coordinate, one can use alternatively a length. Be aware however that
this will prevent scaling those lengths by changing \unitlength
.
(2.4,-5)
, specifying
the point with x-coordinate 2.4
and y-coordinate -5
.
Coordinates are specified in the usual way with respect to an origin,
which is normally at the lower-left corner of the picture. Note that
when a position appears as an argument, it is not enclosed in braces;
the parentheses serve to delimit the argument.
picture
environment has one mandatory argument which is a
position (width,height), which specifies the size of the
picture. The environment produces a rectangular box with these
width and height.
picture
environment also has an optional position argument
(xoffset,yoffset), following the size argument, that can
change the origin. (Unlike ordinary optional arguments, this argument
is not contained in square brackets.) The optional argument gives the
coordinates of the point at the lower-left corner of the picture
(thereby determining the origin). For example, if \unitlength
has been set to 1mm
, the command
\begin{picture}(100,200)(10,20)
\put
command. The command
\put (11.3,-.3){...}
...
in the
picture, with its reference point at coordinates .
The reference points for various objects will be described below.
\put
command creates an LR box. You can put anything
that can go in an \mbox
(\put
command. When you do this, the reference point will
be the lower left corner of the box.
picture
commands are described in the following sections.
\circle
\circle[*]{diameter}
\circle
command produces a circle with a diameter as close
to the specified one as possible. The *
-form of the command
draws a solid circle.
\makebox
picture
)\makebox(width,height)[position]{text}
\makebox
command for the picture environment is similar to
the normal \makebox
command except that you must specify a
width and height in multiples of \unitlength
.
[position]
, specifies the quadrant that
your text appears in. You may select up to two of the following:
\framebox
\framebox(width,height)[pos]{...}
\framebox
command is like \makebox
(see previous
section), except that it puts a frame around the outside of the box
that it creates.
\framebox
command produces a rule of thickness
\fboxrule
, and leaves a space \fboxsep
between the rule
and the contents of the box.
\dashbox
\dashbox{dlen}(rwidth,rheight)[pos]{text}
\dashbox
creates a dashed rectangle around text in a
picture
environment. Dashes are dlen units long, and the
rectangle has overall width rwidth and height rheight.
The text is positioned at optional pos.
\frame
\frame{text}
\frame
command puts a rectangular frame around text.
The reference point is the bottom left corner of the frame. No extra
space is put between the frame and the object.
\line
\line(xslope,yslope){length}
\line
command draws a line with the given length and
slope xslope/yslope.
pict2e
packagepict2e
and many other packages on CTAN.
\linethickness
\linethickness{dim}
command declares the thickness
of horizontal and vertical lines in a picture environment to be
dim, which must be a positive length.
\linethickness
does not affect the thickness of slanted lines,
circles, or the quarter circles drawn by \oval
.
\thicklines
\thicklines
command is an alternate line thickness for
horizontal and vertical lines in a picture environment;
cf. \thinlines
\thinlines
command is the default line thickness for
horizontal and vertical lines in a picture environment;
cf. \multiput
\multiput(x,y)(delta_x,delta_y){n}{obj}
\multiput
command copies the object obj in a regular
pattern across a picture. obj is first placed at position
, then at , and so on,
n times.
\oval
\oval(width,height)[portion]
\oval
command produces a rectangle with rounded corners. The
optional argument portion allows you to produce only half of the
oval via the following:
tr
, br
, bl
, or tl
.
\put
\put(xcoord,ycoord){ ... }
\put
command places the material specified by the
(mandatory) argument in braces at the given coordinate,
(xcoord,ycoord).
\shortstack
\shortstack[position]{...\\...\\...}
\shortstack
command produces a stack of objects. The valid
positions are:
\shortstack
objects)\\
.
\vector
\vector(xslope,yslope){length}
\vector
command draws a line with an arrow of the specified
length and slope. The and
values must lie between −4 and +4, inclusive.
quotation
and quote
quotation
quotation
quote
quote
\begin{quotation} text \end{quotation}
\begin{quote} text \end{quote}
\leftmargin
and the text is justified at both. As with the main
text, leaving a blank line produces a new paragraph.
quotation
environment, paragraphs are
indented by 1.50pt plus 1pt
. In the quote
environment, paragraphs are
not indented and there is vertical space between paragraphs (it is the
rubber length \parsep
). Thus, the quotation
environment
may be more suitable for documents where new paragraphs are marked by an
indent rather than by a vertical separation. In addition, quote
may be more suitable for a short quotation or a sequence of short
quotations.
\begin{quotation} \it Four score and seven years ago ... shall not perish from the earth. \hspace{1em plus 1fill}---Abraham Lincoln \end{quotation}
tabbing
tabbing
tabbing
\begin{tabbing} row1col1 \= row1col2 \= row1col3 \= row1col4 \\ row2col1 \> \> row2col3 \\ ... \end{tabbing}
tabbing
environment provides a way to align text in
columns. It works by setting tab stops and tabbing to them much as
was done on an ordinary typewriter. It is best suited for cases where
the width of each column is constant and known in advance.
tabular
environment.
tabbing
environment:
\>
,
\<
, \'
, \\
, or \kill
command, to the right
of the previous column, flush against the current column&textrsquo;s tab stop.
\`
command moves all the
text that follows it, up to the \\
or \end{tabbing}
command that ends the line, to the right margin of the tabbing
environment. There must be no \>
or \'
command between
the \`
and the command that ends the line.
tabbing
environment, the commands \=
, \'
and
\`
do not produce accents as usual (\a=
, \a'
and \a`
are used.
\\
except that it throws away the current line instead of producing
output for it. The effect of any \=
, \+
or \-
commands in that line remain in effect.
\pushtabs
.
tabbing
environment.
\'
.
\begin{tabbing} function \= fact(n : integer) : integer;\\ \> begin \= \+ \\ \> if \= n $>$ 1 then \+ \\ fact := n * fact(n-1) \- \\ else \+ \\ fact := 1; \-\- \\ end;\\ \end{tabbing}
table
table
table
\begin{table}[placement] table body \caption[loftitle]{title} \label{label} \end{table}
parbox
of width \textwidth
and so it can contain text, commands, etc.
\caption
command specifies caption text for the
table. By default it is numbered. If lottitle is present, it is
used in the list of tables instead of title (\begin{table}[b] \centering \begin{tabular}{r|p{2in}} \hline One &The loneliest number \\ Two &Can be as sad as one. It's the loneliest number since the number one. \end{tabular} \caption{Cardinal virtues} \label{tab:CardinalVirtues} \end{table}
tabular
tabular
tabular
\begin{tabular}[pos]{cols} column 1 entry &column 2 entry ... &column n entry \\ ... \end{tabular}
\begin{tabular*}{width}[pos]{cols} column 1 entry &column 2 entry ... &column n entry \\ ... \end{tabular*}
\begin{tabular}{l|l} \textit{Player name} &\textit{Career home runs} \\ \hline Hank Aaron &755 \\ Babe Ruth &714 \end{tabular}
tabular
&textrsquo;s argument {l|l}
.
&
. A horizontal rule
between two rows is created with \hline
.
tabular
\\
.
This \\
is optional after the last row unless an \hline
command follows, to put a rule below the table.
tabular
consist of:
|
,
\hline
, and \vline
in the tabular
and array
environments. The default is .4pt. Change it as in
\setlength{\arrayrulewidth}{0.8pt}
.
tabular
and
array
environments is multiplied. The default is 1, for
no scaling. Change it as \renewcommand{\arraystretch}{1.2}
.
||
specifier. The default is 2pt.
\setlength
.
tabular
environment, the first two inside an entry and the second two between
lines:
\multicolumn
\multicolumn{numcols}{cols}{text}
array
or tabular
entry that spans several columns.
The first argument numcols gives the number of columns to span.
The second argument cols specifies the formatting of the entry,
with c
for centered, l
for flush left, or r
for
flush right. The third argument text gives the contents of that
entry.
\begin{tabular}{lccl} \textit{ID} &\multicolumn{2}{c}{\textit{Name}} &\textit{Age} \\ \hline % row one 978-0-393-03701-2 &O'Brian &Patrick &55 \\ % row two ... \end{tabular}
array
or tabular
environment is broken into parts, where
each part (except the first) begins with l
, c
, r
,
or p
. So from \begin{tabular}{|r|ccp{1.5in}|}
the parts are |r|
, c
, c
,
and p{1.5in}|
.
array
or tabular
environment&textrsquo;s intercolumn area default adjoining this multicolumn
entry. To affect that area, this argument can contain vertical bars
|
indicating the placement of vertical rules, and &arobase;{...}
expressions. Thus if cols is |c| then this multicolumn
entry will be centered and a vertical rule will come in the intercolumn
area before it and after it. This table details the exact behavior.
\begin{tabular}{|cc|c|c|} \multicolumn{1}{r}{w} % entry one &\multicolumn{1}{|r|}{x} % entry two &\multicolumn{1}{|r}{y} % entry three &z % entry four \end{tabular}
\multicolumn
has the cols specifier r with no
initial vertical bar. Between entry one and entry two there will be a
vertical rule; although the first cols does not have an ending
vertical bar, the second cols does have a starting one. Between
entry two and entry three there is a single vertical rule; despite that
the cols in both of the surrounding multicolumn
&textrsquo;s call for
a vertical rule, you only get one rule. Between entry three and entry
four there is no vertical rule; the default calls for one but the
cols in the entry three \multicolumn
leaves it out, and
that takes precedence. Finally, following entry four there is a
vertical rule because of the default.
tabular
definition&textrsquo;s default intercolumn
area specification, including the placement of vertical rules.
tabular
definition the first column
is specified to default to left justified but in the first row the entry
is centered with \multicolumn{1}{c}{\textsc{Period}}
.
Also in the first row, the second and third columns are spanned by a
single entry with \multicolumn{2}{c}{\textsc{Span}}
,
overriding the specification to center those two columns on the page
range en-dash.
\begin{tabular}{l|r&arobase;{--}l} \multicolumn{1}{c}{\textsc{Period}} &multicolumn{2}{c}{\textsc{Span}} \\ \hline Baroque &1600 &1760 \\ Classical &1730 &1820 \\ Romantic &1780 &1910 \\ Impressionistic &1875 &1925 \end{tabular}
tabular
specification by default puts a
vertical rule between the first and second columns, because there is no
vertical bar in the cols of either of the first row&textrsquo;s
\multicolumn
commands, no rule appears in the first row.
\vline
tabular
or array
environment
extending the full height and depth of an entry&textrsquo;s row. Can also be
used in an &arobase;-expression, although its synonym vertical
bar |
is more common. This command is rarely used in the
body of a table; typically a table&textrsquo;s vertical lines are specified in
tabular
&textrsquo;s cols argument and overridden as needed with
\multicolumn
.
\hfill
moves the \vline
to the left edge of the
cell. But that is different than putting it halfway between the two
columns, so in that row between the first and second columns there are
two vertical rules, with the one from the {c|cc}
specifier
coming before the one produced by the \vline\hfill
. In contrast,
the first line&textrsquo;s third entry shows the usual way to put a vertical bar
between two columns. In the second line, the ghi
is the widest
entry in its column so in the \vline\hfill
the \hfill
has
no effect and the vertical line in that entry appears immediately next
to the g
, with no whitespace.
\begin{tabular}{c|cc} x &\vline\hfill y &\multicolumn{1}{|r}{z} \\ abc &def &\vline\hfill ghi \end{tabular}
\cline
\cline{i-j}
array
or tabular
environment
beginning in column i and ending in column j. The
dash -
must appear in the mandatory argument. To span a
single column use the number twice.
\begin{tabular}{llrr} a &b &c &d \\ \cline{1-1} \cline{3-4} e &f &g &h \end{tabular}
\hline
tabular
or
array
environment. It&textrsquo;s most commonly used to draw a line at the
top, bottom, and between the rows of a table.
\hline
, the
tabular
second row&textrsquo;s line ending double backslash \\
is required.
\begin{tabular}{ll} \hline\hline Baseball &Red Sox \\ Basketball &Celtics \\ \hline \end{tabular}
thebibliography
thebibliography
thebibliography
\begin{thebibliography}{widest-label} \bibitem[label]{cite_key} ... \end{thebibliography}
thebibliography
environment produces a bibliography or
reference list.
article
class, this reference list is labelled
&textldquo;References&textrdquo;; in the report
class, it is labelled
&textldquo;Bibliography&textrdquo;. You can change the label (in the standard classes)
by redefining the command \refname
. For instance, this
eliminates it entirely:
\renewcommand{\refname}{}
\bibitem
commands. It is typically given as 9
for bibliographies with
less than 10 references, 99
for ones with less than 100, etc.
\bibitem
\bibitem[label]{cite_key}
\bibitem
command generates an entry labelled by label.
If the label argument is missing, a number is automatically
generated using the enumi
counter. The cite_key is a
\begin{document}
command, the item&textrsquo;s label is
associated with cite_key
, causing references to cite_key
with a \cite
command (\cite
\cite[subcite]{keys}
\cite[p.~314]{knuth}
might produce
[Knuth, p. 314].
\nocite
\nocite{keys}
\nocite
command produces no text, but writes keys,
which is a list of one or more citation keys, to the thebibliography
environment (\bibliographystyle{bibstyle} \bibliography{bibfile1,bibfile2}
\bibliographystyle
command does not produce any output of
its own. Rather, it defines the style in which the bibliography will
be produced: bibstyle refers to a file
bibstyle\bibliography
command is what actually produces the
bibliography. The argument to \bibliography
refers to files
named \cite
and
\nocite
will be listed in the bibliography.
theorem
theorem
theorem
\begin{theorem} theorem-text \end{theorem}
theorem
environment produces &textldquo;Theorem n&textrdquo; in
boldface followed by theorem-text, where the numbering
possibilities for n are described under \newtheorem
(titlepage
titlepage
titlepage
\begin{titlepage} ... text and spacing ... \end{titlepage}
titlepage
environment you can use \maketitle
(\begin{titlepage} \vspace*{\stretch{1}} \begin{center} {\huge\bfseries Thesis \\[1ex] title} \\[6.5ex] {\large\bfseries Author name} \\ \vspace{4ex} Thesis submitted to \\[5pt] \textit{University name} \\[2cm] in partial fulfilment for the award of the degree of \\[2cm] \textsc{\Large Doctor of Philosophy} \\[2ex] \textsc{\large Mathematics} \\[12ex] \vfill Department of Mathematics \\ Address \\ \vfill \today \end{center} \vspace{\stretch{2}} \end{titlepage}
verbatim
verbatim
verbatim
\begin{verbatim} literal-text \end{verbatim}
verbatim
environment is a paragraph-making environment in
which &latex; produces exactly what you type in; for instance the
\
character produces a printed \. It turns &latex;
into a typewriter with carriage returns and blanks having the same
effect that they would on a typewriter.
verbatim
uses a monospaced typewriter-like font (\tt
).
\verb
\verbcharliteral-textchar \verb*charliteral-textchar
\verb
command typesets literal-text as it is input,
including special characters and spaces, using the typewriter
(\tt
) font. No spaces are allowed between \verb
or
\verb*
and the delimiter char, which begins and ends the
verbatim text. The delimiter must not appear in literal-text.
*
-form differs only in that spaces are printed with a
&textldquo;visible space&textrdquo; character.
verse
verse
verse
\begin{verse} line1 \\ line2 \\ ... \end{verse}
verse
environment is designed for poetry, though you may find
other uses for it.
verse
\\
, and use one or more blank lines to separate the
stanzas.
\\
\\[morespace]
\\*[morespace]
tabular
or array
environment.
p{...}
column
in a tabular
environment) the \newline
command is a synonym for
\\
(\\*
tells
&latex; not to start a new page between the two lines, by issuing a
\nobreak
.
\title{My story: \\[0.25in] a tale of woe}
\obeycr
& \restorecr
\obeycr
command makes a return in the input file
(^^M, internally) the same as \\
(followed by
\relax
). So each new line in the input will also be a new line
in the output.
\restorecr
restores normal line-breaking behavior.
\newline
tabular
or array
environment, in a column with a
specifier producing a paragraph box, like typically p{...}
,
\newline
will insert a line break inside of the column, that is,
it does not break the entire row. To break the entire row use \\
or its equivalent \tabularnewline
.
\begin{tabular}{p{1in}{\hspace{2in}}p{1in}} Name: \newline Address: &Date: \\ \hline \end{tabular}
\-
(discretionary hyphen)\-
command tells &latex; that it may hyphenate the word at
that point. &latex; is pretty good at hyphenating, and usually finds
most of the correct hyphenation points, while almost never using an
incorrect one. The \-
command is used for the exceptional
cases.
\-
commands in a word, the word will only be
hyphenated at those points and not at any of the hyphenation points
that &latex; might otherwise have chosen.
\discretionary
(generalized hyphenation point)\discretionary{pre-break-text}{post-break-text}{no-break-text}
\fussy
\fussy
(which is the default) makes &tex;
picky about line breaking. This usually avoids too much space between
words, at the cost of an occasional overfull box.
\sloppy
command
(\sloppy
\sloppy
makes &tex; less fussy about line
breaking. This will avoid overfull boxes, at the cost of loose
interword spacing.
\fussy
command is issued (\hyphenation
\hyphenation{word-one word-two}
\hyphenation
command declares allowed hyphenation points
with a -
character in the given words. The words are separated
by spaces. &tex; will only hyphenate if the word matches exactly, no
inflections are tried. Multiple \hyphenation
commands
accumulate. Some examples (the default &tex; hyphenation patterns
misses the hyphenations in these words):
\hyphenation{ap-pen-dix col-umns data-base data-bases}
\linebreak
& \nolinebreak
\linebreak[priority] \nolinebreak[priority]
\linebreak
(\nolinebreak
) command forces
(prevents) a line break at the current position. For
\linebreak
, the spaces in the line are stretched out so that it
extends to the right margin as usual.
\cleardoublepage
\cleardoublepage
command ends the current page and causes all
the pending floating figures and tables that have so far appeared in the
input to be printed. In a two-sided printing style, it also makes the
next page a right-hand (odd-numbered) page, producing a blank page if
necessary.
\clearpage
\clearpage
command ends the current page and causes all the
pending floating figures and tables that have so far appeared in the
input to be printed.
\newpage
\newpage
command ends the current page, but does not clear
floats (\enlargethispage
\enlargethispage{size}
\enlargethispage*{size}
\textheight
for the current page by the specified
amount; e.g., \enlargethispage{\baselineskip}
will allow one
additional line.
\pagebreak
.
\pagebreak
& \nopagebreak
\pagebreak[priority] \nopagebreak[priority]
\pagebreak
(\nopagebreak
) command forces
(prevents) a page break at the current position. With
\pagebreak
, the vertical space on the page is stretched out
where possible so that it extends to the normal bottom margin.
\pagebreak
command from a demand to a request. The number must
be a number from 0 to 4. The higher the number, the more
insistent the request is.
Noe l Coward quipped that having to read a footnote is like having to go downstairs to answer the door, while in the midst of making love.\footnote{I wouldn't know, I don't read footnotes.}
\footnotemark
and
the \footnotetext
commands, which is useful in special
circumstances.
\footnote
\footnote[number]{text}
There are over a thousand footnotes in Gibbon's \textit{Decline and Fall of the Roman Empire}.\footnote{After reading an early version with endnotes David Hume complained, ``One is also plagued with his Notes, according to the present Method of printing the Book'' and suggested that they ``only to be printed at the Margin or the Bottom of the Page.''}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
, which
uses a sequence of symbols (\setcounter{footnote}{0}
. By default &latex; uses arabic
numbers.
\footnote
; for instance, you cannot use it in an argument to a
sectioning command such as \chapter
(it can only be used in outer
paragraph mode). There are some workarounds; see following sections.
minipage
environment the \footnote
command uses the mpfootnote
counter instead of the
footnote
counter, so they are numbered independently. They are
shown at the bottom of the environment, not at the bottom of the page.
And by default they are shown alphabetically. \footnotemark
\footnotemark \footnotemark[number]
\thanks
is a version of footnote
).
\title{A Treatise on the Binomial Theorem} \author{J Moriarty\thanks{University of Leeds} \and A C Doyle\thanks{Durham University} \and S Holmes\footnotemark[1]} \begin{document} \maketitle
\footnotemark
without the optional argument then it
increments the footnote counter but if you use the optional number
then it does not. This produces several consecutive footnote markers
referring to the same footnote.
The first theorem\footnote{Due to Gauss.} and the second theorem\footnotemark[\value{footnote}] and the third theorem.\footnotemark[\value{footnote}]
\footnotetext
\footnotetext{text} \footnotetext[number]{text}
\footnotemark
command. The optional
argument number changes the displayed footnote number. The
\footnotetext
command must appear in outer paragraph mode.
table
environment the \footnote
command does not
work. For instance, if the code below appears on its own then the
footnote simply disappears; there is a footnote mark in the table cell
but nothing is set at the bottom of the page.
\begin{center} \begin{tabular}{l|l} \textsc{Ship} &\textsc{Book} \\ \hline \textit{HMS Sophie} &Master and Commander \\ \textit{HMS Polychrest} &Post Captain \\ \textit{HMS Lively} &Post Captain \\ \textit{HMS Surprise} &A number of books\footnote{Starting with HMS Surprise.} \end{tabular} \end{center}
tabular
environment with a
minipage
environment, as here (\begin{center} \begin{minipage}{.5\textwidth} ... tabular material ... \end{minipage} \end{center}
table
environment
(\usepackage{tablefootnote}
in the preamble and use the code
shown then the footnote appears at the bottom and is numbered in
sequence with other footnotes.
\begin{table} \centering \begin{tabular}{l|l} \textsc{Date} &\textsc{Campaign} \\ \hline 1862 &Fort Donelson \\ 1863 &Vicksburg \\ 1865 &Army of Northern Virginia\footnote{Ending the war.} \end{tabular} \caption{Forces captured by US Grant} \end{table}
\section{Full sets\protect\footnote{This material due to ...}}
footmisc
footmisc
stable
option to footmisc
packagestable
option.
\usepackage[stable]{footmisc} ... \begin{document} ... \section{Full sets\footnote{This material due to ...}}
\protect
is gone; including it would cause the
footnote to reappear on the table of contents.
\usepackage{bigfoot} \DeclareNewFootnote{Default} \DeclareNewFootnote{from}[alph] % create class \footnotefrom{} ... \begin{document} ... The third theorem is a partial converse of the second.\footnotefrom{First noted in Wilson.\footnote{Second edition only.}} ...
\usepackage{cleveref}[2012/02/15] % this version of package or later \crefformat{footnote}{#2\footnotemark[#1]#3} ... \begin{document} ... The theorem is from Evers.\footnote{\label{fn:TE}Tinker and Evers, 1994.} The corollary is from Chance.\footnote{Evers and Chance, 1990.} But the key lemma is from Tinker.\cref{fn:TE} ...
0.4pt
thick (or wide), and
0.4\columnwidth
long in the standard document classes (except
slides
, where it does not appear).
\footnotesize
fonts (\newcommand
& \renewcommand
\newcommand
and \renewcommand
define and redefine a
command, respectively. Synopses:
\newcommand{\cmd}[nargs][optargdefault]{defn} \newcommand*{\cmd}[nargs][optargdefault]{defn} \renewcommand{\cmd}[nargs][optargdefault]{defn} \renewcommand*{\cmd}[nargs][optargdefault]{defn}
\long
, in plain &tex;
terms).
{}
after the command (\cmd{} ;
another solution is to use an explicit control space (\cmd\ ).
\newcommand{\RS}{Robin Smith}
results in
\RS
being replaced by the longer text.
\renewcommand{\qedsymbol}{{\small QED}}
.
\newcommand{\defref}[1]{Definition~\ref{#1}}
\defref{def:basis}
expands to
Definition~\ref{def:basis}
, which will ultimately expand to
something like Definition~3.14.
\newcommand{\nbym}[2]{$#1 \times #2$}
is invoked as
\nbym{2}{k}
.
\newcommand{\salutation}[1][Sir or Madam]{Dear #1:}
\salutation
gives Dear Sir or Madam: while
\salutation[John]
gives Dear John:. And
\salutation[]
gives Dear :.
\newcommand{\shipname}[1]{\it #1}
is problematic; in this
sentence,
The \shipname{Monitor} met the \shipname{Merrimac}.
\newcommand{\shipname}[1]{{\it #1}}
. Those braces are
part of the definition and thus do define a group.
\providecommand
\providecommand{cmd}[nargs][optargdefault]{defn} \providecommand*{cmd}[nargs][optargdefault]{defn}
\newcommand
(\newcounter
: Allocating a counter\newcounter{countername} \newcounter{countername}[supercounter]
[supercounter]
then
countername will be numbered within, or subsidiary to, the
existing counter supercounter. For example, ordinarily
subsection
is numbered within section
so that any time
supercounter is incremented with \stepcounter
(\refstepcounter
(\newlength
: Allocating a length\newlength{\arg}
\arg
, which is a place to hold (rubber) lengths such as
1in plus.2in minus.1in
(what plain &tex; calls a skip
register). The register gets an initial value of zero. The control
sequence \arg
must not already be defined.
\newsavebox
: Allocating a box\newsavebox{\cmd}
\cmd
to refer to a new bin for storing boxes.
Such a box is for holding typeset material, to use multiple times
(\cmd
must start with a backslash (\), and must not
be already defined.
\newenvironment
& \renewenvironment
\begin{env} body \end{env}
. Synopses:
\newenvironment{env}[nargs][optargdefault]{begdefn}{enddefn} \newenvironment*{env}[nargs][optargdefault]{begdefn}{enddefn} \renewenvironment{env}[nargs][optargdefault]{begdefn}{enddefn} \renewenvironment*{env}[nargs][optargdefault]{begdefn}{enddefn}
*
-form of environment commands\small
is limited to
the quote and does not extend to material following the environment.
quotation
except that it will be set in smaller type:
\newenvironment{smallquote}{% \small\begin{quotation} }{% \end{quotation} }
\newenvironment{citequote}[1][Shakespeare]{% \begin{quotation} \noindent\textit{#1}: }{% \end{quotation} }
\begin{citequote}[Lincoln] ... \end{citequote}
\newsavebox{\quoteauthor} \newenvironment{citequote}[1][Shakespeare]{% \sbox\quoteauthor{#1}% \begin{quotation} }{% \hspace{1em plus 1fill}---\usebox{\quoteauthor} \end{quotation} }
\newtheorem
\newtheorem{name}{title} \newtheorem{name}{title}[numbered_within] \newtheorem{name}[numbered_like]{title}
\newtheorem{name}{title}
creates an environment that will be labelled with title. See the
first example below.
\newtheorem{name}{title}[numbered_within]
creates an environment whose counter is subordinate to the existing
counter numbered_within (its counter will be reset when
numbered_within is reset).
\newtheorem{name}[numbered_like]{title}
,
with optional argument between the two required arguments, will create
an environment whose counter will share the previously defined counter
numbered_like.
\ref
value will be that of
\thenumbered_within
(\newtheorem{defn}{Definition} \begin{document} \section{...} \begin{defn} First def \end{defn} \section{...} \begin{defn} Second def \end{defn}
\newtheorem
as section
, the
example, with the same document body, gives Definition 1.1
and Definition 2.1.
\newtheorem{defn}{Definition}[section] \begin{document} \section{...} \begin{defn} First def \end{defn} \section{...} \begin{defn} Second def \end{defn}
thm
environment to use the same
counter as defn
. It gives Definition 1.1, followed
by Theorem 2.1 and Definition 2.2.
\newtheorem{defn}{Definition}[section] \newtheorem{thm}[defn]{Theorem} \begin{document} \section{...} \begin{defn} First def \end{defn} \section{...} \begin{thm} First thm \end{thm} \begin{defn} Second def \end{defn}
\newfont
: Define a new font (obsolete)\newfont
, now obsolete, defines a command that will switch fonts.
Synopsis:
\newfont{\cmd}{font description}
\cmd
that will change the
current font. &latex; will look on your system for a file named
at dimen
or scaled factor
, where a factor of 1000
means no scaling. For &latex;&textrsquo;s purposes, all this does is scale all
the character and other font dimensions relative to the font&textrsquo;s design
size, which is a value defined in the \newfont{\testfontat}{cmb10 at 11pt} \newfont{\testfontscaled}{cmb10 scaled 1100} \testfontat abc \testfontscaled abc
\protect
\protect
.
\section{section
name}
command it writes the section name text to the
\caption{...}
command (\thanks{...}
command
(tabular
and
array
environments (\protect
. Every fragile commands must be
protected with their own \protect
.
\protect
command doesn&textrsquo;t hurt, length
commands are robust and should not be preceded by a \protect
command. Nor can a \protect
command be used in the argument to
\addtocounter
or \setcounter
command.
\caption
command gives a mysterious error
about an extra curly brace. Fix the problem by preceding each
\raisebox
command with \protect
.
\begin{figure} ... \caption{Company headquarters of A\raisebox{1pt}{B}\raisebox{-1pt}{C}} \end{figure}
\tableofcontents
command gives an error
because the \(..\)
in the section title expands to illegal &tex;
in the \(..\)
to \protect\(..\protect\)
.
\begin{document} \tableofcontents ... \section{Einstein's \( e=mc^2 \)} ...
\
. Thus, associated with
the \chapter
command is the chapter
counter that keeps
track of the chapter number.
part paragraph figure enumi chapter subparagraph table enumii section page footnote enumiii subsection equation mpfootnote enumiv subsubsection
mpfootnote
counter is used by the \footnote
command
inside of a minipage (enumi
through enumiv
are used in the enumerate
environment, for
up to four levels of nesting (\newcounter
. \alph \Alph \arabic \roman \Roman \fnsymbol
: Printing counters\alph{counter}
in your source will result in a lower case
letter a appearing in the output.
\alph{enumi}
. Note that the counter name does not
start with a backslash.
\ast
\dagger
\ddagger
\S
\P
\parallel
\ast\ast
\dagger\dagger
\ddagger\ddagger
\usecounter{counter}
\usecounter{counter}
list
environment, when used in the second argument, this
command sets up counter to number the list items. It initializes
counter to zero, and arranges that when \item
is called
without its optional argument then counter is incremented by
\refstepcounter
, making its value be the current ref
value. This command is fragile (\newcounter{testcounter} \newenvironment{test}{% \begin{list}{}{% \usecounter{testcounter} } }{% \end{list} }
\value{counter}
\value{counter}
\setcounter
or \addtocounter
, but \value
can
be used anywhere that &latex; expects a number. It must not be
preceded by \protect
(\value
command is not used for typesetting the value of the
counter. \newcounter{test} \setcounter{test}{5} \newcounter{other} \setcounter{other}{\value{test}} \addtocounter{test}{1} Test counter is \arabic{test}. Other counter is \arabic{other}.
\hspace{4\parindent}
.
\setcounter{myctr}{3} \addtocounter{myctr}{1} \hspace{\value{myctr}\parindent}
\setcounter{counter}{value}
\setcounter{counter}{value}
\setcounter
command globally sets the value of counter
to the value argument. Note that the counter name does not start
with a backslash.
\setcounter{section}{5} Here it is in Roman: \Roman{section}.
\addtocounter{counter}{value}
\addtocounter
command globally increments counter by
the amount specified by the value argument, which may be negative.
\setcounter{section}{5} \addtocounter{section}{2} Here it is in Roman: \Roman{section}.
\refstepcounter{counter}
\refstepcounter
command works in the same way as
\stepcounter
(\ref
value
to be the result of \thecounter
.
\ref
value is set
locally, i.e., inside the current group.
\stepcounter{counter}
\stepcounter
command globally adds one to counter and
resets all counters numbered within it. (For the definition of
&textldquo;counters numbered within&textrdquo;, \day \month \year
: Predefined counters\day
,
1&textndash;31), month of the year (\month
, 1&textndash;12), and year
(\year
, Common Era). When &tex; starts up, they are
set to the current values on the system where &tex; is running. They
are not updated as the job progresses.
\today
produces a string representing the
current day (10pt
cannot contain a plus
or
minus
component. A rubber length (what Plain &tex; calls
a skip) can contain those, as with 1cm plus0.05cm
minus0.01cm
. These give the ability to stretch or shrink; the length
in the prior sentence could appear in the output as long as 1.05 cm
or as short as 0.99 cm, depending on what &tex;&textrsquo;s typesetting
algorithm finds optimum.
plus
or minus
component of a rubber length can contain
a fill component, as in 1in plus2fill
. This gives the
length infinite stretchability or shrinkability, so that the length in
the prior sentence can be set by &tex; to any distance greater than or
equal to 1 inch. &tex; actually provides three infinite glue
components fil
, fill
, and filll
, such that the
later ones overcome the earlier ones, but only the middle value is
ordinarily used. \setlength{\ylength}{1in plus 0.2in}
and \setlength{\zlength}{3\ylength}
then the value of
\zlength
is 3in
.
\enspace
, which is 0.5em
). Use of these can help make a
definition work better across font changes. For example, a definition
of the vertical space between list items given as
\setlength{\itemsep}{1ex plus 0.05ex minus 0.01ex}
is more
likely to still be reasonable if the font is changed than a definition
given in points.
\setlength
\setlength{\len}{amount}
\setlength
sets the value of length command
\len
to the value argument which can be expressed in any
units that &latex; understands, i.e., inches (in
), millimeters
(mm
), points (pt
), big points (bp
), etc.
\addtolength
\addtolength{\len}{amount}
\addtolength
command increments a length command \len
by the amount specified in the amount argument, which may be
negative.
\settodepth
\settodepth{\len}{text}
\settodepth
command sets the value of a length command
\len
equal to the depth of the text argument.
\settoheight
\settoheight{\len}{text}
\settoheight
command sets the value of a length command \len
equal to the height of the text
argument.
\settowidth{\len}{text}
\settowidth{\len}{text}
\settowidth
command sets the value of the command \len
to the width of the text argument.
\width
\height
\depth
\totalheight
\totalheight
equals . To make a box with the text stretched to double the
natural size, e.g., say
\makebox[2\width]{Get a stretcher}
%
. A blank line should not appear where a new
paragraph cannot be started, such as in math mode or in the argument of
a sectioning command.
\indent
\indent
produces a horizontal space whose width equals to the
\parindent
length, the normal paragraph indentation. It is used
to add paragraph indentation where it would otherwise be suppressed.
\parindent
is 1em
in two-column
mode, otherwise 15pt
for 10pt
documents, 17pt
for
11pt
, and 1.5em
for 12pt
.
\noindent
... end of the prior paragraph. \noindent This paragraph is not indented.
\setlength{\parindent}{0pt}
in the preamble.
\parskip
\parskip
is a rubber length defining extra vertical space added
before each paragraph. The default is 0pt plus1pt
.
\marginpar[left]{right}
\marginpar
command creates a note in the margin. The first
line of the note will have the same baseline as the line in the text
where the \marginpar
occurs.
oneside
, see twoside
, see twocolumn
, see \reversemarginpar
places subsequent marginal notes
in the opposite (inside) margin. \normalmarginpar
places them
in the default position.
\hspace{0pt}
.
math
math
displaymath
displaymath
equation
equation
math
environment can be used in both paragraph and LR mode,
but the displaymath
and equation
environments can be used
only in paragraph mode. The math
and displaymath
environments are used so often that they have the following short forms:
\(...\)instead of \begin{math}...\end{math} \[...\]instead of \begin{displaymath}...\end{displaymath}
math
environment is so common that it has an even
shorter form:
$ ... $instead of \(...\)
\boldmath
command changes math letters and symbols to be in
a bold font. It is used \unboldmath
command changes math glyphs to be in a normal font;
it too is used \displaystyle
declaration forces the size and style of the
formula to be that of displaymath
, e.g., with limits above and
below summations. For example:
$\displaystyle \sum_{n=0}^\infty x_n $
^
to make the
exp appear as a superscript: ^{exp}
.
Similarly, in math mode, underscore _{exp}
makes a
subscript out of exp.
0
and 1
appear as subscripts while the
2
is a superscript.
\( (x_0+x_1)^2 \)
e^{-2x}
.
e^{x^2}
and
x_{a_0}
will look right. It also does the right thing when
something has both a subscript and a superscript. In this example the
0
appears at the bottom of the integral sign while the 10
appears at the top.
\int_0^{10} x^2 \,dx
{}_t K^2
in math mode (the initial {}
prevents
the prefixed subscript from being attached to any prior symbols in the
expression).
A
test$_\textnormal{subscript}$
will produce a subscript typeset in
text mode, not math mode. Note that there are packages specialized for
writing Chemical formulas such as $\pi$
in your source, you will get
the pi symbol 03C0.
\parallel
.
<
and angle bracket \langle
.
*
, which is often a superscript or
subscript, as in the Kleene star. Similar: \star
, which is
five-pointed, and is sometimes used as a general binary operation, and
sometimes reserved for cross-correlation.
\setminus
, and
\textbackslash
for backslash outside of math mode.
\cap
.
\circ
.
\cup
.
\top
.
\cdot
.
\bigcap
.
\bullet
.
\bigcirc
.
$S^\complement$
(ordinary). Not available in plain &tex;. In &latex; you need to load the $S^{\mathsf{c}}$
or $\bar{S}$
.
\bigcup
.
\vdash
.
\Diamond
, circle bullet \bullet
.
\Doteq
.
\Downarrow
.
\downarrow
.
\varnothing
.
\varepsilon
03B5. Related:
the set membership relation \in
2208.
\geq
.
\ge
.
\leftarrow
.
\ll
.
\Longleftrightarrow
with a \thickmuskip
on either side.
\Re
.
\epsilon
03F5 and small letter script
epsilon \varepsilon
.
\wedge
.
See also logical or \lor
.
<
. Matches \rangle
.
\{
. Matches \rbrace
.
[
. Matches \rbrack
.
\rceil
.
\leq
.
\newcommand*{\Leadsto}{\ensuremath{\leadsto}}
in the
preamble and then use \Leadsto
instead.
\leftarrow
.
\gets
. Similar: double-line left
arrow \Leftarrow
.
\leftrightarrow
.
\Leftrightarrow
.
\le
.
\floor
.
\vartriangleleft
(which is a relation
and so gives better spacing).
\gg
.
\neg
.
\Longleftarrow
.
\Longleftrightarrow
.
\mapsto
.
\Longrightarrow
.
\wedge
.
\longmapsto
.
\mid
is for a set \{\, x \mid x\geq 5 \,\}
.
\vert
and |
produce the same single-line
vertical bar symbol but without any spacing (they fall in class
ordinary) and you should not use them as relations but instead only as
ordinals, i.e., footnote symbols. For absolute value, see the entry
for \vert
and for norm see the entry for \Vert
.
\vDash
.
\neq
.
\lnot
. Sometimes instead used for
negation: \sim
.
\ne
.
\owns
. Similar: is a member
of \in
.
\not
are available,
particularly with the \notin
is probably typographically preferable to \not\in
.
\nsubseteq
.
\bigodot
.
\bigoplus
.
\bigotimes
.
\ni
. Similar: is a member
of \in
.
\|
.
\bot
uses the
same glyph but the spacing is different because it is in the class
ordinary.
\varphi
03C6.
\varpi
03D6.
<
.
\leq
.
$f^\prime$
; $f^\prime$
and $f'$
produce the same result. An advantage of the second
is that $f'''$
produces the desired symbol, that is, the same
result as $f^{\prime\prime\prime}$
, but uses rather less
typing. You can only use \prime
in math mode. Using the right
single quote '
in text mode produces a different character
(apostrophe).
>
. Matches:\langle
.
\}
. Matches \lbrace
.
]
. Matches \lbrack
.
\lceil
.
\mathbb{R}
; to access
this, load the \upharpoonright
. Not available in plain &tex;. In &latex; you need to load the \varnothing
. Not available in plain &tex;. In &latex; you need to load the \lfloor
.
\vartriangleright
(which
is a relation and so gives better spacing).
\varrho
03F1.
\rightarrow
.
\to
. Similar: right double line arrow \Rightarrow
.
\backslash
and also
\textbackslash
outside of math mode.
\varsigma
03C2.
cap
.
cup
. Related: variable-sized
operator \bigsqcup
.
\subset
. Not available in plain &tex;. In &latex; you need to load the \subseteq
.
\supset
. Not available in plain &tex;. In &latex; you need to load the \supseteq
.
*
and \ast
, which are six-pointed,
and more often appear as a superscript or subscript, as with the Kleene
star.
>
.
\leq
.
\Sigma
.
\sqrt{...}
typesets the square root of the argument, with a bar
that extends to cover the argument.
\vartheta
03D1.
\cdot
.
\rightarrow
.
\bot
.
\lhd
. For the normal subgroup symbol you
should load \vartriangleleft
(which
is a relation and so gives better spacing).
\vartriangleright
(which is a
relation and so gives better spacing).
\vartrianglelefteq
(which is a relation and so gives
better spacing).
\vartrianglerighteq
(which is a relation and so gives
better spacing).
\uparrow
.
\Uparrow
.
\updownarrow
.
\Updownarrow
.
&backslashchar;restriction
. Not available in plain &tex;. In &latex; you need to load the \cup
. Related:
variable-sized operator \biguplus
.
\epsilon
03F5. Related: set
membership \in
.
\emptyset
. Related: \revemptyset
. Not available in plain &tex;. In &latex; you need to load the \phi
03D5.
\pi
03C0.
\rho
03C1.
\sigma
03C3.
\theta
03B8.
\dashv
.
\wedge
. Similar: variable-sized
operator \bigvee
.
\vert
.
\DeclarePairedDelimiter\norm{\lVert}{\rVert}
to your
preamble. This gives you three command variants for double-line
vertical bars that are correctly horizontally spaced: if in the
document body you write the starred version $\norm*{M^\perp}$
then the height of the vertical bars will match the height of the
argument, whereas with \norm{M^\perp}
the bars do not grow
with the height of the argument but instead are the default height,
and \norm[size command]{M^\perp}
also gives bars that
do not grow but are set to the size given in the size command,
e.g., \Bigg
.
\Vert
. For such that, as in the definition of a
set, use \mid
because it is a relation.
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
to your
preamble. This gives you three command variants for single-line vertical
bars that are correctly horizontally spaced: if in the document body you
write the starred version $\abs*{\frac{22}{7}}$
then the
height of the vertical bars will match the height of the argument,
whereas with \abs{\frac{22}{7}}
the bars do not grow with
the height of the argument but instead are the default height, and
\abs[size command]{\frac{22}{7}}
also gives bars
that do not grow but are set to the size given in the size
command, e.g., \Bigg
.
\land
. See also
logical or \vee
. Similar: variable-sized
operator \bigwedge
.
math
environment, &latex; ignores the spaces that you use
in the source, and instead puts in the spacing according to the normal
rules for mathematics texts.
\int_0^1 f(x)\,dx
\documentclass{article} \begin{document} Now \(A_3 = 0\), hence the product of all terms \(A_1\) through \(A_4\), that is \(A_1\* A_2\* A_3 \* A_4\), is equal to zero. \end{document}
\left( \sum_{i=1}^{10} a_i \right]
.
\overbrace{x+\cdots+x}^{k \;\textrm{times}}
.
\overline{x+y}
.
x+y
would be typed as
\sqrt[3]{x+y}
.
\stackrel{f}{\longrightarrow}
.
\underbrace{x+y+z}_{>\,0}
\mbox
, &latex; would keep typesetting
them from left to right inside a single box (and then most likely
complain because the resulting box was too wide to fit on the line).
&latex; is in LR mode when it starts making a box with an
\mbox
command. You can get it to enter a different mode inside
the box&textmdash;for example, you can make it enter math mode to put a
formula in the box.
parbox
.
When &latex; is in paragraph mode while making a box, it is said to
be in &textldquo;inner paragraph mode&textrdquo; (no page breaks). Its normal paragraph
mode, which it starts out in, is called &textldquo;outer paragraph mode&textrdquo;.
\ensuremath
\ensuremath{formula}
\ensuremath
command ensures that formula is typeset in
math mode whatever the current mode in which the command is used.
\documentclass{report} \newcommand{\ab}{\ensuremath{(\delta, \varepsilon)}} \begin{document} Now, the \ab\ pair is equal to \(\ab = (\frac{1}{\pi}, 0)\), ... \end{document}
\leadsto
:
\documentclass{report} \usepackage{amssymb} \newcommand{\originalMeaningOfLeadsTo}{} \let\originalMeaningOfLeadsTo\leadsto \renewcommand\leadsto{\ensuremath{\originalMeaningOfLeadsTo}} \begin{document} All roads \leadsto\ Rome. \end{document}
\documentclass
command determines the size and position of
the page&textrsquo;s head and foot. The page style determines what goes in them.
\maketitle
\maketitle
command generates a title on a separate title
page&textmdash;except in the article
class, where the title is placed
at the top of the first page. Information used to produce the title
is obtained from the following declarations:
\author
\author
\author
command declares the document author(s), where the
argument is a list of authors separated by \and
commands. Use
\\
to separate lines within a single author&textrsquo;s entry&textmdash;for
example, to give the author&textrsquo;s institution or address.
\date
command declares text to be the document&textrsquo;s
date. With no \date
command, the current date (\thanks
command produces a \footnote
to the title,
usually used for credit acknowledgements.
\title
\title
command declares text to be the title of the
document. Use \\
to force a line break, as usual.
\pagenumbering
\pagenumbering{style}
\pagestyle
\pagestyle{style}
\pagestyle
command specifies how the headers and footers
are typeset from the current page onwards. Values for style:
\markboth
and \markright
:
\markboth
command before
the end of the page, while a &textldquo;right-hand heading&textrdquo; (right) is
generated by the first \markboth
or \markright
that
comes on the page if there is one, otherwise by the last one before
the page.
\thispagestyle{style}
\thispagestyle
command works in the same manner as the
\pagestyle
command (see previous section) except that it
changes to style for the current page only.
\hspace
\hspace{length} \hspace*{length}
plus
or minus
component, in any unit that &latex; understands (\hspace*{...}
puts a non-discardable
invisible item in front of the space, so the space appears in the
output.
\noindent\makebox[\linewidth]{\hspace{\fill}Name:\hspace{1in}}
\hfill
\hfill
is equivalent to \hspace{\fill}
. For
space that does not disappear at line breaks use
\hspace*{\fill}
instead (\(SPACE)
and \&arobase;\
) or
a tie (~
). Examples are Nat.\ Acad.\ Science
, and
Mr.~Bean
, and (manure, etc.)\ for sale
.
\
, \&arobase;
before that period.
For example, book by the MAA\&arobase;.
will have inter-sentence
spacing after the period.
\&arobase;
after a period tells &tex; that the
period does not end the sentence. In the example reserved words
(if, then, etc.\&arobase;) are different
, &tex; will put interword space
after the closing parenthesis (note that \&arobase;
is before the
parenthesis).
\
after control sequence\
command is often used after control sequences to keep
them from gobbling the space that follows, as in \TeX\ is nice.
And, under normal circumstances, \
\
\
. For another use of
\
, see also {}
for the same purpose, as in
\TeX{} is nice
. This has the advantage that you can always
write it the same way, namely \TeX{}
, whether it is followed
by a space or by a punctuation mark. Compare:
\TeX\ is a nice system. \TeX, a nice system.&linebreak; \TeX{} is a nice system. \TeX{}, a nice system.
xspace
xspace
xspace
,
package do not follow the standard behavior.
\frenchspacing
\nonfrenchspacing
.
\thinspace
: Insert 1/6\thinspace
produces an unbreakable and unstretchable space that
is 1/6 of an em. This is the proper space to use between nested
quotes, as in &textrsquo;\/
: Insert italic correction\/
command produces an italic correction. This is a
small space defined by the font designer for a given character,
to avoid the character colliding with whatever follows. The italic
f character typically has a large italic correction value.
\textit{italic
text}
or {\itshape italic text}
, &latex; will
automatically insert an italic correction if appropriate (\hrulefill \dotfill
\noindent Jack Aubrey\dotfill Melbury Lodge
\null
at the
start or end.
\renewcommand{\hrulefill}{\leavevmode\leaders\hrule height
1pt\hfill\kern\z&arobase;}
, which changes the default thickness of
0.4\renewcommand{\dotfill}{\leavevmode\cleaders\hb&arobase;xt&arobase;
1.00em{\hss .\hss }\hfill\kern\z&arobase;}
, which changes the default
length of 0.33\addvspace
\addvspace{length}
\addvspace
command
then this command will not add more space than what is needed to make
the natural length of the total vertical space equal to length.
\addvspace{...}
so that two consecutive Theorem&textrsquo;s are separated by one vertical space,
not two.
\par
command.
\bigskip \medskip \smallskip
\vspace{\bigskipamount}
, ordinarily about one line
space, with stretch and shrink (the default for the book
and
article
classes is 12pt plus 4pt minus 4pt
).
\vspace{\medskipamount}
, ordinarily about half of
a line space, with stretch and shrink (the default for the book
and article
classes is 6pt plus 2pt minus 2pt
).
\vspace{\smallskipamount}
, ordinarily about a
quarter of a line space, with stretch and shrink (the default for the
book
and article
classes is 3pt plus 1pt minus
1pt
).
\vfill
\vspace{\fill}
, except that
\vfill
ends the current paragraph, whereas
\vspace{\fill}
adds the infinite vertical space below its line
irrespective of the paragraph structure. In both cases that space will
disappear at a page boundary; to circumvent this see \begin{document} Lost Dog! \vfill Lost Dog! \vfill Lost Dog! \end{document}
\vspace{length}
\vspace{length} \vspace*{length}
\vspace
at a page
break, that is, at the top or bottom of a page. The starred version
\vspace*{...}
causes the space to stay.
\vspace
is used in the middle of a paragraph (i.e., in
horizontal mode), the space is inserted \vspace
command. A new paragraph is not started.
\begin{document} 1) Who put the bomp in the bomp bah bomp bah bomp? \vspace{1in plus 1fill} 2) Who put the ram in the rama lama ding dong? \vspace{1in plus 1fill} \end{document}
\mbox{text}
\mbox
command creates a box just wide enough to hold the
text created by its argument. The text is not broken into
lines, so it can be used to prevent hyphenation.
\fbox
and \framebox
\fbox{text} \framebox[width][position]{text}
\fbox
and \framebox
commands are like \mbox
,
except that they put a frame around the outside of the box being created.
\framebox
command allows for explicit
specification of the box width with the optional width argument
(a dimension), and positioning with the optional position
argument.
\fboxrule
(default
.4pt), and leave a space of \fboxsep
(default
3pt) between the rule and the contents of the box.
\framebox
command in the
picture
environment.
lrbox
\begin{lrbox}{\cmd} text \end{lrbox}
\sbox
\cmd
,
which must have been declared with \newsavebox
.
\makebox
\makebox[width][position]{text}
\makebox
command creates a box just wide enough to contain
the text specified. The width of the box can be overridden by the
optional width argument. The position of the text within the box
is determined by the optional position argument, which may take
the following values:
\makebox
is also used within the picture
environment
\parbox
\parbox[position][height][inner-pos]{width}{text}
\parbox
command produces a box whose contents are created
in paragraph
mode. It should be used to make a box small
pieces of text, with nothing fancy inside. In particular, you
shouldn&textrsquo;t use any paragraph-making environments inside a
\parbox
argument. For larger pieces of text, including ones
containing a paragraph-making environment, you should use a
minipage
environment (\parbox
has two mandatory arguments:
\raisebox
\raisebox{distance}[height][depth]{text}
\raisebox
command raises or lowers text. The first
mandatory argument specifies how high text is to be raised (or
lowered if it is a negative amount). text itself is processed
in LR mode.
\savebox
\savebox{\boxcmd}[width][pos]{text}
\makebox
(\newsavebox
(\sbox{\boxcmd}{text}
\sbox{\boxcmd}{text}
\sbox
types text in a box just as with \mbox
(\newsavebox
(\usebox{\boxcmd}
\usebox{\boxcmd}
\usebox
produces the box most recently saved in the bin
\boxcmd by a \savebox
command (%
is for comments) so they are
called reserved characters or special characters.
# $ % & { } _ ~ ^ \
\
in front of the character. Thus,
\$1.23
will produce $1.23
in your output.
\~{}
(omitting the curly braces would result in the next
character receiving a tilde accent). Similarly, to get a get a text
body font circumflex use \^{}
. A text body font backslash
results from \textbackslash{}
.
\verb!!
, as below.
\begin{center} \# \$ \% \& \{ \} \_ \~{} \^{} \textbackslash \\ \verb!# $ % & { } _ ~ ^ \! \end{center}
\\
is only there to
split the lines.
\symbol
command. For example, the visible space character
used in the \verb*
command has the code decimal 32, so it can be
typed as \symbol{32}
.
'
prefix, or hexadecimal (base 16) with a "
prefix, so the previous
example could also be written as \symbol{'40}
or
\symbol{"20}
.
textcomp
package.
\ldots
and \dots
also work in math mode.
\textcapital...
form
has the cap height of the font, while the \textascender...
form
has the ascender height.
\$
)\$
)---
)---
)--
)--
)!`
)!`
)?`
)?`
)``
)``
)''
)''
)`
)`
)'
)'
)babel
babel
babel
package and related support. This
section does not attempt to cover all that support. It merely lists
the core &latex; commands for creating accented characters.
\capital...
commands produce alternative forms for use with
capital letters. These are not available with OT1.
\rule
\rule[raise]{width}{thickness}
\rule
command produces rules, that is, lines or
rectangles. The arguments are:
\today
\today
command produces today&textrsquo;s date, in the format
month dd, yyyy; for example, July 4, 1976.
It uses the predefined counters \day
, \month
, and
\year
(\today
. For example, the following
will output 4 juillet 1976:
\year=1976 \month=7 \day=4 \documentclass{minimal} \usepackage[french]{babel} \begin{document} \today \end{document}
datetime
datetime
datetime
package, among others, can produce a wide variety
of other date formats.
\include
\include{file}
\includeonly
command is present, the \include
command executes \clearpage
to start a new page
(\clearpage
.
\includeonly
command, the \include
actions are
only run if file is listed as an argument to
\includeonly
. See \include
, not allowed\include
command may not appear in the preamble or in a file
read by another \include
command.
includeonly
\includeonly{file1,file2,...}
\includeonly
command controls which files will be read by
subsequent \include
commands. The list of filenames is
comma-separated. Each element file1, file2, &dots; must
exactly match a filename specified in a \include
command for the
selection to be effective.
\input
\input{file}
\input
command causes the specified file to be read
and processed, as if its contents had been inserted in the current
file at that point.
\tableofcontents
command. You put the command right where you want the table of
contents to go; &latex; does the rest for you. A previous run must
have generated a \tableofcontents
command produces a heading, but it does
not automatically start a new page. If you want a new page after the
table of contents, write a \newpage
command after the
\tableofcontents
command.
\listoffigures
and \listoftables
produce a list of figures and a list of tables (from \nofiles
overrides these commands, and
\addcontentsline
\addcontentsline{ext}{unit}{text}
\addcontentsline
command adds an entry to the specified list
or table where:
\contentsline{unit}{text}{num}
, where
num
is the current value of counter unit
.
\addtocontents
\addtocontents
{ext}{text} command adds text
(or formatting commands) directly to the \makeglossary
enables creating glossaries.
\glossary{text}
writes a glossary entry for
text to an auxiliary file with the \glossaryentry{text}{pageno}
, where
pageno is the current \thepage
value.
glossary
package on CTAN provides support for fancier
glossaries.
\makeindex
enables creating indexes. Put this in
the preamble.
\index{text}
writes an index entry for
text to an auxiliary file named with the \indexentry{text}{pageno}
, where pageno
is the current \thepage
value.
\index{bar|see{foo}}
. Use seealso
instead of see
to make a &textlsquo;See also&textrsquo; entry.
\seename
, and &textlsquo;See also&textrsquo;
by the macro \alsoname
. These can be redefined for other
languages.
makeidx
makeidx
\printindex
command.
This is defined in the makeidx
package, so
\usepackage{makeidx}
needs to be in the preamble.
\indexspace
is inserted before each new
letter in the printed index; its default value is 10pt plus5pt
minus3pt.
showidx
showidx
showidx
package causes each index entries to be shown in
the margin on the page where the entry appears. This can help in
preparing the index.
multind
multind
multind
package supports multiple indexes. See also the
&tex; FAQ entry on this topic,
\documentclass{letter} \address{sender address} \signature{sender name} \begin{document} \begin{letter}{recipient address} \opening{salutation} letter body \closing{closing text} \end{letter} ... more letters ... \end{document}
letter
environment, whose argument
recipient address often contains multiple lines separated with a
double backslash (\\
). For example, you might have:
\begin{letter}{Mr. Joe Smith \\ 2345 Princess St. \\ Edinburgh, EH1 1AA} ... \end{letter}
letter
environment resets the page number to 1,
and the footnote number to 1 also.
\\
). &latex; will put the sender name
under the closing, after a vertical space for the traditional
hand-written signature; it also can contain multiple lines.
letter
environment body begins with a required \opening
command
such as \opening{Dear Madam or Sir:}
. The letter body
text is ordinary &latex; so it can contain everything from
enumerated lists to displayed math, except that commands such as
\chapter
that make no sense in a letter are turned off. Each
letter
environment body typically ends with a \closing
command such as \closing{Yours,}
.
\closing
. You can say who
is receiving a copy of the letter with a command like \cc{the
Boss \\ the Boss's Boss}
. There&textrsquo;s a similar \encl
command for
a list of enclosures. And, you can add a postscript with \ps
.
\closing
above it by a length of \longindentation
. By default this is
0.5\textwidth
. To make them flush left, put
\setlength{\longindentation}{0em}
in your preamble.
\renewcommand{\today}{2015-Oct-12}
. If put in your preamble
then it will apply to all the letters.
letter
environment. The three lines
marked as optional are typically omitted.
\documentclass{letter} \address{Sender's street \\ Sender's town} \signature{Sender's name \\ Sender's title} % optional: \location{Mailbox 13} % optional: \telephone{(102) 555-0101} \begin{document} \begin{letter}{Recipient's name \\ Recipient's address} \opening{Sir:} % optional: \thispagestyle{firstpage} I am not interested in entering a business arrangement with you. \closing{Your most humble, etc.,} \end{letter} \end{document}
letter
class.
\address
\address{senders address}
\\
.
letter
environment.
\address
declaration the
letter is formatted with some blank space on top, for copying onto
pre-printed letterhead paper. (\address
declaration, it is
formatted as a personal letter.
\address{Stephen Maturin \\ The Grapes of the Savoy}
\cc
\cc{first name \\ ... }
\closing
. Separate multiple lines with a double
backslash \\
, as in:
\cc{President \\ Vice President}
\closing
\closing{text}
\closing
(although this command is optional). For example,
\closing{Regards,}
\encl
\encl{first enclosed object \\ ... }
\closing
.
Separate multiple lines with a double backslash \\
.
\encl{License \\ Passport }
\location
\location{text}
firstpage
.
\makelabels
\makelabels
\startlabels
,
\mlabel
, and \returnaddress
in the preamble. The command
\startlabels
sets the width, height, number of columns, etc., of
the page onto which the labels are printed. The command
\mlabel{sender address}{recipient address}
produces the two labels (or one, if you choose to ignore the sender
address). The sender address is the value returned by the macro
\returnaddress
while recipient address is the value passed
in the argument to the letter
environment. By default
\mlabel
ignores the first argument, the sender address.
\name
\name{name}
\opening
\opening{text}
\begin{letter}{...}
. The mandatory argument text is the
text that starts your letter. For instance:
\opening{Dear John:}
\ps
\ps{text}
\closing
.
\ps{P.S. After you have read this letter, burn it. Or eat it.}
\signature
\signature{first line \\ ... }
\\
. For example:
\signature{J Fred Muggs \\ White House}
\closing
text
down to the \signature
text is 6\medskipamount
, which is
six times 0.7letter
environment and before the \closing
.
\signature{\vspace{-6\medskipamount}\includegraphics{sig.png}\\
My name}
(this requires writing \usepackage{graphicx}
in the
preamble).
\telephone
\telephone{number}
firstpage
pagestyle is selected. If so, it appears on the lower right of the
page.
\typein[cmd]{msg}
\typein[\cmd]{msg}
\typein
prints msg on the terminal and causes &latex; to
stop and wait for you to type a line of input, ending with return. If
the optional \cmd
argument is omitted, the typed input is
processed as if it had been included in the input file in place of the
\typein
command. If the \cmd
argument is present, it
must be a command name. This command name is then defined or
redefined to be the typed input.
\typeout{msg}
\typeout{msg}
msg
on the terminal and in the log
file.
Commands in msg
that are defined with \newcommand
or
\renewcommand
(among others) are replaced by their definitions
before being printed.
msg
. A
\space
command in msg
causes a single space to be
printed, independent of surrounding spaces. A ^^J
in
msg
prints a newline.
latex '\nonstopmode\input foo.tex'
\stop
(and return) and it will prematurely end the document.
beamer
templatebeamer
template and classbeamer
beamer
class creates presentation slides. It has a vast
array of features, but here is a basic template:
book
templatebook
tugboat
templateltugboat
class