From 2262a40ba5a53bf264584772b8b2a3d66bbfb71f Mon Sep 17 00:00:00 2001 From: octaeder <102688820+octaeder@users.noreply.github.com> Date: Wed, 14 Aug 2024 20:01:18 +0200 Subject: [PATCH] Update latex2e.html --- utilities/latex2e.html | 14734 +++++++++++++++++++++------------------ 1 file changed, 7864 insertions(+), 6870 deletions(-) diff --git a/utilities/latex2e.html b/utilities/latex2e.html index 9671128a79..66433b37e2 100644 --- a/utilities/latex2e.html +++ b/utilities/latex2e.html @@ -1,10 +1,10 @@ - +
-This is an unofficial reference manual for
LaTeX. See below for the Table of Contents.
If you want a tutorial then please instead visit learnlatex.org
or this list.
learnlatex.org
or
+see this long list.
This manual has two versions. One has separate web pages for each section or subsection. It's also available as a single web page and as -a pdf. Note that -there is also a separately-maintained French edition.
+a pdf. +Translations to French and Spanish are available at +https://ctan.org/pkg/latex2e-help-texinfo; they're maintained +separately.This document is not official. It has not been reviewed by the -LaTeX maintainers. Our goal is to cover all (non-private) LaTeX -commands. Your comments and contributions, including bug reports, are -very welcome. See our project -page for more, including license information and -information on how you can -contribute to this manual -as well as -mirror it.
- +LaTeX maintainers. Our ultimate goal is to cover all (non-private) +LaTeX commands. Your comments and contributions, including bug +reports, are very welcome. See our project page for more, +including license +information and information on how you can contribute to this +manual as well as mirror it. @@ -144,12 +148,50 @@Next: About this document, Up: (dir) [Contents][Index]
This document is an unofficial reference manual (version of -January 2023) for LaTeX2e, a document preparation system. +May 2024) for LaTeX2e, a document preparation system.
+\DocumentMetadata
: Producing tagged PDF output\subsubsection
, \paragraph
, \subparagraph
\appendix
\frontmatter
, \mainmatter
, \backmatter
\@startsection
, typesetting sectional unit headings\@startsection
: Typesetting sectional unit headings\obeycr
& \restorecr
\newline
\-
(discretionary hyphen)\discretionary
(generalized hyphenation point)\fussy
& \sloppy
+ \slash
: breakable ‘/’\discretionary
(generalized hyphenation point)\fussy
& \sloppy
\hyphenation
\linebreak
& \nolinebreak
\hyphenation
\linebreak
& \nolinebreak
\newfont
\protect
\ignorespaces & \ignorespacesafterend
xspace
package\AtBeginDvi
& \AtEndDvi
\AtEndOfClass
& \AtEndOfPackage
\CheckCommand
\ClassError
and \PackageError
and others\CurrentOption
\DeclareOption
\DeclareRobustCommand
\ExecuteOptions
\IfFileExists
& \InputIfFileExists
\LoadClass
& \LoadClassWithOptions
\NeedsTeXFormat
\OptionNotUsed
\PassOptionsToClass
& \PassOptionsToPackage
\ProcessOptions
\ProvidesClass
& \ProvidesPackage
\ProvidesFile
\RequirePackage
& \RequirePackageWithOptions
\smash
\pagenumbering
\pagestyle
\thispagestyle
\thepage
\normalsfcodes
\
~
~
, \nobreakspace
\thinspace
& \negthinspace
\/
\hrulefill
& \dotfill
lrbox
\usebox
This is an unofficial reference manual for the LaTeX2e document @@ -668,27 +700,28 @@
This document is a reference, not a tutorial. There is a vast array of other information available about LaTeX, at all levels. Here are a few introductions.
Two pages of recommended references to LaTeX documentation.
Writing your first document, with a bit of both text and math.
A longer introduction to LaTeX, translated to many languages.
Introduction to the TeX system, including LaTeX, with further -references. +
Overview of getting started with TeX and LaTeX.
Next: Document classes, Previous: About this document, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
LaTeX is implemented as a set of related so-called “macros” which -use Donald E. Knuth’s TeX typesetting program or one of its -derivatives, collectively known as “engines”. Thus, the user -produces output, typically PDF, by giving the input file to a TeX -engine. (The following sections describe all this in more detail.) +
LaTeX is implemented as a set of so-called “macros” (a TeX +format) which use Donald E. Knuth’s TeX typesetting +program or one of its derivatives, collectively known as +“engines”. Thus, the user produces output, typically PDF, by giving +the input file to a TeX engine. The following sections describe +all this in more detail.
The term LaTeX is also sometimes used to mean the language in which the input document is marked up, that is, to mean the set of commands @@ -744,9 +778,11 @@
\DocumentMetadata
: Producing tagged PDF outputNext: Output files, Up: Overview of LaTeX [Contents][Index]
LaTeX files have a simple global structure, with a standard beginning -and ending. This is a small example. +and ending. Here is a small example:
\documentclass{article} @@ -774,21 +810,22 @@2.1 Starting and ending
\end{document}
line. -Here, the ‘article’ is the document class. It is implemented -in a file article.cls. You can use any document class on your -system. A few document classes are defined by LaTeX itself, and vast -array of others are widely available. See Document classes. +
Here, the ‘article’ is the document class. It is +implemented in a file article.cls. You can use any document +class available on your system. A few document classes are defined by +LaTeX itself, and a vast array of others are available. +See Document classes.
You can include other LaTeX commands between the
-\documentclass
and the\begin{document}
commands. This area is called the preamble.The
\begin{document}
,\end{document}
pair defines an -environment; the ‘document’ environment (and no others) is -required in all LaTeX documents (seedocument
). LaTeX make -available to you many environments that are documented here +The
@@ -803,19 +840,19 @@\begin{document}
…\end{document}
pair +defines an environment; the ‘document’ environment (and no +others) is required in all LaTeX documents (seedocument
). +LaTeX provides many environments that are documented here (see Environments). Many more are available to you from external packages, most importantly those available at CTAN (see CTAN: The Comprehensive TeX Archive Network).2.1 Starting and ending
Next: TeX engines, Previous: Starting and ending, Up: Overview of LaTeX [Contents][Index]
LaTeX produces a main output file and at least two auxiliary files. The main output file’s name ends in either .dvi or .pdf.
.dvi
¶If LaTeX is invoked with the system command latex
then it
+.dvi
¶
If LaTeX is invoked with the system command latex
then it
produces a DeVice Independent file, with extension .dvi. You
can view this file with a command such as xdvi
, or convert
it to a PostScript .ps
file with dvips
or to a
@@ -825,10 +862,10 @@
.pdf
¶If LaTeX is invoked via the system command pdflatex
,
+.pdf
¶
If LaTeX is invoked via the system command pdflatex
,
among other commands (see TeX engines), then the main output is
a Portable Document Format (PDF) file. Typically this is a
self-contained file, with all fonts and images included.
@@ -839,20 +876,20 @@
LaTeX always produces at least two additional files.
.log
¶This transcript file contains summary information such as a list of
+.log
¶
This transcript file contains summary information such as a list of loaded packages. It also includes diagnostic messages and perhaps additional information for any errors.
.aux
¶Auxiliary information is used by LaTeX for things such as
+.aux
¶
Auxiliary information is used by LaTeX for things such as cross references. For example, the first time that LaTeX finds a forward reference—a cross reference to something that has not yet appeared in the source—it will appear in the output as a doubled @@ -885,9 +922,9 @@
LaTeX is a large set of commands that is executed by a TeX -program (see Overview of LaTeX). Such a set of commands is called a +
LaTeX is a large set of commands (macros) that is executed by a
+TeX program (see Overview of LaTeX). Such a set of commands is called a
format, and is embodied in a binary .fmt
file, which can
be read much more quickly than the corresponding TeX source.
latex
¶pdflatex
¶latex
¶pdflatex
¶In other TeX distributions, latex
may invoke e-TeX
rather than pdfTeX. In any case, the e-TeX extensions can be
-assumed to be available in LaTeX.
+assumed to be available in LaTeX, and a few extensions beyond
+e-TeX, particularly for file manipulation.
lualatex
¶lualatex
¶If LaTeX is invoked via the system command lualatex
, the
LuaTeX engine is run (https://ctan.org/pkg/luatex). This
@@ -943,7 +981,7 @@
dvilualatex
to produce a .dvi file.
xelatex
¶xelatex
¶platex
¶uplatex
¶hilatex
¶If LaTeX is invoked via the system command hilatex
, the
+HiTeX engine is run (https://ctan.org/pkg/hitex). This
+program produces its own format, named HINT, designed especially for
+high-quality typesetting on mobile devices.
+
platex
¶uplatex
¶These commands provide significant additional support for Japanese and
other languages; the u
variant supports Unicode. See
https://ctan.org/pkg/ptex and https://ctan.org/pkg/uptex.
@@ -969,16 +1017,16 @@
As of 2019, there is a companion -dev
command and format for
-all of the above:
+all of the above, except hitex
:
dvilualatex-dev
¶latex-dev
¶lualatex-dev
¶pdflatex-dev
¶platex-dev
¶uplatex-dev
¶xelatex-dev
¶dvilualatex-dev
¶latex-dev
¶lualatex-dev
¶pdflatex-dev
¶platex-dev
¶uplatex-dev
¶xelatex-dev
¶These are candidates for an upcoming LaTeX release. The main @@ -1003,14 +1051,258 @@
To a first approximation, most input characters in LaTeX print as +themselves. But there are exceptions, as discussed in the following +sections. +
+ + + +The input to TeX (or any computer program) ultimately consists of a +sequence of bytes. (Nowadays, a byte is almost universally an +eight-bit number, i.e., an integer between 0 and 255, inclusive.) The +input encoding defines how to interpret that sequence of bytes, and +thus how LaTeX behaves. +
+ +Today, by far the most common way to encode text is with UTF-8, a +so-called “Unicode Transformation Format” which specifies how to +transform a sequence of 8-bit bytes to Unicode code points, which are +defined independent of any particular representation. The Unicode +encoding defines code points for virtually all characters used +today in written text. +
+When TeX was created, Unicode and UTF-8 did not exist and the 7-bit +ASCII encoding was by far the most widely used. So TeX does not +require Unicode for text input. UTF-8 is a superset of ASCII, so a +pure 7-bit ASCII document is also UTF-8. +
+Since 2018, the default input encoding for LaTeX is UTF-8.
+Some methods for handling documents written in some other encoding,
+such as ISO-8859-1 (Latin 1), are explained in inputenc
package.
+
You can easily find more about all these topics in any introductory +computer text or online. For example, you might start at: +https://en.wikipedia.org/wiki/Unicode. +
+A ligature combines two or more letters (more generally, +characters) into a single glyph. For example, in Latin-based +typography, the two letters ‘f’ and ‘i’ are often combined +into the glyph ‘fi’. +
+TeX supports ligatures automatically. To continue the example, if +the input has the word ‘fine’, written as four separate ASCII +characters, TeX will output the word ‘fine’ (with the default +fonts), with three typeset glyphs. +
+In traditional TeX, the available ligatures, if any, are defined by +the current font. TeX also uses the ligature mechanism to produce +a few typographical characters which were not available in any +computer encoding when TeX was invented. In all, in the original +Computer Modern fonts, the following input character sequences are +defined to lead to ligatures: +
+ + + + + + + + + + +ff (ff ligature, U+FB00) +
fi (fi ligature, U+FB01) +
fl (fl ligature, U+FB02) +
ffi (ffi ligature, U+FB03) +
ffl (ffl ligature, U+FB04) +
“ (left double quotation mark, U+201C) +
” (right double quotation mark, U+201D) +
– (en-dash, U+2013) +
— (em-dash, U+2014) +
!‘ (inverted exclamation mark, U+00A1) +
?‘ (inverted question mark, U+00BF) +
(For the f-ligatures above, the text in parentheses shows the +individual characters, so in the typeset output you can easily see the +difference between the ligature and the original character sequence.) +
+Nowadays it’s usually possible to directly input the punctuation +characters as Unicode characters, and LaTeX supports that (see +previous section). But even today, it can still often be useful to +use the ASCII ligature input form; for example, the difference between +an en-dash and em-dash, as a single glyph, can be all but impossible +to discern, but the difference between two and three ASCII hyphen +characters is clear. Similarly with quotation marks, in some fonts. +
+Thus, even the engines with native support for UTF-8, namely LuaTeX +and XeTeX, also support the ASCII ligature input sequences by +default, independent of the font used. They also need to do so for +compatibility. +
+ +By the way, the f-ligatures are also available in Unicode (the +“Alphabetic Presentation Forms” block starting at U+FB00), but it’s +almost never desirable to use them as input characters, since in +principle it should be up to the typesetter and the current font +whether to use ligatures. Also, in practice, using them will +typically cause searches to fail, that is, a search for the two +characters ‘fi’ will not be matched by the ligature ‘fi’ at +U+FB01. +
+ +\ { } % $ & _ ^ # ~
¶Besides ligatures (see previous section), a few individual characters +have special meaning to LaTeX. They are called reserved +characters or special characters. Here they are: +
+Introduces a command name, as seen throughout this manual. +
+Delimits a required argument to a command or a level of grouping, as +seen throughout this manual. +
+Starts a comment: the ‘%’ and all remaining characters on the +current line are ignored. +
+Starts and ends math mode (see Math formulas). +
+Separates cells in a table (see tabular
).
+
Introduce a subscript or superscript, respectively, in math +(see Subscripts & superscripts); they produce an error outside +math mode. As a little-used special feature, two superscript +characters in a row can introduce special notation for an arbitrary +character. +
+Stands for arguments in a macro definition (see \newcommand
& \renewcommand
).
+
Produces a nonbreakable interword space (see ~
, \nobreakspace
).
+
See Printing special characters, for how to typeset these +characters when you need them literally. +
+\
. The name itself then consists of either
(a) a string of letters or (b) a single non-letter.
-LaTeX commands names are case sensitive so that \pagebreak
-differs from \Pagebreak
(the latter is not a standard command).
-Most command names are lowercase, but in any event you must enter all
-commands in the same case as they are defined.
+
LaTeX commands names are case sensitive; for example,
+\pagebreak
differs from \Pagebreak
(the latter is not a
+standard command). Most command names are lowercase, but in any event
+you must enter all commands in the same case as they are defined.
A command may be followed by zero, one, or more arguments. These
arguments may be either required or optional. Required arguments are
contained in curly braces, {...}
. 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.
+first, before any required arguments; optional arguments could come
+after required arguments, or both before and after.
Inside of an optional argument, to use the character close square
bracket (]
) hide it inside curly braces, as
@@ -1039,10 +1332,10 @@
LaTeX has the convention that some commands have a *
form that
-is related to the form without a *
, such as \chapter
and
-\chapter*
. The exact difference in behavior varies from command
-to command.
+
LaTeX has the convention that some commands have a *
form
+that is closely related to the form without a *
, such as
+\chapter
and \chapter*
. The difference in behavior
+varies from command to command.
This manual describes all accepted options and *
-forms for the
commands it covers (barring unintentional omissions, a.k.a. bugs).
@@ -1057,17 +1350,18 @@
As of the 2020-10-01 release of LaTeX, the expl3
and
xparse
packages are part of the LaTeX2e format. They
provide a completely different underlying programming language
-syntax. We won’t try to cover them in this document; see the related
+syntax. We won’t try to cover that in this document; see the related
package documentation and other LaTeX manuals.
Synopsis:
@@ -1104,19 +1398,67 @@\begin{tabular}[t]{r|l} - ... rows of table ... + ... rows-of-table ... \end{tabular}
\DocumentMetadata
: Producing tagged PDF output ¶The \DocumentMetadata
command was added to LaTeX in 2022.
+It enables so-called “tagging” of the PDF output, aiding
+accessibility of the PDF. It is supported best with LuaLaTeX;
+pdfLaTeX and XeLaTeX are supported as well as possible
+(see TeX engines).
+
It is unlike nearly any other command in LaTeX in that it must
+occur before the \documentclass
command that starts a LaTeX
+document proper (see \documentclass). Therefore it must be
+called with \RequirePackage
rather than \usepackage
+(see \RequirePackage).
+
This support is still in development, so we will not try to list all
+the possible settings. Please see the
+documentmetadata-support-doc
document, part of the
+latex-lab
package (https://ctan.org/pkg/latex-lab). Here
+is a simple example which enables most tagging currently implemented:
+
\DocumentMetadata{testphase={phase-III,firstaid}} +\documentclass{article} +... +
As you can see from the key name testphase
, this is all still
+in an experimental phase. The LaTeX developers strongly encourage
+users to give it a try and report problems, so it can be improved.
+
In addition to the massive holdings, the ctan.org
web site
+
In addition to its massive holdings, the ctan.org
web site
offers features such as search by name or by functionality.
Next: Fonts, Previous: Overview of LaTeX, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
The document’s overall class is defined with this command, which is -normally the first command in a LaTeX source file. +
The document’s overall class is defined with the \documentclass
+command, which is normally the first command in a LaTeX source
+file.
\documentclass[options]{class} @@ -1176,8 +1519,8 @@3 Document classes
The following document class names are built into LaTeX. -(Many other document classes are available as separate packages; -see Overview of LaTeX.) +Many other document classes are available as separate packages +(see Overview of LaTeX).
article
slides
For slide presentations—rarely used nowadays. The
-beamer
package is perhaps the most prevalent
+beamer
package is perhaps the most prevalent replacement
(https://ctan.org/pkg/beamer). See beamer
template, for a
small template for a beamer document.
\usepackage
: Additional packagesLaTeX automatically passes options specified for
+\documentclass
on to any other loaded classes that can handle
+them.
+
Here is the list of the standard class options.
All of the standard classes except slides
accept the following
-options for selecting the typeface size (default is 10pt
):
+options for selecting the typeface size; the default is 10pt
:
10pt 11pt 12pt @@ -1258,7 +1605,7 @@3.1 Document class options
All of the standard classes accept these options for selecting the paper -size (these show height by width): +size (dimensions are listed height by width):
a4paper
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’s preamble.
-
-
-
-The geometry
package provides flexible ways of setting the print
-area and physical page size.
+the print area but you must also set the physical paper size. Usually,
+the geometry
package is the best way to do that; it
+provides flexible ways of setting the print area and physical page size.
+Otherwise, setting the paper size is engine-dependent. For example,
+with pdfLaTeX, you could include \pdfpagewidth=\paperwidth
and
+\pdfpageheight=\paperheight
in the preamble.
draft
¶draft
¶final
Mark (draft
) or do not mark (final
) overfull boxes with a
black box in the margin; default is final
.
fleqn
¶Put displayed formulas flush left; default is centered.
+fleqn
¶
Put displayed formulas flush left; default is centered.
landscape
¶Selects landscape format; default is portrait. +
landscape
¶Selects landscape format; default is portrait.
leqno
¶Put equation numbers on the left side of equations; default is the right side.
+leqno
¶
Put equation numbers on the left side of equations; default is the right side.
openbib
¶openbib
¶Use “open” bibliography format.
titlepage
¶titlepage
¶notitlepage
Specifies whether there is a separate page for the title information and for the abstract also, if there is one. The default for the @@ -1363,10 +1708,10 @@
Typeset in one or two columns; default is onecolumn
.
oneside
¶oneside
¶twoside
Selects one- or two-sided layout; default is oneside
, except
+
Selects one- or two-sided layout; default is oneside
, except
that in the book
class the default is twoside
.
For one-sided printing, the text is centered on the page. For two-sided @@ -1391,43 +1736,54 @@
\usepackage
: Additional packages ¶Load a package pkg, with the package options given in the comma-separated -list options, as here. +
To load a package pkg, with the package options given in the +comma-separated list options:
\usepackage[options]{pkg}. +\usepackage[options]{pkg}[mindate]
To specify more than one package you can separate them with a comma,
as in \usepackage{pkg1,pkg2,...}
, or use multiple
\usepackage
commands.
If the mindate optional argument is given, LaTeX gives a
+warning if the loaded package has an earlier date, i.e., is too old.
+The mindate argument must be in the form YYYY/MM/DD
.
+More info on this: https://tex.stackexchange.com/questions/47743.
+
\usepackage
must be used in the document preamble, between the
+\documentclass
declaration and the \begin{document}
.
+Occasionally it is necessary to load packages before the
+\documentclass
; see \RequirePackage
for that
+(see \RequirePackage).
+
Any options given in the \documentclass
command that are unknown
-to the selected document class are passed on to the packages loaded with
-\usepackage
.
+
Any options given in the global \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}
.
-What separates a package from a document class is that the commands in a
-package are useful across classes while those in a document class are
-specific to that class. Thus, a command to set page headers is for a
-package while a command to make the page headers say Memo from the
-SMC Math Department
is for a class.
-
Inside of a class or package file you can use the at-sign @
as a
-character in command names without having to surround the code
-containing that command with \makeatletter
and
-\makeatother
. See \makeatletter
& \makeatother
. This allow
-you to create commands that users will not accidentally redefine.
-Another technique is to preface class- or package-specific commands with
-some string to prevent your class or package from interfering with
-others. For instance, the class smcmemo
might have commands
+
What separates a package from a document class is that the commands in
+a package are useful across classes while those in a document class
+are specific to that class. Thus, a command to set page headers is
+for a package while a command to make the page headers be
+Memo from the SMC Math Department
is for a class.
+
Inside of a class or package definition you can use the at-sign
+@
as a character in command names without having to surround
+the code containing that command with \makeatletter
and
+\makeatother
(see \makeatletter
& \makeatother
). This
+allows you to create commands that users will not accidentally
+redefine.
+
It is also highly desirable to prefix class- or package-specific
+commands with your package name or similar string, to prevent your
+definitions from clashing with those from other packages. For
+instance, the class smcmemo
might have commands
\smc@tolist
, \smc@fromlist
, etc.
A class file or package file typically has four parts. -
\NeedsTeXFormat
and \ProvidesClass
or \ProvidesPackage
commands.
@@ -1507,6 +1865,7 @@ Here is a starting class file, which should be saved as stub.cls where LaTeX can find it, for example in the same directory as the .tex file. @@ -1518,482 +1877,69 @@
It identifies itself, handles the class options via the default of
passing them all to the article
class, and then loads the
article
class to provide the basis for this class’s code.
For more, see the official guide for class and package writers, the -Class Guide, at -https://www.latex-project.org/help/documentation/clsguide.pdf (much -of the descriptions here derive from this document), or the tutorial -https://www.tug.org/TUGboat/tb26-3/tb84heff.pdf. +Class Guide, at https://ctan.org/pkg/clsguide (much of the +description here derives from this document), or the tutorial at +https://tug.org/TUGboat/tb26-3/tb84heff.pdf. +
+See Class and package commands, for some of the commands +specifically intended for class and package writers.
These are the commands designed to help writers of classes or packages. +
LaTeX comes with powerful font capacities. For one thing, its New +Font Selection Scheme allows you to work easily with the font families +in your document (for instance, see Font styles). And, +LaTeX documents can use most fonts that are available today, +including versions of Times Roman, Helvetica, Courier, etc. (Note, +though, that many fonts do not have support for mathematics.)
-\AtBeginDvi{specials}
¶Save in a box register things that are written to the .dvi file -at the beginning of the shipout of the first page of the document. +
The first typeface in the TeX world was the Computer Modern family, +developed by Donald Knuth. It is the default for LaTeX documents and +is still the most widely used. But changing to another font often only +involves a few commands. For instance, putting the following in your +preamble gives you a Palatino-like font, which is handsome and more +readable online than many other fonts, while still allowing you to +typeset mathematics. (This example is from Michael Sharpe, +https://math.ucsd.edu/~msharpe/RcntFnts.pdf.)
-\AtEndOfClass{code}
¶\AtEndOfPackage{code}
Hook to insert code to be executed when LaTeX finishes
-processing the current class or package. You can use these hooks
-multiple times; the code
will be executed in the order that you
-called it. See also \AtBeginDocument
.
+
\usepackage[osf]{newpxtext} % osf for text, not math +\usepackage{cabin} % sans serif +\usepackage[varqu,varl]{inconsolata} % sans serif typewriter +\usepackage[bigdelims,vvarbb]{newpxmath} % bb from STIX +\usepackage[cal=boondoxo]{mathalfa} % mathcal +
In addition, the xelatex
or lualatex
engines allow
+you to use any fonts on your system that are in OpenType or TrueType
+format (see TeX engines).
\CheckCommand{cmd}[num][default]{definition}
¶\CheckCommand*{cmd}[num][default]{definition}
Like \newcommand
(see \newcommand
& \renewcommand
) but does
-not define cmd; instead it checks that the current definition of
-cmd is exactly as given by definition and is or is not
-
-long as expected. A long command is a command that accepts
-\par
within an argument. The cmd command is expected to be
-long with the unstarred version of \CheckCommand
. Raises an
-error when the check fails. This allows you to check before you start
-redefining cmd
yourself that no other package has already
-redefined this command.
-
\ClassError{class name}{error text}{help text}
¶\ClassWarning{class name}{warning text}
\ClassWarningNoLine{class name}{warning text}
\ClassInfo{class name}{info text}
\ClassInfoNoLine{class name}{info text}
\PackageError{package name}{error text}{help text}
\PackageWarning{package name}{warning text}
\PackageWarningNoLine{package name}{warning text}
\PackageInfo{package name}{info text}
\PackageInfoNoLine{package name}{info text}
Produce an error message, or warning or informational messages. -
-For \ClassError
and \PackageError
the message is
-error text, followed by TeX’s ?
error prompt. If the
-user then asks for help by typing h
, they see the help
-text.
-
The four warning commands are similar except that they write
-warning text on the screen with no error prompt. The four info
-commands write info text only in the transcript file. The
-NoLine
versions do not show the number of the line generating the
-message, while the other versions do show that number.
-
To format the messages, including the help text: use
-\protect
to stop a command from expanding, get a line break with
-\MessageBreak
, and get a space with \space
when a space
-character does not allow it, like after a command. Note that LaTeX
-appends a period to the messages.
-
\CurrentOption
¶Expands to the name of the currently-being-processed option. Can only
-be used within the code argument of either \DeclareOption
-or \DeclareOption*
.
-
\DeclareOption{option}{code}
¶\DeclareOption*{code}
Make an option available to a user to invoke in their
-\documentclass
command. For example, the smcmemo
class
-could have an option \documentclass[logo]{smcmemo}
allowing
-users to put the institutional logo on the first page. The class file
-must contain \DeclareOption{logo}{code}
(and later,
-\ProcessOptions
).
-
If you request an option that has not been declared, by default this
-will produce a warning like Unused global option(s):
-[badoption].
Change this behavior with the starred version
-\DeclareOption*{code}
. For example, many classes
-extend an existing class, using a command such as
-\LoadClass{article}
, and for passing extra options to the
-underlying class use code such as this.
-
\DeclareOption*{% -\PassOptionsToClass{\CurrentOption}{article}% -} -
Another example is that the class smcmemo
may allow users to keep
-lists of memo recipients in external files. Then the user could invoke
-\documentclass[math]{smcmemo}
and it will read the file
-math.memo
. This code handles the file if it exists and otherwise
-passes the option to the article
class.
-
\DeclareOption*{\InputIfFileExists{\CurrentOption.memo}{}{% - \PassOptionsToClass{\CurrentOption}{article}}} -
\DeclareRobustCommand{cmd}[num][default]{definition}
* \DeclareRobustCommand*{cmd}[num][default]{definition}
¶Like \newcommand
and \newcommand*
(see \newcommand
& \renewcommand
) but these declare a robust command, even if some code
-within the definition is fragile. (For a discussion of robust and
-fragile commands see \protect
.) Use this command to define new
-robust commands or to redefine existing commands and make them
-robust. Unlike \newcommand
these do not give an error if macro
-cmd already exists; instead, a log message is put into the
-transcript file if a command is redefined.
-
Commands defined this way are a bit less efficient than those defined
-using \newcommand
so unless the command’s data is fragile and the
-command is used within a moving argument, use \newcommand
.
-
The etoolbox
package offers the commands
-\newrobustcmd
, \newrobustcmd*
, as well as the commands
-\renewrobustcmd
, \renewrobustcmd*
, and the commands
-\providerobustcmd
, and \providerobustcmd*
. These are
-similar to \newcommand
, \newcommand*
,
-\renewcommand
, \renewcommand*
, \providecommand
, and
-\providecommand*
, but define a robust cmd with two
-advantages as compared to \DeclareRobustCommand
:
-
\protect
mechanism, so they do not incur
-the slight loss of performance mentioned above, and
-\new…
,
-\renew…
, and \provide…
, as the standard
-commands, so they do not just make a log message when you redefine
-cmd that already exists, in that case you need to use either
-\renew…
or \provide…
or you get an error.
-\IfFileExists{filename}{true code}{false code}
¶\InputIfFileExists{filename}{true code}{false code}
Execute true code if LaTeX finds the file file -name or false code otherwise. In the first case it executing -true code and then inputs the file. Thus the command -
-\IfFileExists{img.pdf}{% - \includegraphics{img.pdf}}{\typeout{!! img.pdf not found} -
will include the graphic img.pdf if it is found and otherwise -give a warning. -
-This command looks for the file in all search paths that LaTeX uses,
-not only in the current directory. To look only in the current
-directory do something like \IfFileExists{./filename}{true
-code}{false code}
. If you ask for a filename without a
-.tex
extension then LaTeX will first look for the file by
-appending the .tex
; for more on how LaTeX handles file
-extensions see \input
.
-
\LoadClass[options list]{class name}[release date]
¶\LoadClassWithOptions{class name}[release date]
Load a class, as with \documentclass[options
-list]{class name}[release info]
. An example is
-\LoadClass[twoside]{article}
.
-
The options list, if present, is a comma-separated list. The -release date is optional. If present it must have the form -YYYY/MM/DD. -
-If you request a release date and the date of the package -installed on your system is earlier, then you get a warning on the -screen and in the log like this. -
-You have requested, on input line 4, version `2038/01/19' of -document class article, but only version `2014/09/29 v1.4h -Standard LaTeX document class' is available. -
The command version \LoadClassWithOptions
uses the list of
-options for the current class. This means it ignores any options passed
-to it via \PassOptionsToClass
. This is a convenience command
-that lets you build classes on existing ones, such as the standard
-article
class, without having to track which options were passed.
-
\ExecuteOptions{options-list}
¶For each option option in the options-list, in order, this command
-executes the command \ds@option
. If this command is not
-defined then that option is silently ignored.
-
It can be used to provide a default option list before
-\ProcessOptions
. For example, if in a class file you want the
-default to be 11pt fonts then you could specify
-\ExecuteOptions{11pt}\ProcessOptions\relax
.
-
\NeedsTeXFormat{format}[format date]
¶Specifies the format that this class must be run under. Often issued
-as the first line of a class file, and most often used as:
-\NeedsTeXFormat{LaTeX2e}
. When a document using that class is
-processed, the format name given here must match the format that is
-actually being run (including that the format string is case
-sensitive). If it does not match then execution stops with an error
-like ‘This file needs format `LaTeX2e' but this is `xxx'.’
-
To specify a version of the format that you know to have certain
-features, include the optional format date on which those features
-were implemented. If present it must be in the form YYYY/MM/DD
.
-If the format version installed on your system is earlier than
-format date then you get a warning like this.
-
You have requested release `2038/01/20' of LaTeX, but only -release `2016/02/01' is available. -
\OptionNotUsed
¶Adds the current option to the list of unused options. Can only be used
-within the code argument of either \DeclareOption
or
-\DeclareOption*
.
-
\PassOptionsToClass{option list}{class name}
¶\PassOptionsToPackage{option list}{package name}
Adds the options in the comma-separated list option list to the
-options used by any future \RequirePackage
or \usepackage
-command for package package name or the class class name.
-
The reason for these commands is: you may load a package any number of
-times with no options but if you want options then you may only supply
-them when you first load the package. Loading a package with options
-more than once will get you an error like Option clash for package
-foo.
(LaTeX throws an error even if there is no conflict between the
-options.)
-
If your own code is bringing in a package twice then you can collapse
-that to once, for example replacing the two
-\RequirePackage[landscape]{geometry}
and
-\RequirePackage[margins=1in]{geometry}
with the single command
-\RequirePackage[landscape,margins=1in]{geometry}
.
-
However, imagine that you are loading firstpkg and inside that
-package it loads secondpkg, and you need the second package to be
-loaded with option draft
. Then before doing the first package
-you must queue up the options for the second package, like this.
-
\PassOptionsToPackage{draft}{secondpkg} -\RequirePackage{firstpkg} -
(If firstpkg.sty
loads an option in conflict with what you want
-then you may have to alter its source.)
-
These commands are useful for general users as well as class and package
-writers. For instance, suppose a user wants to load the graphicx
-package with the option draft
and also wants to use a class
-foo
that loads the graphicx
package, but without that
-option. The user could start their LaTeX file with
-\PassOptionsToPackage{draft}{graphicx}\documentclass{foo}
.
-
\ProcessOptions
¶\ProcessOptions*\@options
Execute the code for each option that the user has invoked. Include it
-in the class file as \ProcessOptions\relax
(because of the
-existence of the starred command).
-
Options come in two types. Local options have been specified for this
-particular package in the options argument of
-\PassOptionsToPackage{options}
,
-\usepackage[options]
, or
-\RequirePackage[options]
. Global options are those given
-by the class user in \documentclass[options]
(If an option
-is specified both locally and globally then it is local.)
-
When \ProcessOptions
is called for a package pkg.sty, the
-following happens:
-
\DeclareOption
, it looks to see if that option is either a
-global or a local option for pkg
. If so then it executes the
-declared code. This is done in the order in which these options were
-given in pkg.sty.
-\ds@
option if it has been defined somewhere (other than by
-a \DeclareOption
); otherwise, it executes the default option code
-given in \DeclareOption*
. If no default option code has been
-declared then it gives an error message. This is done in the order in
-which these options were specified.
-When \ProcessOptions
is called for a class it works in the same
-way except that all options are local, and the default code for
-\DeclareOption*
is \OptionNotUsed
rather than an error.
-
The starred version \ProcessOptions*
executes the
-options in the order specified in the calling commands, rather than in
-the order of declaration in the class or package. For a package this
-means that the global options are processed first.
-
\ProvidesClass{class name}[release date brief additional information]
¶\ProvidesClass{class name}[release date]
\ProvidesPackage{package name}[release date brief additional information]
\ProvidesPackage{package name}[release date]
Identifies the class or package, printing a message to the screen and -the log file. -
-When you load a class or package, for example with
-\documentclass{smcmemo}
or \usepackage{test}
, LaTeX
-inputs a file. If the name of the file does not match the class or
-package name declared in it then you get a warning. Thus, if you invoke
-\documentclass{smcmemo}
, and the file smcmemo.cls has
-the statement \ProvidesClass{xxx}
then you get a warning like
-You have requested document class `smcmemo', but the document
-class provides 'xxx'.
This warning does not prevent LaTeX from
-processing the rest of the class file normally.
-
If you include the optional argument then you must include a date,
-before any spaces, of the form YYYY/MM/DD
. The rest of the
-optional argument is free-form, although it traditionally identifies the
-class, and is written to the screen during compilation and to the log
-file. Thus, if your file smcmemo.cls contains the line
-\ProvidesClass{smcmemo}[2008/06/01 v1.0 SMC memo class]
and
-your document’s first line is \documentclass{smcmemo}
then you
-will see Document Class: smcmemo 2008/06/01 v1.0 SMC memo class
.
-
The date in the optional argument allows class and package users to ask
-to be warned if the version of the class or package is earlier than
-release date. For instance, a user could enter
-\documentclass{smcmemo}[2018/10/12]
or
-\usepackage{foo}[[2017/07/07]]
to require a class or package
-with certain features by specifying that it must be released no earlier
-than the given date. (Although, in practice package users only rarely
-include a date, and class users almost never do.)
-
\ProvidesFile{filename}[additional information]
¶Declare a file other than the main class and package files, such as
-configuration files or font definition files. Put this command in that
-file and you get in the log a string like File: test.config
-2017/10/12 config file for test.cls
for filename equal to
-‘test.config’ and additional information equal to
-‘2017/10/12 config file for test.cls’.
-
\RequirePackage[option list]{package name}[release date]
¶\RequirePackageWithOptions{package name}[release date]
Load a package, like the command \usepackage
(see Additional packages). The LaTeX development team strongly recommends use of
-these commands over Plain TeX’s \input
; see the Class
-Guide. An example is
-\RequirePackage[landscape,margin=1in]{geometry}
.
-
The option list, if present, is a comma-separated list. The
-release date, if present, must have the form YYYY/MM/DD. If
-the release date of the package as installed on your system is earlier
-than release date then you get a warning like You have
-requested, on input line 9, version `2017/07/03' of package jhtest, but
-only version `2000/01/01' is available
.
-
The \RequirePackageWithOptions
version uses the list of options
-for the current class. This means it ignores any options passed to it
-via \PassOptionsToClass
. This is a convenience command to allow
-easily building classes on existing ones without having to track which
-options were passed.
-
The difference between \usepackage
and \RequirePackage
is
-small. The \usepackage
command is intended for the document file
-while \RequirePackage
is intended for package and class files.
-Thus, using \usepackage
before the \documentclass
command
-causes LaTeX to give error like \usepackage before
-\documentclass
, but you can use \RequirePackage
there.
-
LaTeX comes with powerful font capacities. For one thing, its New -Font Selection Scheme allows you to work easily with the font families -in your document (for instance, see Font styles). And, -LaTeX documents can use most fonts that are available today, -including versions of Times Roman, Helvetica, Courier, etc. (Note, -though, that many fonts do not have support for mathematics.) -
-The first typeface in the TeX world was the Computer Modern family, -developed by Donald Knuth. It is the default for LaTeX documents and -is still the most widely used. But changing to another font often only -involves a few commands. For instance, putting the following in your -preamble gives you a Palatino-like font, which is handsome and more -readable online than many other fonts, while still allowing you to -typeset mathematics. (This example is from Michael Sharpe, -https://math.ucsd.edu/~msharpe/RcntFnts.pdf.) -
-\usepackage[osf]{newpxtext} % osf for text, not math -\usepackage{cabin} % sans serif -\usepackage[varqu,varl]{inconsolata} % sans serif typewriter -\usepackage[bigdelims,vvarbb]{newpxmath} % bb from STIX -\usepackage[cal=boondoxo]{mathalfa} % mathcal -
In addition, the xelatex
or lualatex
engines allow
-you to use any fonts on your system that are in OpenType or TrueType
-format (see TeX engines).
-
The LaTeX Font Catalogue (https://tug.org/FontCatalogue) shows -font sample graphics and copy-and-pasteable source to use many fonts, -including many with support for mathematics. It aims to cover all Latin -alphabet free fonts available for easy use with LaTeX. +
The LaTeX Font Catalogue (https://tug.org/FontCatalogue) shows +font sample graphics and copy-and-pasteable source to use many fonts, +including many with support for mathematics. It aims to cover all Latin +alphabet free fonts available for easy use with LaTeX.
More information is also available from the TeX Users Group, at https://www.tug.org/fonts/. @@ -2012,7 +1958,7 @@
Next: Font styles, Up: Fonts [Contents][Index]
fontenc
packagefontenc
package ¶fontenc
+
@@ -2075,24 +2022,26 @@ fontenc
font_encodingenc.def. It also sets \encodingdefault
to be the last encoding in the option list.
-These are the common values for font_encoding. +
These are the common values for font_encoding:
OT1
The original encoding for TeX. Limited to mostly English characters. +
OT1
¶The original 7-bit encoding for TeX. Limited to mostly English characters.
OMS, OML
Math symbols and math letters encoding.
T1
TeX text extended. Sometimes called the Cork encoding for the Users -Group meeting where it was developed. Gives access to most European -accented characters. The most common option for this package. +
T1
¶TeX text extended. Sometimes called the Cork encoding for the +users group meeting where it was developed (1990). Gives access to +most European accented characters. The most common option for this +package.
TS1
TS1
¶Text Companion encoding.
fontenc
fonts before loading fontenc, to prevent the system from loading
any T1
encoded fonts from the default.
-The LaTeX team reserve encoding names starting with: ‘T’ for the -standard text encodings with 256 characters, ‘TS’ for symbols that -extend the corresponding T encodings, ‘X’ for test encodings, -‘M’ for standard math encodings with 256 characters, ‘A’ for -special applications, ‘OT’ for standard text encodings with 128 -characters, and ‘OM’ for standard math encodings with 128 -characters (‘O’ stands for ‘obsolete’). +
The LaTeX team reserves encoding names starting with: ‘T’ for +the standard text encodings with 256 characters, ‘TS’ for symbols +that extend the corresponding T encodings, ‘X’ for test +encodings, ‘M’ for standard math encodings with 256 characters, +‘A’ for special applications, ‘OT’ for standard text +encodings with 128 characters, and ‘OM’ for standard math +encodings with 128 characters (‘O’ stands for ‘obsolete’).
This package provides a number of commands, detailed below. Many of them are encoding-specific, so if you have defined a command that works @@ -2142,7 +2091,7 @@
fontenc
Next: \DeclareTextAccent
, Up: fontenc
package [Contents][Index]
\DeclareFontEncoding
\DeclareFontEncoding
¶\DeclareTextAccentDefault
, Previous: \DeclareFontEncoding
, Up: fontenc
package [Contents][Index]
-4.1.2 \DeclareTextAccent
+4.1.2 \DeclareTextAccent
¶
@@ -2235,7 +2184,7 @@ 4.1.2
Next: \DeclareTextCommand
& \ProvideTextCommand
, Previous: \DeclareTextAccent
, Up: fontenc
package [Contents][Index]
-4.1.3 \DeclareTextAccentDefault
+4.1.3 \DeclareTextAccentDefault
¶
@@ -2281,7 +2230,7 @@ 4.1.3
Next: \DeclareTextCommandDefault
& \ProvideTextCommandDefault
, Previous: \DeclareTextAccentDefault
, Up: fontenc
package [Contents][Index]
-4.1.4 \DeclareTextCommand
& \ProvideTextCommand
+4.1.4 \DeclareTextCommand
& \ProvideTextCommand
¶
@@ -2350,7 +2299,7 @@ \DeclareTextComposite
, Previous: \DeclareTextCommand
& \ProvideTextCommand
, Up: fontenc
package [Contents][Index]
-4.1.5 \DeclareTextCommandDefault
& \ProvideTextCommandDefault
+4.1.5 \DeclareTextCommandDefault
& \ProvideTextCommandDefault
¶
@@ -2397,7 +2346,7 @@ \DeclareTextCompositeCommand
, Previous: \DeclareTextCommandDefault
& \ProvideTextCommandDefault
, Up: fontenc
package [Contents][Index]
-4.1.6 \DeclareTextComposite
+4.1.6 \DeclareTextComposite
¶
@@ -2436,7 +2385,7 @@ 4.1.6 \DeclareTextSymbol
, Previous: \DeclareTextComposite
, Up: fontenc
package [Contents][Index]
-4.1.7 \DeclareTextCompositeCommand
+4.1.7 \DeclareTextCompositeCommand
¶
@@ -2469,7 +2418,7 @@ 4.1.7
Next: \DeclareTextSymbolDefault
, Previous: \DeclareTextCompositeCommand
, Up: fontenc
package [Contents][Index]
-4.1.8 \DeclareTextSymbol
+4.1.8 \DeclareTextSymbol
¶
@@ -2488,10 +2437,10 @@ 4.1.8
-\DeclareTextSymbol{\guillemotleft}{T1}{19}
+\DeclareTextSymbol{\guillemetleft}{T1}{19}
-The command \DeclareTextCommand{\guillemotleft}{T1}{\char
+The command \DeclareTextCommand{\guillemetleft}{T1}{\char
19}
has the same effect but is slower (see \DeclareTextCommand
& \ProvideTextCommand
).
See fontenc
package, for a list of common encodings. The slot
@@ -2511,7 +2460,7 @@
4.1.8
Next: \LastDeclaredEncoding
, Previous: \DeclareTextSymbol
, Up: fontenc
package [Contents][Index]
-4.1.9 \DeclareTextSymbolDefault
+4.1.9 \DeclareTextSymbolDefault
¶
@@ -2553,7 +2502,7 @@ 4.1.9
Next: \UseTextSymbol
& \UseTextAccent
, Previous: \DeclareTextSymbolDefault
, Up: fontenc
package [Contents][Index]
-4.1.10 \LastDeclaredEncoding
+4.1.10 \LastDeclaredEncoding
¶
@@ -2583,7 +2532,7 @@ 4.1.10 \LastDeclaredEncoding
, Up: fontenc
package [Contents][Index]
-4.1.11 \UseTextSymbol
& \UseTextAccent
+4.1.11 \UseTextSymbol
& \UseTextAccent
¶
@@ -2643,7 +2592,7 @@ 4.1
Next: Font sizes, Previous: fontenc
package, Up: Fonts [Contents][Index]
-4.2 Font styles
+4.2 Font styles ¶
@@ -2677,54 +2626,54 @@ 4.2 Font styles
\textit{\nocorr text}
or \textsc{text \nocorr}
.
-\textrm (\rmfamily)
¶
--
-
Roman.
+
-
+
\textrm (\rmfamily)
¶
+Roman.
-\textit (\itshape)
¶
--
-
Italics.
+
-
+
\textit (\itshape)
¶
+Italics.
-\textmd (\mdseries)
¶
--
-
Medium weight (default).
+
-
+
\textmd (\mdseries)
¶
+Medium weight (default).
-\textbf (\bfseries)
¶
--
-
Boldface.
+
-
+
\textbf (\bfseries)
¶
+Boldface.
-\textup (\upshape)
¶
--
-
Upright (default).
+
-
+
\textup (\upshape)
¶
+Upright (default).
-\textsl (\slshape)
¶
--
-
Slanted.
+
-
+
\textsl (\slshape)
¶
+Slanted.
-\textsf (\sffamily)
¶
--
-
Sans serif.
+
-
+
\textsf (\sffamily)
¶
+Sans serif.
-\textsc (\scshape)
¶
--
-
Small caps.
+
-
+
\textsc (\scshape)
¶
+Small caps.
-\texttt (\ttfamily)
¶
--
-
Typewriter.
+
-
+
\texttt (\ttfamily)
¶
+Typewriter.
-\textnormal (\normalfont)
¶
--
-
Main document font.
+
-
+
\textnormal (\normalfont)
¶
+Main document font.
@@ -2749,44 +2698,44 @@ 4.2 Font styles
needed.)
-\bf
¶
+\bf
¶
-
Switch to bold face.
-\cal
¶
+\cal
¶
-
Switch to calligraphic letters for math.
-\it
¶
+\it
¶
-
Italics.
-\rm
¶
+\rm
¶
-
Roman.
-\sc
¶
+\sc
¶
-
Small caps.
-\sf
¶
+\sf
¶
-
Sans serif.
-\sl
¶
+\sl
¶
-
Slanted (oblique).
-\tt
¶
+\tt
¶
-
@@ -2804,19 +2753,19 @@
4.2 Font styles
typographic treatment, regardless of the surrounding environment.
-\mathrm
¶
+\mathrm
¶
Roman, for use in math mode.
-\mathbf
¶
+\mathbf
¶
Boldface, for use in math mode.
-\mathsf
¶
+\mathsf
¶
Sans serif, for use in math mode.
-\mathtt
¶
+\mathtt
¶
Typewriter, for use in math mode.
@@ -2825,11 +2774,11 @@ 4.2 Font styles
Italics, for use in math mode.
-\mathnormal
¶
+\mathnormal
¶
For use in math mode, e.g., inside another type style declaration.
-\mathcal
¶
+\mathcal
¶
Calligraphic letters, for use in math mode.
@@ -2864,7 +2813,7 @@ 4.2 Font styles
Next: Low-level font commands, Previous: Font styles, Up: Fonts [Contents][Index]
-4.3 Font sizes
+4.3 Font sizes ¶
@@ -2950,7 +2899,7 @@ 4.3 Font sizes
Previous: Font sizes, Up: Fonts [Contents][Index]
-4.4 Low-level font commands
+4.4 Low-level font commands ¶
@@ -2961,7 +2910,7 @@ 4.4 Low-level font comman
-\fontencoding{encoding}
¶
+\fontencoding{encoding}
¶
Select the font encoding, the encoding of the output font. There are a
large number of valid encodings. The most common are OT1
,
Knuth’s original encoding for Computer Modern (the default), and
@@ -2972,10 +2921,10 @@
4.4 Low-level font comman
https://ctan.org/pkg/encguide.
-\fontfamily{family}
¶
--
+
-
-
Select the font family. The web page
+\fontfamily{family}
¶
+Select the font family. The web page
https://tug.org/FontCatalogue/ provides one way to browse
through many of the fonts easily used with LaTeX. Here are
examples of some common families.
@@ -3006,9 +2955,9 @@
4.4 Low-level font comman
-\fontseries{series}
¶
--
-
Select the font series. A series combines a weight and a
+
-
+
\fontseries{series}
¶
+Select the font series. A series combines a weight and a
width. Typically, a font supports only a few of the possible
combinations. Some common combined series values include:
@@ -3060,9 +3009,9 @@ 4.4 Low-level font comman
(‘m
’).
-\fontshape{shape}
¶
--
-
Select font shape. Valid shapes are:
+
-
+
\fontshape{shape}
¶
+Select font shape. Valid shapes are:
n
Upright (normal)
@@ -3078,10 +3027,10 @@ 4.4 Low-level font comman
small caps are often missing as well.
-\fontsize{size}{skip}
¶
--
+
-
-
Set the font size and the line spacing. The unit of both parameters
+\fontsize{size}{skip}
¶
+Set the font size and the line spacing. The unit of both parameters
defaults to points (pt
). The line spacing is the nominal
vertical space between lines, baseline to baseline. It is stored in the
parameter \baselineskip
. The default \baselineskip
for
@@ -3091,13 +3040,13 @@
4.4 Low-level font comman
\baselinestretch
. (see \baselineskip
& \baselinestretch
).
-\linespread{factor}
¶
+\linespread{factor}
¶
Equivalent to \renewcommand{\baselinestretch}{factor}
,
and therefore must be followed by \selectfont
to have any
effect. Best specified in the preamble. See \baselineskip
& \baselinestretch
, for using setspace
package instead.
-\selectfont
¶
+\selectfont
¶
The effects of the font commands described above do not happen until
\selectfont
is called, as in
\fontfamily{familyname}\selectfont
. It is often useful
@@ -3106,7 +3055,7 @@
4.4 Low-level font comman
(see \newcommand
& \renewcommand
).
-\usefont{enc}{family}{series}{shape}
¶
+\usefont{enc}{family}{series}{shape}
¶
The same as invoking \fontencoding
, \fontfamily
,
\fontseries
and \fontshape
with the given parameters,
followed by \selectfont
. For example:
@@ -3127,7 +3076,7 @@
4.4 Low-level font comman
Next: Sectioning, Previous: Fonts, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-5 Layout
+5 Layout ¶
@@ -3150,7 +3099,7 @@ 5 Layout
Next: \twocolumn
, Up: Layout [Contents][Index]
-5.1 \onecolumn
+5.1 \onecolumn
¶
@@ -3174,7 +3123,7 @@ 5.1 \onecolumn
Next: \flushbottom
, Previous: \onecolumn
, Up: Layout [Contents][Index]
-5.2 \twocolumn
+5.2 \twocolumn
¶
@@ -3199,14 +3148,14 @@ 5.2 \twocolumn
These parameters control typesetting in two-column output:
-\columnsep
¶
+\columnsep
¶
The distance between columns. The default is 35pt. Change it with a
command such as \setlength{\columnsep}{40pt}
. You must change
it before the two column mode starts; in the preamble is a good
place.
-\columnseprule
¶
+\columnseprule
¶
The width of the rule between columns. The default is 0pt, meaning that
there is no rule. Otherwise, the rule appears halfway between the two
columns. Change it with a command such as
@@ -3214,7 +3163,7 @@
5.2 \twocolumn
mode starts.
-\columnwidth
¶
+\columnwidth
¶
The width of a single column. In one-column mode this is equal to
\textwidth
. In two-column mode by default LaTeX sets the
width of each of the two columns, \columnwidth
, to be half of
@@ -3231,7 +3180,7 @@
5.2 \twocolumn
-\dbltopfraction
¶
+\dbltopfraction
¶
The maximum fraction at the top of a two-column page that may be
occupied by two-column wide floats. The default is 0.7, meaning that
the height of a table*
or figure*
environment must not
@@ -3254,13 +3203,13 @@
5.2 \twocolumn
\renewcommand{\dbltopfraction}{0.9}
.
-\dblfloatpagefraction
¶
+\dblfloatpagefraction
¶
For a float page of two-column wide floats, this is the minimum fraction
that must be occupied by floats, limiting the amount of blank space.
LaTeX’s default is 0.5
. Change it with \renewcommand
.
-\dblfloatsep
¶
+\dblfloatsep
¶
On a float page of two-column wide floats, this length is the distance
between floats, at both the top and bottom of the page. The default is
12pt plus2pt minus2pt
for a document set at 10pt
or
@@ -3268,13 +3217,13 @@
5.2 \twocolumn
12pt
.
-\dbltextfloatsep
¶
+\dbltextfloatsep
¶
This length is the distance between a multi-column float at the top or
bottom of a page and the main text. The default is 20pt plus2pt
minus4pt
.
-\dbltopnumber
¶
+\dbltopnumber
¶
On a float page of two-column wide floats, this counter gives the
maximum number of floats allowed at the top of the page. The LaTeX
default is 2
.
@@ -3313,7 +3262,7 @@
5.2 \twocolumn
Next: \raggedbottom
, Previous: \twocolumn
, Up: Layout [Contents][Index]
-5.3 \flushbottom
+5.3 \flushbottom
¶
@@ -3344,7 +3293,7 @@ 5.3 \flushbott
Next: Page layout parameters, Previous: \flushbottom
, Up: Layout [Contents][Index]
-5.4 \raggedbottom
+5.4 \raggedbottom
¶
@@ -3365,7 +3314,7 @@ 5.4 \raggedbo
Next: \baselineskip
& \baselinestretch
, Previous: \raggedbottom
, Up: Layout [Contents][Index]
-5.5 Page layout parameters
+5.5 Page layout parameters ¶
@@ -3375,9 +3324,9 @@ 5.5 Page layout parameters
-\columnsep
¶
-\columnseprule
¶
-\columnwidth
¶
+\columnsep
¶
+\columnseprule
¶
+\columnwidth
¶
-
@@ -3387,14 +3336,14 @@
5.5 Page layout parameters
\twocolumn
.
-\headheight
¶
+\headheight
¶
-
Height of the box that contains the running head. The default in the
article
, report
, and book
classes is ‘12pt’,
at all type sizes.
-\headsep
¶
+\headsep
¶
-
Vertical distance between the bottom of the header line and the top of
the main text. The default in the article
and report
@@ -3403,7 +3352,7 @@
5.5 Page layout parameters
0.275in’.
-\footskip
¶
+\footskip
¶
-
Distance from the baseline of the last line of text to the baseline of
the page footer. The default in the article
and report
@@ -3412,7 +3361,7 @@
5.5 Page layout parameters
0.38in’, and at 12pt it is ‘30pt’.
-\linewidth
¶
+\linewidth
¶
-
Width of the current line, decreased for each nested list
(see list
). That is, the nominal value for \linewidth
is to
@@ -3421,9 +3370,9 @@
5.5 Page layout parameters
\rightmargin
(see itemize
).
-\marginparpush
¶
-\marginsep
¶
-\marginparwidth
¶
+\marginparpush
¶
+\marginsep
¶
+\marginparwidth
¶
-
@@ -3452,8 +3401,8 @@
5.5 Page layout parameters
-\oddsidemargin
¶
-\evensidemargin
¶
+\oddsidemargin
¶
+\evensidemargin
¶
-
The \oddsidemargin
length is the extra distance between the left side of
@@ -3468,21 +3417,21 @@
5.5 Page layout parameters
\evensidemargin
is the remainder.
-\paperheight
¶
+\paperheight
¶
-
The height of the paper, as distinct from the height of the print area.
Normally set with a document class option, as in
\documentclass[a4paper]{article}
(see Document class options).
-\paperwidth
¶
+\paperwidth
¶
-
The width of the paper, as distinct from the width of the print area.
Normally set with a document class option, as in
\documentclass[a4paper]{article}
(see Document class options).
-\textheight
¶
+\textheight
¶
-
The normal vertical height of the page body. If the document is set at
a nominal type size of 10pt then for an article
or report
@@ -3492,7 +3441,7 @@
5.5 Page layout parameters
36\baselineskip’ for all classes.
-\textwidth
¶
+\textwidth
¶
-
The full horizontal width of the entire page body. For an
article
or report
document, the default is ‘345pt’
@@ -3514,14 +3463,14 @@
5.5 Page layout parameters
minipage
or \parbox
.
-\hsize
¶
+\hsize
¶
-
This entry is included for completeness: \hsize
is the TeX
primitive parameter used when text is broken into lines. It should not
be used in normal LaTeX documents.
-\topmargin
¶
+\topmargin
¶
-
Space between the top of the TeX page (one inch from the top of the
paper, by default) and the top of the header. The value is computed
@@ -3530,7 +3479,7 @@
5.5 Page layout parameters
-\topskip
¶
+\topskip
¶
-
Minimum distance between the top of the page body and the baseline of
the first line of text. For the standard classes, the default is the
@@ -3547,7 +3496,7 @@
5.5 Page layout parameters
Next: Floats, Previous: Page layout parameters, Up: Layout [Contents][Index]
-5.6 \baselineskip
& \baselinestretch
+5.6 \baselineskip
& \baselinestretch
¶
@@ -3669,7 +3618,7 @@ 5.6 <
Previous: \baselineskip
& \baselinestretch
, Up: Layout [Contents][Index]
-5.7 Floats
+5.7 Floats ¶
Some typographic elements, such as figures and tables, cannot be broken
across pages. They must be typeset outside of the normal flow of text,
@@ -3732,7 +3681,7 @@
5.7 Floats
https://www.texfaq.org/FAQ-figurehere.
-p
¶
+p
¶
(Page of floats)—on a separate float page, which is a page
containing no text, only floats.
@@ -3780,26 +3729,26 @@ 5.7 Floats
\renewcommand{parameter}{decimal between 0 and 1}
):
-\bottomfraction
¶
+\bottomfraction
¶
-
The maximum fraction of the page allowed to be occupied by floats at
the bottom; default ‘.3’.
-\floatpagefraction
¶
+\floatpagefraction
¶
-
The minimum fraction of a float page that must be occupied by floats;
default ‘.5’.
-\textfraction
¶
+\textfraction
¶
-
Minimum fraction of a page that must be text; if floats take up too
much space to preserve this much text, floats will be moved to a
different page. The default is ‘.2’.
-\topfraction
¶
+\topfraction
¶
-
Maximum fraction at the top of a page that may be occupied before
floats; default ‘.7’.
@@ -3811,20 +3760,20 @@
5.7 Floats
expression}):
-\floatsep
¶
+\floatsep
¶
-
Space between floats at the top or bottom of a page; default
‘12pt plus2pt minus2pt’.
-\intextsep
¶
+\intextsep
¶
-
Space above and below a float in the middle of the main text; default
‘12pt plus2pt minus2pt’ for 10 point and 11 point documents,
and ‘14pt plus4pt minus4pt’ for 12 point documents.
-\textfloatsep
¶
+\textfloatsep
¶
-
Space between the last (first) float at the top (bottom) of a page;
default ‘20pt plus2pt minus4pt’.
@@ -3836,25 +3785,25 @@
5.7 Floats
number}):
-bottomnumber
¶
+bottomnumber
¶
-
Maximum number of floats that can appear at the bottom of a text page;
default 1.
-dbltopnumber
¶
+dbltopnumber
¶
-
Maximum number of full-sized floats that can appear at the top of a
two-column page; default 2.
-topnumber
¶
+topnumber
¶
-
Maximum number of floats that can appear at the top of a text page;
default 2.
-totalnumber
¶
+totalnumber
¶
-
Maximum number of floats that can appear on a text page; default 3.
@@ -3880,7 +3829,7 @@ 5.7 Floats
-5.7.1 \caption
+5.7.1 \caption
¶
@@ -3980,7 +3929,7 @@ 5.7.1 \caption<
Next: Cross references, Previous: Layout, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-6 Sectioning
+6 Sectioning ¶
@@ -4071,7 +4020,7 @@ 6 Sectioning
Two counters relate to the appearance of headings made by sectioning commands.
-secnumdepth
¶
+secnumdepth
¶
-
Controls which sectioning unit are numbered. Setting the counter with
@@ -4086,7 +4035,7 @@
6 Sectioning
2 in the book and report classes.
-tocdepth
¶
+tocdepth
¶
-
Controls which sectioning units are listed in the table of contents.
@@ -4111,7 +4060,7 @@
6 Sectioning
\subsubsection
, \paragraph
, \subparagraph
\appendix
\frontmatter
, \mainmatter
, \backmatter
-\@startsection
, typesetting sectional unit headings
+\@startsection
: Typesetting sectional unit headings
@@ -4119,7 +4068,7 @@ 6 Sectioning
Next: \chapter
, Up: Sectioning [Contents][Index]
-6.1 \part
+6.1 \part
¶
@@ -4196,7 +4145,7 @@ 6.1 \part
Next: \section
, Previous: \part
, Up: Sectioning [Contents][Index]
-6.2 \chapter
+6.2 \chapter
¶
@@ -4324,7 +4273,7 @@ 6.2 \chapter
Next: \subsection
, Previous: \chapter
, Up: Sectioning [Contents][Index]
-6.3 \section
+6.3 \section
¶
@@ -4406,7 +4355,7 @@ 6.3 \section
In general, to change the behavior of the \section
command, there
are a number of options. One is the \@startsection
command
-(see \@startsection
, typesetting sectional unit headings). There are also many packages on CTAN that
+(see \@startsection
: Typesetting sectional unit headings). There are also many packages on CTAN that
address this, including titlesec
. See the documentation but the
example below gives a sense of what they can do.
@@ -4431,7 +4380,7 @@ 6.3 \section
Next: \subsubsection
, \paragraph
, \subparagraph
, Previous: \section
, Up: Sectioning [Contents][Index]
-6.4 \subsection
+6.4 \subsection
¶
@@ -4498,7 +4447,7 @@ 6.4 \subsection
There are a number of ways to change the behavior of the
\subsection
command. One is the \@startsection
command
-(see \@startsection
, typesetting sectional unit headings). There are also many packages on CTAN that
+(see \@startsection
: Typesetting sectional unit headings). There are also many packages on CTAN that
address this, including titlesec
. See the documentation but the
example below gives a sense of what they can do.
@@ -4522,7 +4471,7 @@ 6.4 \subsection
Next: \appendix
, Previous: \subsection
, Up: Sectioning [Contents][Index]
-6.5 \subsubsection
, \paragraph
, \subparagraph
+6.5 \subsubsection
, \paragraph
, \subparagraph
¶
@@ -4604,7 +4553,7 @@
There are a number of ways to change the behavior of the these commands.
-One is the \@startsection
command (see \@startsection
, typesetting sectional unit headings).
+One is the \@startsection
command (see \@startsection
: Typesetting sectional unit headings).
There are also many packages on CTAN that address this, including
titlesec
. See the documentation on CTAN.
@@ -4617,7 +4566,7 @@ \frontmatter
, \mainmatter
, \backmatter
, Previous: \subsubsection
, \paragraph
, \subparagraph
, Up: Sectioning [Contents][Index]
-6.6 \appendix
+6.6 \appendix
¶
@@ -4669,9 +4618,9 @@ 6.6 \appendix
6.7 \frontmatter
, \mainmatter
, \backmatter
+6.7 \frontmatter
, \mainmatter
, \backmatter
¶
@@ -4727,7 +4676,7 @@ \frontmatter
, \mainmatter
, \backmatter
, Up: Sectioning [Contents][Index]
-6.8 \@startsection
, typesetting sectional unit headings
+6.8 \@startsection
: Typesetting sectional unit headings ¶
@@ -4741,14 +4690,14 @@ \section
or
-\subsection
.
-
Note that the titlesec
package makes manipulation of sectioning
+
The titlesec
package makes manipulation of sectioning
easier. Further, while most requirements for sectioning commands can be
satisfied with \@startsection
, some cannot. For instance, in
the standard LaTeX book
and report
classes the commands
-\chapter
and \report
are not constructed in this way. To
+\chapter
and \report
are not constructed using this. To
make such a command you may want to use the \secdef
command.
-Technically, \@startsection
has the form
+
The \@startsection
macro is used like this:
\@startsection{name}
@@ -4771,7 +4720,7 @@ \section while keeping its standard calling form
-\section*[toctitle]{title}
(in which, for reminder,
+\section*[toctitle]{title}
(in which, as a reminder,
the star *
is optional). See Sectioning. This implies
that when you write a command like
\renewcommand{\section}{...}
, the
@@ -4822,8 +4771,8 @@ 1pt plus 2pt minus 3pt
+header is not indented; if it is non-negative then the first paragraph
+is indented. (Example: the negative of 1pt plus 2pt minus 3pt
is -1pt plus -2pt minus -3pt
.)
For example, if beforeskip is -3.5ex plus -1ex minus -0.2ex
@@ -4891,7 +4840,7 @@
\normalfont\Large\bfseries.
- For
subsection
: level is 2, indent is 0pt,
-beforeskip is -3.25ex plus -1ex minus -0.2ex
,
+beforeskip is -3.25ex plus -1ex minus -0.2ex
,
afterskip is 1.5ex plus 0.2ex
, and style is
\normalfont\large\bfseries
.
@@ -4967,7 +4916,7 @@ Environments, Previous: Sectioning, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-7 Cross references
+7 Cross references ¶
@@ -5030,7 +4979,7 @@ 7 Cross references
Next: \pageref
, Up: Cross references [Contents][Index]
-7.1 \label
+7.1 \label
¶
@@ -5112,7 +5061,7 @@ 7.1 \label
Next: \ref
, Previous: \label
, Up: Cross references [Contents][Index]
-7.2 \pageref
+7.2 \pageref
¶
@@ -5152,7 +5101,7 @@ 7.2 \pageref
Next: xr
package, Previous: \pageref
, Up: Cross references [Contents][Index]
-7.3 \ref
+7.3 \ref
¶
@@ -5203,7 +5152,7 @@ 7.3 \ref
Previous: \ref
, Up: Cross references [Contents][Index]
-7.4 xr
package
+7.4 xr
package ¶
@@ -5289,12 +5238,12 @@ 7.4 xr
package
Next: Line breaking, Previous: Cross references, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-8 Environments
+8 Environments ¶
-
+
LaTeX provides many environments for delimiting certain behavior.
An environment begins with \begin
and ends with \end
,
like this:
@@ -5352,7 +5301,7 @@
8 Environments
Next: array
, Up: Environments [Contents][Index]
-8.1 abstract
+8.1 abstract
¶
@@ -5419,7 +5368,7 @@ 8.1 abstract
Next: center
, Previous: abstract
, Up: Environments [Contents][Index]
-8.2 array
+8.2 array
¶
@@ -5532,7 +5481,7 @@ 8.2 array
Next: description
, Previous: array
, Up: Environments [Contents][Index]
-8.3 center
+8.3 center
¶
@@ -5603,7 +5552,7 @@ 8.3 center
-8.3.1 \centering
+8.3.1 \centering
¶
@@ -5663,7 +5612,7 @@ 8.3.1 \center
Next: displaymath
, Previous: center
, Up: Environments [Contents][Index]
-8.4 description
+8.4 description
¶
@@ -5741,7 +5690,7 @@ 8.4 description
Next: document
, Previous: description
, Up: Environments [Contents][Index]
-8.5 displaymath
+8.5 displaymath
¶
@@ -5773,18 +5722,18 @@ 8.5 displaymath
ways in that package for having math text broken across lines.
-
The construct \[math\]
is a synonym for the environment
+
The construct \[ math \]
is a synonym for the environment
\begin{displaymath} math \end{displaymath}
but the
latter is easier to work with in the source; for instance,
searching for a square bracket may get false positives but the word
displaymath
will likely be unique.
-(Aside: The construct $$math$$
from Plain TeX is
-sometimes mistakenly used as a synonym for displaymath
. It is
+
The construct $$math$$
from Plain TeX is
+sometimes used as a synonym for LaTeX’s displaymath
. It is
not a synonym, and is not officially supported in LaTeX at all;
$$
doesn’t support the fleqn
option (see Document class options), has different vertical spacing, and doesn’t perform
-consistency checks.)
+consistency checks.
The output from this example is centered and alone on its line.
@@ -5805,7 +5754,7 @@ 8.5 displaymath
Next: enumerate
, Previous: displaymath
, Up: Environments [Contents][Index]
-8.6 document
+8.6 document
¶
@@ -5826,7 +5775,7 @@ 8.6 document
Next: \AtEndDocument
, Up: document
[Contents][Index]
-8.6.1 \AtBeginDocument
+8.6.1 \AtBeginDocument
¶
@@ -5854,7 +5803,7 @@ 8.6.1 \
Previous: \AtBeginDocument
, Up: document
[Contents][Index]
-8.6.2 \AtEndDocument
+8.6.2 \AtEndDocument
¶
@@ -5884,7 +5833,7 @@ 8.6.2 \At
Next: eqnarray
, Previous: document
, Up: Environments [Contents][Index]
-8.7 enumerate
+8.7 enumerate
¶
@@ -5983,7 +5932,7 @@ 8.7 enumerate
Next: equation
, Previous: enumerate
, Up: Environments [Contents][Index]
-8.8 eqnarray
+8.8 eqnarray
¶
@@ -6064,7 +6013,7 @@ 8.8 eqnarray
Next: figure
, Previous: eqnarray
, Up: Environments [Contents][Index]
-8.9 equation
+8.9 equation
¶
@@ -6085,7 +6034,7 @@ 8.9 equation
The equation number is generated using the equation
counter.
You should have no blank lines between \begin{equation}
and
-\begin{equation}
, or LaTeX will tell you that there is a
+\end{equation}
, or LaTeX will tell you that there is a
missing dollar sign.
@@ -6102,7 +6051,7 @@ 8.9 equation
Next: filecontents
, Previous: equation
, Up: Environments [Contents][Index]
-8.10 figure
+8.10 figure
¶
@@ -6179,7 +6128,7 @@ 8.10 figure
Next: flushleft
, Previous: figure
, Up: Environments [Contents][Index]
-8.11 filecontents
+8.11 filecontents
¶
@@ -6218,17 +6167,17 @@ 8.11 filecontentsThe possible options are:
-force
¶
+-
+
force
¶
overwrite
--
-
Overwrite an existing file.
+
Overwrite an existing file.
- noheader
¶
+noheader
¶
Omit the header. Equivalent to using filecontents*
.
-nosearch
¶
+nosearch
¶
Only check the current directory (and the output directory, if
specified) for an existing file, not the entire search path.
@@ -6277,7 +6226,7 @@ 8.11 filecontents
Next: flushright
, Previous: filecontents
, Up: Environments [Contents][Index]
-8.12 flushleft
+8.12 flushleft
¶
@@ -6328,7 +6277,7 @@ 8.12 flushleft
Up: flushleft
[Contents][Index]
-8.12.1 \raggedright
+8.12.1 \raggedright
¶
@@ -6382,7 +6331,7 @@ 8.12.1 \rag
Next: itemize
, Previous: flushleft
, Up: Environments [Contents][Index]
-8.13 flushright
+8.13 flushright
¶
@@ -6421,7 +6370,7 @@ 8.13 flushright
<
Up: flushright
[Contents][Index]
-8.13.1 \raggedleft
+8.13.1 \raggedleft
¶
@@ -6449,13 +6398,12 @@ 8.13.1 \ragg
Unlike the flushright
environment, the \raggedleft
command does not start a new paragraph; it only changes how LaTeX
-formats paragraph units. To affect a paragraph unit’s format, the
+formats paragraph units. To affect a paragraph unit’s formatting, the
scope of the declaration must contain the blank line or \end
command that ends the paragraph unit.
-For an example related to this environment, see \raggedright
,
-where one just have mutatis mutandis to replace \raggedright
by
-\raggedleft
.
+
See \raggedright
, for an example related to this environment;
+just replace \raggedright
there by \raggedleft
.
@@ -6466,7 +6414,7 @@ 8.13.1 \ragg
Next: letter
environment: writing letters, Previous: flushright
, Up: Environments [Contents][Index]
-8.14 itemize
+8.14 itemize
¶
@@ -6530,7 +6478,7 @@ 8.14 itemize
- • (bullet, from
\textbullet
)
- - -- (bold en-dash, from
\normalfont\bfseries\textendash
)
+ - -- (bold en-dash, from
\normalfont\bfseries\textendash
)
- * (asterisk, from
\textasteriskcentered
)
- . (vertically centered dot, rendered here as a period, from
\textperiodcentered
)
@@ -6586,8 +6534,9 @@ 8.14 itemize
\newenvironment{itemize*}%
{\begin{itemize}%
\setlength{\itemsep}{0pt}%
- \setlength{\parsep}{0pt}}%
- \setlength{\parskip}{0pt}}%
+ \setlength{\parsep}{0pt}%
+ \setlength{\parskip}{0pt}%
+ }%
{\end{itemize}}
@@ -6599,7 +6548,7 @@ 8.14 itemize
Next: list
, Previous: itemize
, Up: Environments [Contents][Index]
-8.15 letter
environment: writing letters
+8.15 letter
environment: writing letters ¶
@@ -6615,7 +6564,7 @@ 8.15
Next: math
, Previous: letter
environment: writing letters, Up: Environments [Contents][Index]
-8.16 list
+8.16 list
¶
@@ -6704,16 +6653,16 @@ 8.16 list
the list. Each is a length (see Lengths). The vertical spaces are
normally rubber lengths, with plus
and minus
components,
to give TeX flexibility in setting the page. Change each with a
-command such as \setlength{itemsep}{2pt plus1pt minus1pt}
.
+command such as \setlength{\itemsep}{2pt plus1pt minus1pt}
.
For some effects these lengths should be zero or negative.
-\itemindent
¶
+\itemindent
¶
Extra horizontal space indentation, beyond leftmargin
, of the
first line each item. Its default value is 0pt
.
-\itemsep
¶
+\itemsep
¶
Vertical space between items, beyond the \parsep
. The defaults
for the first three levels in LaTeX’s ‘article’, ‘book’,
and ‘report’ classes at 10 point size are: 4pt plus2pt
@@ -6726,13 +6675,13 @@ 8.16 list
\topsep
(that is, 2.5pt plus1pt minus1pt
).
-\labelsep
¶
+\labelsep
¶
Horizontal space between the label and text of an item.
The default for LaTeX’s ‘article’, ‘book’,
and ‘report’ classes is 0.5em
.
-\labelwidth
¶
+\labelwidth
¶
Horizontal width. The box containing the label is nominally this wide.
If \makelabel
returns text that is wider than this then the first
line of the item will be indented to make room for this extra material.
@@ -6754,7 +6703,7 @@
8.16 list
environment.
-\leftmargin
¶
+\leftmargin
¶
Horizontal space between the left margin of the enclosing environment
(or the left margin of the page if this is a top-level list), and the
left margin of this list. It must be non-negative.
@@ -6772,14 +6721,14 @@
8.16 list
2.2em
, and \leftmarginiii
is 1.87em
.
-\listparindent
¶
+\listparindent
¶
Horizontal space of additional line indentation, beyond
\leftmargin
, for second and subsequent paragraphs within a list
item. A negative value makes this an “outdent”. Its default value
is 0pt
.
-\parsep
¶
+\parsep
¶
Vertical space between paragraphs within an item.
The defaults for the first three levels in LaTeX’s ‘article’,
‘book’, and ‘report’ classes at 10 point size are: 4pt
@@ -6790,7 +6739,7 @@ 8.16 list
minus1pt
, and 0pt
.
-\partopsep
¶
+\partopsep
¶
Vertical space added, beyond \topsep
+\parskip
, to the top
and bottom of the entire environment if the list instance is preceded by
a blank line. (A blank line in the LaTeX source before the list
@@ -6806,13 +6755,13 @@
8.16 list
minus2pt
, and 1pt plus0pt minus1pt
.
-\rightmargin
¶
+\rightmargin
¶
Horizontal space between the right margin of the list and the right
margin of the enclosing environment. Its default value is 0pt
.
It must be non-negative.
-\topsep
¶
+\topsep
¶
Vertical space added to both the top and bottom of the list, in addition
to \parskip
(see \parindent
& \parskip
). The defaults for
the first three levels in LaTeX’s ‘article’, ‘book’, and
@@ -6829,7 +6778,7 @@
8.16 list
This shows the horizontal and vertical distances.
-
+
The lengths shown are listed below. The key relationship is that the
right edge of the bracket for h1 equals the right edge of the
@@ -6899,15 +6848,15 @@
8.16 list
page break.
-\@beginparpenalty
¶
+\@beginparpenalty
¶
The page breaking penalty for breaking before the list (default -51
).
-\@itempenalty
¶
+\@itempenalty
¶
The page breaking penalty for breaking before a list item (default -51
).
-\@endparpenalty
¶
+\@endparpenalty
¶
The page breaking penalty for breaking after a list (default -51
).
@@ -6952,7 +6901,7 @@ 8.16 list
Next: trivlist
: A restricted form of list
, Up: list
[Contents][Index]
-8.16.1 \item
: An entry in a list
+8.16.1 \item
: An entry in a list ¶
Synopsis:
@@ -7003,7 +6952,7 @@ 8.16.1
Previous: \item
: An entry in a list, Up: list
[Contents][Index]
-8.16.2 trivlist
: A restricted form of list
+8.16.2 trivlist
: A restricted form of list
¶
Synopsis:
@@ -7057,7 +7006,7 @@ 8.16.2
Next: minipage
, Previous: list
, Up: Environments [Contents][Index]
-8.17 math
+8.17 math
¶
@@ -7086,7 +7035,7 @@ 8.17 math
Next: picture
, Previous: math
, Up: Environments [Contents][Index]
-8.18 minipage
+8.18 minipage
¶
@@ -7150,12 +7099,12 @@ 8.18 minipage
vertical center lines up with the center of the adjacent text line.
-t
¶
+t
¶
Align the baseline of the top line in the minipage
with the
baseline of the surrounding text (plain TeX’s \vtop
).
-b
¶
+b
¶
Align the baseline of the bottom line in the minipage
with the
baseline of the surrounding text (plain TeX’s \vbox
).
@@ -7294,7 +7243,7 @@ 8.18 minipage
Next: quotation
& quote
, Previous: minipage
, Up: Environments [Contents][Index]
-8.19 picture
+8.19 picture
¶
@@ -7473,7 +7422,7 @@ 8.19 picture
Next: \multiput
, Up: picture
[Contents][Index]
-8.19.1 \put
+8.19.1 \put
¶
@@ -7505,7 +7454,7 @@ 8.19.1 \put
<
Next: \qbezier
, Previous: \put
, Up: picture
[Contents][Index]
-8.19.2 \multiput
+8.19.2 \multiput
¶
@@ -7541,7 +7490,7 @@ 8.19.2 \multip
Next: \graphpaper
, Previous: \multiput
, Up: picture
[Contents][Index]
-8.19.3 \qbezier
+8.19.3 \qbezier
¶
@@ -7597,7 +7546,7 @@ 8.19.3 \qbezier
Next: \line
, Previous: \qbezier
, Up: picture
[Contents][Index]
-8.19.4 \graphpaper
+8.19.4 \graphpaper
¶
Synopsis:
@@ -7636,7 +7585,7 @@
8.19.4 \grap
Next: \linethickness
, Previous: \graphpaper
, Up: picture
[Contents][Index]
-8.19.5 \line
+8.19.5 \line
¶
@@ -7714,7 +7663,7 @@ 8.19.5 \line
Next: \thinlines
, Previous: \line
, Up: picture
[Contents][Index]
-8.19.6 \linethickness
+8.19.6 \linethickness
¶
@@ -7738,7 +7687,7 @@ 8.19.6 \l
Next: \thicklines
, Previous: \linethickness
, Up: picture
[Contents][Index]
-8.19.7 \thinlines
+8.19.7 \thinlines
¶
@@ -7755,7 +7704,7 @@ 8.19.7 \thinl
Next: \circle
, Previous: \thinlines
, Up: picture
[Contents][Index]
-8.19.8 \thicklines
+8.19.8 \thicklines
¶
@@ -7772,7 +7721,7 @@ 8.19.8 \thic
Next: \oval
, Previous: \thicklines
, Up: picture
[Contents][Index]
-8.19.9 \circle
+8.19.9 \circle
¶
@@ -7804,7 +7753,7 @@ 8.19.9 \circle
Next: \shortstack
, Previous: \circle
, Up: picture
[Contents][Index]
-8.19.10 \oval
+8.19.10 \oval
¶
@@ -7860,7 +7809,7 @@ 8.19.10 \oval
Next: \vector
, Previous: \oval
, Up: picture
[Contents][Index]
-8.19.11 \shortstack
+8.19.11 \shortstack
¶
@@ -7927,7 +7876,7 @@ 8.19.11 \sho
Next: \makebox
(picture), Previous: \shortstack
, Up: picture
[Contents][Index]
-8.19.12 \vector
+8.19.12 \vector
¶
@@ -7961,7 +7910,7 @@ 8.19.12 \vector<
Next: \framebox
(picture), Previous: \vector
, Up: picture
[Contents][Index]
-8.19.13 \makebox
(picture)
+8.19.13 \makebox
(picture) ¶
@@ -8018,7 +7967,7 @@ 8.19.13
Next: \frame
, Previous: \makebox
(picture), Up: picture
[Contents][Index]
-8.19.14 \framebox
(picture)
+8.19.14 \framebox
(picture) ¶
@@ -8069,7 +8018,7 @@ 8.19.14
Next: \dashbox
, Previous: \framebox
(picture), Up: picture
[Contents][Index]
-8.19.15 \frame
+8.19.15 \frame
¶
@@ -8093,7 +8042,7 @@ 8.19.15 \frame
Previous: \frame
, Up: picture
[Contents][Index]
-8.19.16 \dashbox
+8.19.16 \dashbox
¶
@@ -8138,7 +8087,7 @@ 8.19.16 \dashbo
Next: tabbing
, Previous: picture
, Up: Environments [Contents][Index]
-8.20 quotation
& quote
+8.20 quotation
& quote
¶
@@ -8194,7 +8143,7 @@ 8.20 quotati
Next: table
, Previous: quotation
& quote
, Up: Environments [Contents][Index]
-8.21 tabbing
+8.21 tabbing
¶
@@ -8275,44 +8224,44 @@ 8.21 tabbing
They are all fragile (see \protect
).
-\\ (tabbing)
¶
+\\ (tabbing)
¶
End a tabbed line and typeset it.
-\= (tabbing)
¶
+\= (tabbing)
¶
Sets a tab stop at the current position.
-\> (tabbing)
¶
+\> (tabbing)
¶
-
Advances to the next tab stop.
-\<
¶
+\<
¶
Put following text to the left of the local margin (without changing
the margin). Can only be used at the start of the line.
-\+
¶
+\+
¶
Moves the left margin of the next and all the
following commands one tab stop to the right, beginning tabbed line if
necessary.
-\-
¶
+\-
¶
Moves the left margin of the next and all the
following commands one tab stop to the left, beginning tabbed line if
necessary.
-\' (tabbing)
¶
+\' (tabbing)
¶
Moves everything that you have typed so far in the current column, i.e.,
everything from the most recent \>
, \<
, \'
,
\\
, or \kill
command, to the previous column and aligned
to the right, flush against the current column’s tab stop.
-\` (tabbing)
¶
+\` (tabbing)
¶
Allows you to put text flush right against any tab stop, including tab
stop 0. However, it can’t move text to the right of the last
column because there’s no tab stop there. The \`
command moves
@@ -8323,7 +8272,7 @@
8.21 tabbing
\end{tabbing}
command that ends the line.
-\a (tabbing)
¶
+\a (tabbing)
¶
-
@@ -8332,24 +8281,24 @@
8.21 tabbing
use the commands \a=
, \a'
and \a`
.
-\kill
¶
+\kill
¶
Sets tab stops without producing text. Works just like \\
except
that it throws away the current line instead of producing output for it.
Any \=
, \+
or \-
commands in that line remain in
effect.
-\poptabs
¶
+\poptabs
¶
-
Restores the tab stop positions saved by the last \pushtabs
.
-\pushtabs
¶
+\pushtabs
¶
Saves all current tab stop positions. Useful for temporarily changing
tab stop positions in the middle of a tabbing
environment.
-\tabbingsep
¶
+\tabbingsep
¶
Distance of the text moved by \'
to left of current tab stop.
@@ -8383,14 +8332,16 @@ 8.21 tabbing
+
+
+
+
+
-
-
-
This example is just for illustration of the environment. To actually
typeset computer code in typewriter like this, a verbatim environment
(see verbatim
) would normally be best. For pretty-printed code,
@@ -8405,7 +8356,7 @@
8.21 tabbing
Next: tabular
, Previous: tabbing
, Up: Environments [Contents][Index]
-8.22 table
+8.22 table
¶
@@ -8482,7 +8433,7 @@ 8.22 table
Next: thebibliography
, Previous: table
, Up: Environments [Contents][Index]
-8.23 tabular
+8.23 tabular
¶
@@ -8674,25 +8625,25 @@ 8.23 tabular
Parameters that control formatting:
-\arrayrulewidth
¶
+\arrayrulewidth
¶
A length that is the thickness of the rule created by |
,
\hline
, and \vline
in the tabular
and array
environments. The default is ‘.4pt’. Change it as in
\setlength{\arrayrulewidth}{0.8pt}
.
-\arraystretch
¶
+\arraystretch
¶
A factor by which the spacing between rows in the tabular
and
array
environments is multiplied. The default is ‘1’, for
no scaling. Change it as \renewcommand{\arraystretch}{1.2}
.
-\doublerulesep
¶
+\doublerulesep
¶
A length that is the distance between the vertical rules produced by the
||
specifier. The default is ‘2pt’.
-\tabcolsep
¶
+\tabcolsep
¶
A length that is half of the space between columns. The default is
‘6pt’. Change it with \setlength
.
@@ -8717,7 +8668,7 @@ 8.23 tabular
Next: \vline
, Up: tabular
[Contents][Index]
-8.23.1 \multicolumn
+8.23.1 \multicolumn
¶
@@ -8820,7 +8771,7 @@ 8.23.1 \mul
Next: \cline
, Previous: \multicolumn
, Up: tabular
[Contents][Index]
-8.23.2 \vline
+8.23.2 \vline
¶
Draw a vertical line in a tabular
or array
environment
@@ -8858,7 +8809,7 @@
8.23.2 \vline
Next: \hline
, Previous: \vline
, Up: tabular
[Contents][Index]
-8.23.3 \cline
+8.23.3 \cline
¶
@@ -8893,7 +8844,7 @@ 8.23.3 \cline
Previous: \cline
, Up: tabular
[Contents][Index]
-8.23.4 \hline
+8.23.4 \hline
¶
@@ -8923,7 +8874,7 @@ 8.23.4 \hline
Next: theorem
, Previous: tabular
, Up: Environments [Contents][Index]
-8.24 thebibliography
+8.24 thebibliography
¶
@@ -9007,7 +8958,7 @@ 8.24 thebibliograp
Next: \cite
, Up: thebibliography
[Contents][Index]
-8.24.1 \bibitem
+8.24.1 \bibitem
¶
@@ -9084,7 +9035,7 @@ 8.24.1 \bibitem
Next: \nocite
, Previous: \bibitem
, Up: thebibliography
[Contents][Index]
-8.24.2 \cite
+8.24.2 \cite
¶
@@ -9150,7 +9101,7 @@ 8.24.2 \cite
Next: Using BibTeX, Previous: \cite
, Up: thebibliography
[Contents][Index]
-8.24.3 \nocite
+8.24.3 \nocite
¶
@@ -9176,7 +9127,7 @@ 8.24.3 \nocite
Previous: \nocite
, Up: thebibliography
[Contents][Index]
-8.24.4 Using BibTeX
+8.24.4 Using BibTeX ¶
@@ -9267,7 +9218,7 @@ 8.24.4 Using BibTeX
Up: Using BibTeX [Contents][Index]
-8.24.4.1 BibTeX error messages
+8.24.4.1 BibTeX error messages ¶
@@ -9284,17 +9235,17 @@ 8.24.4.1 BibTeX error mes
errors, and the corresponding user-level commands.
-\bibdata
¶
+\bibdata
¶
-
\bibliography
-\bibstyle
¶
+\bibstyle
¶
-
\bibliographystyle
-\citation
¶
+\citation
¶
-
\cite
, \nocite
@@ -9318,7 +9269,7 @@
8.24.4.1 BibTeX error mes
Next: titlepage
, Previous: thebibliography
, Up: Environments [Contents][Index]
-8.25 theorem
+8.25 theorem
¶
@@ -9370,7 +9321,7 @@ 8.25 theorem
Next: verbatim
, Previous: theorem
, Up: Environments [Contents][Index]
-8.26 titlepage
+8.26 titlepage
¶
@@ -9426,7 +9377,7 @@ 8.26 titlepage
Next: verse
, Previous: titlepage
, Up: Environments [Contents][Index]
-8.27 verbatim
+8.27 verbatim
¶
@@ -9480,11 +9431,11 @@ 8.27 verbatim
-
One common use of verbatim input is to typeset computer code. There are
-packages that are an improvement the verbatim
environment. For
-instance, one improvement is to allow the verbatim inclusion of external
-files, or parts of those files. Such packages include listings
,
-and minted
.
+
One common use of verbatim input is to typeset computer code. Some
+packages offer many features not provided by the verbatim
+environment; two of the most popular are listings
and
+minted
. For example, they are capable of pretty-printing,
+line numbering, and selecting parts of files for a continuing listing.
@@ -9495,7 +9446,10 @@ 8.27 verbatim
A package that provides many more options for verbatim environments is
fancyvrb
. Another is verbatimbox
.
-For a list of all the relevant packages, see CTAN (see CTAN: The Comprehensive TeX Archive Network).
+
For a list of all the relevant packages, see CTAN (see CTAN: The Comprehensive TeX Archive Network),
+particularly the topics listing
+(https://ctan.org/topic/listing) and verbatim
+(https://ctan.org/topic/verbatim).
@@ -9508,7 +9462,7 @@ 8.27 verbatim
Up: verbatim
[Contents][Index]
-8.27.1 \verb
+8.27.1 \verb
¶
@@ -9561,15 +9515,6 @@ 8.27.1 \verb
\verb
command, since
it allows line breaks.
-
-
-
-
-
-
-
For computer code there are many packages with advantages over
-\verb
. One is listings
, another is minted
.
-
@@ -9591,7 +9536,7 @@ 8.27.1 \verb
Previous: verbatim
, Up: Environments [Contents][Index]
-8.28 verse
+8.28 verse
¶
@@ -9647,7 +9592,7 @@ 8.28 verse
Next: Page breaking, Previous: Environments, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-9 Line breaking
+9 Line breaking ¶
@@ -9673,10 +9618,11 @@ 9 Line breaking
\obeycr
& \restorecr
\newline
\-
(discretionary hyphen)
-\discretionary
(generalized hyphenation point)
-\fussy
& \sloppy
-\hyphenation
-\linebreak
& \nolinebreak
+\slash
: breakable ‘/’
+\discretionary
(generalized hyphenation point)
+\fussy
& \sloppy
+\hyphenation
+\linebreak
& \nolinebreak
@@ -9684,7 +9630,7 @@ 9 Line breaking
Next: \obeycr
& \restorecr
, Up: Line breaking [Contents][Index]
-9.1 \\
+9.1 \\
¶
@@ -9770,7 +9716,7 @@ 9.1 \\
Next: \newline
, Previous: \\
, Up: Line breaking [Contents][Index]
-9.2 \obeycr
& \restorecr
+9.2 \obeycr
& \restorecr
¶
@@ -9825,7 +9771,7 @@ 9.2 \-
(discretionary hyphen), Previous: \obeycr
& \restorecr
, Up: Line breaking [Contents][Index]
-9.3 \newline
+9.3 \newline
¶
@@ -9860,9 +9806,9 @@ 9.3 \newline
-9.4 \-
(discretionary hyphen)
+9.4 \-
(discretionary hyphen) ¶
@@ -9903,14 +9849,37 @@ 9.4
+
+
+
+9.5 \slash
: breakable ‘/’ ¶
+
+
+
+
+The \slash
command produces a ‘/’ character and then a
+penalty of the same value as an explicit ‘-’ character
+(\exhyphenpenalty
). This allows TeX to break a line at the
+‘/’, similar to a hyphen. Hyphenation is allowed in the word part
+preceding the ‘/’, but not after. For example:
+
+
+The input\slash output of the program is complicated.
+
+
+
+
9.5 \discretionary
(generalized hyphenation point)
+9.6 \discretionary
(generalized hyphenation point) ¶
@@ -9947,7 +9916,7 @@ \hyphenation
, Previous: \discretionary
(generalized hyphenation point), Up: Line breaking [Contents][Index]
-
-9.6 \fussy
& \sloppy
+9.7 \fussy
& \sloppy
¶
@@ -9976,7 +9945,7 @@ 9.6 \fussy
& \sloppy
[Contents][Index]
-9.6.1 sloppypar
+9.7.1 sloppypar
¶
@@ -10020,7 +9989,7 @@ 9.6.1 sloppypar
Next: \linebreak
& \nolinebreak
, Previous: \fussy
& \sloppy
, Up: Line breaking [Contents][Index]
-9.7 \hyphenation
+9.8 \hyphenation
¶
@@ -10033,7 +10002,7 @@ 9.7 \hyphenati
Declares allowed hyphenation points within the words in the list. The
words in that list are separated by spaces. Show permitted points for
-hyphenation with a dash character, -
.
+hyphenation with an ASCII dash character, -
.
Here is an example:
@@ -10042,7 +10011,7 @@ 9.7 \hyphenati
Use lowercase letters. TeX will only hyphenate if the word matches
-exactly, no inflections are tried. Multiple \hyphenation
+exactly; no inflections are tried. Multiple \hyphenation
commands accumulate.
@@ -10054,7 +10023,7 @@ 9.7 \hyphenati
Previous: \hyphenation
, Up: Line breaking [Contents][Index]
-9.8 \linebreak
& \nolinebreak
+9.9 \linebreak
& \nolinebreak
¶
@@ -10105,7 +10074,7 @@ 9.8
Next: Footnotes, Previous: Line breaking, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-10 Page breaking
+10 Page breaking ¶
@@ -10154,7 +10123,7 @@ 10 Page breaking
Next: \newpage
, Up: Page breaking [Contents][Index]
-10.1 \clearpage
& \cleardoublepage
+10.1 \clearpage
& \cleardoublepage
¶
@@ -10217,7 +10186,7 @@ 10.1
Next: \enlargethispage
, Previous: \clearpage
& \cleardoublepage
, Up: Page breaking [Contents][Index]
-10.2 \newpage
+10.2 \newpage
¶
@@ -10266,7 +10235,7 @@ 10.2 \newpage
Next: \pagebreak
& \nopagebreak
, Previous: \newpage
, Up: Page breaking [Contents][Index]
-10.3 \enlargethispage
+10.3 \enlargethispage
¶
@@ -10305,7 +10274,7 @@ 10.3 \enla
Previous: \enlargethispage
, Up: Page breaking [Contents][Index]
-10.4 \pagebreak
& \nopagebreak
+10.4 \pagebreak
& \nopagebreak
¶
@@ -10360,11 +10329,10 @@ 10.4
-(There is an obsolete declaration \samepage
, which tries to only
-allow a break between two paragraphs. There is a related environment
-samepage
, also obsolete. Neither of these work reliably. For
-more on keeping material on the same page, see the FAQ entry
-https://texfaq.org/FAQ-nopagebrk.)
+
A declaration \samepage
and corresponding samepage
+environment try to only allow breaks between paragraphs. They are not
+perfectly reliable. For more on keeping material on the same page,
+see the FAQ entry https://texfaq.org/FAQ-nopagebrk.)
@@ -10375,7 +10343,7 @@ 10.4
Next: Definitions, Previous: Page breaking, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-11 Footnotes
+11 Footnotes ¶
@@ -10414,7 +10382,7 @@ 11 Footnotes
Next: \footnotemark
, Up: Footnotes [Contents][Index]
-11.1 \footnote
+11.1 \footnote
¶
@@ -10425,7 +10393,8 @@ 11.1 \footnotenumber]{text}
-Place a footnote text at the bottom of the current page.
+
Place a footnote text at the bottom of the current page, with a
+footnote marker at the current position in the text.
There are over a thousand footnotes in Gibbon's
@@ -10456,22 +10425,26 @@ 11.1 \footnote
-\footnoterule
¶
+\footnoterule
¶
Produces the rule separating the main text on a page from the page’s
footnotes. Default dimensions in the standard document classes (except
-slides
, where it does not appear) is: vertical thickness of
+slides
, where it does not appear) are: vertical thickness of
0.4pt
, and horizontal size of 0.4\columnwidth
long.
Change the rule with something like this.
-\renewcommand{\footnoterule}{% Kerns avoid vertical space
+% \footnoterule is expanded in vertical mode, thus \kern
+% commands ensure that no vertical space is created,
+% and the rule is separated vertically with 2pt
+% above the note text.
+\renewcommand*{\footnoterule}{%
\kern -3pt % This -3 is negative
\hrule width \textwidth height 1pt % of the sum of this 1
\kern 2pt} % and this 2
-\footnotesep
¶
+\footnotesep
¶
-
The height of the strut placed at the beginning of the footnote
(see \strut
). By default, this is set to the normal strut for
@@ -10507,7 +10480,7 @@
11.1 \footnote
Next: \footnotetext
, Previous: \footnote
, Up: Footnotes [Contents][Index]
-11.2 \footnotemark
+11.2 \footnotemark
¶
@@ -10538,8 +10511,8 @@ 11.2 \footnot
If there are intervening footnotes then you must remember the value of
the number of the common mark. This example gives the same
institutional affiliation to both the first and third authors
-(\thanks
is a version of \footnote
), by-hand giving the
-number of the footnote.
+(\thanks
is a version of \footnote
), by explicitly
+specifying the number of the footnote (‘1’).
\title{A Treatise on the Binomial Theorem}
@@ -10550,19 +10523,6 @@ 11.2 \footnot
\maketitle
-This uses a counter to remember the footnote number. The third sentence
-is followed by the same footnote marker as the first.
-
-
-\newcounter{footnoteValueSaver}
-All babies are illogical.\footnote{%
- Lewis Carroll.}\setcounter{footnoteValueSaver}{\value{footnote}}
-Nobody is despised who can manage a crocodile.\footnote{%
- Captain Hook.}
-Illogical persons are despised.\footnotemark[\value{footnoteValueSaver}]
-Therefore, anyone who can manage a crocodile is not a baby.
-
-
@@ -10585,6 +10545,19 @@ 11.2 \footnot
It will work with the package hyperref
.
+This uses a counter to remember the footnote number. The third sentence
+is followed by the same footnote marker as the first.
+
+
+\newcounter{footnoteValueSaver}
+All babies are illogical.\footnote{%
+ Lewis Carroll.}\setcounter{footnoteValueSaver}{\value{footnote}}
+Nobody is despised who can manage a crocodile.\footnote{%
+ Captain Hook.}
+Illogical persons are despised.\footnotemark[\value{footnoteValueSaver}]
+Therefore, anyone who can manage a crocodile is not a baby.
+
+
@@ -10593,7 +10566,7 @@ 11.2 \footnot
Next: Footnotes in section headings, Previous: \footnotemark
, Up: Footnotes [Contents][Index]
-11.3 \footnotetext
+11.3 \footnotetext
¶
@@ -10621,7 +10594,7 @@ 11.3 \footnot
Next: Footnotes in a table, Previous: \footnotetext
, Up: Footnotes [Contents][Index]
-11.4 Footnotes in section headings
+11.4 Footnotes in section headings ¶
@@ -10636,7 +10609,7 @@ 11.4 Footnotes in secti
section starts, as usual, but also at the bottom of the table of
contents, where it is not likely to be desired. The simplest way
to have it not appear on the table of contents is to use the optional
-argument to \section
+argument to \section
.
\section[Please]{Please\footnote{%
@@ -10654,7 +10627,7 @@ 11.4 Footnotes in secti
Next: Footnotes of footnotes, Previous: Footnotes in section headings, Up: Footnotes [Contents][Index]
-11.5 Footnotes in a table
+11.5 Footnotes in a table ¶
@@ -10705,7 +10678,7 @@ 11.5 Footnotes in a table
Little is known other than her death.}%
\stepcounter{mpFootnoteValueSaver}%
\footnotetext[\value{mpFootnoteValueSaver}]{%
- Relationship is unresolved in XXI.}
+ Relationship is unresolved.}
\end{center}
@@ -10742,7 +10715,7 @@ 11.5 Footnotes in a table
Previous: Footnotes in a table, Up: Footnotes [Contents][Index]
-11.6 Footnotes of footnotes
+11.6 Footnotes of footnotes ¶
@@ -10773,7 +10746,7 @@ 11.6 Footnotes of footnotes
Next: Counters, Previous: Footnotes, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-12 Definitions
+12 Definitions ¶
@@ -10794,7 +10767,8 @@ 12 Definitions
\newfont
\protect
\ignorespaces & \ignorespacesafterend
-- xspace package
+xspace
package
+- Class and package commands
@@ -10802,7 +10776,7 @@ 12 Definitions
Next: \providecommand
, Up: Definitions [Contents][Index]
-12.1 \newcommand
& \renewcommand
+12.1 \newcommand
& \renewcommand
¶
@@ -10823,7 +10797,7 @@ 12.1 cmd}[nargs][optargdefault]{defn}
-or all the same possibilities with \renewcommand
instead of
+
or the same six possibilities with \renewcommand
instead of
\newcommand
:
@@ -10835,17 +10809,16 @@ 12.1 cmd}[nargs][optargdefault]{defn}
-
Define or redefine a command (see also \DeclareRobustCommand
in
Class and package commands).
-
+
The starred form of these two forbids the arguments from containing
-multiple paragraphs of text (in plain TeX terms: the commands
-are not \long
). With the default form, arguments can be
-multiple paragraphs.
+multiple paragraphs of text (i.e., a \par
token; in plain
+TeX terms: the commands are not \long
). With the default
+form, arguments can be multiple paragraphs.
These are the parameters (examples follow):
@@ -10865,9 +10838,9 @@ 12.1
-- optargdefault ¶
--
-
Optional; if this argument is present then the first argument of
+
-
+optargdefault ¶
+Optional; if this argument is present then the first argument of
\cmd
is optional, with default value optargdefault
(which may be the empty string). If optargdefault is not present
then \cmd
does not take an optional argument.
@@ -10899,7 +10872,7 @@
12.1
-- defn ¶
+- defn ¶
Required; the text to be substituted for every occurrence of
\cmd
. The parameters #1
, #2
,
…, #nargs
are replaced by the values supplied when
@@ -10991,7 +10964,7 @@
12.1
Up: \newcommand
& \renewcommand
[Contents][Index]
-12.1.1 Control sequence, control word and control symbol
+12.1.1 Control sequence, control word and control symbol ¶
@@ -11040,7 +11013,7 @@ \makeatletter
& \makeatother
, Previous: \newcommand
& \renewcommand
, Up: Definitions [Contents][Index]
-12.2 \providecommand
+12.2 \providecommand
¶
@@ -11084,7 +11057,7 @@ 12.2 \provi
Next: \@ifstar
, Previous: \providecommand
, Up: Definitions [Contents][Index]
-12.3 \makeatletter
& \makeatother
+12.3 \makeatletter
& \makeatother
¶
@@ -11153,7 +11126,7 @@ 12.3
Next: \newcounter
: Allocating a counter, Previous: \makeatletter
& \makeatother
, Up: Definitions [Contents][Index]
-12.4 \@ifstar
+12.4 \@ifstar
¶
@@ -11254,7 +11227,7 @@ 12.4 \@ifstar<
Next: \newlength
, Previous: \@ifstar
, Up: Definitions [Contents][Index]
-12.5 \newcounter
: Allocating a counter
+12.5 \newcounter
: Allocating a counter ¶
@@ -11312,7 +11285,7 @@ 12.5
Next: \newsavebox
, Previous: \newcounter
: Allocating a counter, Up: Definitions [Contents][Index]
-12.6 \newlength
+12.6 \newlength
¶
@@ -11353,7 +11326,7 @@ 12.6 \newlength<
Next: \newenvironment
& \renewenvironment
, Previous: \newlength
, Up: Definitions [Contents][Index]
-12.7 \newsavebox
+12.7 \newsavebox
¶
@@ -11395,7 +11368,7 @@ 12.7 \newsavebo
Next: \newtheorem
, Previous: \newsavebox
, Up: Definitions [Contents][Index]
-12.8 \newenvironment
& \renewenvironment
+12.8 \newenvironment
& \renewenvironment
¶
@@ -11567,7 +11540,7 @@ 12
Next: \newfont
, Previous: \newenvironment
& \renewenvironment
, Up: Definitions [Contents][Index]
-12.9 \newtheorem
+12.9 \newtheorem
¶
@@ -11711,7 +11684,7 @@ 12.9 \newtheore
Next: \protect
, Previous: \newtheorem
, Up: Definitions [Contents][Index]
-12.10 \newfont
+12.10 \newfont
¶
@@ -11760,7 +11733,7 @@ 12.10 \newfont
Next: \ignorespaces & \ignorespacesafterend
, Previous: \newfont
, Up: Definitions [Contents][Index]
-12.11 \protect
+12.11 \protect
¶
@@ -11768,20 +11741,16 @@ 12.11 \protectAll LaTeX commands are either fragile or robust. A
fragile command can break when it is used in the argument to certain
-other commands. Commands that contain data that LaTeX writes to an
-auxiliary file and re-reads later are fragile. This includes material
-that goes into a table of contents, list of figures, list of tables,
-etc. Fragile commands also include line breaks, any command that has an
-optional argument, and many more. To prevent such commands from
-breaking, one solution is to preceded them with the command
-\protect
.
+other commands, typically those that write material to the table of
+contents, the cross-reference file, etc. To prevent fragile
+commands from causing errors, one solution is to precede them with the
+command \protect
.
For example, when LaTeX runs the \section{section
name}
command it writes the section name text to the
.aux auxiliary file, moving it there for use elsewhere in the
-document such as in the table of contents. Any argument that is
-internally expanded by LaTeX without typesetting it directly is
-referred to as a
+document such as in the table of contents. Such an argument that is
+used in multiple places is referred to as a
moving argument. A command is fragile if it can
expand during this process into invalid TeX code. Some examples of
@@ -11791,47 +11760,65 @@
12.11 \protectarray
environments (see tabular
).
If you get strange errors from commands used in moving arguments, try
-preceding it with \protect
. Every fragile commands must be
+preceding it with \protect
. Each fragile command must be
protected with their own \protect
.
Although usually a \protect
command doesn’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.
+commands such as \parindent
should not be preceded by a
+\protect
command (see Lengths. Nor can a \protect
+command be used in the argument to \addtocounter
or
+\setcounter
command (see \setcounter
and
+\addtocounter
. These commands are already robust.
-In this example the \caption
command gives a mysterious error
-about an extra curly brace. Fix the problem by preceding each
-\raisebox
command with \protect
.
+
As of the October 2019 release of LaTeX
+(https://www.latex-project.org/news/latex2e-news/ltnews30.pdf),
+most commands that had been previously fragile were fixed to be
+robust. For example, any command taking an optional argument, such as
+\root
or \raisebox
, was fragile, but is now
+robust. Similarly, \(...\)
math was fragile and is now robust
+($...$
has always been robust).
+
+
+Perhaps the most commonly used remaining fragile command is
+\verb
; for example,
\begin{figure}
...
- \caption{Company headquarters of A\raisebox{1pt}{B}\raisebox{-1pt}{C}}
+ \caption{This \verb|\command| causes an error.}
\end{figure}
-In the next example the \tableofcontents
command gives an error
-because the \(..\)
in the section title expands to illegal TeX
-in the .toc file. You can solve this by changing \(..\)
-to \protect\(..\protect\)
.
+
Adding \protect
does not help here. It’s usually feasible to
+rewrite the caption (or section heading or whatever) to use
+\texttt
, often the simplest solution.
+
+
+
+
+
+Alternatively, to use \verb
, you can apply the
+\cprotect
command from cprotect
package
+(https://ctan.org/pkg/cprotect) to the \caption
:
-\begin{document}
-\tableofcontents
-...
-\section{Einstein's \( e=mc^2 \)}
-...
+\cprotect\caption{This \verb|\command| is ok with \verb|\cprotect|.}
+
+\cprotect
also allows use of \begin...\end
environments
+in moving arguments, where they are normally not allowed, via a
+similar prefix command \cprotEnv
.
+
12.12 \ignorespaces & \ignorespacesafterend
+12.12 \ignorespaces & \ignorespacesafterend
¶
@@ -11929,9 +11916,9 @@
12.13 xspace package
+12.13 xspace
package ¶
@@ -11940,7 +11927,7 @@ 12.13 xspace package
-Synopsis:
+
This is an add-on package, not part of core LaTeX. Synopsis:
\usepackage{xspace}
@@ -11952,15 +11939,15 @@ 12.13 xspace package
adds a space unless the command is followed by certain punctuation
characters.
-After a command control sequence that is a control word (see Control sequence, control word and control symbol, as opposed to control symbols such as \$
), TeX
-gobbles blank characters. Thus, in the first sentence below, the output
-has ‘Vermont’ placed snugly against the period, without any
-intervening space.
+
After a control sequence that is a control word (see Control sequence, control word and control symbol, as opposed to control symbols such as \$
), TeX
+gobbles blank characters. Thus, in the first sentence below, the
+output has ‘Vermont’ placed snugly against the period, without
+any intervening space, despite the space in the input.
\newcommand{\VT}{Vermont}
Our college is in \VT .
-The \VT{} summers are nice.
+\VT{} summers are nice.
But because of the gobbling, the second sentence needs the empty curly
@@ -11982,2094 +11969,2893 @@
12.13 xspace package
The default exception list contains the characters ,.'/?;:!~-)
,
the open curly brace and the backslash-space command discussed above,
-and the commands \footnote
or \footnotemark
. Add to that
-list as with \xspaceaddexceptions{\myfni \myfnii}
which adds
-\myfni
and \myfnii
to the list, and remove from that
-list as with \xspaceremoveexception{!}
.
+and the commands \footnote
or \footnotemark
. You can
+add to that list as with \xspaceaddexceptions{\myfni \myfnii}
+which adds \myfni
and \myfnii
to the list; and you
+can remove from that list as with \xspaceremoveexception{!}
.
A comment: many experts prefer not to use \xspace
. Putting it in
a definition means that the command will usually get the spacing right.
But it isn’t easy to predict when to enter empty braces because
\xspace
will get it wrong, such as when it is followed by another
command, and so \xspace
can make editing material harder and more
-error-prone than instead always inserting the empty braces.
+error-prone than instead of always inserting the empty braces.
-
-
-
+
13 Counters
-
-
-
+12.14 Class and package commands ¶
-Everything LaTeX numbers for you has a counter associated with
-it. The name of the counter is often the same as the name of the
-environment or command associated with the number, except that the
-counter’s name has no backslash \
. Thus, associated with
-the \chapter
command is the chapter
counter that keeps
-track of the chapter number.
-
-Below is a list of the counters used in LaTeX’s standard document
-classes to control numbering.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-part paragraph figure enumi
-chapter subparagraph table enumii
-section page footnote enumiii
-subsection equation mpfootnote enumiv
-subsubsection
-
+
+
+
-The mpfootnote
counter is used by the \footnote
command
-inside of a minipage (see minipage
). The counters enumi
-through enumiv
are used in the enumerate
environment, for
-up to four levels of nesting (see enumerate
).
-
-Counters can have any integer value but they are typically positive.
-
-New counters are created with \newcounter
. See \newcounter
: Allocating a counter.
+
These are commands designed to help writers of classes or packages.
-
-
-\alph \Alph \arabic \roman \Roman \fnsymbol
: Printing counters
-\usecounter
-\value
-\setcounter
-\addtocounter
-\refstepcounter
-\stepcounter
-\day
& \month
& \year
+\AtBeginDvi
& \AtEndDvi
+\AtEndOfClass
& \AtEndOfPackage
+\CheckCommand
+\ClassError
and \PackageError
and others
+\CurrentOption
+\DeclareOption
+\DeclareRobustCommand
+\ExecuteOptions
+\IfFileExists
& \InputIfFileExists
+\LoadClass
& \LoadClassWithOptions
+\NeedsTeXFormat
+\OptionNotUsed
+\PassOptionsToClass
& \PassOptionsToPackage
+\ProcessOptions
+\ProvidesClass
& \ProvidesPackage
+\ProvidesFile
+\RequirePackage
& \RequirePackageWithOptions
-
+
13.1 \alph \Alph \arabic \roman \Roman \fnsymbol
: Printing counters
+12.14.1 \AtBeginDvi
& \AtEndDvi
¶
-
+
+
-Print the value of a counter, in a specified style. For instance, if
-the counter counter has the value 1 then a
-\alph{counter}
in your source will result in a lowercase
-letter a appearing in the output.
-
-All of these commands take a single counter as an argument, for
-instance, \alph{enumi}
. Note that the counter name does not
-start with a backslash.
-
-
-\alph{counter}
¶
-Print the value of counter in lowercase letters: ‘a’, ‘b’,
-... If the counter’s value is less than 1 or more than 26 then
-you get ‘LaTeX Error: Counter too large.’
-
-
-\Alph{counter}
¶
-Print in uppercase letters: ‘A’, ‘B’, ... If the counter’s value
-is less than 1 or more than 26 then you get ‘LaTeX Error: Counter
-too large.’
-
-
-\arabic{counter}
¶
-Print in Arabic numbers such as ‘5’ or ‘-2’.
-
-
-\roman{counter}
¶
-Print in lowercase roman numerals: ‘i’, ‘ii’, ... If the
-counter’s value is less than 1 then you get no warning or error but
-LaTeX does not print anything in the output.
-
-
-\Roman{counter}
¶
-Print in uppercase roman numerals: ‘I’, ‘II’, ... If the
-counter’s value is less than 1 then you get no warning or error but
-LaTeX does not print anything in the output.
-
-
-\fnsymbol{counter}
¶
-Prints the value of counter using a sequence of nine symbols that
-are traditionally used for labeling footnotes. The value of
-counter should be between 1 and 9, inclusive. If the
-counter’s value is less than 0 or more than 9 then you get ‘LaTeX
-Error: Counter too large’, while if it is 0 then you get no error or
-warning but LaTeX does not output anything.
-
-Here are the symbols:
+
Synopsis:
-
-Number Name Command Symbol
-1 asterisk \ast
*
-2 dagger \dagger
†
-3 ddagger \ddagger
‡
-4 section-sign \S
§
-5 paragraph-sign \P
¶
-6 double-vert \parallel
‖
-7 double-asterisk \ast\ast
**
-8 double-dagger \dagger\dagger
††
-9 double-ddagger \ddagger\ddagger
‡‡
-
-
+
+\AtBeginDvi{code}
+\AtEndDvi{code}
+
-
-
+\AtBeginDvi
saves, in a box register, code to be executed
+at the beginning of the shipout of the first page of the document.
+Despite the name, it applies to DVI, PDF, and XDV output. It fills
+the shipout/firstpage
hook; new code should use that hook
+directly.
+
+
+
+Similarly, \AtEndDvi
(previously available only with the
+atenddvi
package) is code executed when finalizing the main
+output document.
+
-
-
+
13.2 \usecounter
+12.14.2 \AtEndOfClass
& \AtEndOfPackage
¶
-
-
-
+
+
-Synopsis:
+
Synopses:
-\usecounter{counter}
+\AtEndOfClass{code}
+\AtEndOfPackage{code}
-Used in the second argument of the list
environment
-(see list
), this declares that list items will be numbered by
-counter. 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 (see \ref
). This command is fragile
-(see \protect
).
+
Hooks to insert code to be executed when LaTeX finishes
+processing the current class resp. package.
-Put in the document preamble, this example makes a new list environment
-enumerated with testcounter:
+
These hooks can be used multiple times; each code
segment will
+be executed in the order called. Many packages and classes use these
+commands.
+
+See also \AtBeginDocument
.
-
-\newcounter{testcounter}
-\newenvironment{test}{%
- \begin{list}{}{%
- \usecounter{testcounter}
- }
-}{%
- \end{list}
-}
-
-
-
-
+
13.3 \value
+12.14.3 \CheckCommand
¶
-
-
+
+
+
+
Synopsis:
-\value{counter}
+\CheckCommand{cmd}[num][default]{definition}
+\CheckCommand* (same parameters)
-Expands to the value of the counter counter. (Note that the name
-of a counter does not begin with a backslash.)
+
Like \newcommand
(see \newcommand
& \renewcommand
) but does
+not define cmd; instead it checks that the current definition of
+cmd is exactly as given by definition and is or is not
+\long
as expected. A long command is a command that
+accepts \par
within an argument.
-This example outputs ‘Test counter is 6. Other counter
-is 5.’.
+
With the unstarred version of \CheckCommand
, cmd is
+expected to be \long
; with the starred version, cmd must
+not be \long
+
+\CheckCommand
raises an error when the check fails. This
+allows you to check before you start redefining cmd
yourself
+that no other package has already redefined this command.
-
-\newcounter{test} \setcounter{test}{5}
-\newcounter{other} \setcounter{other}{\value{test}}
-\addtocounter{test}{1}
-Test counter is \arabic{test}.
-Other counter is \arabic{other}.
-
+
+
+
-
+12.14.4 \ClassError
and \PackageError
and others ¶
-The \value
command is not used for typesetting the value of the
-counter. For that, see \alph \Alph \arabic \roman \Roman \fnsymbol
: Printing counters.
+
+
Produce error, warning, and informational messages for classes:
-It is often used in \setcounter
or \addtocounter
but
-\value
can be used anywhere that LaTeX expects a number, such
-as in \hspace{\value{foo}\parindent}
. It must not be
-preceded by \protect
(see \protect
).
+
+-
+
+
+
+
\ClassError{class name}{error-text}{help-text}
¶
+\ClassWarning{class name}{warning-text}
+\ClassWarningNoLine{class name}{warning-text}
+\ClassInfo{class name}{info-text}
+\ClassInfoNoLine{class name}{info-text}
+
+
+and the same for packages:
+
+-
+
+
+
+
\PackageError{package name}{error-text}{help-text}
¶
+\PackageWarning{package name}{warning-text}
+\PackageWarningNoLine{package name}{warning-text}
+\PackageInfo{package name}{info-text}
+\PackageInfoNoLine{package name}{info-text}
+
+
+For \ClassError
and \PackageError
the message is
+error-text, followed by TeX’s ‘?
’ error prompt. If the
+user then asks for help by typing h
, they see the help
+text.
-This example inserts \hspace{4\parindent}
.
+
The four Warning
commands are similar except that they write
+warning-text on the screen with no error prompt. The four
+Info
commands write info-text only in the transcript
+file. The NoLine
versions omit the number of the line
+generating the message, while the other versions do show that number.
-
-\setcounter{myctr}{3} \addtocounter{myctr}{1}
-\hspace{\value{myctr}\parindent}
-
+
+
+
+To format the messages, including the help-text: use
+\protect
to stop a command from expanding, get a line break
+with \MessageBreak
, and get a space with \space
when a
+space character is ignore, most commonly after a command.
+
+LaTeX appends a period to the messages.
+
+
+
+
+
+
+12.14.5 \CurrentOption
¶
+
+
+
+Expands to the name of the option currently being processed. This can
+only be used within the code argument of either
+\DeclareOption
or \DeclareOption*
.
+
-
+
+
13.4 \setcounter
+12.14.6 \DeclareOption
¶
-
-
-
+
+
+
+
+
Synopsis:
-\setcounter{counter}{value}
+\DeclareOption{option}{code}
+\DeclareOption*{option}{code}
-Globally set the counter counter to have the value of the
-value argument, which must be an integer. Thus, you can set a
-counter’s value as \setcounter{section}{5}
. Note that the
-counter name does not start with a backslash.
+
Define an option a user can include in their \documentclass
+command. For example, a class smcmemo
could have an option
+logo
allowing users to put the institutional logo on the first
+page. The document would start with
+\documentclass[logo]{smcmemo}
. To enable this, the class file
+must contain \DeclareOption{logo}{code}
(and later,
+\ProcessOptions
).
-In this example if the counter theorem
has value 12 then the
-second line will print ‘XII’.
+
+
+
+
If you request an option that has not been declared, by default this
+will produce a warning like Unused global option(s):
+[badoption].
This can be changed by using
+\DeclareOption*{code}
, which executes code for
+any unknown option.
+
+For example, many classes extend an existing class, using code such as
+\LoadClass{article}
(see \LoadClass). In this case, it
+makes sense to pass any otherwise-unknown options to the underlying
+class, like this:
-\setcounter{exercise}{\value{theorem}}
-Here it is in Roman: \Roman{exercise}.
+\DeclareOption*{%
+ \PassOptionsToClass{\CurrentOption}{article}%
+}
+
+
+As another example, our class smcmemo
might allow users to keep
+lists of memo recipients in external files, so the user could invoke
+\documentclass[math]{smcmemo}
and it will read the file
+math.memo
. This code inputs the file if it exists, while if it
+doesn’t, the option is passed to the article
class:
+
+
+\DeclareOption*{\InputIfFileExists{\CurrentOption.memo}
+ {}{%
+ \PassOptionsToClass{\CurrentOption}{article}}}
-
-
+
13.5 \addtocounter
+12.14.7 \DeclareRobustCommand
¶
-
+
+
+
Synopsis:
-\addtocounter{counter}{value}
+\DeclareRobustCommand{cmd}[num][default]{definition}
+\DeclareRobustCommand* (same parameters
-Globally increment counter by the amount specified by the
-value argument, which may be negative.
+
\DeclareRobustCommand
and its starred form are generally like
+\newcommand
and \newcommand*
(see \newcommand
& \renewcommand
), with the addition that they define a so-called
+robust command, even if some code within the definition is
+fragile. (For a discussion of robust and fragile commands,
+see \protect
.)
-In this example the section value appears as ‘VII’.
+
Also unlike \newcommand
, these do not give an error if macro
+cmd already exists; instead, a log message is put into the
+transcript file if a command is redefined. Thus,
+\DeclareRobustCommand
can be used to define new robust commands
+or to redefine existing commands, making them robust.
-
-\setcounter{section}{5}
-\addtocounter{section}{2}
-Here it is in Roman: \Roman{section}.
-
+The starred form, \DeclareRobustCommand*
, disallows the
+arguments from containing multiple paragraphs, just like the starred
+form of \newcommand
and \renewcommand
. The meaning of
+the arguments is the same.
+
+Commands defined this way are a bit less efficient than those defined
+using \newcommand
so unless the command’s data is fragile and the
+command is used within a moving argument, use \newcommand
.
+
+
+
+
+
+
+
+
+
+Related to this, the etoolbox
package offers three commands
+and their starred forms: \newrobustcmd
(*
)
+\renewrobustcmd
(*
), and
+\providerobustcmd
(*
). They are similar to
+\newcommand
, \renewcommand
, and \providecommand
+and their own starred forms, but define a robust cmd. They have
+two possible advantages compared to \DeclareRobustCommand
:
+
+
+- They use the low-level e-TeX protection mechanism rather than the
+higher-level LaTeX
\protect
mechanism, so they do not incur
+the slight loss of performance mentioned above, and
+
+ - They make the same distinction between
\new…
,
+\renew…
, and \provide…
, as the standard
+commands. That is, they do not just write a log message when you
+redefine cmd that already exists; you need to use either
+\renew…
or \provide…
, or you get an error.
+This may or may not be a benefit.
+
-
-
+
13.6 \refstepcounter
+12.14.8 \ExecuteOptions
¶
-
+
Synopsis:
-\refstepcounter{counter}
+\ExecuteOptions{option-list}
-Globally increments the value of counter by one, as does
-\stepcounter
(see \stepcounter
). The difference is that this
-command resets the value of any counter numbered within it. (For the
-definition of “counters numbered within”, see \newcounter
: Allocating a counter.)
-
-In addition, this command also defines the current \ref
value
-to be the result of \thecounter
.
+
+
For each option option in option-list, in order, this
+command executes the command \ds@option
. If this
+command is not defined then that option is silently ignored.
-While the counter value is set globally, the \ref
value is set
-locally, i.e., inside the current group.
+
This can be used to provide a default option list before
+\ProcessOptions
. For example, if in a class file you want the
+default to be 11pt fonts then you could specify
+\ExecuteOptions{11pt}\ProcessOptions\relax
.
-
-
+
13.7 \stepcounter
+12.14.9 \IfFileExists
& \InputIfFileExists
¶
-
+
+
-Synopsis:
+
Synopses:
-\stepcounter{counter}
+\IfFileExists{filename}{true-code}{false-code}
+\InputIfFileExists{filename}{true-code}{false-code}
-Globally adds one to counter and resets all counters numbered
-within it. (For the definition of “counters numbered within”,
-see \newcounter
: Allocating a counter.)
+
\IfFileExists
executes true-code if LaTeX finds the
+file filename or false-code otherwise. In the
+first case it executing true-code and then inputs the file.
+Thus the command
-This command differs from \refstepcounter
in that this one does
-not influence references; that is, it does not define the current
-\ref
value to be the result of \thecounter
-(see \refstepcounter
).
+
+\IfFileExists{img.pdf}{%
+ \includegraphics{img.pdf}}
+ {\typeout{!! img.pdf not found}
+
+
+will include the graphic img.pdf if it is found and otherwise
+give a warning.
+
+This command looks for the file in all search paths that LaTeX
+uses, not only in the current directory. To look only in the current
+directory do something like
+\IfFileExists{./filename}{true-code}{false-code}
.
+If you ask for a filename without a .tex
extension then
+LaTeX will first look for the file by appending the .tex
;
+for more on how LaTeX handles file extensions see \input
.
+
+\InputIfFileExists
is similar, but, as the name states,
+automatically \input
s filename if it exists. The
+true-code is executed just before the \input
; if the file
+doesn’t exist, the false-code is executed. An example:
+
+\InputIfFileExists{mypkg.cfg}
+ {\PackageInfo{Loading mypkg.cfg for configuration information}}
+ {\PackageInfo{No mypkg.cfg found}}
+
+
-
-
+
13.8 \day
& \month
& \year
+12.14.10 \LoadClass
& \LoadClassWithOptions
¶
-
-
-
+
+
-LaTeX defines the counter \day
for the day of the month
-(nominally with value between 1 and 31), \month
for the month of
-the year (nominally with value between 1 and 12), and \year
for
-the year. When TeX starts up, they are set from the current values
-on the system. The related command \today
produces a string
-representing the current day (see \today
).
-
-They counters are not updated as the job progresses so in principle they
-could be incorrect by the end. In addition, TeX does no sanity
-check:
+
Synopses:
-\day=-2 \month=13 \year=-4 \today
+\LoadClass[options-list]{class-name}[release-date]
+\LoadClassWithOptions{class-name}[release-date]
-gives no error or warning and results in the output ‘-2, -4’ (the
-bogus month value produces no output).
+
Load a class, as with
+\documentclass[options-list]{class-name}[release-date]
.
+An example: \LoadClass[twoside]{article}
.
-See Command line input, to force the date to a given value from the
-command line.
+
The options-list, if present, is a comma-separated list. The
+release-date is also optional. If present it must have the form
+YYYY/MM/DD
.
+If you request release-date and the date of the package
+installed on your system is earlier, then you get a warning on the
+screen and in the log like this:
+
+
+You have requested, on input line 4, version `2038/01/19' of
+document class article, but only version `2014/09/29 v1.4h
+Standard LaTeX document class' is available.
+
+
+
+The command version \LoadClassWithOptions
uses the list of
+options for the current class. This means it ignores any options passed
+to it via \PassOptionsToClass
. This is a convenience command
+that lets you build classes on existing ones, such as the standard
+article
class, without having to track which options were passed.
+
+
-
-
-
+
14 Lengths
+12.14.11 \NeedsTeXFormat
¶
-
+
+
+
+
-A length is a measure of distance. Many LaTeX commands take a
-length as an argument.
-
-
-
-
-
-
-Lengths come in two types. A rigid length such as 10pt
-does not contain a plus
or minus
component. (Plain
-TeX calls this a dimen.) A rubber length (what plain
-TeX calls a skip or glue) such as with 1cm
-plus0.05cm minus0.01cm
can contain either or both of those
-components. In that rubber length, the 1cm
is the natural
-length while the other two, the plus
and minus
-components, allow TeX to stretch or shrink the length to optimize
-placement.
-
-The illustrations below use these two commands.
+
Synopsis:
-% make a black bar 10pt tall and #1 wide
-\newcommand{\blackbar}[1]{\rule{#1}{10pt}}
-
-% Make a box around #2 that is #1 wide (excluding the border)
-\newcommand{\showhbox}[2]{%
- \fboxsep=0pt\fbox{\hbox to #1{#2}}}
+\NeedsTeXFormat{format}[format-date]
-This example uses those commands to show a black bar 100 points
-long between ‘XXX’ and ‘YYY’. This length is rigid.
+
Specifies the format that this class must be run under. Often issued
+as the first line of a class file, and most often used as:
+\NeedsTeXFormat{LaTeX2e}
. When a document using that class
+is processed, the format being run must exactly match the format
+name given, including case. If it does not match then execution stops
+with an error like ‘This file needs format `LaTeX2e' but this is
+`plain'.’.
+
+To require a version of the format that you know to have certain
+features, include the optional format-date on which those
+features were implemented. If present, it must be in the form
+YYYY/MM/DD
. If the format version installed on your system is
+earlier than format date then you get a warning like this.
-XXX\showhbox{100pt}{\blackbar{100pt}}YYY
+You have requested release `2038/01/20' of LaTeX, but only
+release `2016/02/01' is available.
-As for rubber lengths, shrinking is simpler one: with 1cm minus
-0.05cm
, the natural length is 1cm but TeX can shrink it down
-as far as 0.95cm. Beyond that, TeX refuses to shrink any more.
-Thus, below the first one works fine, producing a space of
-98 points between the two bars.
-
-
-XXX\showhbox{300pt}{%
- \blackbar{101pt}\hspace{100pt minus 2pt}\blackbar{101pt}}YYY
-XXX\showhbox{300pt}{%
- \blackbar{105pt}\hspace{100pt minus 1pt}\blackbar{105pt}}YYY
-
+
+
+
-
+12.14.12 \OptionNotUsed
¶
-But the second one gets a warning like ‘Overfull \hbox (1.0pt too
-wide) detected at line 17’. In the output the first ‘Y’ is
-overwritten by the end of the black bar, because the box’s material is
-wider than the 300pt allocated, as TeX has refused to shrink
-the total to less than 309 points.
+
+
+
+
+
Adds the current option to the list of unused options. Can only be used
+within the code argument of either \DeclareOption
or
+\DeclareOption*
.
-Stretching is like shrinking except that if TeX is asked to stretch
-beyond the given amount, it will do it. Here the first line is fine,
-producing a space of 110 points between the bars.
+
+
+
+
+
+
+12.14.13 \PassOptionsToClass
& \PassOptionsToPackage
¶
+
+
+
+
+Synopses:
-XXX\showhbox{300pt}{%
- \blackbar{95pt}\hspace{100pt plus 10pt}\blackbar{95pt}}YYY
-
-XXX\showhbox{300pt}{%
- \blackbar{95pt}\hspace{100pt plus 1pt}\blackbar{95pt}}YYY
+\PassOptionsToClass{options}{clsname}
+\PassOptionsToPackage{option}{pkgname}
-In the second line TeX needs a stretch of 10 points and only
-1 point was specified. TeX stretches the space to the required
-length but it gives you a warning like ‘Underfull \hbox (badness
-10000) detected at line 22’. (We won’t discuss badness.)
+
Adds the options in the comma-separated list options to the
+options used by any future \RequirePackage
or
+\usepackage
command for the class clsname or the package
+pkgname, respectively.
-You can put both stretch and shrink in the same length, as in
-1ex plus 0.05ex minus 0.02ex
.
+
+
+
The reason for these commands is that although you may load a package
+any number of times with no options, if you can specify options only
+the first time you load the package. Loading a package with options
+more than once will get you an error like Option clash for
+package foo.
. LaTeX throws an error even if there is no conflict
+between the options.
-If TeX is setting two or more rubber lengths then it allocates the
-stretch or shrink in proportion.
+
If your own code is bringing in a package twice then you can combine
+the calls; for example, replacing the two
-XXX\showhbox{300pt}{%
- \blackbar{100pt}% left
- \hspace{0pt plus 50pt}\blackbar{80pt}\hspace{0pt plus 10pt}% middle
- \blackbar{100pt}}YYY % right
+\RequirePackage[landscape]{geometry}
+\RequirePackage[margins=1in]{geometry}
-The left and right bars take up 100 points, so the middle needs
-another 100. The middle bar is 80 points so the two
-\hspace
’s must stretch 20 points. Because the two are
-plus 50pt
and plus 10pt
, TeX gets 5/6 of the stretch
-from the first space and 1/6 from the second.
+
with the single command
-The 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 TeX could set
-it to any distance. Here the two figures will be equal-spaced across
-the page.
+
+\RequirePackage[landscape,margins=1in]{geometry}
+
+
+However, suppose you are loading firstpkg and inside that
+package it loads secondpkg, and you need secondpkg
to be
+loaded with option draft
. Then before load the first package
+you must tell LaTeX about the desired options for the second
+package, like this:
-\begin{minipage}{\linewidth}
- \hspace{0pt plus 1fill}\includegraphics{godel.png}%
- \hspace{0pt plus 1fill}\includegraphics{einstein.png}%
- \hspace{0pt plus 1fill}
-\end{minipage}
+\PassOptionsToPackage{draft}{secondpkg}
+\RequirePackage{firstpkg}
-TeX has three levels of infinity for glue components: fil
,
-fill
, and filll
. The later ones are more infinite than
-the earlier ones. Ordinarily document authors only use the middle one
-(see \hfill
and see \vfill
).
+
If firstpkg.sty
loads an option in conflict with what you want
+then you may have to alter its source, or yours.
-Multiplying a rubber length by a number turns it into a rigid length, so
-that after \setlength{\ylength}{1in plus 0.2in}
and
-\setlength{\zlength}{3\ylength}
then the value of
-\zlength
is 3in
.
+
These commands are useful for general users as well as class and package
+writers. For instance, suppose a user wants to load the graphicx
+package with the option draft
and also wants to use a class
+foo
that loads the graphicx
package, but without that
+option. The user could start their LaTeX file with
+\PassOptionsToPackage{draft}{graphicx} \documentclass{foo}
.
-
-
-- Units of length
-\setlength
-\addtolength
-\settodepth
-\settoheight
-\settowidth
-\stretch
-- Expressions
-
-
+
+
14.1 Units of length
+12.14.14 \ProcessOptions
¶
-
+
+
+
-TeX and LaTeX know about these units both inside and outside of
-math mode.
-
-
-pt
¶
--
-
Point, 1/72.27 inch. The (approximate) conversion to metric units
-is 1point = .35146mm = .035146cm.
-
-
-pc
¶
--
-
Pica, 12 pt
-
-
-in
¶
--
-
Inch, 72.27 pt
+
Synopsis:
-
-bp
¶
--
-
-
Big point, 1/72 inch. This length is the definition of a point in
-PostScript and many desktop publishing systems.
+
+\ProcessOptions\@options
+\ProcessOptions*\@options
+
+
+Execute the code for each option that the user has invoked. Invoke it
+in the class file as \ProcessOptions\relax
(because of the
+existence of the starred version, described below).
+
+
+
+
+Options come in two types. Local options have been specified
+for this particular package in \usepackage[options]
,
+\RequirePackage[options]
, or the options argument
+of \PassOptionsToPackage{options}
. Global options
+are those given by the class user in
+\documentclass[options]
. If an option is specified both
+locally and globally then it is local.
-
-mm
¶
--
-
Millimeter, 2.845pt
+
When \ProcessOptions
is called for a package pkg.sty, the
+following happens:
-
-cm
¶
--
-
Centimeter, 10mm
-
-
-dd
¶
--
-
Didot point, 1.07 pt
-
-
-cc
¶
--
-
Cicero, 12 dd
-
-
-sp
¶
--
-
Scaled point, 1/65536 pt
-
-
-
+
+- For each option option so far declared with
+
\DeclareOption
, \ProcessOptions
looks to see if that
+option is either global or local for pkg
. If so, then it
+executes the declared code. This is done in the order in which these
+options were given in pkg.sty.
-Three other units are defined according to the current font, rather
-than being an absolute dimension.
-
-
-ex
¶
--
-
-
The x-height of the current font ex, traditionally the
-height of the lowercase letter x, is often used for vertical
-lengths.
-
-
-em
¶
--
-
-
Similarly em, traditionally the width of the capital
-letter M, is often used for horizontal lengths. This is also often
-the size of the current font, e.g., a nominal 10pt font will
-have 1em = 10pt. LaTeX has several commands to produce
-horizontal spaces based on the em (see \enspace
& \quad
& \qquad
).
+
- For each remaining local option, it executes the command
+
\ds@
option if it has been defined somewhere (other than by
+a \DeclareOption
); otherwise, it executes the default option code
+given in \DeclareOption*
. If no default option code has been
+declared then it gives an error message. This is done in the order in
+which these options were specified.
+
+
+When \ProcessOptions
is called for a class it works in the same
+way except that all options are local, and the default code for
+\DeclareOption*
is \OptionNotUsed
rather than an error.
-
-mu
¶
--
-
Finally, in math mode, many definitions are expressed in terms
-of the math unit mu, defined by 1em = 18mu, where the
-em is taken from the current math symbols family. See Spacing in math mode.
+
The starred version \ProcessOptions*
executes the
+options in the order specified in the calling commands, rather than in
+the order of declaration in the class or package. For a package, this
+means that the global options are processed first.
-
-
-Using these units 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.
-
-
-
+
14.2 \setlength
+12.14.15 \ProvidesClass
& \ProvidesPackage
¶
-
-
+
+
-Synopsis:
+
Synopses:
-\setlength{\len}{amount}
+\ProvidesClass{clsname}[release-date [info-text]]
+\ProvidesPackage{pkgname}[release-date [info-text]]
-Set the length \len to amount. The length name
-\len
has to be a control sequence (see Control sequence, control word and control symbol), and as such must begin with a backslash, \
under
-normal circumstances. The amount can be a rubber length
-(see Lengths). It can be positive, negative or zero, and can be in
-any units that LaTeX understands (see Units of length).
+
Identifies the class or package being defined, printing a message to
+the screen and the log file.
-Below, with LaTeX’s defaults the first paragraph will be indented
-while the second will not.
+
When you load a class or package, for example with
+\documentclass{smcmemo}
or \usepackage{test}
,
+LaTeX inputs a file (smcmemo.cls and test.sty,
+respectively). If the name of the file does not match the class or
+package name declared in it then you get a warning. Thus, if you
+invoke \documentclass{smcmemo}
, and the file
+smcmemo.cls has the statement \ProvidesClass{foo}
then
+you get a warning like You have requested document class
+`smcmemo', but the document class provides 'foo'.
This warning does
+not prevent LaTeX from processing the rest of the class file
+normally.
-
-I told the doctor I broke my leg in two places.
-
-\setlength{\parindent}{0em}
-He said stop going to those places.
-
-
-If you did not declare \len with \newlength
, for example if
-you mistype it as in
-\newlength{\specparindent}\setlength{\sepcparindent}{...}
,
-then you get an error like ‘Undefined control sequence. <argument>
-\sepcindent’. If you omit the backslash at the start of the length name
-then you get an error like ‘Missing number, treated as zero.’.
+
If you include the optional argument then you must include a date,
+before any spaces, of the form YYYY/MM/DD
. The rest of the
+optional argument is free-form, although it traditionally identifies
+the class. It is written to the screen during compilation and to the
+log file. Thus, if your file smcmemo.cls contains the line
+\ProvidesClass{smcmemo}[2008/06/01 v1.0 SMC memo class]
and
+your document’s first line is \documentclass{smcmemo}
then
+you will see Document Class: smcmemo 2008/06/01 v1.0 SMC memo
+class
.
+
+The date in the optional argument allows class and package users to
+ask to be warned if the version of the class or package is earlier
+than release date. For instance, a user could enter
+\documentclass{smcmemo}[2018/10/12]
or
+\usepackage{foo}[[2017/07/07]]
to require a class or package
+with certain features by specifying that it must be released no
+earlier than the given date. Perhaps more importantly, the date
+serves as documentation of the last release. (In practice, package
+users rarely include a date, and class users almost never do.)
+
-
-
+
14.3 \addtolength
+12.14.16 \ProvidesFile
¶
-
-
+
Synopsis:
-\addtolength{\len}{amount}
+\ProvidesFile{filename}[info-text]
-Increment the length \len by amount. The length name
-\len
has to be a control sequence (see Control sequence, control word and control symbol), and as such must begin with a backslash, \
under
-normal circumstances. The amount is a rubber length
-(see Lengths). It can be positive, negative or zero, and can be in
-any units that LaTeX understands (see Units of length).
+
Declare a file other than the main class and package files, such as a
+configuration or font definition file. It writes the given
+information to the log file, essentially like \ProvidesClass
+and \ProvidesPackage
(see the previous section).
-Below, if \parskip
starts with the value 0pt plus 1pt
+
For example:
-Doctor: how is the boy who swallowed the silver dollar?
-\addtolength{\parskip}{1pt}
-
-Nurse: no change.
+\ProvidesFile{smcmemo.cfg}[2017/10/12 config file for smcmemo.cls]
-then it has the value 1pt plus 1pt
for the second paragraph.
-
-If you did not declare \len with \newlength
, for example if
-you mistype it as in
-\newlength{\specparindent}\addtolength{\sepcparindent}{...}
,
-then you get an error like ‘Undefined control sequence. <argument>
-\sepcindent’. If the amount uses some length that has not been
-declared, for instance if for example you mistype the above as
-\addtolength{\specparindent}{0.6\praindent}
, then you get
-something like ‘Undefined control sequence. <argument> \praindent’.
-If you leave off the backslash at the start of \len, as in
-\addtolength{parindent}{1pt}
, then you get something like
-‘You can't use `the letter p' after \advance’.
+
writes this into the log:
+
+File: smcmemo.cfg 2017/10/12 config file for smcmemo.cls
+
+
+
-
-
+
14.4 \settodepth
+12.14.17 \RequirePackage
& \RequirePackageWithOptions
¶
-
+
+
Synopsis:
-\settodepth{\len}{text}
+\RequirePackage[option-list]{pkgname}[release-date]
+\RequirePackageWithOptions{pkgname}[release-date]
-Set the length \len to the depth of box that LaTeX gets on
-typesetting the text argument. The length name \len
-has to be a control sequence (see Control sequence, control word and control symbol), and as such
-must begin with a backslash, \
under normal circumstances.
+
Load a package, like the command \usepackage
(see Additional packages). An example:
+\RequirePackage[landscape,margin=1in]{geometry}
-This will print how low the character descenders go.
+
The initial optional argument option-list, if present, must be a
+comma-separated list. The trailing optional argument
+release-date, if present, must have the form YYYY/MM/DD
.
+If the release date of the package as installed on your system is
+earlier than release-date then you get a warning like ‘You
+have requested, on input line 9, version `2017/07/03' of package
+jhtest, but only version `2000/01/01' is available’.
-
-\newlength{\alphabetdepth}
-\settodepth{\alphabetdepth}{abcdefghijklmnopqrstuvwxyz}
-\the\alphabetdepth
-
-
-If you did not declare \len with \newlength
, if for example you
-mistype the above as \settodepth{\aplhabetdepth}{abc...}
,
-then you get something like ‘Undefined control sequence. <argument>
-\aplhabetdepth’. If you leave the backslash out of \len, as in
-\settodepth{alphabetdepth}{...}
then you get something like
-‘Missing number, treated as zero. <to be read again> \setbox’.
+
The \RequirePackageWithOptions
variant uses the list of options
+for the current class. This means it ignores any options passed to it
+via \PassOptionsToClass
. This is a convenience command to
+allow easily building classes on existing ones without having to track
+which options were passed.
+
+The difference between \usepackage
and \RequirePackage
+is small. The \usepackage
command is intended to be used in
+documents, while \RequirePackage
is intended for package and
+class files. The most significant difference in practice is that
+\RequirePackage
can be used in a document before the
+\documentclass
command, while \usepackage
gives an error
+there. The most common need for this nowadays is for the
+\DocumentMetadata
command (see \DocumentMetadata
: Producing tagged PDF output).
+
+The LaTeX development team strongly recommends use of these and
+related commands over Plain TeX’s \input
; see the Class
+Guide (https://ctan.org/pkg/clsguide).
-
-
+
+
+
14.5 \settoheight
+13 Counters ¶
-
+
+
-Synopsis:
+
Everything LaTeX numbers for you has a counter associated with
+it. The name of the counter is often the same as the name of the
+environment or command associated with the number, except that the
+counter’s name has no backslash \
. Thus, associated with
+the \chapter
command is the chapter
counter that keeps
+track of the chapter number.
+
+Below is a list of the counters used in LaTeX’s standard document
+classes to control numbering.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-\settoheight{\len}{text}
+part paragraph figure enumi
+chapter subparagraph table enumii
+section page footnote enumiii
+subsection equation mpfootnote enumiv
+subsubsection
-Sets the length \len to the height of box that LaTeX gets on
-typesetting the text
argument. The length name \len
-has to be a control sequence (see Control sequence, control word and control symbol), and as such
-must begin with a backslash, \
under normal circumstances.
+
The mpfootnote
counter is used by the \footnote
command
+inside of a minipage (see minipage
). The counters enumi
+through enumiv
are used in the enumerate
environment, for
+up to four levels of nesting (see enumerate
).
-This will print how high the characters go.
+
Counters can have any integer value but they are typically positive.
-
-\newlength{\alphabetheight}
-\settoheight{\alphabetheight}{abcdefghijklmnopqrstuvwxyz}
-\the\alphabetheight
-
-
-If no such length \len has been declared with \newlength
, if
-for example you mistype as
-\settoheight{\aplhabetheight}{abc...}
, then you get something
-like ‘Undefined control sequence. <argument> \alphabetheight’. If
-you leave the backslash out of \len, as in
-\settoheight{alphabetheight}{...}
then you get something like
-‘Missing number, treated as zero. <to be read again> \setbox’.
+
New counters are created with \newcounter
. See \newcounter
: Allocating a counter.
+
+
+\alph \Alph \arabic \roman \Roman \fnsymbol
: Printing counters
+\usecounter
+\value
+\setcounter
+\addtocounter
+\refstepcounter
+\stepcounter
+\day
& \month
& \year
+
-
-
-
+
14.6 \settowidth
+13.1 \alph \Alph \arabic \roman \Roman \fnsymbol
: Printing counters ¶
-
+
-Synopsis:
+
Print the value of a counter, in a specified style. For instance, if
+the counter counter has the value 1 then a
+\alph{counter}
in your source will result in a lowercase
+letter a appearing in the output.
-
-\settowidth{\len}{text}
-
-
-Set the length \len to the width of the box that LaTeX gets on
-typesetting the text argument. The length name \len
-has to be a control sequence (see Control sequence, control word and control symbol), and as such
-must begin with a backslash, \
under normal circumstances.
+
All of these commands take a single counter as an argument, for
+instance, \alph{enumi}
. Note that the counter name does not
+start with a backslash.
-This prints the width of the lowercase ASCII alphabet.
+
+\alph{counter}
¶
+Print the value of counter in lowercase letters: ‘a’, ‘b’,
+... If the counter’s value is less than 1 or more than 26 then
+you get ‘LaTeX Error: Counter too large.’
-
-\newlength{\alphabetwidth}
-\settowidth{\alphabetwidth}{abcdefghijklmnopqrstuvwxyz}
-\the\alphabetwidth
-
-
-If no such length \len has been declared with \newlength
,
-if for example you mistype the above as
-\settowidth{\aplhabetwidth}{abc...}
, then you get something
-like ‘Undefined control sequence. <argument> \aplhabetwidth’. If
-you leave the backslash out of \len, as in
-\settoheight{alphabetwidth}{...}
then you get something like
-‘Missing number, treated as zero. <to be read again> \setbox’.
+
+\Alph{counter}
¶
+Print in uppercase letters: ‘A’, ‘B’, ... If the counter’s value
+is less than 1 or more than 26 then you get ‘LaTeX Error: Counter
+too large.’
+
+
+\arabic{counter}
¶
+Print in Arabic numbers such as ‘5’ or ‘-2’.
+
+
+\roman{counter}
¶
+Print in lowercase roman numerals: ‘i’, ‘ii’, ... If the
+counter’s value is less than 1 then you get no warning or error but
+LaTeX does not print anything in the output.
+
+
+\Roman{counter}
¶
+Print in uppercase roman numerals: ‘I’, ‘II’, ... If the
+counter’s value is less than 1 then you get no warning or error but
+LaTeX does not print anything in the output.
+
+
+\fnsymbol{counter}
¶
+Prints the value of counter using a sequence of nine symbols that
+are traditionally used for labeling footnotes. The value of
+counter should be between 1 and 9, inclusive. If the
+counter’s value is less than 0 or more than 9 then you get ‘LaTeX
+Error: Counter too large’, while if it is 0 then you get no error or
+warning but LaTeX does not output anything.
+
+Here are the symbols:
+
+Number Name Command Symbol
+1 asterisk \ast
*
+2 dagger \dagger
†
+3 ddagger \ddagger
‡
+4 section-sign \S
§
+5 paragraph-sign \P
¶
+6 double-vert \parallel
‖
+7 double-asterisk \ast\ast
**
+8 double-dagger \dagger\dagger
††
+9 double-ddagger \ddagger\ddagger
‡‡
+
+
+
+
+
+
-
-
+
14.7 \stretch
+13.2 \usecounter
¶
-
+
+
+
Synopsis:
-\stretch{number}
+\usecounter{counter}
-Produces a rubber length with zero natural length and number times
-\fill
units of stretchability (see Lengths). The
-number can be positive or negative. This command is robust
+
Used in the second argument of the list
environment
+(see list
), this declares that list items will be numbered by
+counter. 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 (see \ref
). This command is fragile
(see \protect
).
-It works for both vertical and horizontal spacing. In this horizontal
-example, LaTeX produces three tick marks, and the distance between
-the first and second is half again as long as the distance between the
-second and third.
-
-
-\rule{0.4pt}{1ex}\hspace{\stretch{1.5}}%
- \rule{0.4pt}{1ex}\hspace{\stretch{1}}%
- \rule{0.4pt}{1ex}
-
-
-In this vertical example, the ‘We dedicate …’ will have three
-times as much space under it as above it.
+
Put in the document preamble, this example makes a new list environment
+enumerated with testcounter:
-\newenvironment{dedication}{% in document preamble
- \clearpage\thispagestyle{empty}%
- \vspace*{\stretch{1}} % stretchable space at top
- \it
+\newcounter{testcounter}
+\newenvironment{test}{%
+ \begin{list}{}{%
+ \usecounter{testcounter}
+ }
}{%
- \vspace{\stretch{3}} % space at bot is 3x as at top
- \clearpage
+ \end{list}
}
- ...
-\begin{dedication} % in document body
-We dedicate this book to our wives.
-\end{dedication}
-
-
+
14.8 Expressions
+13.3 \value
¶
-
+
+
-Synopsis, one of:
+
Synopsis:
-\numexpr expression
-\dimexpr expression
-\glueexpr expression
-\muglue expression
+\value{counter}
-Any place where you may write an integer, or a TeX dimen, or TeX
-glue, or muglue, you can instead write an expression to compute that
-type of quantity.
-
-An example is that \the\dimexpr\linewidth-4pt\relax
will
-produce as output the length that is four points less than width of a
-line (the only purpose of \the
is to show the result in the
-document). Analogously, \romannumeral\numexpr6+3\relax
will
-produce ‘ix’, and \the\glueexpr 5pt plus 1pt * 2 \relax
-will produce ‘10.0pt plus 2.0pt’.
+
Expands to the value of the counter counter. (Note that the name
+of a counter does not begin with a backslash.)
-A convenience here over doing calculations by allocating registers and
-then using \advance
, etc., is that the evaluation of expressions
-does not involve assignments and can therefore be performed in places
-where assignments are not allowed. The next example computes the width
-of the \parbox
.
+
This example outputs ‘Test counter is 6. Other counter
+is 5.’.
-\newlength{\offset}\setlength{\offset}{2em}
-\begin{center}
-\parbox{\dimexpr\linewidth-\offset*3}{With malice toward none
-with charity for all with firmness in the right as God gives us to see
-the right let us strive on to finish the work we are in to bind up the
-nation's wounds, to care for him who shall have borne the battle and
-for his widow and his orphan \textasciitilde\ to do all which may
-achieve and cherish a just and lasting peace among ourselves and with
-all nations. ---Abraham Lincoln, Second Inaugural Address, from the
-memorial}
-\end{center}
+\newcounter{test} \setcounter{test}{5}
+\newcounter{other} \setcounter{other}{\value{test}}
+\addtocounter{test}{1}
+
+Test counter is \arabic{test}.
+Other counter is \arabic{other}.
-The expression consists of one or more terms of the same type
-(integer, dimension, etc.) that are added or subtracted. A term that is
-a type of number, dimension, etc., consists of a factor of that type,
-optionally multiplied or divided by factors. A factor of a type is
-either a quantity of that type or a parenthesized subexpression. The
-expression produces a result of the given type, so that \numexpr
-produces an integer, \dimexpr
produces a dimension, etc.
-
-In the quotation example above, changing to
-\dimexpr\linewidth-3*\offset
gives the error Illegal unit
-of measure (pt inserted)
. This is because for \dimexpr
and
-\glueexpr
, the input consists of a dimension or glue value
-followed by an optional multiplication factor, and not the other way
-around. Thus \the\dimexpr 1pt*10\relax
is valid and produces
-‘10.0pt’, but \the\dimexpr 10*1pt\relax
gives the
-Illegal unit
error.
-
-The expressions absorb tokens and carry out appropriate mathematics up
-to a \relax
(which will be absorbed), or up to the first
-non-valid token. Thus, \the\numexpr2+3px
will print
-‘5px’, because LaTeX reads the \numexpr2+3
, which is
-made up of numbers, and then finds the letter p
, which cannot
-be part of a number. It therefore terminates the expression and
-produces the ‘5’, followed by the regular text ‘px’.
-
-This termination behavior is useful in comparisons. In
-\ifnum\numexpr\parindent*2 < 10pt Yes\else No\fi
, the less than
-sign terminates the expression and the result is ‘No’ (in a
-standard LaTeX article).
-
-Expressions may use the operators +
, -
, *
and
-/
along with parentheses for subexpressions, (...)
. In
-glue expressions the plus
and minus
parts do not need
-parentheses to be affected by a factor. So \the\glueexpr 5pt plus
-1pt * 2 \relax
results in ‘10pt plus 2pt’.
-
-TeX will coerce other numerical types in the same way as it does when
-doing register assignment. Thus \the\numexpr\dimexpr
-1pt\relax\relax
will result in ‘65536’, which is 1pt
-converted to scaled points (see sp
,
-TeX’s internal unit) and then coerced into an integer. With a
-\glueexpr
here, the stretch and shrink would be dropped. Going
-the other way, a \numexpr
inside a \dimexpr
or
-\glueexpr
will need appropriate units, as in
-\the\dimexpr\numexpr 1 + 2\relax pt\relax
, which produces
-‘3.0pt’.
+
The \value
command is not used for typesetting the value of the
+counter. For that, see \alph \Alph \arabic \roman \Roman \fnsymbol
: Printing counters.
-The details of the arithmetic: each factor is checked to be in the
-allowed range, numbers must be less than 2^{31} in absolute
-value, and dimensions or glue components must be less than
-2^{14} points, or mu
, or fil
, etc. The
-arithmetic operations are performed individually, except for a scaling
-operation (a multiplication immediately followed by a division) which
-is done as one combined operation with a 64-bit product as
-intermediate value. The result of each operation is again checked to
-be in the allowed range.
+
It is often used in \setcounter
or \addtocounter
but
+\value
can be used anywhere that LaTeX expects a number, such
+as in \hspace{\value{foo}\parindent}
. It must not be
+preceded by \protect
(see \protect
).
-Finally, division and scaling take place with rounding (unlike TeX’s
-\divide
, which truncates). Thus
-\the\dimexpr 5pt*(3/2)\relax
puts ‘10.0pt’ in the document,
-because it rounds 3/2
to 2
, while
-\the\dimexpr 5pt*(4/3)\relax
produces ‘5.0pt’.
+
This example inserts \hspace{4\parindent}
.
+
+\setcounter{myctr}{3} \addtocounter{myctr}{1}
+\hspace{\value{myctr}\parindent}
+
+
-
-
-
+
15 Making paragraphs
+13.4 \setcounter
¶
-
-
+
+
+
-To start a paragraph, just type some text. To end the current
-paragraph, put an empty line. This is three paragraphs, the
-separation of which is made by two empty lines.
+
Synopsis:
-It is a truth universally acknowledged, that a single man in possession
-of a good fortune, must be in want of a wife.
-
-However little known the feelings or views of such a man may be on his
-first entering a neighbourhood, this truth is so well fixed in the minds
-of the surrounding families, that he is considered the rightful property
-of some one or other of their daughters.
+\setcounter{counter}{value}
+
-``My dear Mr. Bennet,'' said his lady to him one day,
-``have you heard that Netherfield Park is let at last?''
-
-
-
-A paragraph separator can be made of a sequence of at least one blank
-line, at least one of which is not terminated by a comment. A blank line
-is a line that is empty or made only of blank characters such as space
-or tab. Comments in source code are started with a %
and span up
-to the end of line. In the following example the two columns are
-identical:
-
-
-\documentclass[twocolumn]{article}
-\begin{document}
-First paragraph.
-
-Second paragraph.
-\newpage
-First paragraph.
-
- % separator lines may contain blank characters.
-
-Second paragraph.
-\end{document}
-
-
-
-Once LaTeX has gathered all of a paragraph’s contents it divides that
-content into lines in a way that is optimized over the entire paragraph
-(see Line breaking).
-
-There are places where a new paragraph is not permitted. Don’t put a
-blank line in math mode (see Modes); here the blank line before the
-\end{equation}
+
Globally set the counter counter to have the value of the
+value argument, which must be an integer. Thus, you can set a
+counter’s value as \setcounter{section}{5}
. Note that the
+counter name does not start with a backslash.
-
-\begin{equation}
- 2^{|S|} > |S|
-
-\end{equation}
-
-
-will get you the error ‘Missing $ inserted’. Similarly, the blank
-line in this \section
argument
+
In this example if the counter theorem
has value 12 then the
+second line will print ‘XII’.
-\section{aaa
-
-bbb}
+\setcounter{exercise}{\value{theorem}}
+Here it is in Roman: \Roman{exercise}.
-gets ‘Runaway argument? {aaa ! Paragraph ended before \@sect was
-complete’.
-
-
-
-
-
+
+
15.1 \par
-
-
-
+13.5 \addtocounter
¶
-Synopsis (note that while reading the input TeX converts any sequence
-of one or more blank lines to a \par
, Making paragraphs):
-
-
-\par
-
+
-End the current paragraph. The usual way to separate paragraphs is with
-a blank line but the \par
command is entirely equivalent. This
-command is robust (see \protect
).
-
-This example uses \par
rather than a blank line simply for
-readability.
+
Synopsis:
-\newcommand{\syllabusLegalese}{%
- \whatCheatingIs\par\whatHappensWhenICatchYou}
+\addtocounter{counter}{value}
-In LR mode the \par
command does nothing and is ignored. In
-paragraph mode, the \par
command terminates paragraph mode,
-switching LaTeX to vertical mode (see Modes).
-
-You cannot use the \par
command in a math mode. You also cannot
-use it in the argument of many commands, such as the sectioning
-commands, e.g. \section
(see Making paragraphs and
-\newcommand
& \renewcommand
).
-
-The \par
command is not the same as the \paragraph
-command. The latter is, like \section
or \subsection
, a
-sectioning command used by the LaTeX document standard classes
-(see \subsubsection
, \paragraph
, \subparagraph
).
-
-The \par
command is not the same as \newline
or the line
-break double backslash, \\
. The difference is that \par
-ends the paragraph, not just the line, and also triggers the addition of
-the between-paragraph vertical space \parskip
(see \parindent
& \parskip
).
+
Globally increment counter by the amount specified by the
+value argument, which may be negative.
-The output from this example
+
In this example the section value appears as ‘VII’.
-xyz
-
-\setlength{\parindent}{3in}
-\setlength{\parskip}{5in}
-\noindent test\indent test1\par test2
+\setcounter{section}{5}
+\addtocounter{section}{2}
+Here it is in Roman: \Roman{section}.
-is: after ‘xyz’ there is a vertical skip of 5 inches and then
-‘test’ appears, aligned with the left margin. On the same line,
-there is an empty horizontal space of 3 inches and then
-‘test1’ appears. Finally. there is a vertical space of
-5 inches, followed by a fresh paragraph with a paragraph indent of
-3 inches, and then LaTeX puts the text ‘test2’.
-
-
-
+
15.2 \indent
& \noindent
+13.6 \refstepcounter
¶
-
-
-
+
Synopsis:
-\indent
-
-
-or
-
-
-\noindent
-
-
-Go into horizontal mode (see Modes). The \indent
command
-first outputs an empty box whose width is \parindent
. These
-commands are robust (see \protect
).
-
-Ordinarily you create a new paragraph by putting in a blank line.
-See \par
, for the difference between this command and \par
. To
-start a paragraph without an indent, or to continue an interrupted
-paragraph, use \noindent
.
-
-In the middle of a paragraph the \noindent
command has no effect,
-because LaTeX is already in horizontal mode there. The
-\indent
command’s only effect is to output a space.
-
-This example starts a fresh paragraph.
-
-
-... end of the prior paragraph.
-
-\noindent This paragraph is not indented.
+\refstepcounter{counter}
-and this continues an interrupted paragraph.
+
Globally increments the value of counter by one, as does
+\stepcounter
(see \stepcounter
). The difference is that this
+command resets the value of any counter numbered within it. (For the
+definition of “counters numbered within”, see \newcounter
: Allocating a counter.)
-
-The data
-
-\begin{center}
- \begin{tabular}{rl} ... \end{tabular}
-\end{center}
-
-\noindent shows this clearly.
-
-
-
-To omit indentation in the entire document put
-\setlength{\parindent}{0pt}
in the preamble. If you do that,
-you may want to also set the length of spaces between paragraphs,
-\parskip
(see \parindent
& \parskip
).
+
In addition, this command also defines the current \ref
value
+to be the result of \thecounter
.
-
-
-
-Default LaTeX styles have the first paragraph after a section that is
-not indented, as is traditional typesetting in English. To change that,
-look on CTAN for the package indentfirst
.
+
While the counter value is set globally, the \ref
value is set
+locally, i.e., inside the current group.
-
-
+
15.3 \parindent
& \parskip
+13.7 \stepcounter
¶
-
-
-
-
-
+
Synopsis:
-\setlength{\parindent}{horizontal len}
-\setlength{\parskip}{vertical len}
-
-
-Both are rubber lengths (see Lengths). They affect the
-indentation of ordinary paragraphs, not paragraphs inside
-minipages (see minipage
), and the vertical space between
-paragraphs, respectively.
-
-For example, if this is put in the preamble:
-
-
-\setlength{\parindent}{0em}
-\setlength{\parskip}{1ex}
+\stepcounter{counter}
-The document will have paragraphs that are not indented, but instead
-are vertically separated by about the height of a lowercase ‘x’.
-
-In LaTeX standard class documents, the default value for
-\parindent
in one-column documents is 15pt
when the
-default text size is 10pt
, 17pt
for 11pt
, and
-1.5em
for 12pt
. In two-column documents it is 1em
.
-(These values are set before LaTeX calls \normalfont
so
-em
is derived from the default font, Computer Modern. If you use
-a different font then to set \parindent
to 1em matching
-that font, put
-\AtBeginDocument{\setlength{\parindent}{1em}}
in the
-preamble.)
+
Globally adds one to counter and resets all counters numbered
+within it. (For the definition of “counters numbered within”,
+see \newcounter
: Allocating a counter.)
-The default value for \parskip
in LaTeX’s standard document
-classes is 0pt plus1pt
.
+
This command differs from \refstepcounter
in that this one does
+not influence references; that is, it does not define the current
+\ref
value to be the result of \thecounter
+(see \refstepcounter
).
-
-
+
15.4 Marginal notes
+13.8 \day
& \month
& \year
¶
-
-
-
-
+
+
+
-Synopsis, one of:
-
-
-\marginpar{right}
-\marginpar[left]{right}
-
-
-Create 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.
-
-The margin that LaTeX uses for the note depends on the current layout
-(see Document class options) and also on \reversemarginpar
-(see below). If you are using one-sided layout (document option
-oneside
) then it goes in the right margin. If you are using
-two-sided layout (document option twoside
) then it goes in the
-outside margin. If you are in two-column layout (document option
-twocolumn
) then it goes in the nearest margin.
-
-
-
-If you declare \reversemarginpar
then LaTeX will place
-subsequent marginal notes in the opposite margin to that given in the
-prior paragraph. Revert that to the default position with
-\normalmarginpar
.
-
-When you specify the optional argument left then it is used for
-a note in the left margin, while the mandatory argument right is
-used for a note in the right margin.
-
-Normally, a note’s first word will not be hyphenated. You can enable
-hyphenation there by beginning left or right with
-\hspace{0pt}
.
-
-These parameters affect the formatting of the note:
-
-
-\marginparpush
¶
-Minimum vertical space between notes; default ‘7pt’ for ‘12pt’
-documents, ‘5pt’ else. See also page layout parameters marginparpush.
-
-
-\marginparsep
¶
-Horizontal space between the main text and the note; default
-‘11pt’ for ‘10pt’ documents, ‘10pt’ else.
+
LaTeX defines the counter \day
for the day of the month
+(nominally with value between 1 and 31), \month
for the month of
+the year (nominally with value between 1 and 12), and \year
for
+the year. When TeX starts up, they are set from the current values
+on the system. The related command \today
produces a string
+representing the current day (see \today
).
-
-\marginparwidth
¶
-Width of the note itself; default for a one-sided ‘10pt’ document
-is ‘90pt’, ‘83pt’ for ‘11pt’, and ‘68pt’ for
-‘12pt’; ‘17pt’ more in each case for a two-sided document.
-In two column mode, the default is ‘48pt’.
+
They counters are not updated as the job progresses so in principle they
+could be incorrect by the end. In addition, TeX does no sanity
+check:
-
-
+
+\day=-2 \month=13 \year=-4 \today
+
-The standard LaTeX routine for marginal notes does not prevent
-notes from falling off the bottom of the page.
+
gives no error or warning and results in the output ‘-2, -4’ (the
+bogus month value produces no output).
+
+See Command line input, to force the date to a given value from the
+command line.
-
-
-
+
16 Math formulas
+14 Lengths ¶
-
-
-
-
-
-
-
-
-
-
-
-
+
-Produce mathematical text by putting LaTeX into math mode or display
-math mode (see Modes). This example shows both.
+
A length is a measure of distance. Many LaTeX commands take a
+length as an argument.
+
+
+
+
+
+
+Lengths come in two types. A rigid length such as 10pt
+does not contain a plus
or minus
component. (Plain
+TeX calls this a dimen.) A rubber length (what plain
+TeX calls a skip or glue) such as with 1cm
+plus0.05cm minus0.01cm
can contain either or both of those
+components. In that rubber length, the 1cm
is the natural
+length while the other two, the plus
and minus
+components, allow TeX to stretch or shrink the length to optimize
+placement.
+
+The illustrations below use these two commands.
-The wave equation for \( u \) is
-\begin{displaymath}
- \frac{\partial^2u}{\partial t^2} = c^2\nabla^2u
-\end{displaymath}
-where \( \nabla^2 \) is the spatial Laplacian and \( c \) is constant.
+% make a black bar 10pt tall and #1 wide
+\newcommand{\blackbar}[1]{\rule{#1}{10pt}}
+
+% Make a box around #2 that is #1 wide (excluding the border)
+\newcommand{\showhbox}[2]{%
+ \fboxsep=0pt\fbox{\hbox to #1{#2}}}
-Math mode is for inline mathematics. In the above example it is invoked
-by the starting \(
and finished by the matching ending \)
.
-Display math mode is for displayed equations and here is invoked by the
-displaymath
environment. Note that any mathematical text
-whatever, including mathematical text consisting of just one character,
-is handled in math mode.
+
This next example uses those commands to show a black bar 100 points
+long between ‘ABC’ and ‘XYZ’. This length is rigid.
-When in math mode or display math mode, LaTeX handles many aspects of
-your input text differently than in other text modes. For example,
+
+ABC\showhbox{100pt}{\blackbar{100pt}}XYZ
+
+
+As for rubber lengths, shrinking is simpler one: with 1cm minus
+0.05cm
, the natural length is 1cm but TeX can shrink it down
+as far as 0.95cm. Beyond that, TeX refuses to shrink any more.
+Thus, below the first one works fine, producing a space of
+98 points between the two bars.
-contrast x+y with \( x+y \)
+ABC\showhbox{300pt}{%
+ \blackbar{101pt}\hspace{100pt minus 2pt}\blackbar{101pt}}YYY
+
+ABC\showhbox{300pt}{%
+ \blackbar{105pt}\hspace{100pt minus 1pt}\blackbar{105pt}}YYY
-in math mode the letters are in italics and the spacing around the plus
-sign is different.
+
But the second one gets a warning like ‘Overfull \hbox (1.0pt too
+wide) detected at line 17’. In the output the first ‘Y’ is
+overwritten by the end of the black bar, because the box’s material is
+wider than the 300pt allocated, as TeX has refused to shrink
+the total to less than 309 points.
-There are three ways to make inline formulas, to put LaTeX in math
-mode.
+
Stretching is like shrinking except that if TeX is asked to stretch
+beyond the given amount, it will do it. Here the first line is fine,
+producing a space of 110 points between the bars.
-\( mathematical material \)
-$ mathematical material $
-\begin{math} mathematical material \end{math}
+ABC\showhbox{300pt}{%
+ \blackbar{95pt}\hspace{100pt plus 10pt}\blackbar{95pt}}YYY
+
+ABC\showhbox{300pt}{%
+ \blackbar{95pt}\hspace{100pt plus 1pt}\blackbar{95pt}}YYY
-The first form is preferred and the second is quite common, but the
-third form is rarely used. You can sometimes use one and sometimes
-another, as in \(x\) and $y$
. You can use these in paragraph
-mode or in LR mode (see Modes).
+
In the second line TeX needs a stretch of 10 points and only
+1 point was specified. TeX stretches the space to the required
+length but it gives you a warning like ‘Underfull \hbox (badness
+10000) detected at line 22’. (We won’t discuss badness.)
-To make displayed formulas, put LaTeX into display math mode with
-either:
+
You can put both stretch and shrink in the same length, as in
+1ex plus 0.05ex minus 0.02ex
.
+
+If TeX is setting two or more rubber lengths then it allocates the
+stretch or shrink in proportion.
-\begin{displaymath}
- mathematical material
-\end{displaymath}
+ABC\showhbox{300pt}{%
+ \blackbar{100pt}% left
+ \hspace{0pt plus 50pt}\blackbar{80pt}\hspace{0pt plus 10pt}% middle
+ \blackbar{100pt}}YYY % right
-or
+
The left and right bars take up 100 points, so the middle needs
+another 100. The middle bar is 80 points so the two
+\hspace
’s must stretch 20 points. Because the two are
+plus 50pt
and plus 10pt
, TeX gets 5/6 of the stretch
+from the first space and 1/6 from the second.
+
+The 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 TeX could set
+it to any distance. Here the two figures will be equally spaced across
+the page.
-\begin{equation}
- mathematical material
-\end{equation}
+\begin{minipage}{\linewidth}
+ \hspace{0pt plus 1fill}\includegraphics{godel.png}%
+ \hspace{0pt plus 1fill}\includegraphics{einstein.png}%
+ \hspace{0pt plus 1fill}
+\end{minipage}
-(see displaymath
, see equation
). The only difference is that
-with the equation
environment, LaTeX puts a formula number
-alongside the formula. The construct \[ math \]
is
-equivalent to \begin{displaymath} math
-\end{displaymath}
. These environments can only be used in paragraph
-mode (see Modes).
+
TeX has three levels of infinity for glue components: fil
,
+fill
, and filll
. The later ones are more infinite than
+the earlier ones. Ordinarily document authors only use the middle one
+(see \hfill
and see \vfill
).
-
-
-
-
-
-
-
-
-
-The American Mathematical Society has made freely available a set of
-packages that greatly expand your options for writing mathematics,
-amsmath
and amssymb
(also be aware of the mathtools
-package that is an extension to, and loads, amsmath
). New
-documents that will have mathematical text should use these packages.
-Descriptions of these packages is outside the scope of this document;
-see their documentation on CTAN.
+
Multiplying a rubber length by a number turns it into a rigid length, so
+that after \setlength{\ylength}{1in plus 0.2in}
and
+\setlength{\zlength}{3\ylength}
then the value of
+\zlength
is 3in
.
-- Subscripts & superscripts
-- Math symbols
-- Math functions
-- Math accents
-- Over- and Underlining
-- Spacing in math mode
-- Math styles
-- Math miscellany
+- Units of length
+\setlength
+\addtolength
+\settodepth
+\settoheight
+\settowidth
+\stretch
+- Expressions
-
+
16.1 Subscripts & superscripts
+14.1 Units of length ¶
-
-
-
-
-
+
-Synopsis (in math mode or display math mode), one of:
+
TeX and LaTeX know about these units both inside and outside of
+math mode.
-
-base^exp
-base^{exp}
-
-
-or, one of:
-
-
-base_exp
-base_{exp}
-
-
-Make exp appear as a superscript of base (with the caret
-character, ^
) or a subscript (with
-underscore, _
).
-
-In this example the 0
’s and 1
’s are subscripts while the
-2
’s are superscripts.
-
-
-\( (x_0+x_1)^2 \leq (x_0)^2+(x_1)^2 \)
-
-
-To have the subscript or superscript contain more than one character,
-surround the expression with curly braces, as in e^{-2x}
.
-This example’s fourth line shows curly braces used to group an expression
-for the exponent.
-
-
-\begin{displaymath}
- (3^3)^3=27^3=19\,683
- \qquad
- 3^{(3^3)}=3^{27}=7\,625\,597\,484\,987
-\end{displaymath}
-
-
-LaTeX knows how to handle a superscript on a superscript, or a
-subscript on a subscript, or supers on subs, or subs on supers. So,
-expressions such as e^{x^2}
and x_{i_0}
give correct
-output. Note the use in those expressions of curly braces to give the
-base a determined exp. If you enter \(3^3^3\)
, this
-interpreted as \(3^{3}^{3}\)
and then you get TeX error
-‘Double superscript’.
-
-LaTeX does the right thing when something has both a subscript and a
-superscript. In this example the integral has both. They come out in
-the correct place without any author intervention.
-
-
-\begin{displaymath}
- \int_{x=a}^b f'(x)\,dx = f(b)-f(a)
-\end{displaymath}
-
-
-Note the curly braces around x=a
to make the entire expression a
-subscript.
-
-To put a superscript or subscript before a symbol, use a construct like
-{}_t K^2
. The empty curly braces {}
give the
-subscript something to attach to and keeps it from accidentally
-attaching to a prior symbols.
-
-Using the subscript or superscript character outside of math mode or
-display math mode, as in the expression x^2
, will get you
-the TeX error ‘Missing $ inserted’.
-
-
-
-
-A common reason to want subscripts outside of a mathematics mode is to
-typeset chemical formulas. There are packages for that, such as
-mhchem
; see CTAN.
-
-
-
-
-
-
-16.2 Math symbols
-
-
-
-
-
-
-
-
-
-LaTeX provides almost any mathematical or technical symbol that
-anyone uses. For example, if you include $\pi$
in your source,
-you will get the pi symbol π. See the “Comprehensive
-LaTeX Symbol List” package at
-https://ctan.org/pkg/comprehensive.
-
-Here is a list of commonly-used symbols. It is by no means exhaustive.
-Each symbol is described with a short phrase, and its symbol class,
-which determines the spacing around it, is given in parenthesis. Unless
-said otherwise, the commands for these symbols can be used only in math
-mode. To redefine a command so that it can be used whatever the current
-mode, see \ensuremath
.
-
-
-\|
¶
-∥ Parallel (relation). Synonym: \parallel
.
-
-
-\aleph
¶
-ℵ Aleph, transfinite cardinal (ordinary).
-
-
-\alpha
¶
-α Lowercase Greek letter alpha (ordinary).
+
pt
¶
+-
+
Point, 1/72.27 inch. The (approximate) conversion to metric units
+is 1point = .35146mm = .035146cm.
-\amalg
¶
-⨿ Disjoint union (binary)
+
pc
¶
+-
+
Pica, 12 pt
-\angle
¶
-∠ Geometric angle (ordinary). Similar: less-than
-sign <
and angle bracket \langle
.
+
in
¶
+-
+
Inch, 72.27 pt
-\approx
¶
-≈ Almost equal to (relation).
+
bp
¶
+-
+
+
Big point, 1/72 inch. This length is the definition of a point in
+PostScript and many desktop publishing systems.
-\ast
¶
-∗ Asterisk operator, convolution, six-pointed
-(binary). Synonym: *
, 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.
+
mm
¶
+-
+
Millimeter, 2.845pt
-\asymp
¶
-≍ Asymptotically equivalent (relation).
+
cm
¶
+-
+
Centimeter, 10mm
-\backslash
¶
-\ Backslash (ordinary). Similar: set minus \setminus
, and
-\textbackslash
for backslash outside of math mode.
+
dd
¶
+-
+
Didot point, 1.07 pt
-\beta
¶
-β Lowercase Greek letter beta (ordinary).
+
cc
¶
+-
+
Cicero, 12 dd
-\bigcap
¶
-⋂ Variable-sized, or n-ary, intersection (operator). Similar:
-binary intersection \cap
.
+
sp
¶
+-
+
Scaled point, 1/65536 pt
-\bigcirc
¶
-⚪ Circle, larger (binary). Similar: function
-composition \circ
.
+
+
+Three other units are defined according to the current font, rather
+than being an absolute dimension.
-
-\bigcup
¶
-⋃ Variable-sized, or n-ary, union (operator). Similar: binary
-union \cup
.
+
+ex
¶
+-
+
+
The x-height of the current font ex, traditionally the
+height of the lowercase letter x, is often used for vertical
+lengths.
-\bigodot
¶
-⨀ Variable-sized, or n-ary, circled dot operator (operator).
+
em
¶
+-
+
+
Similarly em, traditionally the width of the capital
+letter M, is often used for horizontal lengths. This is also often
+the size of the current font, e.g., a nominal 10pt font will
+have 1em = 10pt. LaTeX has several commands to produce
+horizontal spaces based on the em (see \enspace
& \quad
& \qquad
).
-\bigoplus
¶
-⨁ Variable-sized, or n-ary, circled plus operator (operator).
+
mu
¶
+-
+
Finally, in math mode, many definitions are expressed in terms
+of the math unit mu, defined by 1em = 18mu, where the
+em is taken from the current math symbols family. See Spacing in math mode.
-\bigotimes
¶
-⨂ Variable-sized, or n-ary, circled times operator (operator).
+
+
+Using these units 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.
-
-\bigtriangledown
¶
-▽ Variable-sized, or n-ary, open triangle
-pointing down (binary). Synonym: \varbigtriangledown.
+
+
+
-
+14.2 \setlength
¶
+
+
+
+
+Synopsis:
-
-\bigtriangleup
¶
-△ Variable-sized, or n-ary, open triangle
-pointing up (binary). Synonym: \varbigtriangleup.
+
+\setlength{\len}{amount}
+
+
+Set the length \len to amount. The length name
+\len
has to be a control sequence (see Control sequence, control word and control symbol), and as such must begin with a backslash, \
under
+normal circumstances. The amount can be a rubber length
+(see Lengths). It can be positive, negative or zero, and can be in
+any units that LaTeX understands (see Units of length).
-
-\bigsqcup
¶
-⨆ Variable-sized, or n-ary, square union (operator).
+
Below, with LaTeX’s defaults the first paragraph will be indented
+while the second will not.
-
-\biguplus
¶
-⨄ Variable-sized, or n-ary, union operator with a plus
-(operator). (Note that the name has only one p.)
+
+I told the doctor I broke my leg in two places.
+
+\setlength{\parindent}{0em}
+He said stop going to those places.
+
+
+If you did not declare \len with \newlength
, for example if
+you mistype it as in
+\newlength{\specparindent}\setlength{\sepcparindent}{...}
,
+then you get an error like ‘Undefined control sequence. <argument>
+\sepcindent’. If you omit the backslash at the start of the length name
+then you get an error like ‘Missing number, treated as zero.’.
-
-\bigvee
¶
-⋁ Variable-sized, or n-ary, logical-or (operator).
+
+
+
+
+14.3 \addtolength
¶
+
+
+
+
+Synopsis:
-
-\bigwedge
¶
-⋀ Variable-sized, or n-ary, logical-and (operator).
+
+\addtolength{\len}{amount}
+
+
+Increment the length \len by amount. The length name
+\len
has to be a control sequence (see Control sequence, control word and control symbol), and as such must begin with a backslash, \
under
+normal circumstances. The amount is a rubber length
+(see Lengths). It can be positive, negative or zero, and can be in
+any units that LaTeX understands (see Units of length).
-
-\bot
¶
-⊥, Up tack, bottom, least element of a partially ordered
-set, or a contradiction (ordinary). See also \top
.
+
Below, if \parskip
starts with the value 0pt plus 1pt
-
-\bowtie
¶
-⋈ Natural join of two relations (relation).
+
+Doctor: how is the boy who swallowed the silver dollar?
+\addtolength{\parskip}{1pt}
+
+Nurse: no change.
+
+
+then it has the value 1pt plus 1pt
for the second paragraph.
+
+If you did not declare \len with \newlength
, for example if
+you mistype it as in
+\newlength{\specparindent}\addtolength{\sepcparindent}{...}
,
+then you get an error like ‘Undefined control sequence. <argument>
+\sepcindent’. If the amount uses some length that has not been
+declared, for instance if for example you mistype the above as
+\addtolength{\specparindent}{0.6\praindent}
, then you get
+something like ‘Undefined control sequence. <argument> \praindent’.
+If you leave off the backslash at the start of \len, as in
+\addtolength{parindent}{1pt}
, then you get something like
+‘You can't use `the letter p' after \advance’.
+
+
+
+
+
+14.4 \settodepth
¶
+
+
+
+Synopsis:
+
+
+\settodepth{\len}{text}
+
+
+Set the length \len to the depth of box that LaTeX gets on
+typesetting the text argument. The length name \len
+has to be a control sequence (see Control sequence, control word and control symbol), and as such
+must begin with a backslash, \
under normal circumstances.
+
+This will print how low the character descenders go.
+
+
+\newlength{\alphabetdepth}
+\settodepth{\alphabetdepth}{abcdefghijklmnopqrstuvwxyz}
+\the\alphabetdepth
+
+
+If you did not declare \len with \newlength
, if for example you
+mistype the above as \settodepth{\aplhabetdepth}{abc...}
,
+then you get something like ‘Undefined control sequence. <argument>
+\aplhabetdepth’. If you leave the backslash out of \len, as in
+\settodepth{alphabetdepth}{...}
then you get something like
+‘Missing number, treated as zero. <to be read again> \setbox’.
+
+
+
+
+
+
+14.5 \settoheight
¶
+
+
+
+Synopsis:
+
+
+\settoheight{\len}{text}
+
+
+Sets the length \len to the height of box that LaTeX gets on
+typesetting the text
argument. The length name \len
+has to be a control sequence (see Control sequence, control word and control symbol), and as such
+must begin with a backslash, \
under normal circumstances.
+
+This will print how high the characters go.
+
+
+\newlength{\alphabetheight}
+\settoheight{\alphabetheight}{abcdefghijklmnopqrstuvwxyz}
+\the\alphabetheight
+
+
+If no such length \len has been declared with \newlength
, if
+for example you mistype as
+\settoheight{\aplhabetheight}{abc...}
, then you get something
+like ‘Undefined control sequence. <argument> \alphabetheight’. If
+you leave the backslash out of \len, as in
+\settoheight{alphabetheight}{...}
then you get something like
+‘Missing number, treated as zero. <to be read again> \setbox’.
+
+
+
+
+
+
+14.6 \settowidth
¶
+
+
+
+Synopsis:
+
+
+\settowidth{\len}{text}
+
+
+Set the length \len to the width of the box that LaTeX gets on
+typesetting the text argument. The length name \len
+has to be a control sequence (see Control sequence, control word and control symbol), and as such
+must begin with a backslash, \
under normal circumstances.
+
+This prints the width of the lowercase ASCII alphabet.
+
+
+\newlength{\alphabetwidth}
+\settowidth{\alphabetwidth}{abcdefghijklmnopqrstuvwxyz}
+\the\alphabetwidth
+
+
+If no such length \len has been declared with \newlength
,
+if for example you mistype the above as
+\settowidth{\aplhabetwidth}{abc...}
, then you get something
+like ‘Undefined control sequence. <argument> \aplhabetwidth’. If
+you leave the backslash out of \len, as in
+\settoheight{alphabetwidth}{...}
then you get something like
+‘Missing number, treated as zero. <to be read again> \setbox’.
+
+
+
+
+
+
+14.7 \stretch
¶
+
+
+
+Synopsis:
+
+
+\stretch{number}
+
+
+Produces a rubber length with zero natural length and number times
+\fill
units of stretchability (see Lengths). The
+number can be positive or negative. This command is robust
+(see \protect
).
+
+It works for both vertical and horizontal spacing. In this horizontal
+example, LaTeX produces three tick marks, and the distance between
+the first and second is half again as long as the distance between the
+second and third.
+
+
+\rule{0.4pt}{1ex}\hspace{\stretch{1.5}}%
+ \rule{0.4pt}{1ex}\hspace{\stretch{1}}%
+ \rule{0.4pt}{1ex}
+
+
+In this vertical example, the ‘We dedicate …’ will have three
+times as much space under it as above it.
+
+
+\newenvironment{dedication}{% in document preamble
+ \clearpage\thispagestyle{empty}%
+ \vspace*{\stretch{1}} % stretchable space at top
+ \it
+}{%
+ \vspace{\stretch{3}} % space at bot is 3x as at top
+ \clearpage
+}
+ ...
+\begin{dedication} % in document body
+We dedicate this book to our wives.
+\end{dedication}
+
+
+
+
+
+
+
+14.8 Expressions ¶
+
+
+
+Synopsis, one of:
+
+
+\numexpr expression
+\dimexpr expression
+\glueexpr expression
+\muglue expression
+
+
+Any place where you may write an integer, or a TeX dimen, or TeX
+glue, or muglue, you can instead write an expression to compute that
+type of quantity.
+
+An example is that \the\dimexpr\linewidth-4pt\relax
will
+produce as output the length that is four points less than width of a
+line (the only purpose of \the
is to show the result in the
+document). Analogously, \romannumeral\numexpr6+3\relax
will
+produce ‘ix’, and \the\glueexpr 5pt plus 1pt * 2 \relax
+will produce ‘10.0pt plus 2.0pt’.
+
+A convenience here over doing calculations by allocating registers and
+then using \advance
, etc., is that the evaluation of expressions
+does not involve assignments and can therefore be performed in places
+where assignments are not allowed. The next example computes the width
+of the \parbox
.
+
+
+\newlength{\offset}\setlength{\offset}{2em}
+\begin{center}
+\parbox{\dimexpr\linewidth-\offset*3}{With malice toward none
+with charity for all with firmness in the right as God gives us to see
+the right let us strive on to finish the work we are in to bind up the
+nation's wounds, to care for him who shall have borne the battle and
+for his widow and his orphan \textasciitilde\ to do all which may
+achieve and cherish a just and lasting peace among ourselves and with
+all nations. ---Abraham Lincoln, Second Inaugural Address, from the
+memorial}
+\end{center}
+
+
+The expression consists of one or more terms of the same type
+(integer, dimension, etc.) that are added or subtracted. A term that is
+a type of number, dimension, etc., consists of a factor of that type,
+optionally multiplied or divided by factors. A factor of a type is
+either a quantity of that type or a parenthesized subexpression. The
+expression produces a result of the given type, so that \numexpr
+produces an integer, \dimexpr
produces a dimension, etc.
+
+In the quotation example above, changing to
+\dimexpr\linewidth-3*\offset
gives the error Illegal unit
+of measure (pt inserted)
. This is because for \dimexpr
and
+\glueexpr
, the input consists of a dimension or glue value
+followed by an optional multiplication factor, and not the other way
+around. Thus \the\dimexpr 1pt*10\relax
is valid and produces
+‘10.0pt’, but \the\dimexpr 10*1pt\relax
gives the
+Illegal unit
error.
+
+The expressions absorb tokens and carry out appropriate mathematics up
+to a \relax
(which will be absorbed), or up to the first
+non-valid token. Thus, \the\numexpr2+3px
will print
+‘5px’, because LaTeX reads the \numexpr2+3
, which is
+made up of numbers, and then finds the letter p
, which cannot
+be part of a number. It therefore terminates the expression and
+produces the ‘5’, followed by the regular text ‘px’.
+
+This termination behavior is useful in comparisons. In
+\ifnum\numexpr\parindent*2 < 10pt Yes\else No\fi
, the less than
+sign terminates the expression and the result is ‘No’ (in a
+standard LaTeX article).
+
+Expressions may use the operators +
, -
, *
and
+/
along with parentheses for subexpressions, (...)
. In
+glue expressions the plus
and minus
parts do not need
+parentheses to be affected by a factor. So \the\glueexpr 5pt plus
+1pt * 2 \relax
results in ‘10pt plus 2pt’.
+
+TeX will coerce other numerical types in the same way as it does when
+doing register assignment. Thus \the\numexpr\dimexpr
+1pt\relax\relax
will result in ‘65536’, which is 1pt
+converted to scaled points (see sp
,
+TeX’s internal unit) and then coerced into an integer. With a
+\glueexpr
here, the stretch and shrink would be dropped. Going
+the other way, a \numexpr
inside a \dimexpr
or
+\glueexpr
will need appropriate units, as in
+\the\dimexpr\numexpr 1 + 2\relax pt\relax
, which produces
+‘3.0pt’.
+
+The details of the arithmetic: each factor is checked to be in the
+allowed range, numbers must be less than 2^{31} in absolute
+value, and dimensions or glue components must be less than
+2^{14} points, or mu
, or fil
, etc. The
+arithmetic operations are performed individually, except for a scaling
+operation (a multiplication immediately followed by a division) which
+is done as one combined operation with a 64-bit product as
+intermediate value. The result of each operation is again checked to
+be in the allowed range.
+
+Finally, division and scaling take place with rounding (unlike TeX’s
+\divide
, which truncates). Thus
+\the\dimexpr 5pt*(3/2)\relax
puts ‘10.0pt’ in the document,
+because it rounds 3/2
to 2
, while
+\the\dimexpr 5pt*(4/3)\relax
produces ‘5.0pt’.
+
+
+
+
+
+
+
+15 Making paragraphs ¶
+
+
+
+
+To start a paragraph, just type some text. To end the current
+paragraph, put an empty line. This is three paragraphs, the
+separation of which is made by two empty lines.
+
+
+It is a truth universally acknowledged, that a single man in possession
+of a good fortune, must be in want of a wife.
+
+However little known the feelings or views of such a man may be on his
+first entering a neighbourhood, this truth is so well fixed in the minds
+of the surrounding families, that he is considered the rightful property
+of some one or other of their daughters.
+
+``My dear Mr. Bennet,'' said his lady to him one day,
+``have you heard that Netherfield Park is let at last?''
+
+
+A paragraph separator can be made of a sequence of at least one blank
+line, at least one of which is not terminated by a comment. A blank line
+is a line that is empty or made only of blank characters such as space
+or tab. Comments in source code are started with a %
and span up
+to the end of line. In the following example the two columns are
+identical:
+
+
+\documentclass[twocolumn]{article}
+\begin{document}
+First paragraph.
+
+Second paragraph.
+\newpage
+First paragraph.
+
+ % separator lines may contain blank characters.
+
+Second paragraph.
+\end{document}
+
+
+
+Once LaTeX has gathered all of a paragraph’s contents it divides that
+content into lines in a way that is optimized over the entire paragraph
+(see Line breaking).
+
+There are places where a new paragraph is not permitted. Don’t put a
+blank line in math mode (see Modes); here the blank line before the
+\end{equation}
+
+
+\begin{equation}
+ 2^{|S|} > |S|
+
+\end{equation}
+
+
+will get you the error ‘Missing $ inserted’. Similarly, the blank
+line in this \section
argument
+
+
+\section{aaa
+
+bbb}
+
+
+gets ‘Runaway argument? {aaa ! Paragraph ended before \@sect was
+complete’.
+
+
+
+
+
+
+
+15.1 \par
¶
+
+
+
+
+Synopsis (note that while reading the input TeX converts any sequence
+of one or more blank lines to a \par
, Making paragraphs):
+
+
+\par
+
+
+End the current paragraph. The usual way to separate paragraphs is with
+a blank line but the \par
command is entirely equivalent. This
+command is robust (see \protect
).
+
+This example uses \par
rather than a blank line simply for
+readability.
+
+
+\newcommand{\syllabusLegalese}{%
+ \whatCheatingIs\par\whatHappensWhenICatchYou}
+
+
+In LR mode the \par
command does nothing and is ignored. In
+paragraph mode, the \par
command terminates paragraph mode,
+switching LaTeX to vertical mode (see Modes).
+
+You cannot use the \par
command in a math mode. You also cannot
+use it in the argument of many commands, such as the sectioning
+commands, e.g. \section
(see Making paragraphs and
+\newcommand
& \renewcommand
).
+
+The \par
command is not the same as the \paragraph
+command. The latter is, like \section
or \subsection
, a
+sectioning command used by the LaTeX document standard classes
+(see \subsubsection
, \paragraph
, \subparagraph
).
+
+The \par
command is not the same as \newline
or the line
+break double backslash, \\
. The difference is that \par
+ends the paragraph, not just the line, and also triggers the addition of
+the between-paragraph vertical space \parskip
(see \parindent
& \parskip
).
+
+The output from this example
+
+
+xyz
+
+\setlength{\parindent}{3in}
+\setlength{\parskip}{5in}
+\noindent test\indent test1\par test2
+
+
+is: after ‘xyz’ there is a vertical skip of 5 inches and then
+‘test’ appears, aligned with the left margin. On the same line,
+there is an empty horizontal space of 3 inches and then
+‘test1’ appears. Finally. there is a vertical space of
+5 inches, followed by a fresh paragraph with a paragraph indent of
+3 inches, and then LaTeX puts the text ‘test2’.
+
+
+
+
+
+
+15.2 \indent
& \noindent
¶
+
+
+
+
+
+Synopsis:
+
+
+\indent
+
+
+or
+
+
+\noindent
+
+
+Go into horizontal mode (see Modes). The \indent
command
+first outputs an empty box whose width is \parindent
. These
+commands are robust (see \protect
).
+
+Ordinarily you create a new paragraph by putting in a blank line.
+See \par
, for the difference between this command and \par
. To
+start a paragraph without an indent, or to continue an interrupted
+paragraph, use \noindent
.
+
+In the middle of a paragraph the \noindent
command has no effect,
+because LaTeX is already in horizontal mode there. The
+\indent
command’s only effect is to output a space.
+
+This example starts a fresh paragraph.
+
+
+... end of the prior paragraph.
+
+\noindent This paragraph is not indented.
+
+
+and this continues an interrupted paragraph.
+
+
+The data
+
+\begin{center}
+ \begin{tabular}{rl} ... \end{tabular}
+\end{center}
+
+\noindent shows this clearly.
+
+
+
+To omit indentation in the entire document put
+\setlength{\parindent}{0pt}
in the preamble. If you do that,
+you may want to also set the length of spaces between paragraphs,
+\parskip
(see \parindent
& \parskip
).
+
+
+
+
+Default LaTeX styles have the first paragraph after a section that is
+not indented, as is traditional typesetting in English. To change that,
+look on CTAN for the package indentfirst
.
+
+
+
+
+
+
+15.3 \parindent
& \parskip
¶
+
+
+
+
+
+
+
+Synopsis:
+
+
+\setlength{\parindent}{horizontal len}
+\setlength{\parskip}{vertical len}
+
+
+Both are rubber lengths (see Lengths). They affect the
+indentation of ordinary paragraphs, not paragraphs inside
+minipages (see minipage
), and the vertical space between
+paragraphs, respectively.
+
+For example, if this is put in the preamble:
+
+
+\setlength{\parindent}{0em}
+\setlength{\parskip}{1ex}
+
+
+The document will have paragraphs that are not indented, but instead
+are vertically separated by about the height of a lowercase ‘x’.
+
+In LaTeX standard class documents, the default value for
+\parindent
in one-column documents is 15pt
when the
+default text size is 10pt
, 17pt
for 11pt
, and
+1.5em
for 12pt
. In two-column documents it is 1em
.
+(These values are set before LaTeX calls \normalfont
so
+em
is derived from the default font, Computer Modern. If you use
+a different font then to set \parindent
to 1em matching
+that font, put
+\AtBeginDocument{\setlength{\parindent}{1em}}
in the
+preamble.)
+
+The default value for \parskip
in LaTeX’s standard document
+classes is 0pt plus1pt
.
+
+
+
+
+
+
+15.4 Marginal notes ¶
+
+
+
+
+
+
+Synopsis, one of:
+
+
+\marginpar{right}
+\marginpar[left]{right}
+
+
+Create 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.
+
+The margin that LaTeX uses for the note depends on the current layout
+(see Document class options) and also on \reversemarginpar
+(see below). If you are using one-sided layout (document option
+oneside
) then it goes in the right margin. If you are using
+two-sided layout (document option twoside
) then it goes in the
+outside margin. If you are in two-column layout (document option
+twocolumn
) then it goes in the nearest margin.
+
+
+
+If you declare \reversemarginpar
then LaTeX will place
+subsequent marginal notes in the opposite margin to that given in the
+prior paragraph. Revert that to the default position with
+\normalmarginpar
.
+
+When you specify the optional argument left then it is used for
+a note in the left margin, while the mandatory argument right is
+used for a note in the right margin.
+
+Normally, a note’s first word will not be hyphenated. You can enable
+hyphenation there by beginning left or right with
+\hspace{0pt}
.
+
+These parameters affect the formatting of the note:
+
+
+\marginparpush
¶
+Minimum vertical space between notes; default ‘7pt’ for ‘12pt’
+documents, ‘5pt’ else. See also page layout parameters marginparpush.
+
+
+\marginparsep
¶
+Horizontal space between the main text and the note; default
+‘11pt’ for ‘10pt’ documents, ‘10pt’ else.
+
+
+\marginparwidth
¶
+Width of the note itself; default for a one-sided ‘10pt’ document
+is ‘90pt’, ‘83pt’ for ‘11pt’, and ‘68pt’ for
+‘12pt’; ‘17pt’ more in each case for a two-sided document.
+In two column mode, the default is ‘48pt’.
+
+
+
+
+The standard LaTeX routine for marginal notes does not prevent
+notes from falling off the bottom of the page.
+
+
+
+
+
+
+
+
+16 Math formulas ¶
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Produce mathematical text by putting LaTeX into math mode or display
+math mode (see Modes). This example shows both.
+
+
+The wave equation for \( u \) is
+\begin{displaymath}
+ \frac{\partial^2u}{\partial t^2} = c^2\nabla^2u
+\end{displaymath}
+where \( \nabla^2 \) is the spatial Laplacian and \( c \) is constant.
+
+
+Math mode is for inline mathematics. In the above example it is invoked
+by the starting \(
and finished by the matching ending \)
.
+Display math mode is for displayed equations and here is invoked by the
+displaymath
environment. Note that any mathematical text
+whatever, including mathematical text consisting of just one character,
+is handled in math mode.
+
+When in math mode or display math mode, LaTeX handles many aspects of
+your input text differently than in other text modes. For example,
+
+
+contrast x+y with \( x+y \)
+
+
+in math mode the letters are in italics and the spacing around the plus
+sign is different.
+
+There are three ways to make inline formulas, to put LaTeX in math
+mode.
+
+
+\( mathematical material \)
+$ mathematical material $
+\begin{math} mathematical material \end{math}
+
+
+The first form is preferred and the second is quite common, but the
+third form is rarely used. You can sometimes use one and sometimes
+another, as in \(x\) and $y$
. You can use these in paragraph
+mode or in LR mode (see Modes).
+
+To make displayed formulas, put LaTeX into display math mode with
+either:
+
+
+\begin{displaymath}
+ mathematical material
+\end{displaymath}
+
+
+or
+
+
+\begin{equation}
+ mathematical material
+\end{equation}
+
+
+(see displaymath
, see equation
). The only difference is that
+with the equation
environment, LaTeX puts a formula number
+alongside the formula. The construct \[ math \]
is
+equivalent to \begin{displaymath} math
+\end{displaymath}
. These environments can only be used in paragraph
+mode (see Modes).
+
+
+
+
+
+
+
+
+
+
+The American Mathematical Society has made freely available a set of
+packages that greatly expand your options for writing mathematics,
+amsmath
and amssymb
(also be aware of the mathtools
+package that is an extension to, and loads, amsmath
). New
+documents that will have mathematical text should use these packages.
+Descriptions of these packages is outside the scope of this document;
+see their documentation on CTAN.
+
+
+
+
+- Subscripts & superscripts
+- Math symbols
+- Math functions
+- Math accents
+- Over- or under math
+- Spacing in math mode
+- Math styles
+- Math miscellany
+
+
+
+16.1 Subscripts & superscripts ¶
+
+
+
+
+
+
+
+Synopsis (in math mode or display math mode), one of:
+
+
+base^exp
+base^{exp}
+
+
+or, one of:
+
+
+base_exp
+base_{exp}
+
+
+Make exp appear as a superscript of base (with the caret
+character, ^
) or a subscript (with
+underscore, _
).
+
+In this example the 0
’s and 1
’s are subscripts while the
+2
’s are superscripts.
+
+
+\( (x_0+x_1)^2 \leq (x_0)^2+(x_1)^2 \)
+
+
+To have the subscript or superscript contain more than one character,
+surround the expression with curly braces, as in e^{-2x}
.
+This example’s fourth line shows curly braces used to group an expression
+for the exponent.
+
+
+\begin{displaymath}
+ (3^3)^3=27^3=19\,683
+ \qquad
+ 3^{(3^3)}=3^{27}=7\,625\,597\,484\,987
+\end{displaymath}
+
+
+LaTeX knows how to handle a superscript on a superscript, or a
+subscript on a subscript, or supers on subs, or subs on supers. So,
+expressions such as e^{x^2}
and x_{i_0}
give correct
+output. Note the use in those expressions of curly braces to give the
+base a determined exp. If you enter \(3^3^3\)
, this
+interpreted as \(3^{3}^{3}\)
and then you get TeX error
+‘Double superscript’.
+
+LaTeX does the right thing when something has both a subscript and a
+superscript. In this example the integral has both. They come out in
+the correct place without any author intervention.
+
+
+\begin{displaymath}
+ \int_{x=a}^b f'(x)\,dx = f(b)-f(a)
+\end{displaymath}
+
+
+Note the curly braces around x=a
to make the entire expression a
+subscript.
+
+To put a superscript or subscript before a symbol, use a construct like
+{}_t K^2
. The empty curly braces {}
give the
+subscript something to attach to and keeps it from accidentally
+attaching to a prior symbols.
+
+Using the subscript or superscript character outside of math mode or
+display math mode, as in the expression x^2
, will get you
+the TeX error ‘Missing $ inserted’.
+
+
+
+
+A common reason to want subscripts outside of a mathematics mode is to
+typeset chemical formulas. There are packages for that, such as
+mhchem
; see CTAN.
+
+
+
+
+
+
+16.2 Math symbols ¶
+
+
+
+
+
+
+
+
+
+LaTeX provides almost any mathematical or technical symbol that
+anyone uses. For example, if you include $\pi$
in your source,
+you will get the pi symbol π. See the “Comprehensive
+LaTeX Symbol List” package at
+https://ctan.org/pkg/comprehensive.
+
+Here is a list of commonly-used symbols. It is by no means exhaustive.
+Each symbol is described with a short phrase, and its symbol class,
+which determines the spacing around it, is given in parenthesis. Unless
+said otherwise, the commands for these symbols can be used only in math
+mode. To redefine a command so that it can be used whatever the current
+mode, see \ensuremath
.
+
+
+
+\|
¶
+∥ Parallel (relation). Synonym: \parallel
.
+
+
+\aleph
¶
+ℵ Aleph, transfinite cardinal (ordinary).
+
+
+\alpha
¶
+α Lowercase Greek letter alpha (ordinary).
+
+
+\amalg
¶
+⨿ Disjoint union (binary)
+
+
+\angle
¶
+∠ Geometric angle (ordinary). Similar: less-than
+sign <
and angle bracket \langle
.
+
+
+\approx
¶
+≈ Almost equal to (relation).
+
+
+\ast
¶
+∗ Asterisk operator, convolution, six-pointed
+(binary). Synonym: *
, 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.
+
+
+\asymp
¶
+≍ Asymptotically equivalent (relation).
+
+
+\backslash
¶
+\ Backslash (ordinary). Similar: set minus \setminus
, and
+\textbackslash
for backslash outside of math mode.
+
+
+\beta
¶
+β Lowercase Greek letter beta (ordinary).
+
+
+\bigcap
¶
+⋂ Variable-sized, or n-ary, intersection (operator). Similar:
+binary intersection \cap
.
+
+
+\bigcirc
¶
+⚪ Circle, larger (binary). Similar: function
+composition \circ
.
+
+
+\bigcup
¶
+⋃ Variable-sized, or n-ary, union (operator). Similar: binary
+union \cup
.
+
+
+\bigodot
¶
+⨀ Variable-sized, or n-ary, circled dot operator (operator).
+
+
+\bigoplus
¶
+⨁ Variable-sized, or n-ary, circled plus operator (operator).
+
+
+\bigotimes
¶
+⨂ Variable-sized, or n-ary, circled times operator (operator).
+
+
+\bigtriangledown
¶
+▽ Variable-sized, or n-ary, open triangle
+pointing down (binary). Synonym: \varbigtriangledown.
+
+
+\bigtriangleup
¶
+△ Variable-sized, or n-ary, open triangle
+pointing up (binary). Synonym: \varbigtriangleup.
+
+
+\bigsqcup
¶
+⨆ Variable-sized, or n-ary, square union (operator).
+
+
+\biguplus
¶
+⨄ Variable-sized, or n-ary, union operator with a plus
+(operator). (Note that the name has only one p.)
+
+
+\bigvee
¶
+⋁ Variable-sized, or n-ary, logical-or (operator).
+
+
+\bigwedge
¶
+⋀ Variable-sized, or n-ary, logical-and (operator).
+
+
+\bot
¶
+⊥, Up tack, bottom, least element of a partially ordered
+set, or a contradiction (ordinary). See also \top
.
-\Box
¶
+\bowtie
¶
+⋈ Natural join of two relations (relation).
+
+
+\Box
¶
□ Modal operator for necessity; square open box
(ordinary). Not available in plain TeX. In LaTeX you need to load the amssymb
package.
-\bullet
¶
+\bullet
¶
-
• Bullet (binary). Similar: multiplication
dot \cdot
.
-\cap
¶
+\cap
¶
∩ Intersection of two sets (binary). Similar: variable-sized
operator \bigcap
.
-\cdot
¶
+\cdot
¶
⋅ Multiplication (binary). Similar: Bullet
dot \bullet
.
-\chi
¶
+\chi
¶
χ Lowercase Greek chi (ordinary).
-\circ
¶
+\circ
¶
∘ Function composition, ring operator (binary). Similar:
variable-sized operator \bigcirc
.
-\clubsuit
¶
+\clubsuit
¶
♣ Club card suit (ordinary).
-\complement
¶
+\complement
¶
∁, Set complement, used as a superscript as in
$S^\complement$
(ordinary). Not available in plain TeX. In LaTeX you need to load the amssymb
package. Also used:
$S^{\mathsf{c}}$
or $\bar{S}$
.
-\cong
¶
+\cong
¶
≅ Congruent (relation).
-\coprod
¶
+\coprod
¶
∐ Coproduct (operator).
-\cup
¶
+\cup
¶
∪ Union of two sets (binary). Similar: variable-sized
operator \bigcup
.
-\dagger
¶
+\dagger
¶
† Dagger relation (binary).
-\dashv
¶
+\dashv
¶
⊣ Dash with vertical, reversed turnstile (relation). Similar:
turnstile \vdash
.
-\ddagger
¶
+\ddagger
¶
‡ Double dagger relation (binary).
-\Delta
¶
+\Delta
¶
Δ Greek uppercase delta, used for increment (ordinary).
-\delta
¶
+\delta
¶
δ Greek lowercase delta (ordinary).
-\Diamond
¶
+\Diamond
¶
◇ Large diamond operator (ordinary). Not available in plain TeX. In LaTeX you need to load the amssymb
package.
-\diamond
¶
+\diamond
¶
⋄ Diamond operator (binary). Similar: large
diamond \Diamond
, circle bullet \bullet
.
-\diamondsuit
¶
+\diamondsuit
¶
♢ Diamond card suit (ordinary).
-\div
¶
+\div
¶
÷ Division sign (binary).
-\doteq
¶
+\doteq
¶
≐ Approaches the limit (relation). Similar: geometrically equal
to \Doteq
.
-\downarrow
¶
+\downarrow
¶
↓ Down arrow, converges (relation). Similar:
\Downarrow
double line down arrow.
-\Downarrow
¶
+\Downarrow
¶
⇓ Double line down arrow (relation). Similar:
\downarrow
single line down arrow.
-\ell
¶
+\ell
¶
ℓ Lowercase cursive letter l (ordinary).
-\emptyset
¶
+\emptyset
¶
∅ Empty set symbol (ordinary). The variant form is
\varnothing
.
-\epsilon
¶
+\epsilon
¶
ϵ Lowercase lunate epsilon (ordinary). Similar to
Greek text letter. More widely used in mathematics is the script small
letter epsilon \varepsilon
ε. Related:
the set membership relation \in
∈.
-\equiv
¶
+\equiv
¶
≡ Equivalence (relation).
-\eta
¶
+\eta
¶
η Lowercase Greek letter (ordinary).
-\exists
¶
+\exists
¶
∃ Existential quantifier (ordinary).
-\flat
¶
+\flat
¶
♭ Musical flat (ordinary).
-\forall
¶
+\forall
¶
∀ Universal quantifier (ordinary).
-\frown
¶
+\frown
¶
⌢ Downward curving arc (ordinary).
-\Gamma
¶
+\Gamma
¶
Γ uppercase Greek letter (ordinary).
-\gamma
¶
+\gamma
¶
γ Lowercase Greek letter (ordinary).
-\ge
¶
+\ge
¶
≥ Greater than or equal to (relation). This is a synonym
for \geq
.
-\geq
¶
+\geq
¶
≥ Greater than or equal to (relation). This is a synonym
for \ge
.
-\gets
¶
+\gets
¶
← Is assigned the value (relation).
Synonym: \leftarrow
.
-\gg
¶
+\gg
¶
≫ Much greater than (relation). Similar: much less
than \ll
.
-\hbar
¶
+\hbar
¶
ℏ Planck constant over two pi (ordinary).
-\heartsuit
¶
+\heartsuit
¶
♡ Heart card suit (ordinary).
-\hookleftarrow
¶
+\hookleftarrow
¶
↩ Hooked left arrow (relation).
-\hookrightarrow
¶
+\hookrightarrow
¶
↪ Hooked right arrow (relation).
-\iff
¶
+\iff
¶
⟷ If and only if (relation). It is \Longleftrightarrow
with a \thickmuskip
on either side.
-\Im
¶
+\Im
¶
ℑ Imaginary part (ordinary). See: real part \Re
.
-\imath
¶
+\imath
¶
-
Dotless i; used when you are putting an accent on an i (see Math accents).
-\in
¶
+\in
¶
∈ Set element (relation). See also: lowercase lunate
epsilon \epsilon
ϵ and small letter script
epsilon \varepsilon
.
-\infty
¶
+\infty
¶
∞ Infinity (ordinary).
-\int
¶
+\int
¶
∫ Integral (operator).
-\iota
¶
+\iota
¶
ι Lowercase Greek letter (ordinary).
-\Join
¶
+\Join
¶
⨝ Condensed bowtie symbol (relation). Not available in Plain
TeX.
-\jmath
¶
+\jmath
¶
-
Dotless j; used when you are putting an accent on a j (see Math accents).
-\kappa
¶
+\kappa
¶
κ Lowercase Greek letter (ordinary).
-\Lambda
¶
+\Lambda
¶
Λ uppercase Greek letter (ordinary).
-\lambda
¶
+\lambda
¶
λ Lowercase Greek letter (ordinary).
-\land
¶
+\land
¶
∧ Logical and (binary). Synonym: \wedge
.
See also logical or \lor
.
-\langle
¶
+\langle
¶
⟨ Left angle, or sequence, bracket (opening). Similar:
less-than <
. Matches \rangle
.
-\lbrace
¶
+\lbrace
¶
{ Left curly brace
(opening). Synonym: \{
. Matches \rbrace
.
-\lbrack
¶
+\lbrack
¶
[ Left square bracket (opening).
Synonym: [
. Matches \rbrack
.
-\lceil
¶
+\lceil
¶
⌈ Left ceiling bracket, like a square bracket but with the bottom
shaved off (opening). Matches \rceil
.
-\le
¶
+\le
¶
≤ Less than or equal to (relation). This is a synonym
for \leq
.
-\leadsto
¶
+\leadsto
¶
⇝ Squiggly right arrow (relation).
To get this symbol outside of math mode you can put
\newcommand*{\Leadsto}{\ensuremath{\leadsto}}
in the
preamble and then use \Leadsto
instead.
-\Leftarrow
¶
+\Leftarrow
¶
⇐ Is implied by, double-line left arrow (relation). Similar:
single-line left arrow \leftarrow
.
-\leftarrow
¶
+\leftarrow
¶
← Single-line left arrow (relation).
Synonym: \gets
. Similar: double-line left
arrow \Leftarrow
.
-\leftharpoondown
¶
+\leftharpoondown
¶
↽ Single-line left harpoon, barb under bar (relation).
-\leftharpoonup
¶
+\leftharpoonup
¶
↼ Single-line left harpoon, barb over bar (relation).
-\Leftrightarrow
¶
+\Leftrightarrow
¶
⇔ Bi-implication; double-line double-headed arrow (relation).
Similar: single-line double headed arrow \leftrightarrow
.
-\leftrightarrow
¶
+\leftrightarrow
¶
↔ Single-line double-headed arrow (relation). Similar:
double-line double headed arrow \Leftrightarrow
.
-\leq
¶
+\leq
¶
≤ Less than or equal to (relation). This is a synonym
for \le
.
-\lfloor
¶
+\lfloor
¶
⌊ Left floor bracket (opening). Matches: \floor
.
-\lhd
¶
+\lhd
¶
◁ Arrowhead, that is, triangle, pointing left (binary).
For the normal subgroup symbol you should load
amssymb
and use \vartriangleleft
(which is a relation
and so gives better spacing).
-\ll
¶
+\ll
¶
≪ Much less than (relation). Similar: much greater
than \gg
.
-\lnot
¶
+\lnot
¶
¬ Logical negation (ordinary). Synonym: \neg
.
-\longleftarrow
¶
+\longleftarrow
¶
⟵ Long single-line left arrow (relation). Similar: long
double-line left arrow \Longleftarrow
.
-\longleftrightarrow
¶
+\longleftrightarrow
¶
⟷ Long single-line double-headed arrow (relation). Similar: long
double-line double-headed arrow \Longleftrightarrow
.
-\longmapsto
¶
+\longmapsto
¶
⟼ Long single-line left arrow starting with vertical bar
(relation). Similar: shorter version \mapsto
.
-\longrightarrow
¶
+\longrightarrow
¶
⟶ Long single-line right arrow (relation). Similar: long
double-line right arrow \Longrightarrow
.
-\lor
¶
+\lor
¶
∨ Logical or (binary). Synonym: \vee
.
See also logical and \land
.
-\mapsto
¶
+\mapsto
¶
↦ Single-line left arrow starting with vertical bar
(relation).
Similar: longer version \longmapsto
.
-\mho
¶
+\mho
¶
℧ Conductance, half-circle rotated capital omega (ordinary).
-\mid
¶
+\mid
¶
∣ Single-line vertical bar (relation). A typical use of
\mid
is for a set \{\, x \mid x\geq 5 \,\}
.
@@ -14080,52 +14866,52 @@ 16.2 Math symbols
for \vert
and for norm see the entry for \Vert
.
-\models
¶
+\models
¶
⊨ Entails, or satisfies; double turnstile, short double dash
(relation). Similar: long double dash \vDash
.
-\mp
¶
+\mp
¶
∓ Minus or plus (relation).
-\mu
¶
+\mu
¶
μ Lowercase Greek letter (ordinary).
-\nabla
¶
+\nabla
¶
∇ Hamilton’s del, or differential, operator (ordinary).
-\natural
¶
+\natural
¶
♮ Musical natural notation (ordinary).
-\ne
¶
+\ne
¶
≠ Not equal (relation). Synonym: \neq
.
-\nearrow
¶
+\nearrow
¶
↗ North-east arrow (relation).
-\neg
¶
+\neg
¶
¬ Logical negation (ordinary).
Synonym: \lnot
. Sometimes instead used for
negation: \sim
.
-\neq
¶
+\neq
¶
≠ Not equal (relation). Synonym: \ne
.
-\ni
¶
+\ni
¶
∋ Reflected membership epsilon; has the member
(relation). Synonym: \owns
. Similar: is a member
of \in
.
-\not
¶
+\not
¶
Long solidus, or slash, used to overstrike a
following operator (relation).
@@ -14134,107 +14920,107 @@ 16.2 Math symbols
is typographically preferable to \not\in
.
-\notin
¶
+\notin
¶
∉ Not an element of (relation). Similar: not subset
of \nsubseteq
.
-\nu
¶
+\nu
¶
ν Lowercase Greek letter (ordinary).
-\nwarrow
¶
+\nwarrow
¶
↖ North-west arrow (relation).
-\odot
¶
+\odot
¶
⊙ Dot inside a circle (binary). Similar: variable-sized
operator \bigodot
.
-\oint
¶
+\oint
¶
∮ Contour integral, integral with circle in the middle
(operator).
-\Omega
¶
+\Omega
¶
Ω uppercase Greek letter (ordinary).
-\omega
¶
+\omega
¶
ω Lowercase Greek letter (ordinary).
-\ominus
¶
+\ominus
¶
⊖ Minus sign, or dash, inside a circle (binary).
-\oplus
¶
+\oplus
¶
⊕ Plus sign inside a circle (binary). Similar: variable-sized
operator \bigoplus
.
-\oslash
¶
+\oslash
¶
⊘ Solidus, or slash, inside a circle (binary).
-\otimes
¶
+\otimes
¶
⊗ Times sign, or cross, inside a circle (binary). Similar:
variable-sized operator \bigotimes
.
-\owns
¶
+\owns
¶
∋ Reflected membership epsilon; has the member
(relation). Synonym: \ni
. Similar: is a member
of \in
.
-\parallel
¶
+\parallel
¶
∥ Parallel (relation). Synonym: \|
.
-\partial
¶
+\partial
¶
∂ Partial differential (ordinary).
-\perp
¶
+\perp
¶
⟂ Perpendicular (relation). Similar: \bot
uses the
same glyph but the spacing is different because it is in the class
ordinary.
-\Phi
¶
+\Phi
¶
Φ Uppercase Greek letter (ordinary).
-\phi
¶
+\phi
¶
ϕ Lowercase Greek letter (ordinary). The variant form is
\varphi
φ.
-\Pi
¶
+\Pi
¶
Π uppercase Greek letter (ordinary).
-\pi
¶
+\pi
¶
π Lowercase Greek letter (ordinary). The variant form is
\varpi
ϖ.
-\pm
¶
+\pm
¶
± Plus or minus (binary).
-\prec
¶
+\prec
¶
≺ Precedes (relation). Similar: less than <
.
-\preceq
¶
+\preceq
¶
⪯ Precedes or equals (relation). Similar: less than or
equals \leq
.
-\prime
¶
+\prime
¶
′ Prime, or minute in a time expression (ordinary).
Typically used as a superscript: $f^\prime$
; $f^\prime$
and $f'$
produce the same result. An advantage of the second
@@ -14245,176 +15031,176 @@
16.2 Math symbols
(apostrophe).
-\prod
¶
+\prod
¶
∏ Product (operator).
-\propto
¶
+\propto
¶
∝ Is proportional to (relation)
-\Psi
¶
+\Psi
¶
Ψ uppercase Greek letter (ordinary).
-\psi
¶
+\psi
¶
ψ Lowercase Greek letter (ordinary).
-\rangle
¶
+\rangle
¶
⟩ Right angle, or sequence, bracket (closing).
Similar: greater than >
. Matches:\langle
.
-\rbrace
¶
+\rbrace
¶
} Right curly brace
(closing). Synonym: \}
. Matches \lbrace
.
-\rbrack
¶
+\rbrack
¶
] Right square bracket
(closing). Synonym: ]
. Matches \lbrack
.
-\rceil
¶
+\rceil
¶
⌉ Right ceiling bracket (closing). Matches \lceil
.
-\Re
¶
+\Re
¶
ℜ Real part, real numbers, cursive capital R (ordinary). Related:
double-line, or blackboard bold, R \mathbb{R}
; to access
this, load the amsfonts
package.
-\restriction
¶
+\restriction
¶
↾, Restriction of a function (relation). Synonym:
\upharpoonright
. Not available in plain TeX. In LaTeX you need to load the amssymb
package.
-\revemptyset
¶
+\revemptyset
¶
⦰, Reversed empty set symbol (ordinary). Related:
\varnothing
. Not available in plain TeX. In LaTeX you need to load the stix package.
-\rfloor
¶
+\rfloor
¶
⌋ Right floor bracket, a right square bracket with the top cut
off (closing). Matches \lfloor
.
-\rhd
¶
+\rhd
¶
◁ Arrowhead, that is, triangle, pointing right (binary).
For the normal subgroup symbol you should instead
load amssymb
and use \vartriangleright
(which is a
relation and so gives better spacing).
-\rho
¶
+\rho
¶
ρ Lowercase Greek letter (ordinary). The variant form is
\varrho
ϱ.
-\Rightarrow
¶
+\Rightarrow
¶
⇒ Implies, right-pointing double line arrow
(relation). Similar: right single-line arrow \rightarrow
.
-\rightarrow
¶
+\rightarrow
¶
→ Right-pointing single line arrow (relation).
Synonym: \to
. Similar: right double line
arrow \Rightarrow
.
-\rightharpoondown
¶
+\rightharpoondown
¶
⇁ Right-pointing harpoon with barb below
the line (relation).
-\rightharpoonup
¶
+\rightharpoonup
¶
⇀ Right-pointing harpoon with barb above the
line (relation).
-\rightleftharpoons
¶
+\rightleftharpoons
¶
⇌ Right harpoon up above left harpoon down
(relation).
-\searrow
¶
+\searrow
¶
↘ Arrow pointing southeast (relation).
-\setminus
¶
+\setminus
¶
⧵ Set difference, reverse solidus or reverse slash,
like \ (binary). Similar: backslash \backslash
and also
\textbackslash
outside of math mode.
-\sharp
¶
+\sharp
¶
♯ Musical sharp (ordinary).
-\Sigma
¶
+\Sigma
¶
Σ uppercase Greek letter (ordinary).
-\sigma
¶
+\sigma
¶
σ Lowercase Greek letter (ordinary). The variant form is
\varsigma
ς.
-\sim
¶
+\sim
¶
∼ Similar, in a relation (relation).
-\simeq
¶
+\simeq
¶
≃ Similar or equal to, in a relation (relation).
-\smallint
¶
+\smallint
¶
∫ Integral sign that does not change to a larger size in a
display (operator).
-\smile
¶
+\smile
¶
⌣ Upward curving arc, smile (ordinary).
-\spadesuit
¶
+\spadesuit
¶
♠ Spade card suit (ordinary).
-\sqcap
¶
+\sqcap
¶
⊓ Square intersection symbol (binary). Similar:
intersection cap
.
-\sqcup
¶
+\sqcup
¶
⊔ Square union symbol (binary). Similar:
union cup
. Related: variable-sized
operator \bigsqcup
.
-\sqsubset
¶
+\sqsubset
¶
⊏, Square subset symbol (relation). Similar:
subset \subset
. Not available in plain TeX. In LaTeX you need to load the amssymb
package.
-\sqsubseteq
¶
+\sqsubseteq
¶
⊑ Square subset or equal symbol (binary). Similar: subset or
equal to \subseteq
.
-\sqsupset
¶
+\sqsupset
¶
⊐, Square superset symbol (relation). Similar:
superset \supset
. Not available in plain TeX. In LaTeX you need to load the amssymb
package.
-\sqsupseteq
¶
+\sqsupseteq
¶
⊒ Square superset or equal symbol (binary).
Similar: superset or equal \supseteq
.
-\star
¶
+\star
¶
⋆ Five-pointed star, sometimes used as a general binary
operation but sometimes reserved for cross-correlation (binary).
Similar: the synonyms asterisk *
and \ast
, which
@@ -14422,90 +15208,90 @@
16.2 Math symbols
as with the Kleene star.
-\subset
¶
+\subset
¶
⊂ Subset (occasionally, is implied by) (relation).
-\subseteq
¶
+\subseteq
¶
⊆ Subset or equal to (relation).
-\succ
¶
+\succ
¶
≻ Comes after, succeeds (relation). Similar: is less
than >
.
-\succeq
¶
+\succeq
¶
⪰ Succeeds or is equal to (relation). Similar: less
than or equal to \leq
.
-\sum
¶
+\sum
¶
∑ Summation (operator). Similar: Greek capital
sigma \Sigma
.
-\supset
¶
+\supset
¶
⊃ Superset (relation).
-\supseteq
¶
+\supseteq
¶
⊇ Superset or equal to (relation).
-\surd
¶
+\surd
¶
√ Radical symbol (ordinary). The LaTeX command
\sqrt{...}
typesets the square root of the argument, with a bar
that extends to cover the argument.
-\swarrow
¶
+\swarrow
¶
↙ Southwest-pointing arrow (relation).
-\tau
¶
+\tau
¶
τ Lowercase Greek letter (ordinary).
-\theta
¶
+\theta
¶
θ Lowercase Greek letter (ordinary). The variant form is
\vartheta
ϑ.
-\times
¶
+\times
¶
× Primary school multiplication sign (binary). See
also \cdot
.
-\to
¶
+\to
¶
→ Right-pointing single line arrow (relation).
Synonym: \rightarrow
.
-\top
¶
+\top
¶
⊤ Top, greatest element of a partially ordered set
(ordinary). See also \bot
.
-\triangle
¶
+\triangle
¶
△ Triangle (ordinary).
-\triangleleft
¶
+\triangleleft
¶
◁ Not-filled triangle pointing left
(binary). Similar: \lhd
. For the normal subgroup symbol you
should load amssymb
and use \vartriangleleft
(which
is a relation and so gives better spacing).
-\triangleright
¶
+\triangleright
¶
▷ Not-filled triangle pointing right
(binary). For the normal subgroup symbol you should instead load
amssymb
and use \vartriangleright
(which is a
relation and so gives better spacing).
-\unlhd
¶
+\unlhd
¶
⊴ Left-pointing not-filled underlined arrowhead, that is,
triangle, with a line under (binary). For the
normal subgroup symbol load amssymb
and
@@ -14513,7 +15299,7 @@
16.2 Math symbols
better spacing).
-\unrhd
¶
+\unrhd
¶
⊵ Right-pointing not-filled underlined arrowhead, that is,
triangle, with a line under (binary). For the
normal subgroup symbol load amssymb
and
@@ -14521,137 +15307,137 @@
16.2 Math symbols
better spacing).
-\Uparrow
¶
+\Uparrow
¶
⇑ Double-line upward-pointing arrow
(relation). Similar: single-line up-pointing
arrow \uparrow
.
-\uparrow
¶
+\uparrow
¶
↑ Single-line upward-pointing arrow, diverges
(relation). Similar: double-line up-pointing
arrow \Uparrow
.
-\Updownarrow
¶
+\Updownarrow
¶
⇕ Double-line upward-and-downward-pointing arrow
(relation). Similar: single-line upward-and-downward-pointing
arrow \updownarrow
.
-\updownarrow
¶
+\updownarrow
¶
↕ Single-line upward-and-downward-pointing arrow
(relation). Similar: double-line upward-and-downward-pointing
arrow \Updownarrow
.
-\upharpoonright
¶
+\upharpoonright
¶
↾, Up harpoon, with barb on right side
(relation). Synonym: \restriction
.
Not available in plain TeX. In LaTeX you need to load the amssymb
package.
-\uplus
¶
+\uplus
¶
⊎ Multiset union, a union symbol with a plus symbol in
the middle (binary). Similar: union \cup
. Related:
variable-sized operator \biguplus
.
-\Upsilon
¶
+\Upsilon
¶
Υ uppercase Greek letter (ordinary).
-\upsilon
¶
+\upsilon
¶
υ Lowercase Greek letter (ordinary).
-\varepsilon
¶
+\varepsilon
¶
ε Small letter script epsilon (ordinary). This is
more widely used in mathematics than the non-variant lunate epsilon form
\epsilon
ϵ. Related: set
membership \in
.
-\vanothing
¶
+\vanothing
¶
∅, Empty set symbol. Similar: \emptyset
. Related:
\revemptyset
. Not available in plain TeX. In LaTeX you need to load the amssymb
package.
-\varphi
¶
+\varphi
¶
φ Variant on the lowercase Greek letter (ordinary).
The non-variant form is \phi
ϕ.
-\varpi
¶
+\varpi
¶
ϖ Variant on the lowercase Greek letter (ordinary).
The non-variant form is \pi
π.
-\varrho
¶
+\varrho
¶
ϱ Variant on the lowercase Greek letter (ordinary).
The non-variant form is \rho
ρ.
-\varsigma
¶
+\varsigma
¶
ς Variant on the lowercase Greek letter
(ordinary). The non-variant form is
\sigma
σ.
-\vartheta
¶
+\vartheta
¶
ϑ Variant on the lowercase Greek letter
(ordinary). The non-variant form is
\theta
θ.
-\vdash
¶
+\vdash
¶
⊢ Provable; turnstile, vertical and a dash
(relation). Similar: turnstile rotated a
half-circle \dashv
.
-\vee
¶
+\vee
¶
∨ Logical or; a downwards v shape (binary). Related:
logical and \wedge
. Similar: variable-sized
operator \bigvee
.
-\Vert
¶
+\Vert
¶
‖ Vertical double bar (ordinary). See Delimiters,
for how to use the mathtools
package to create flexibly-sized
norm symbols.
-\vert
¶
+\vert
¶
| Single line vertical bar (ordinary). For “such
that”, as in the definition of a set, use \mid
because it
is a relation. See Delimiters, for how to use the mathtools
package to create flexibly-sized absolute-value symbols.
-\wedge
¶
+\wedge
¶
∧ Logical and (binary). Synonym: \land
. See also
logical or \vee
. Similar: variable-sized
operator \bigwedge
.
-\wp
¶
+\wp
¶
℘ Weierstrass p (ordinary).
-\wr
¶
+\wr
¶
≀ Wreath product (binary).
-\Xi
¶
+\Xi
¶
Ξ uppercase Greek letter (ordinary).
-\xi
¶
+\xi
¶
ξ Lowercase Greek letter (ordinary).
-\zeta
¶
+\zeta
¶
ζ Lowercase Greek letter (ordinary).
@@ -14661,23 +15447,23 @@ 16.2 Math symbols
provides versions to use in mathematical text.
-\mathdollar
¶
+\mathdollar
¶
Dollar sign in math mode: $.
-\mathparagraph
¶
+\mathparagraph
¶
Paragraph sign (pilcrow) in math mode, ¶.
-\mathsection
¶
+\mathsection
¶
Section sign in math mode: §.
-\mathsterling
¶
+\mathsterling
¶
Sterling sign in math mode: £.
-\mathunderscore
¶
+\mathunderscore
¶
Underscore in math mode: _.
@@ -14700,7 +15486,7 @@ 16.2 Math symbols
Next: \boldmath
& \unboldmath
, Up: Math symbols [Contents][Index]
-
+16.2.1 Arrows
+16.2.1 Arrows ¶
@@ -14766,7 +15552,7 @@ 16.2.1 Arrows
Next: Blackboard bold, Previous: Arrows, Up: Math symbols [Contents][Index]
-
+16.2.2 \boldmath
& \unboldmath
+16.2.2 \boldmath
& \unboldmath
¶
@@ -14820,7 +15606,7 @@ 16.2.2
Next: OpenType bold math, Up: \boldmath
& \unboldmath
[Contents][Index]
-
-16.2.2.1 bm
: Individual bold math symbols
+16.2.2.1 bm
: Individual bold math symbols ¶
@@ -14849,7 +15635,7 @@ 16.2.2.1
Previous: bm
: Individual bold math symbols, Up: \boldmath
& \unboldmath
[Contents][Index]
-16.2.2.2 OpenType bold math
+16.2.2.2 OpenType bold math ¶
@@ -14893,7 +15679,7 @@ 16.2.2.2 OpenType bold math<
Next: Calligraphic, Previous: \boldmath
& \unboldmath
, Up: Math symbols [Contents][Index]
-16.2.3 Blackboard bold
+16.2.3 Blackboard bold ¶
@@ -14934,7 +15720,7 @@ 16.2.3 Blackboard bold
Next: Delimiters, Previous: Blackboard bold, Up: Math symbols [Contents][Index]
-16.2.4 Calligraphic
+16.2.4 Calligraphic ¶
@@ -14966,7 +15752,7 @@ 16.2.4 Calligraphic
Next: Dots, horizontal or vertical, Previous: Calligraphic, Up: Math symbols [Contents][Index]
-16.2.5 Delimiters
+16.2.5 Delimiters ¶
@@ -15036,7 +15822,7 @@ 16.2.5 Delimiters
Next: \bigl
, \bigr
, etc., Up: Delimiters [Contents][Index]
-16.2.5.1 \left
& \right
+16.2.5.1 \left
& \right
¶
@@ -15187,7 +15973,7 @@ 16.2.5.1
Previous: \left
& \right
, Up: Delimiters [Contents][Index]
-16.2.5.2 \bigl
, \bigr
, etc.
+16.2.5.2 \bigl
, \bigr
, etc. ¶
@@ -15308,7 +16094,7 @@ 16.2.5.
Next: Greek letters, Previous: Delimiters, Up: Math symbols [Contents][Index]
-16.2.6 Dots, horizontal or vertical
+16.2.6 Dots, horizontal or vertical ¶
@@ -15328,20 +16114,20 @@ 16.2.6 Dots, horizo
-\cdots
¶
+\cdots
¶
Horizontal ellipsis with the dots raised to the center of the line, as
in ⋯. Used as: \( a_0\cdot a_1\cdots a_{n-1}
\)
.
-\ddots
¶
+\ddots
¶
Diagonal ellipsis, ⋱. See the above array example for a
usage.
-\ldots
¶
-\mathellipsis
¶
-\dots
¶
+\ldots
¶
+\mathellipsis
¶
+\dots
¶
Ellipsis on the baseline, …. Used as: \(
x_0,\ldots x_{n-1} \)
. Another example is the above array example.
Synonyms are \mathellipsis
and \dots
. A synonym from
@@ -15351,7 +16137,7 @@
16.2.6 Dots, horizo
The gears, brakes, \ldots{} are all broken
.
-\vdots
¶
+\vdots
¶
Vertical ellipsis, ⋮. See the above array example for a
usage.
@@ -15418,7 +16204,7 @@ 16.2.6 Dots, horizo
Previous: Dots, horizontal or vertical, Up: Math symbols [Contents][Index]
-16.2.7 Greek letters
+16.2.7 Greek letters ¶
@@ -15474,7 +16260,7 @@ 16.2.7 Greek letters
Next: Math accents, Previous: Math symbols, Up: Math formulas [Contents][Index]
-
+16.3 Math functions
+16.3 Math functions ¶
@@ -15483,140 +16269,140 @@ 16.3 Math functions
spacing.
-\arccos
¶
+\arccos
¶
Inverse cosine
-\arcsin
¶
+\arcsin
¶
Inverse sine
-\arctan
¶
+\arctan
¶
Inverse tangent
-\arg
¶
+\arg
¶
Angle between the real axis and a point in the complex plane
-\bmod
¶
+\bmod
¶
Binary modulo operator, used as in \( 5\bmod 3=2 \)
-\cos
¶
+\cos
¶
Cosine
-\cosh
¶
+\cosh
¶
Hyperbolic cosine
-\cot
¶
+\cot
¶
Cotangent
-\coth
¶
+\coth
¶
Hyperbolic cotangent
-\csc
¶
+\csc
¶
Cosecant
-\deg
¶
+\deg
¶
Degrees
-\det
¶
+\det
¶
Determinant
-\dim
¶
+\dim
¶
Dimension
-\exp
¶
+\exp
¶
Exponential
-\gcd
¶
+\gcd
¶
Greatest common divisor
-\hom
¶
+\hom
¶
Homomorphism
-\inf
¶
+\inf
¶
Infimum
-\ker
¶
+\ker
¶
Kernel
-\lg
¶
+\lg
¶
Base 2 logarithm
-\lim
¶
+\lim
¶
Limit
-\liminf
¶
+\liminf
¶
Limit inferior
-\limsup
¶
+\limsup
¶
Limit superior
-\ln
¶
+\ln
¶
Natural logarithm
-\log
¶
+\log
¶
Logarithm
-\max
¶
+\max
¶
Maximum
-\min
¶
+\min
¶
Minimum
-\pmod
¶
+\pmod
¶
Parenthesized modulus, as used in \( 5\equiv 2\pmod 3 \)
-\Pr
¶
+\Pr
¶
Probability
-\sec
¶
+\sec
¶
Secant
-\sin
¶
+\sin
¶
Sine
-\sinh
¶
+\sinh
¶
Hyperbolic sine
-\sup
¶
+\sup
¶
Supremum
sup
-\tan
¶
+\tan
¶
Tangent
-\tanh
¶
+\tanh
¶
Hyperbolic tangent
@@ -15640,9 +16426,9 @@ 16.3 Math functions
16.4 Math accents
+16.4 Math accents ¶
@@ -15652,70 +16438,70 @@ 16.4 Math accents
(see Accents).
-\acute
¶
+\acute
¶
-
Math acute accent
-\bar
¶
+\bar
¶
-
Math bar-over accent
-\breve
¶
+\breve
¶
-
Math breve accent
-\check
¶
+\check
¶
-
Math háček (check) accent
-\ddot
¶
+\ddot
¶
-
Math dieresis accent
-\dot
¶
+\dot
¶
-
Math dot accent
-\grave
¶
+\grave
¶
-
Math grave accent
-\hat
¶
+\hat
¶
-
Math hat (circumflex) accent
-\mathring
¶
+\mathring
¶
-
Math ring accent
-\tilde
¶
+\tilde
¶
-
Math tilde accent
-\vec
¶
+\vec
¶
-
Math vector symbol
-\widehat
¶
+\widehat
¶
-
Math wide hat accent
-\widetilde
¶
+\widetilde
¶
-
Math wide tilde accent
@@ -15728,46 +16514,48 @@ 16.4 Math accents
-
-
+
16.5 Over- and Underlining
+16.5 Over- or under math ¶
-
+
-LaTeX provides commands for making overlines or underlines, or
-putting braces over or under some material.
+
LaTeX provides commands for putting lines, braces, and arrows over
+or under math material.
-\underline{text}
¶
-Underline text. Works inside math mode, and outside.
+
\underline{math}
¶
+Underline math. For example: \underline{x+y}
.
The line is always completely below the text, taking account of
descenders, so in \(\underline{y}\)
the line is lower than in
-\(\underline{x}\)
. This command is fragile (see \protect
).
+\(\underline{x}\)
. As of approximately 2019, this command
+and others in this section are robust; before that, they were fragile
+(see \protect
).
-Note that the package ulem
does text mode underlining and allows
-line breaking as well as a number of other features. See the
-documentation on CTAN. See also \hrulefill
& \dotfill
for
-producing a line, for such things as a signature.
+
The package ulem
(https://ctan.org/pkg/uelem) does
+text mode underlining and allows line breaking as well as a number of
+other features. See also \hrulefill
& \dotfill
for
+producing a line for such things as a signature or placeholder.
-\overline{text}
¶
-Put a horizontal line over text. Works inside math mode, and
-outside. For example, \overline{x+y}
.
-Note that this differs from the command \bar
(see Math accents).
+
\overline{math}
¶
+Put a horizontal line over math. For example: \overline{x+y}
.
+This differs from the accent command \bar
(see Math accents).
-\underbrace{math}
¶
-Put a brace under math. For example, this
-(1-\underbrace{1/2)+(1/2}-1/3)
emphasizes the telescoping part.
-Attach text to the brace by using the subscript command, _
, or
-superscript, ^
, as here.
+
\underbrace{math}
¶
+Put a brace under math. For example:
+(1-\underbrace{1/2)+(1/2}-1/3)
.
+
+You can attach text to the brace as a subscript (_
) or
+superscript (^
) as here:
\begin{displaymath}
@@ -15780,10 +16568,19 @@ 16.5 Over- and Underlining<
unconnected to the underbrace.
-\overbrace{math}
¶
-Put a brace over math, as with
-\overbrace{x+x+\cdots+x}^{\mbox{\(k\) times}}
. See also
-\underbrace
.
+
\overbrace{math}
¶
+Put a brace over math. For example:
+\overbrace{x+x+\cdots+x}^{\mbox{\(k\) times}}
.
+
+
+\overrightarrow{math}
¶
+Put a right arrow over math. For example:
+\overrightarrow{x+y}
.
+
+
+\overleftarrow{math}
¶
+Put a left arrow over math. For example:
+\overleftarrow{a+b}
.
@@ -15791,8 +16588,9 @@ 16.5 Over- and Underlining<
-
The package mathtools
adds an over- and underbrace, as well as
-some improvements on the braces. See the documentation on CTAN.
+
The package mathtools
(https://ctan.org/pkg/mathtools)
+adds an over- and underbracket, as well as some improvements on the
+braces.
@@ -15800,9 +16598,9 @@ 16.5 Over- and Underlining<
16.6 Spacing in math mode
+16.6 Spacing in math mode ¶
@@ -15828,9 +16626,9 @@ 16.6 Spacing in math mode
a ‘M’.
-\;
¶
--
-
+
-
+
\;
¶
+-
Synonym: \thickspace
. Normally 5.0mu plus 5.0mu
. With
@@ -15839,32 +16637,32 @@
16.6 Spacing in math mode
only.
-\negthickspace
¶
+\negthickspace
¶
Normally -5.0mu plus 2.0mu minus 4.0mu
. With the amsmath
package, or as of the 2020-10-01 LaTeX release, can be used in text
mode as well as math mode; otherwise, in math mode only.
-\:
¶
-\>
--
+
-
-
Synonym: \medspace
. Normally 4.0mu plus 2.0mu minus
+\:
¶
+\>
+Synonym: \medspace
. Normally 4.0mu plus 2.0mu minus
4.0mu
. With the amsmath
package, or as of the 2020-10-01
LaTeX release, can be used in text mode as well as math mode; before
that, in math mode only.
-\negmedspace
¶
+\negmedspace
¶
Normally -4.0mu plus 2.0mu minus 4.0mu
. With the amsmath
package, or as of the 2020-10-01 LaTeX release, can be used in text
mode as well as math mode; before that, in math mode only.
-\,
¶
--
+
-
-
Synonym: \thinspace
. Normally 3mu
, which is 1/6em.
+\,
¶
+Synonym: \thinspace
. Normally 3mu
, which is 1/6em.
Can be used in both math mode and text mode (see \thinspace
& \negthinspace
).
This space is widely used, for instance between the function and the
@@ -15879,10 +16677,10 @@
16.6 Spacing in math mode
-
-\!
¶
--
+
-
-
Synonym: \negthinspace
. A negative thin space. Normally
+\!
¶
+Synonym: \negthinspace
. A negative thin space. Normally
-3mu
. With the amsmath
package, or as of the 2020-10-01
LaTeX release, can be used in text mode as well as math mode;
otherwise, the \!
command is math mode only but the
@@ -15890,15 +16688,15 @@
16.6 Spacing in math mode
(see \thinspace
& \negthinspace
).
-\quad
¶
--
-
This is 18mu, that is, 1em. This is often used for space
+
-
+
\quad
¶
+This is 18mu, that is, 1em. This is often used for space
surrounding equations or expressions, for instance for the space between
two equations inside a displaymath
environment. It is available
in both text and math mode.
-\qquad
¶
+\qquad
¶
A length of 2 quads, that is, 36mu = 2em. It is available in
both text and math mode.
@@ -15917,7 +16715,7 @@ 16.6 Spacing in math mode
Next: \phantom
& \vphantom
& \hphantom
, Up: Spacing in math mode [Contents][Index]
-16.6.1 \smash
+16.6.1 \smash
¶
@@ -15979,11 +16777,11 @@ 16.6.1 \smash\leavevmode
, as in the bottom line below.
-xxx xxx xxx
+Text above.
-\smash{yyy} % no paragraph indent
+\smash{smashed, no indent} % no paragraph indent
-\leavevmode\smash{zzz} % usual paragraph indent
+\leavevmode\smash{smashed, with indent} % usual paragraph indent
@@ -16000,7 +16798,7 @@ 16.6.1 \smash
Next: \mathstrut
, Previous: \smash
, Up: Spacing in math mode [Contents][Index]
-
-16.6.2 \phantom
& \vphantom
& \hphantom
+16.6.2 \phantom
& \vphantom
& \hphantom
¶
@@ -16097,7 +16895,7 @@ \phantom
& \vphantom
& \hphantom
, Up: Spacing in math mode [Contents][Index]
-16.6.3 \mathstrut
+16.6.3 \mathstrut
¶
@@ -16137,7 +16935,7 @@ 16.6.3 \maths
Next: Math miscellany, Previous: Spacing in math mode, Up: Math formulas [Contents][Index]
-16.7 Math styles
+16.7 Math styles ¶
@@ -16230,7 +17028,7 @@ 16.7 Math styles
Previous: Math styles, Up: Math formulas [Contents][Index]
-16.8 Math miscellany
+16.8 Math miscellany ¶
@@ -16252,7 +17050,7 @@ 16.8 Math miscellany
Next: \*
, Up: Math miscellany [Contents][Index]
-16.8.1 Colon character :
& \colon
+16.8.1 Colon character :
& \colon
¶
@@ -16293,7 +17091,7 @@ 16.8.1 Colon
Next: \frac
, Previous: Colon character :
& \colon
, Up: Math miscellany [Contents][Index]
-16.8.2 \*
+16.8.2 \*
¶
@@ -16325,7 +17123,7 @@ 16.8.2 \*
<
Next: \sqrt
, Previous: \*
, Up: Math miscellany [Contents][Index]
-16.8.3 \frac
+16.8.3 \frac
¶
@@ -16349,7 +17147,7 @@ 16.8.3 \frac
Next: \stackrel
, Previous: \frac
, Up: Math miscellany [Contents][Index]
-16.8.4 \sqrt
+16.8.4 \sqrt
¶
@@ -16381,7 +17179,7 @@ 16.8.4 \sqrt
Previous: \sqrt
, Up: Math miscellany [Contents][Index]
-16.8.5 \stackrel
+16.8.5 \stackrel
¶
@@ -16406,7 +17204,7 @@ 16.8.5 \stackr
Next: Page styles, Previous: Math formulas, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-17 Modes
+17 Modes ¶
@@ -16485,7 +17283,7 @@ 17 Modes
-
-17.1 \ensuremath
+17.1 \ensuremath
¶
Synopsis:
@@ -16522,7 +17320,7 @@ 17.1 \ensuremat
Next: Spaces, Previous: Modes, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-18 Page styles
+18 Page styles ¶
@@ -16546,6 +17344,7 @@ 18 Page styles
\pagenumbering
\pagestyle
\thispagestyle
+\thepage
@@ -16553,7 +17352,7 @@ 18 Page styles
Next: \pagenumbering
, Up: Page styles [Contents][Index]
-18.1 \maketitle
+18.1 \maketitle
¶
@@ -16599,7 +17398,7 @@ 18.1 \maketitle<
\maketitle
, either in the preamble or in the document body.
-\author{name1 \and name2 \and ...}
¶
-
@@ -16611,7 +17410,7 @@
18.1 \maketitle<
\author given’.
-\date{text}
¶
+\date{text}
¶
-
Optional. Declare text to be the document’s date. The text
doesn’t need to be in a date format; it can be any text at all. If you
@@ -16619,17 +17418,17 @@
18.1 \maketitle<
To have no date, instead use \date{}
.
-\thanks{text}
¶
+\thanks{text}
¶
-
-
Optional. Produce a footnote. You can use it in the author information
-for acknowledgements as illustrated above, but you can also use it in
-the title, or any place a footnote mark makes sense. It can be any text
-at all so you can use it for any purpose, such as to print an email
-address.
+
Optional. Produce a footnote. You can use it in the author
+information for acknowledgements as illustrated above, but you can
+also use it in the title, or anywhere that a footnote mark makes
+sense. It can be any text at all so you can use it for any purpose,
+such as to print an email address.
-\title{text}
¶
+\title{text}
¶
-
Required. Declare text to be the title of the document. Get line
@@ -16640,11 +17439,11 @@
18.1 \maketitle<
-
+To make your own title page, see titlepage
. You can either
+
To make your own title page, see titlepage
. You can either
create this as a one-off or you can include it as part of a renewed
-\maketitle
command. (Many publishers will provide a class to use
+\maketitle
command. Many publishers will provide a class to use
in place of article
that formats the title according to their
-house requirements.)
+house requirements.
@@ -16654,7 +17453,7 @@ 18.1 \maketitle<
Next: \pagestyle
, Previous: \maketitle
, Up: Page styles [Contents][Index]
-
-18.2 \pagenumbering
+18.2 \pagenumbering
¶
@@ -16671,20 +17470,11 @@ 18.2 \pagenu
so its effect is not stopped by an end of group such as a closing brace
or an end of environment.
-In this example, before the ‘Main’ section the pages are numbered
-‘a’, etc. Starting on the page containing the
-\pagenumbering
call in that section, the pages are numbered
-‘1’, etc.
+
By default, LaTeX numbers pages starting at 1, using Arabic
+numerals.
-
-\begin{document}\pagenumbering{alph}
- ...
-\section{Main}\pagenumbering{arabic}
- ...
-
-
The argument number-style is one of the following (see
-also \alph \Alph \arabic \roman \Roman \fnsymbol
: Printing counters).
+also \alph \Alph \arabic \roman \Roman \fnsymbol
: Printing counters).
arabic
@@ -16709,26 +17499,46 @@ 18.2 \pagenu
get ‘LaTeX Error: Counter too large’.
-gobble
¶
--
-
LaTeX does not output a page number, although it
-does get reset. References to that page also are blank. (This does not
-work with the popular package hyperref
so to have the page number
-not appear you may want to instead use \pagestyle{empty}
or
-\thispagestyle{empty}
.)
+
gobble
+no page number is output, though the number is still reset.
+References to that page also are blank.
+
+
+
+
+This setting does not work with the popular package hyperref
,
+so to omit page numbers you may want to instead use
+\pagestyle{empty}
or \thispagestyle{empty}
.
+If you want to typeset the page number in some other way, or change
+where the page number appears on the page, see \pagestyle
+(in short: use the fancyhdr
package). The list above of
+LaTeX’s built-in numbering styles cannot be extended.
+
Traditionally, if a document has front matter—preface, table of
-contents, etc.—then it is numbered with lowercase Roman numerals. The
-main matter of a document uses arabic. See \frontmatter
, \mainmatter
, \backmatter
.
+contents, etc.—then it is numbered with lowercase Roman
+numerals. The main matter of a document uses arabic. LaTeX
+implements this, by providing explicit commands for the different parts
+(see \frontmatter
, \mainmatter
, \backmatter
).
-If you want to change where the page number appears on the page,
-see \pagestyle
. If you want to change the value of the page
-number, then you manipulate the page
counter (see Counters).
+
As an explicit example, before the ‘Main’ section the pages are
+numbered ‘a’, etc. Starting on the page containing the
+\pagenumbering
call in that section, the pages are numbered
+‘1’, etc.
+
+\begin{document}\pagenumbering{alph}
+ ...
+\section{Main}\pagenumbering{arabic}
+ ...
+
+If you want to change the value of the page number, then you
+manipulate the page
counter (see Counters).
+
@@ -16736,7 +17546,7 @@ 18.2 \pagenu
Next: \thispagestyle
, Previous: \pagenumbering
, Up: Page styles [Contents][Index]
-18.3 \pagestyle
+18.3 \pagestyle
¶
@@ -16755,11 +17565,11 @@ 18.3 \pagestyle<
-A discussion with an example is below. Note first that the package
+
A discussion with an example is below. First, however: the package
fancyhdr
is now the standard way to manipulate headers and
footers. New documents that need to do anything other than one of the
standard options below should use this package. See its documentation
-on CTAN.
+(https://ctan.org/pkg/fancyhdr).
Values for style:
@@ -16829,7 +17639,7 @@ 18.3 \pagestyle<
Here are the descriptions of \markboth
and \markright
:
-\markboth{left-head}{right-head}
¶
+\markboth{left-head}{right-head}
¶
Sets both the right hand and left hand heading information for either a
page style of headings
or myheadings
. A left hand page
heading left-head is generated by the last \markboth
@@ -16839,7 +17649,7 @@
18.3 \pagestyle<
the last one that came before that page.
-\markright{right-head}
¶
+\markright{right-head}
¶
Sets the right hand page heading, leaving the left unchanged.
@@ -16851,9 +17661,9 @@ 18.3 \pagestyle<
+
-
+18.5 \thepage
¶
+
+
+
+If you want to change the appearance of page numbers only in the page
+headers, for example by adding an ornament, typesetting in small caps,
+etc., then the fancyhdr
package, as mentioned in a previous
+section, is the best approach.
+
+
+
+
+On the other hand, you may want to change how page numbers are denoted
+everywhere, including the table of contents and cross-references, as
+well as the page headers. In this case, you should redefine
+\thepage
, which is the command LaTeX uses for the
+representation of page numbers.
+
+However, \thepage
should do any typesetting or other
+complicated maneuvers, but merely expand to the intended page number
+representation. The results of a complicated redefinition of
+\thepage
are not predictable, but LaTeX’s report of page
+numbers in diagnostic messages, at least, will become unusable.
+
+There is some discussion of this issue at
+https://tex.stackexchange.com/questions/687258.
+
+
@@ -16897,7 +17742,7 @@
+18.4 \thispa
Next: Boxes, Previous: Page styles, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-19 Spaces
+19 Spaces ¶
@@ -16915,7 +17760,7 @@ 19 Spaces
\hss
\spacefactor
- Backslash-space,
\
-~
+~
, \nobreakspace
\thinspace
& \negthinspace
\/
\hrulefill
& \dotfill
@@ -16932,7 +17777,7 @@ 19 Spaces
Next: \hspace
, Up: Spaces [Contents][Index]
-19.1 \enspace
& \quad
& \qquad
+19.1 \enspace
& \quad
& \qquad
¶
@@ -16974,7 +17819,7 @@ 19.1
Next: \hfill
, Previous: \enspace
& \quad
& \qquad
, Up: Spaces [Contents][Index]
-19.2 \hspace
+19.2 \hspace
¶
@@ -17039,7 +17884,7 @@ 19.2 \hspace
Next: \hss
, Previous: \hspace
, Up: Spaces [Contents][Index]
-19.3 \hfill
+19.3 \hfill
¶
@@ -17091,7 +17936,7 @@ 19.3 \hfill
Next: \spacefactor
, Previous: \hfill
, Up: Spaces [Contents][Index]
-19.4 \hss
+19.4 \hss
¶
@@ -17129,7 +17974,7 @@ 19.4 \hss
Next: Backslash-space, \
, Previous: \hss
, Up: Spaces [Contents][Index]
-19.5 \spacefactor
+19.5 \spacefactor
¶
Synopsis:
@@ -17138,13 +17983,14 @@ 19.5 \spacefac
-Influence LaTeX’s glue stretch and shrink behavior. Most user-level
-documents do not use this command.
+
+
Influence LaTeX’s stretching and shrinking of glue. Few user-level
+documents need to use this.
While LaTeX is laying out the material, it may stretch or shrink the
gaps between words. (This space is not a character; it is called the
-interword glue; see \hspace
). The \spacefactor
command
-(from Plain TeX) allows you to, for instance, have the space
+interword glue; see \hspace
). The \spacefactor
parameter
+(a TeX primitive) allows you to, for instance, have the space
after a period stretch more than the space after a word-ending letter.
After LaTeX places each character, or rule or other box, it sets a
@@ -17154,48 +18000,49 @@
19.5 \spacefac
that the glue can stretch more and shrink less. Normally, the space
factor is 1000. This value is in effect following most characters, and
any non-character box or math formula. But it is 3000 after a period,
-exclamation mark, or question mark, it is 2000 after a colon, 1500 after
+exclamation mark, or question mark, 2000 after a colon, 1500 after
a semicolon, 1250 after a comma, and 0 after a right parenthesis or
bracket, or closing double quote or single quote. Finally, it is 999
after a capital letter.
If the space factor f is 1000 then the glue gap will be the
font’s normal space value (for Computer Modern Roman 10 point this is
-3.3333 points). Otherwise, if the space factor f is greater
+3.3333pt). Otherwise, if the space factor f is greater
than 2000 then TeX adds the font’s extra space value (for Computer
-Modern Roman 10 point this is 1.11111 points), and then the font’s
+Modern Roman 10 point this is 1.11111pt), and then the font’s
normal stretch value is multiplied by f /1000 and the normal
shrink value is multiplied by 1000/f (for Computer Modern Roman
-10 point these are 1.66666 and 1.11111 points).
+10 point these are 1.66666 and 1.11111pt).
-For example, consider the period ending A man's best friend is his
-dog.
After it, TeX puts in a fixed extra space, and also allows the
-glue to stretch 3 times as much and shrink 1/3 as much, as the glue
-after friend
, which does not end in a period.
+
For example, consider the period ending ‘A man's best friend is
+his dog.’. After it, TeX puts in a fixed extra space, and also
+allows the glue to stretch 3 times as much and shrink 1/3 as much, as
+the glue after friend
or any of the other words, since they are
+not followed by punctuation.
The rules for space factors are even more complex because they play
-additional roles. In practice, there are two consequences. First, if a
-period or other punctuation is followed by a right parenthesis or
-bracket, or right single or double quote then the spacing effect of that
-period carries through those characters (that is, the following glue
-will have increased stretch and shrink). Second, if
-punctuation comes after a capital letter then its effect is not in place
-so you get an ordinary space. This second case also affects abbreviations
-that do not end in a capital letter (see \@
).
+additional roles. In practice, there are two consequences. First, if
+a period or other punctuation is followed by a right parenthesis or
+bracket, or right single or double quote then the spacing effect of
+that period carries through those characters (that is, the following
+glue will have increased stretch and shrink). Second, if punctuation
+comes after a capital letter then the normal effect of the period is
+does not happen, so you get an ordinary space. This second case also
+affects abbreviations that do not end in a capital letter
+(see \@
).
You can only use \spacefactor
in paragraph mode or LR mode
(see Modes). You can see the current value with
\the\spacefactor
or \showthe\spacefactor
.
-(Comment, not really related to \spacefactor
: if you get errors
-like ‘You can't use `\spacefactor' in vertical mode’, or ‘You
-can't use `\spacefactor' in math mode.’, or ‘Improper \spacefactor’
-then you have probably tried to redefine an internal command.
-See \makeatletter
& \makeatother
.)
+
Finally, not especially related to \spacefactor
itself: if you
+get errors like ‘You can't use `\spacefactor' in vertical mode’,
+or ‘You can't use `\spacefactor' in math mode.’, or
+‘Improper \spacefactor’ then you have probably tried to redefine
+an internal command. See \makeatletter
& \makeatother
.
-
\@
\frenchspacing
& \nonfrenchspacing
@@ -17207,13 +18054,16 @@ 19.5 \spacefac
Next: \frenchspacing
& \nonfrenchspacing
, Up: \spacefactor
[Contents][Index]
-19.5.1 \@
+19.5.1 \@
¶
+
+
+
Synopsis:
@@ -17221,13 +18071,11 @@ 19.5.1 \@
<
capital-letter\@.
-
Treat a period as sentence-ending, where LaTeX would otherwise think
-it is part of an abbreviation. LaTeX thinks that a period ends an
-abbreviation if the period comes after a capital letter, and otherwise
-thinks the period ends the sentence. By default, in justifying a line
-LaTeX adjusts the space after a sentence-ending period (or a question
-mark, exclamation point, comma, or colon) more than it adjusts the space
-between words (see \spacefactor
).
+
Treat a period (or other punctuation) as sentence-ending, where
+LaTeX would otherwise think it is part of an abbreviation.
+LaTeX thinks that a period ends an abbreviation if the period comes
+after a capital letter, and otherwise thinks the period ends the
+sentence.
This example shows the two cases to remember.
@@ -17235,12 +18083,15 @@ 19.5.1 \@
<
The songs \textit{Red Guitar}, etc.\ are by Loudon Wainwright~III\@.
-
The second period ends the sentence, despite that it is preceded by a
-capital. We tell LaTeX that it ends the sentence by putting
-\@
before it. The first period ends the abbreviation
-‘etc.’ but not the sentence. The backslash-space, \
,
-produces a mid-sentence space.
+
The first period ends the abbreviation ‘etc.’ but not the
+sentence. The backslash-space, \
, produces a mid-sentence
+space. The second period ends the sentence, despite it being preceded
+by a capital letter. We tell LaTeX that it ends the sentence by
+putting \@
before it.
+
+
+
So: if you have a capital letter followed by a period that ends the
sentence, then put \@
before the period. This holds even if
there is an intervening right parenthesis or bracket, or right single or
@@ -17254,17 +18105,24 @@
19.5.1 \@
<
will have correct inter-sentence spacing after the period.
-The \@
command is only for a text mode. If you use it outside of
-a text mode then you get ‘You can't use `\spacefactor' in vertical
-mode’ (see Modes).
+
The \@
command is only for text modes. If you use it outside
+of a text mode then you get the error ‘You can't use
+`\spacefactor' in vertical mode’ (see Modes).
-Comment: the converse case is a period ending an abbreviation whose last
-letter is not a capital letter, and that abbreviation is not the last
-word in the sentence. For that case follow the period with a
+
+
+
All the above applies equally to question marks and exclamation points
+as periods, since all are sentence-ending punctuation, and LaTeX
+increases the space after each in the same way, when they end a
+sentence. LaTeX also increases spacing after colon, semicolon, and
+comma characters (see \spacefactor
).
+
+In addition: the converse case is a period (or other punctuation) that
+does not end a sentence. For that case, follow the period with a
backslash-space, (\
), or a tie, (~
), or \@
.
Examples are Nat.\ Acad.\ Science
, and Mr.~Bean
, and
(manure, etc.\@) for sale
(note in the last one that the
-\@
comes before the closing parenthesis).
+\@
comes after the period but before the closing parenthesis).
@@ -17274,7 +18132,7 @@ 19.5.1 \@
<
Next: \normalsfcodes
, Previous: \@
, Up: \spacefactor
[Contents][Index]
-19.5.2 \frenchspacing
& \nonfrenchspacing
+19.5.2 \frenchspacing
& \nonfrenchspacing
¶
@@ -17287,18 +18145,21 @@ 19.5.1 \@
<
\nonfrenchspacing
-
The first declaration causes LaTeX to handle spacing between
-sentences in the same way as spacing between words in the middle of a
-sentence. The second switches back to the default handling in which
-spacing between sentences stretches or shrinks more
-(see \spacefactor
).
+
\frenchspacing
causes LaTeX to make spacing after all
+punctuation, including periods, be the same as the space between words
+in the middle of a sentence. \nonfrenchspacing
switches back
+to the default handling in which spacing after most punctuation stretches
+or shrinks differently than a word space (see \spacefactor
).
-Some typographic traditions, including English, prefer to adjust the
-space between sentences (or spaces following a question mark,
-exclamation point, comma, or colon) more than the space between words
-that are in the middle of a sentence. Declaring \frenchspacing
-(the command is from plain TeX) switches to the tradition that all
-spaces are treated equally.
+
In American English, the typesetting tradition is to adjust, typically
+increasing, the space after punctuation more than the space between
+words that are in the middle of a sentence. Declaring
+\frenchspacing
(the command is inherited from plain TeX)
+switches to the tradition that all spaces are treated equally.
+
+If your LaTeX document specifies the language being used, for
+example with the babel
package, the necessary settings
+should be taken care of for you.
@@ -17308,7 +18169,7 @@ 19.5.1 \@
<
Previous: \frenchspacing
& \nonfrenchspacing
, Up: \spacefactor
[Contents][Index]
-19.5.3 \normalsfcodes
+19.5.3 \normalsfcodes
¶
@@ -17329,9 +18190,9 @@ 19.5.3 \n
19.6 Backslash-space, \
+19.6 Backslash-space, \
¶
@@ -17340,7 +18201,7 @@ 19.6 Backslash-space, <
This section refers to the command consisting of two characters, a
-backslash followed by a space.
Synopsis:
+backslash followed by a space. Synopsis:
\
@@ -17349,8 +18210,9 @@ 19.6 Backslash-space, <
Produce a space. By default it produces white space of length
3.33333pt plus 1.66666pt minus 1.11111pt.
-When you type one or more blanks between words, LaTeX produces white
-space. But that is different than an explicit space. This illustrates.
+
When you type one or more blanks between words, LaTeX produces
+whitespace that is different than an explicit space. This
+illustrates:
\begin{tabular}{rl}
@@ -17384,9 +18246,9 @@ 19.6 Backslash-space, <
Under normal circumstances, \
TAB and \
NEWLINE
are equivalent to backslash-space, \
.
-Please also note that in order to allow source code indentation, under
-normal circumstances, TeX ignores leading blanks in a line. So the
-following prints ‘one word’:
+
In order to allow source code indentation, under normal circumstances,
+TeX ignores leading blanks in a line. So the following prints
+‘one word’:
one
@@ -17405,7 +18267,7 @@ 19.6 Backslash-space, <
Next: \thinspace
& \negthinspace
, Previous: Backslash-space, \
, Up: Spaces [Contents][Index]
-19.7 ~
+19.7 ~
, \nobreakspace
¶
@@ -17420,10 +18282,14 @@ 19.7 ~
before~after
+
+
The tie character, ~
, produces a space between before and
after at which the line will not be broken. By default the white
space has length 3.33333pt plus 1.66666pt minus
-1.11111pt (see Lengths).
+1.11111pt (see Lengths). The command \nobreakspace
+and the Unicode input character U+00A0 (also in many 8-bit encodings)
+are synonyms.
Note that the word ‘tie’ has this meaning in the TeX/Texinfo
community; this differs from the typographic term “tie”, which
@@ -17439,14 +18305,14 @@
19.7 ~
In addition, despite the period, LaTeX does not use the
end-of-sentence spacing (see \@
).
-Ties prevent the end of line separation of things where that could
-cause confusion. They also still allow hyphenation (of either of the
-tied words), so they are generally preferable to putting consecutive
-words in an \mbox
(see \mbox
& \makebox
).
+
Ties prevent a line break where that could cause confusion. They also
+still allow hyphenation (of either of the tied words), so they are
+generally preferable to putting consecutive words in an \mbox
+(see \mbox
& \makebox
).
-They are also matters of taste, sometimes alarmingly dogmatic taste,
-among readers. Nevertheless, here are some usage models, many of them
-from The TeXbook.
+
Exactly where ties should be used is something of a matter of taste,
+sometimes alarmingly dogmatic taste, among readers. Nevertheless, here
+are some usage models, many of them from The TeXbook.
- Between an enumerator label and number, such as in references:
@@ -17495,9 +18361,9 @@
19.7 ~
19.8 \thinspace
& \negthinspace
+19.8 \thinspace
& \negthinspace
¶
@@ -17548,7 +18414,7 @@ 19.8
Next: \hrulefill
& \dotfill
, Previous: \thinspace
& \negthinspace
, Up: Spaces [Contents][Index]
-
-19.9 \/
+19.9 \/
¶
@@ -17610,7 +18476,7 @@ 19.9 \/
Next: \bigskip
& \medskip
& \smallskip
, Previous: \/
, Up: Spaces [Contents][Index]
-19.10 \hrulefill
& \dotfill
+19.10 \hrulefill
& \dotfill
¶
@@ -17681,7 +18547,7 @@ 19.10
Next: \bigbreak
& \medbreak
& \smallbreak
, Previous: \hrulefill
& \dotfill
, Up: Spaces [Contents][Index]
-
-19.11 \bigskip
& \medskip
& \smallskip
+19.11 \bigskip
& \medskip
& \smallskip
¶
@@ -17715,21 +18581,21 @@
-\bigskip
¶
+\bigskip
¶
-
The same as \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
.
-\medskip
¶
+\medskip
¶
-
The same as \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
.
-\smallskip
¶
+\smallskip
¶
-
The same as \vspace{\smallskipamount}
, ordinarily about a
quarter of a line space, with stretch and shrink. The default for the
@@ -17755,7 +18621,7 @@
\strut
, Previous: \bigskip
& \medskip
& \smallskip
, Up: Spaces [Contents][Index]
-19.12 \bigbreak
& \medbreak
& \smallbreak
+19.12 \bigbreak
& \medbreak
& \smallbreak
¶
@@ -17798,7 +18664,7 @@ \vspace
, Previous: \bigbreak
& \medbreak
& \smallbreak
, Up: Spaces [Contents][Index]
-19.13 \strut
+19.13 \strut
¶
@@ -17906,7 +18772,7 @@ 19.13 \strut
<
Next: \vfill
, Previous: \strut
, Up: Spaces [Contents][Index]
-19.14 \vspace
+19.14 \vspace
¶
@@ -17976,7 +18842,7 @@ 19.14 \vspace
Next: \addvspace
, Previous: \vspace
, Up: Spaces [Contents][Index]
-19.15 \vfill
+19.15 \vfill
¶
@@ -18022,7 +18888,7 @@ 19.15 \vfill
<
Previous: \vfill
, Up: Spaces [Contents][Index]
-19.16 \addvspace
+19.16 \addvspace
¶
@@ -18086,9 +18952,9 @@ 19.16 \addvspace
20 Boxes
+20 Boxes ¶
@@ -18118,7 +18984,7 @@ 20 Boxes
Next: \fbox
& \framebox
, Up: Boxes [Contents][Index]
-
-20.1 \mbox
& \makebox
+20.1 \mbox
& \makebox
¶
@@ -18156,7 +19022,7 @@ 20.1 width specifies the
width of the box. Note that the space occupied by the text need not
equal the width of the box. For one thing, text can be too small;
-this creates a full-line box
+this creates a full-line box:
\makebox[\linewidth]{Chapter Exam}
@@ -18246,7 +19112,7 @@ 20.1 \parbox
, Previous: \mbox
& \makebox
, Up: Boxes [Contents][Index]
-20.2 \fbox
& \framebox
+20.2 \fbox
& \framebox
¶
@@ -18291,7 +19157,7 @@ 20.2
-\fboxrule
¶
+\fboxrule
¶
-
@@ -18300,7 +19166,7 @@
20.2 \setlength{\fboxrule}{0.8pt}
(see \setlength
).
-\fboxsep
¶
+\fboxsep
¶
-
The distance from the frame to the enclosed box. The default is 3pt.
@@ -18345,7 +19211,7 @@
20.2 \raisebox
, Previous: \fbox
& \framebox
, Up: Boxes [Contents][Index]
-20.3 \parbox
+20.3 \parbox
¶
@@ -18414,7 +19280,7 @@ 20.3 \parbox
Next: \sbox
& \savebox
, Previous: \parbox
, Up: Boxes [Contents][Index]
-20.4 \raisebox
+20.4 \raisebox
¶
@@ -18477,7 +19343,7 @@ 20.4 \raisebox
Next: lrbox
, Previous: \raisebox
, Up: Boxes [Contents][Index]
-20.5 \sbox
& \savebox
+20.5 \sbox
& \savebox
¶
@@ -18578,7 +19444,7 @@ 20.5 \usebox
, Previous: \sbox
& \savebox
, Up: Boxes [Contents][Index]
-20.6 lrbox
+20.6 lrbox
¶
@@ -18621,7 +19487,7 @@ 20.6 lrbox
Previous: lrbox
, Up: Boxes [Contents][Index]
-20.7 \usebox
+20.7 \usebox
¶
@@ -18641,153 +19507,143 @@ 20.7 \usebox
-
+
21 Color
+21 Graphics ¶
-
+
+
-You can add color to text, rules, etc. You can also have color in a box
-or on an entire page and write text on top of it.
+
You can use graphics such as PNG or PDF files in your LaTeX document.
+You need an additional package, which comes standard with LaTeX.
+This example is the short how-to.
-Color support comes as an additional package. So put
-\usepackage{color}
in your document preamble to use the
-commands described here.
+
+\include{graphicx} % goes in the preamble
+ ...
+\includegraphics[width=0.5\linewidth]{plot.pdf}
+
+
+To use the commands described here your document preamble must contain
+either \usepackage{graphicx}
or
+\usepackage{graphics}
. Most of the time, graphicx
is the
+better choice.
-Many other packages also supplement LaTeX’s color abilities.
-Particularly worth mentioning is xcolor, which is widely used and
-significantly extends the capabilities described here, including adding
-‘HTML’ and ‘Hsb’ color models.
+
Graphics come in two main types, raster and vector. LaTeX can use
+both. In raster graphics the file contains an entry for each location
+in an array, describing what color it is. An example is a photograph
+in JPG format. In vector graphics, the file contains a list of
+instructions such as ‘draw a circle with this radius and that
+center’. An example is a line drawing produced by the Asymptote
+program, in PDF format. Generally vector graphics are more useful
+because you can rescale their size without pixelation or other problems,
+and because they often have a smaller size.
+
+There are systems particularly well-suited to make graphics for a
+LaTeX document. For example, these allow you to use the same fonts
+as in your document. LaTeX comes with a picture
environment
+(see picture
) that has simple capabilities. Besides that, there are
+other ways to include the graphic-making commands in the document. Two
+such systems are the PSTricks and TikZ packages. There are also systems
+external to LaTeX, that generate a graphic that you include using the
+commands of this chapter. Two that use a programming language are
+Asymptote and MetaPost. One that uses a graphical interface is Xfig.
+Full description of these systems is outside the scope of this document;
+see their documentation on CTAN.
-color
package options
-- Color models
-- Commands for color
+graphics
package options
+graphics
package configuration
+- Commands for graphics
-
+
21.1 color
package options
+21.1 graphics
package options ¶
-
-
+
+
Synopsis (must be in the document preamble):
-\usepackage[comma-separated option list]{color}
+\usepackage[comma-separated option list]{graphics}
-When you load the color package there are two kinds of available
-options.
+
or
-The first specifies the printer driver. LaTeX doesn’t contain
-information about different output systems but instead depends on
-information stored in a file. Normally you should not specify the
-driver option in the document, and instead rely on your system’s
-default. One advantage of this is that it makes the document portable
-across systems. For completeness we include a list of the drivers. The
-currently relevant ones are: dvipdfmx, dvips,
-dvisvgm, luatex, pdftex, xetex. The two
-xdvi and oztex are essentially aliases for dvips
-(and xdvi is monochrome). Ones that should not be used for new
-systems are: dvipdf, dvipdfm, dviwin,
-dvipsone, emtex, pctexps, pctexwin,
-pctexhp, pctex32, truetex, tcidvi,
-vtex (and dviwindo is an alias for dvipsone).
+
+\usepackage[comma-separated option list]{graphicx}
+
+
+The graphicx
package has a format for optional arguments to the
+\includegraphics
command that is convenient (it is the key-value
+format), so it is the better choice for new documents. When you load
+the graphics
or graphicx
package with \usepackage
+there are two kinds of available options.
+
+The first is that LaTeX does not contain information about different
+output systems but instead depends on information stored in a
+printer driver file. Normally you should not specify the driver
+option in the document, and instead rely on your system’s default. One
+advantage of this is that it makes the document portable across systems.
+
+For completeness here is a list of the drivers. The currently relevant
+ones are: dvipdfmx, dvips, dvisvgm, luatex,
+pdftex, xetex. The two xdvi and oztex are
+essentially aliases for dvips (and xdvi is monochrome).
+Ones that should not be used for new systems are: dvipdf,
+dvipdfm, dviwin, dvipsone, emtex,
+pctexps, pctexwin, pctexhp, pctex32,
+truetex, tcidvi, vtex (and dviwindo is an
+alias for dvipsone). These are stored in files with a
+.def extension, such as pdftex.def.
-The second kind of options, beyond the drivers, are below.
+
The second kind of options are below.
-monochrome
-Disable the color commands, so that they do not generate errors but do
-not generate color either.
+
demo
+Instead of an image file, LaTeX puts in a 150 pt by 100 pt
+rectangle (unless another size is specified in the
+\includegraphics
command).
-dvipsnames
-Make available a list of 68 color names that are often used,
-particularly in legacy documents. These color names were originally
-provided by the dvips driver, giving the option name.
+
draft
+For each graphic file, it is not shown but instead its file name is
+printed in a box of the correct size. In order to determine the size,
+the file must be present.
-nodvipsnames
-Do not load that list of color names, saving LaTeX a tiny amount of
-memory space.
+
final
+(Default) Override any previous draft
option, so that the
+document shows the contents of the graphic files.
-
-
-
-
-
-
-
-21.2 Color models
-
-
-
-A color model is a way of representing colors. LaTeX’s
-capabilities depend on the printer driver. However, the pdftex,
-xetex, and luatex printer drivers are today by far the
-most commonly used. The models below work for those drivers. All but
-one of these is also supported by essentially all other printer drivers
-used today.
-
-Note that color combination can be additive or subtractive. Additive
-mixes colors of light, so that for instance combining full intensities
-of red, green, and blue produces white. Subtractive mixes pigments,
-such as with inks, so that combining full intensity of cyan, magenta,
-and yellow makes black.
-
-
-
-cmyk
-A comma-separated list with four real numbers between 0 and 1,
-inclusive. The first number is the intensity of cyan, the second is
-magenta, and the others are yellow and black. A number value of 0 means
-minimal intensity, while a 1 is for full intensity. This model is often
-used in color printing. It is a subtractive model.
-
-
-gray
-A single real number between 0 and 1, inclusive. The colors are shades
-of grey. The number 0 produces black while 1 gives white.
-
-
-rgb
-A comma-separated list with three real numbers between 0 and 1,
-inclusive. The first number is the intensity of the red component, the
-second is green, and the third the blue. A number value of 0 means that
-none of that component is added in, while a 1 means full intensity.
-This is an additive model.
+
hiderotate
+Do not show rotated text. (This allows for the possibility that a
+previewer does not have the capability to rotate text.)
-
-RGB
-(pdftex, xetex, luatex drivers) A comma-separated
-list with three integers between 0 and 255, inclusive. This model is a
-convenience for using rgb
since outside of LaTeX colors are
-often described in a red-green-blue model using numbers in this range.
-The values entered here are converted to the rgb
model by
-dividing by 255.
+
+hidescale
+Do not show scaled text. (This allows for the possibility that a
+previewer does not have the capability to scale.)
-
-named
-Colors are accessed by name, such as ‘PrussianBlue’. The list of
-names depends on the driver, but all support the names ‘black’,
-‘blue’, ‘cyan’, ‘green’, ‘magenta’, ‘red’,
-‘white’, and ‘yellow’ (See the dvipsnames
option in
-color
package options).
+
+hiresbb
+In a PS or EPS file the graphic size may be specified in two ways. The
+%%BoundingBox
lines describe the graphic size using integer
+multiples of a PostScript point, that is, integer multiples of 1/72
+inch. A later addition to the PostScript language allows decimal
+multiples, such as 1.23, in %%HiResBoundingBox
lines. This
+option has LaTeX to read the size from the latter.
@@ -18795,1293 +19651,1303 @@ 21.2 Color models
-
-
+
21.3 Commands for color
+21.2 graphics
package configuration ¶
-
+
+
+
-These are the commands available with the color package.
+
These commands configure the way LaTeX searches the file system for
+the graphic.
+
+The behavior of file system search code is necessarily platform
+dependent. In this document we cover GNU/Linux, Macintosh, and Windows, as
+those systems are typically configured. For other situations consult
+the documentation in grfguide.pdf, or the LaTeX source, or your
+TeX distribution’s documentation.
-- Define colors
-- Colored text
-- Colored boxes
-- Colored pages
+\graphicspath
+\DeclareGraphicsExtensions
+\DeclareGraphicsRule
-
+
21.3.1 Define colors
+21.2.1 \graphicspath
¶
-
-
-
+
Synopsis:
-\definecolor{name}{model}{specification}
-
-
-Give the name name to the color. For example, after this
-
-
-\definecolor{silver}{rgb}{0.75,0.75,0.74}
+\graphicspath{list of directories inside curly braces}
-you can use that color name with Hi ho,
-\textcolor{silver}{Silver}!
.
+
Declare a list of directories to search for graphics files. This allows
+you to later say something like \includegraphics{lion.png}
+instead of having to give its path.
-This example gives the color a more abstract name, so it could change and
-not be misleading.
+
LaTeX always looks for graphic files first in the current directory
+(and the output directory, if specified; see output directory).
+The declaration below tells the system to then look in the
+subdirectory pix, and then ../pix.
-\definecolor{logocolor}{RGB}{145,92,131} % RGB needs pdflatex
-\newcommand{\logo}{\textcolor{logocolor}{Bob's Big Bagels}}
+\usepackage{graphicx} % or graphics; put in preamble
+ ...
+\graphicspath{ {pix/} {../pix/} }
-Often a document’s colors are defined in the preamble, or in the class
-or style, rather than in the document body.
-
-
-
-
-
-
-21.3.2 Colored text
-
-
-
-
-Synopses:
+
The \graphicspath
declaration is optional. If you don’t include
+it then LaTeX’s default is to search all of the places that it
+usually looks for a file (it uses LaTeX’s \input@path
). In
+particular, in this case one of the places it looks is the current
+directory.
-
-\textcolor{name}{...}
-\textcolor[color model]{color specification}{...}
-
-
-or
+
Enclose each directory name in curly braces; for example, above it says
+‘{pix}
’. Do this even if there is only one directory.
+Each directory name must end in a forward slash, /. This is true
+even on Windows, where good practice is to use forward slashes for all
+the directory separators since it makes the document portable to other
+platforms. If you have spaces in your directory name then use double
+quotes, as with {"my docs/"}
. Getting one of these rules wrong
+will cause LaTeX to report Error: File `filename' not
+found
.
-
-\color{name}
-\color[color model]{color specification}
-
-
-The affected text gets the color. This line
+
Basically, the algorithm is that with this example, after looking in the
+current directory,
-\textcolor{magenta}{My name is Ozymandias, King of Kings;}
-Look on my works, ye Mighty, and despair!
+\graphicspath{ {pix/} {../pix/} }
+...
+\usepackage{lion.png}
-causes the first half to be in magenta while the rest is in black. You
-can use a color declared with \definecolor
in exactly the same
-way that we just used the builtin color ‘magenta’.
+
for each of the listed directories, LaTeX concatenates it with the
+filename and searches for the result, checking for pix/lion.png
+and then ../pix/lion.png. This algorithm means that the
+\graphicspath
command does not recursively search subdirectories:
+if you issue \graphicspath{{a/}}
and the graphic is in
+a/b/lion.png then LaTeX will not find it. It also means that
+you can use absolute paths such as
+\graphicspath{{/home/jim/logos/}}
or
+\graphicspath{{C:/Users/Albert/Pictures/}}
. However, using
+these means that the document is not portable. (You could preserve
+portability by adjusting your TeX system settings configuration file
+parameter TEXINPUTS
; see the documentation of your system.)
-
-\definecolor{MidlifeCrisisRed}{rgb}{1.0,0.11,0.0}
-I'm thinking about getting a \textcolor{MidlifeCrisisRed}{sports car}.
-
-
-The two \textcolor
and \color
differ in that the first is
-a command form, enclosing the text to be colored as an argument. Often
-this form is more convenient, or at least more explicit. The second
-form is a declaration, as in The moon is made of {\color{green}
-green} cheese
, so it is in effect until the end of the current group
-or environment. This is sometimes useful when writing macros or as
-below where it colors everything inside the center
environment,
-including the vertical and horizontal lines.
+
You can use \graphicspath
anywhere in the document. You can use
+it more than once. Show its value with
+\makeatletter\typeout{\Ginput@path}\makeatother
.
-
-\begin{center} \color{blue}
- \begin{tabular}{l|r}
- UL &UR \\ \hline
- LL &LR
- \end{tabular}
-\end{center}
-
-
-You can use color in equations. A document might have this definition
-in the preamble
+
The directories are taken with respect to the base file. That is,
+suppose that you are working on a document based on book/book.tex
+and it contains \include{chapters/chap1}
. If in
+chap1.tex you put \graphicspath{{plots/}}
then
+LaTeX will not search for graphics in book/chapters/plots, but
+instead in book/plots.
-
-\definecolor{highlightcolor}{RGB}{225,15,0}
-
-and then contain this equation.
-
-
-\begin{equation}
- \int_a^b \textcolor{highlightcolor}{f'(x)}\,dx=f(b)-f(a)
-\end{equation}
-
+
+
+
-
+21.2.2 \DeclareGraphicsExtensions
¶
-Typically the colors used in a document are declared in a class or style
-but sometimes you want a one-off. Those are the second forms in the
-synopses.
+
+
+
Synopses:
-Colors of \textcolor[rgb]{0.33,0.14,0.47}{Purple} and
-{\color[rgb]{0.72,0.60,0.37}Gold} for the team.
+\DeclareGraphicsExtensions{comma-separated list of file extensions}
-The format of color specification depends on the color model
-(see Color models). For instance, while rgb
takes three
-numbers, gray
takes only one.
+
Declare the filename extensions to try. This allows you to specify the
+order in which to choose graphic formats when you include graphic files
+by giving the filename without the extension, as in
+\includegraphics{functionplot}
.
+
+In this example, LaTeX will find files in the PNG format before PDF
+files.
-The selection was \textcolor[gray]{0.5}{grayed out}.
+\DeclareGraphicsExtensions{.png,PNG,.pdf,.PDF}
+ ...
+\includegraphics{lion} % will find lion.png before lion.pdf
-Colors inside colors do not combine. Thus
+
Because the filename lion does not have a period, LaTeX uses
+the extension list. For each directory in the graphics path
+(see \graphicspath
), LaTeX will try the extensions in the order
+given. If it does not find such a file after trying all the directories
+and extensions then it reports ‘! LaTeX Error: File `lion'
+not found’. Note that you must include the periods at the start of the
+extensions.
+
+Because GNU/Linux and Macintosh filenames are case sensitive, the list of
+file extensions is case sensitive on those platforms. The Windows
+platform is not case sensitive.
+
+You are not required to include \DeclareGraphicsExtensions
in
+your document; the printer driver has a sensible default. For example,
+the most recent pdftex.def has this extension list.
-\textcolor{green}{kind of \textcolor{blue}{blue}}
+.pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,.PDF,.PNG,.JPG,.JPEG,.JBIG2,.JB2
-has a final word that is blue, not a combination of blue and green.
-
+
+
+To change the order, use the grfext
package.
+
+You can use this command anywhere in the document. You can use it more
+than once. Show its value with
+\makeatletter\typeout{\Gin@extensions}\makeatother
.
+
-
+
+
21.3.3 Colored boxes
+21.2.3 \DeclareGraphicsRule
¶
-
-
-
+
-Synopses:
+
Synopsis:
-\colorbox{name}{...}
-\colorbox[model name]{box background color}{...}
+\DeclareGraphicsRule{extension}{type}{size-file extension}{command}
-or
+
Declare how to handle graphic files whose names end in extension.
-
-\fcolorbox{frame color}{box background color}{...}
-\fcolorbox[model name]{frame color}{box background color}{...}
-
-
-Make a box with the stated background color. The \fcolorbox
-command puts a frame around the box. For instance this
+
This example declares that all files with names of the form
+filename-without-dot.mps will be treated as output from MetaPost,
+meaning that the printer driver will use its MetaPost-handling code to
+input the file.
-Name:~\colorbox{cyan}{\makebox[5cm][l]{\strut}}
+\DeclareGraphicsRule{.mps}{mps}{.mps}{}
-makes a cyan-colored box that is five centimeters long and gets its
-depth and height from the \strut
(so the depth is
--.3\baselineskip
and the height is \baselineskip
). This
-puts white text on a blue background.
+
This
-\colorbox{blue}{\textcolor{white}{Welcome to the machine.}}
+\DeclareGraphicsRule{*}{mps}{*}{}
-The \fcolorbox
commands use the same parameters as \fbox
-(see \fbox
& \framebox
), \fboxrule
and \fboxsep
, to
-set the thickness of the rule and the boundary between the box interior
-and the surrounding rule. LaTeX’s defaults are 0.4pt
and
-3pt
, respectively.
+
tells LaTeX that it should handle as MetaPost output any file with an
+extension not covered by another rule, so it covers filename.1,
+filename.2, etc.
-This example changes the thickness of the border to 0.8 points. Note
-that it is surrounded by curly braces so that the change ends at the end
-of the second line.
+
This describes the four arguments.
-
-{\setlength{\fboxrule}{0.8pt}
-\fcolorbox{black}{red}{Under no circumstances turn this knob.}}
-
-
+
+- extension
+The file extension to which this rule applies. The extension is anything
+after and including the first dot in the filename. Use the Kleene star,
+*
, to denote the default behavior for all undeclared extensions.
+
+
+- type
+The type of file involved. This type is a string that must be defined
+in the printer driver. For instance, files with extensions .ps,
+.eps, or .ps.gz may all be classed as type eps
.
+All files of the same type will be input with the same internal command
+by the printer driver. For example, the file types that pdftex
+recognizes are: jpg
, jbig2
, mps
, pdf
,
+png
, tif
.
+
+
+- size-file extension
+The extension of the file to be read to determine the size of the
+graphic, if there is such a file. It may be the same as extension
+but it may be different.
+
+As an example, consider a PostScript graphic. To make it smaller, it
+might be compressed into a .ps.gz file. Compressed files are not
+easily read by LaTeX so you can put the bounding box information in a
+separate file. If size-file extension is empty then you must
+specify size information in the arguments of \includegraphics
.
+
+If the driver file has a procedure for reading size files for
+type
then that will be used, otherwise it will use the procedure
+for reading .eps files. (Thus you may specify the size of bitmap
+files in a file with a PostScript style %%BoundingBox
line if no
+other format is available.)
+
+
+- command
+A command that will be applied to the file. This is often left
+empty. This command must start with a single backward quote. Thus,
+\DeclareGraphicsRule{.eps.gz}{eps}{.eps.bb}{`gunzip -c
+#1}
specifies that any file with the extension .eps.gz should
+be treated as an eps
file, with the BoundingBox information
+stored in the file with extension .eps.bb, and that the command
+gunzip -c
will run on your platform to decompresses the file.
+
+Such a command is specific to your platform. In addition, your TeX
+system must allow you to run external commands; as a security measure
+modern systems restrict running commands unless you explicitly allow it.
+See the documentation for your TeX distribution.
+
+
+
-
-
+
+
21.3.4 Colored pages
-
-
-
-
-
+21.3 Commands for graphics ¶
-Synopses:
-
-
-\pagecolor{name}
-\pagecolor[color model]{color specification}
-\nopagecolor
-
+
+
-The first two set the background of the page, and all subsequent pages,
-to the color. For an explanation of the specification in the second
-form see Colored text. The third returns the background to normal,
-which is a transparent background. (If that is not supported use
-\pagecolor{white}
, although that will make a white background
-rather than the default transparent background.)
+
These are the commands available with the graphics
and
+graphicx
packages.
-
- ...
-\pagecolor{cyan}
- ...
-\nopagecolor
-
+
-
-
-
-
-
+
22 Graphics
+21.3.1 \includegraphics
¶
-
-
+
+
+
+
+
+
+
+
+
+
-You can use graphics such as PNG or PDF files in your LaTeX document.
-You need an additional package, which comes standard with LaTeX.
-This example is the short how-to.
+
Synopses for graphics
package:
+
+
+\includegraphics{filename}
+\includegraphics[urx,ury]{filename}
+\includegraphics[llx,lly][urx,ury]{filename}
+\includegraphics*{filename}
+\includegraphics*[urx,ury]{filename}
+\includegraphics*[llx,lly][urx,ury]{filename}
+
+
+Synopses for graphicx
package:
+
+
+\includegraphics{filename}
+\includegraphics[key-value list]{filename}
+\includegraphics*{filename}
+\includegraphics*[key-value list]{filename}
+
+
+Include a graphics file. The starred form \includegraphics*
will
+clip the graphic to the size specified, while for the unstarred form any
+part of the graphic that is outside the box of the specified size will
+over-print the surrounding area.
+
+This
-\include{graphicx} % goes in the preamble
+\usepackage{graphicx} % in preamble
...
-\includegraphics[width=0.5\linewidth]{plot.pdf}
+\begin{center}
+ \includegraphics{plot.pdf}
+\end{center}
-To use the commands described here your document preamble must contain
-either \usepackage{graphicx}
or
-\usepackage{graphics}
. Most of the time, graphicx
is the
-better choice.
+
will incorporate into the document the graphic in plot.pdf,
+centered and at its nominal size. You can also give a path to the file,
+as with \includegraphics{graphics/plot.pdf}
. To specify a list
+of locations to search for the file, see \graphicspath
.
-Graphics come in two main types, raster and vector. LaTeX can use
-both. In raster graphics the file contains an entry for each location
-in an array, describing what color it is. An example is a photograph
-in JPG format. In vector graphics, the file contains a list of
-instructions such as ‘draw a circle with this radius and that
-center’. An example is a line drawing produced by the Asymptote
-program, in PDF format. Generally vector graphics are more useful
-because you can rescale their size without pixelation or other problems,
-and because they often have a smaller size.
+
If your filename includes spaces then put it in double quotes. An example
+is \includegraphics{"sister picture.jpg"}
.
-There are systems particularly well-suited to make graphics for a
-LaTeX document. For example, these allow you to use the same fonts
-as in your document. LaTeX comes with a picture
environment
-(see picture
) that has simple capabilities. Besides that, there are
-other ways to include the graphic-making commands in the document. Two
-such systems are the PSTricks and TikZ packages. There are also systems
-external to LaTeX, that generate a graphic that you include using the
-commands of this chapter. Two that use a programming language are
-Asymptote and MetaPost. One that uses a graphical interface is Xfig.
-Full description of these systems is outside the scope of this document;
-see their documentation on CTAN.
+
The \includegraphics{filename}
command decides on the
+type of graphic by splitting filename on the first dot. You can
+instead use filename with no dot, as in
+\includegraphics{turing}
, and then LaTeX tries a sequence of
+extensions such as .png
and .pdf
until it finds a file
+with that extension (see \DeclareGraphicsExtensions
).
+If your file name contains dots before the extension then you can hide
+them with curly braces, as in
+\includegraphics{{plot.2018.03.12.a}.pdf}
. Or, if you use
+the graphicx
package then you can use the options type
and
+ext
; see below. This and other filename issues are also handled
+with the package grffile.
+
+This example puts a graphic in a figure
environment so LaTeX can
+move it to the next page if fitting it on the current page is awkward
+(see figure
).
+
+
+\begin{figure}
+ \centering
+ \includegraphics[width=3cm]{lungxray.jpg}
+ \caption{The evidence is overwhelming: don't smoke.} \label{fig:xray}
+\end{figure}
+
-
-
-
-
-22.1 graphics
package options
-
-
-
-
-Synopsis (must be in the document preamble):
+
This places a graphic that will not float, so it is sure to appear at
+this point in the document even if makes LaTeX stretch the text or
+resort to blank areas on the page. It will be centered and will have a
+caption.
-\usepackage[comma-separated option list]{graphics}
+\usepackage{caption} % in preamble
+ ...
+\begin{center}
+ \includegraphics{pix/nix.png}
+ \captionof{figure}{The spirit of the night} \label{pix:nix} % optional
+\end{center}
-or
+
This example puts a box with a graphic side by side with one having
+text, with the two vertically centered.
-\usepackage[comma-separated option list]{graphicx}
+\newcommand*{\vcenteredhbox}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}
+ ...
+\begin{center}
+ \vcenteredhbox{\includegraphics[width=0.4\textwidth]{plot}}
+ \hspace{1em}
+ \vcenteredhbox{\begin{minipage}{0.4\textwidth}
+ \begin{displaymath}
+ f(x)=x\cdot \sin (1/x)
+ \end{displaymath}
+ \end{minipage}}
+\end{center}
-The graphicx
package has a format for optional arguments to the
-\includegraphics
command that is convenient (it is the key-value
-format), so it is the better choice for new documents. When you load
-the graphics
or graphicx
package with \usepackage
-there are two kinds of available options.
+
If you use the graphics
package then the only options involve the
+size of the graphic (but see \rotatebox
and \scalebox
).
+When one optional argument is present then it is
+[urx,ury]
and it gives the coordinates of the top
+right corner of the image, as a pair of TeX dimensions (see Units of length). If the units are omitted they default to bp
. In
+this case, the lower left corner of the image is assumed to be at (0,0).
+If two optional arguments are present then the leading one is
+[llx,lly]
, specifying the coordinates of the image’s
+lower left. Thus, \includegraphics[1in,0.618in]{...}
calls for
+the graphic to be placed so it is 1 inch wide and 0.618 inches
+tall and so its origin is at (0,0).
-The first is that LaTeX does not contain information about different
-output systems but instead depends on information stored in a
-printer driver file. Normally you should not specify the driver
-option in the document, and instead rely on your system’s default. One
-advantage of this is that it makes the document portable across systems.
+
The graphicx
package gives you many more options. Specify them
+in a key-value form, as here.
-For completeness here is a list of the drivers. The currently relevant
-ones are: dvipdfmx, dvips, dvisvgm, luatex,
-pdftex, xetex. The two xdvi and oztex are
-essentially aliases for dvips (and xdvi is monochrome).
-Ones that should not be used for new systems are: dvipdf,
-dvipdfm, dviwin, dvipsone, emtex,
-pctexps, pctexwin, pctexhp, pctex32,
-truetex, tcidvi, vtex (and dviwindo is an
-alias for dvipsone). These are stored in files with a
-.def extension, such as pdftex.def.
+
+\begin{center}
+ \includegraphics[width=1in,angle=90]{lion}
+ \hspace{2em}
+ \includegraphics[angle=90,width=1in]{lion}
+\end{center}
+
+
+The options are read left-to-right. So the first graphic above is made
+one inch wide and then rotated, while the second is rotated and then
+made one inch wide. Thus, unless the graphic is perfectly square, the
+two will end with different widths and heights.
-The second kind of options are below.
+
There are many options. The primary ones are listed first.
+
+
+
+Note that a graphic is placed by LaTeX into a box, which is
+traditionally referred to as its bounding box (distinct from the
+PostScript BoundingBox described below). The graphic’s printed area may
+go beyond this box, or sit inside this box, but when LaTeX makes up a
+page it puts together boxes and this is the box allocated for the
+graphic.
-demo
-Instead of an image file, LaTeX puts in a 150 pt by 100 pt
-rectangle (unless another size is specified in the
-\includegraphics
command).
+
+width
+The graphic will be shown so its bounding box is this width. An example
+is \includegraphics[width=1in]{plot}
. You can use the standard
+TeX dimensions (see Units of length) and also convenient is
+\linewidth
, or in a two-column document, \columnwidth
+(see Page layout parameters). An example is that by using the
+calc package you can make the graphic be 1 cm narrower than
+the width of the text with
+\includegraphics[width=\linewidth-1.0cm]{hefferon.jpg}
.
-draft
-For each graphic file, it is not shown but instead its file name is
-printed in a box of the correct size. In order to determine the size,
-the file must be present.
+
height
+The graphic will be shown so its bounding box is this height. You can
+use the standard TeX dimensions (see Units of length), and also
+convenient are \pageheight
and \textheight
(see Page layout parameters). For instance, the command
+\includegraphics[height=0.25\textheight]{godel}
will make the
+graphic a quarter of the height of the text area.
-final
-(Default) Override any previous draft
option, so that the
-document shows the contents of the graphic files.
+
totalheight
+The graphic will be shown so its bounding box has this height plus
+depth. This differs from the height if the graphic was rotated. For
+instance, if it has been rotated by -90 then it will have zero height
+but a large depth.
-hiderotate
-Do not show rotated text. (This allows for the possibility that a
-previewer does not have the capability to rotate text.)
+
keepaspectratio
+If set to true
, or just specified as here
+
+
+\includegraphics[...,keepaspectratio,...]{...}
+
+
+and you give as options both width
and height
(or
+totalheight
), then LaTeX will make the graphic is as large as
+possible without distortion. That is, LaTeX will ensure that neither
+is the graphic wider than width
nor taller than height
(or
+totalheight
).
-hidescale
-Do not show scaled text. (This allows for the possibility that a
-previewer does not have the capability to scale.)
+
scale
+Factor by which to scale the graphic. To make a graphic twice its
+nominal size, enter \includegraphics[scale=2.0]{...}
. This
+number may be any value; a number between 0 and 1 will shrink the
+graphic and a negative number will reflect it.
-hiresbb
-In a PS or EPS file the graphic size may be specified in two ways. The
-%%BoundingBox
lines describe the graphic size using integer
-multiples of a PostScript point, that is, integer multiples of 1/72
-inch. A later addition to the PostScript language allows decimal
-multiples, such as 1.23, in %%HiResBoundingBox
lines. This
-option has LaTeX to read the size from the latter.
+
angle
+Rotate the graphic. The angle is taken in degrees and counterclockwise.
+The graphic is rotated about its origin
; see that option. For a
+complete description of how rotated material is typeset,
+see \rotatebox
.
-
-
-
-
-
-
-
-22.2 graphics
package configuration
-
-
-
-
-
-These commands configure the way LaTeX searches the file system for
-the graphic.
+
origin
+The point of the graphic about which the rotation happens. Possible
+values are any string containing one or two of: l
for left,
+r
for right, b
for bottom, c
for center, t
+for top, and B
for baseline. Thus, entering the command
+\includegraphics[angle=180,origin=c]{moon}
will turn the
+picture upside down about that picture’s center, while the command
+\includegraphics[angle=180,origin=lB]{LeBateau}
will turn its
+picture upside down about its left baseline. (The character c
+gives the horizontal center in bc
or tc
, but gives the
+vertical center in lc
or rc
.) The default is lB
.
-The behavior of file system search code is necessarily platform
-dependent. In this document we cover GNU/Linux, Macintosh, and Windows, as
-those systems are typically configured. For other situations consult
-the documentation in grfguide.pdf, or the LaTeX source, or your
-TeX distribution’s documentation.
+
To rotate about an arbitrary point, see \rotatebox
.
+
+
-
-
-
-
-22.2.1 \graphicspath
-
-
-
-Synopsis:
+
These are lesser-used options.
+
+
+
+viewport
+Pick out a subregion of the graphic to show. Takes four arguments,
+separated by spaces and given in TeX dimensions, as with
+\includegraphics[.., viewport=0in 0in 1in 0.618in]{...}
. When
+the unit is omitted, the dimensions default to big
+points, bp
. They are taken relative to the origin specified
+by the bounding box. See also the trim
option.
+
+
+trim
+Gives parts of the graphic to not show. Takes four arguments, separated
+by spaces, that are given in TeX dimensions, as with
+\includegraphics[.., trim= 0in 0.1in 0.2in 0.3in, ...]{...}
.
+These give the amounts of the graphic not to show, that is, LaTeX
+will crop the picture by 0 inches on the left, 0.1 inches on
+the bottom, 0.2 inches on the right, and 0.3 inches on the
+top. See also the viewport
option.
+
+
+clip
+If set to true
, or just specified as here
-\graphicspath{list of directories inside curly braces}
+\includegraphics[...,clip,...]{...}
-Declare a list of directories to search for graphics files. This allows
-you to later say something like \includegraphics{lion.png}
-instead of having to give its path.
+
then the graphic is cropped to the bounding box. This is the same as
+using the starred form of the command,
+\includegraphics*[...]{...}
.
-LaTeX always looks for graphic files first in the current directory
-(and the output directory, if specified; see output directory).
-The declaration below tells the system to then look in the
-subdirectory pix, and then ../pix.
+
+page
+Give the page number of a multi-page PDF file. The default is
+page=1
.
+
+
+pagebox
+Specifies which bounding box to use for PDF files from among
+mediabox
, cropbox
, bleedbox
, trimbox
, or
+artbox
. PDF files do not have the BoundingBox that PostScript
+files have, but may specify up to four predefined rectangles. The
+MediaBox gives the boundaries of the physical medium. The CropBox is the
+region to which the contents of the page are to be clipped when
+displayed. The BleedBox is the region to which the contents of the page
+should be clipped in production. The TrimBox is the intended dimensions
+of the finished page. The ArtBox is the extent of the page’s meaningful
+content. The driver will set the image size based on CropBox if
+present, otherwise it will not use one of the others, with a
+driver-defined order of preference. MediaBox is always present.
+
+
+interpolate
+Enable or disable interpolation of raster images by the viewer. Can be
+set with interpolate=true
or just specified as here.
-\usepackage{graphicx} % or graphics; put in preamble
- ...
-\graphicspath{ {pix/} {../pix/} }
+\includegraphics[...,interpolate,...]{...}
-The \graphicspath
declaration is optional. If you don’t include
-it then LaTeX’s default is to search all of the places that it
-usually looks for a file (it uses LaTeX’s \input@path
). In
-particular, in this case one of the places it looks is the current
-directory.
-
-Enclose each directory name in curly braces; for example, above it says
-‘{pix}
’. Do this even if there is only one directory.
-Each directory name must end in a forward slash, /. This is true
-even on Windows, where good practice is to use forward slashes for all
-the directory separators since it makes the document portable to other
-platforms. If you have spaces in your directory name then use double
-quotes, as with {"my docs/"}
. Getting one of these rules wrong
-will cause LaTeX to report Error: File `filename' not
-found
.
+
+quiet
+Do not write information to the log. You can set it with
+quiet=true
or just specified it with
+\includegraphics[...,quiet,...]{...}
,
-Basically, the algorithm is that with this example, after looking in the
-current directory,
+
+draft
+If you set it with draft=true
or just specify it with
-\graphicspath{ {pix/} {../pix/} }
-...
-\usepackage{lion.png}
+\includegraphics[...,draft,...]{...}
-for each of the listed directories, LaTeX concatenates it with the
-filename and searches for the result, checking for pix/lion.png
-and then ../pix/lion.png. This algorithm means that the
-\graphicspath
command does not recursively search subdirectories:
-if you issue \graphicspath{{a/}}
and the graphic is in
-a/b/lion.png then LaTeX will not find it. It also means that
-you can use absolute paths such as
-\graphicspath{{/home/jim/logos/}}
or
-\graphicspath{{C:/Users/Albert/Pictures/}}
. However, using
-these means that the document is not portable. (You could preserve
-portability by adjusting your TeX system settings configuration file
-parameter TEXINPUTS
; see the documentation of your system.)
+
then the graphic will not appear in the document, possibly saving color
+printer ink. Instead, LaTeX will put an empty box of the correct
+size with the filename printed in it.
-You can use \graphicspath
anywhere in the document. You can use
-it more than once. Show its value with
-\makeatletter\typeout{\Ginput@path}\makeatother
.
+
+
+
+These options address the bounding box for Encapsulated PostScript
+graphic files, which have a size specified with a line
+%%BoundingBox
that appears in the file. It has four values,
+giving the lower x coordinate, lower y coordinate, upper
+x coordinate, and upper y coordinate. The units are
+PostScript points, equivalent to TeX’s big points, 1/72 inch.
+For example, if an .eps file has the line %%BoundingBox 10
+20 40 80
then its natural size is 30/72 inch wide by
+60/72 inch tall.
-The directories are taken with respect to the base file. That is,
-suppose that you are working on a document based on book/book.tex
-and it contains \include{chapters/chap1}
. If in
-chap1.tex you put \graphicspath{{plots/}}
then
-LaTeX will not search for graphics in book/chapters/plots, but
-instead in book/plots.
+
+
+bb
+Specify the bounding box of the displayed region. The argument is four
+dimensions separated by spaces, as with \includegraphics[.., bb=
+0in 0in 1in 0.618in]{...}
. Usually \includegraphics
reads the
+BoundingBox numbers from the EPS file automatically, so this option is
+only useful if the bounding box is missing from that file or if you want
+to change it.
-
-
-
-
-
-22.2.2 \DeclareGraphicsExtensions
-
-
-
-bbllx, bblly, bburx, bbury
+Set the bounding box. These four are obsolete, but are retained for
+compatibility with old packages.
+
+
+natwidth, natheight
+An alternative for bb
. Setting
-\DeclareGraphicsExtensions{comma-separated list of file extensions}
+\includegraphics[...,natwidth=1in,natheight=0.618in,...]{...}
-Declare the filename extensions to try. This allows you to specify the
-order in which to choose graphic formats when you include graphic files
-by giving the filename without the extension, as in
-\includegraphics{functionplot}
.
-
-In this example, LaTeX will find files in the PNG format before PDF
-files.
+
is the same as setting bb=0 0 1in 0.618in
.
+
+
+hiresbb
+If set to true
, or just specified as with
-\DeclareGraphicsExtensions{.png,PNG,.pdf,.PDF}
- ...
-\includegraphics{lion} % will find lion.png before lion.pdf
+\includegraphics[...,hiresbb,...]{...}
-Because the filename lion does not have a period, LaTeX uses
-the extension list. For each directory in the graphics path
-(see \graphicspath
), LaTeX will try the extensions in the order
-given. If it does not find such a file after trying all the directories
-and extensions then it reports ‘! LaTeX Error: File `lion'
-not found’. Note that you must include the periods at the start of the
-extensions.
+
then LaTeX will look for %%HiResBoundingBox
lines instead of
+%%BoundingBox
lines. (The BoundingBox
lines use only
+natural numbers while the HiResBoundingBox
lines use decimals;
+both use units equivalent to TeX’s big points, 1/72 inch.) To
+override a prior setting of true
, you can set it to false
.
-Because GNU/Linux and Macintosh filenames are case sensitive, the list of
-file extensions is case sensitive on those platforms. The Windows
-platform is not case sensitive.
+
+
+
+These following options allow a user to override LaTeX’s method of
+choosing the graphic type based on the filename extension. An example
+is that \includegraphics[type=png,ext=.xyz,read=.xyz]{lion}
+will read the file lion.xyz as though it were
+lion.png. For more on these, see \DeclareGraphicsRule
.
-You are not required to include \DeclareGraphicsExtensions
in
-your document; the printer driver has a sensible default. For example,
-the most recent pdftex.def has this extension list.
+
+
+type
+Specify the graphics type.
-
-.pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,.PDF,.PNG,.JPG,.JPEG,.JBIG2,.JB2
-
-
-
-
-
-
+ext
+Specify the graphics extension.
+Only use this in conjunction with the option type
.
-You can use this command anywhere in the document. You can use it more
-than once. Show its value with
-\makeatletter\typeout{\Gin@extensions}\makeatother
.
+
+read
+Specify the file extension of the read file.
+Only use this in conjunction with the option type
.
+
+command
+Specify a command to be applied to this file. Only use this in
+conjunction with the option type
. See Command line options,
+for a discussion of enabling the \write18
functionality to run
+external commands.
+
+
+
+
-
-
+
22.2.3 \DeclareGraphicsRule
+21.3.2 \rotatebox
¶
-
+
+
+
+
-Synopsis:
+
Synopsis if you use the graphics
package:
-\DeclareGraphicsRule{extension}{type}{size-file extension}{command}
+\rotatebox{angle}{material}
-Declare how to handle graphic files whose names end in extension.
+
Synopses if you use the graphicx
package:
-This example declares that all files with names of the form
-filename-without-dot.mps will be treated as output from MetaPost,
-meaning that the printer driver will use its MetaPost-handling code to
-input the file.
+
+\rotatebox{angle}{material}
+\rotatebox[key-value list]{angle}{material}
+
+
+Put material in a box and rotate it angle degrees
+counterclockwise.
+
+This example rotates the table column heads forty-five degrees.
-\DeclareGraphicsRule{.mps}{mps}{.mps}{}
+\begin{tabular}{ll}
+ \rotatebox{45}{Character} &\rotatebox{45}{NATO phonetic} \\
+ A &AL-FAH \\
+ B &BRAH-VOH
+\end{tabular}
-This
+
The material can be anything that goes in a box, including a graphic.
-\DeclareGraphicsRule{*}{mps}{*}{}
+ \rotatebox[origin=c]{45}{\includegraphics[width=1in]{lion}}
-tells LaTeX that it should handle as MetaPost output any file with an
-extension not covered by another rule, so it covers filename.1,
-filename.2, etc.
+
To place the rotated material, the first step is that LaTeX sets
+material in a box, with a reference point on the left baseline.
+The second step is the rotation, by default about the reference point.
+The third step is that LaTeX computes a box to bound the rotated
+material. Fourth, LaTeX moves this box horizontally so that the left
+edge of this new bounding box coincides with the left edge of the box
+from the first step (they need not coincide vertically). This new
+bounding box, in its new position, is what LaTeX uses as the box when
+typesetting this material.
-This describes the four arguments.
+
If you use the graphics
package then the rotation is about the
+reference point of the box. If you use the graphicx
package
+then these are the options that can go in the key-value list,
+but note that you can get the same effect without needing this
+package, except for the x
and y
options
+(see \includegraphics
).
-- extension
-The file extension to which this rule applies. The extension is anything
-after and including the first dot in the filename. Use the Kleene star,
-*
, to denote the default behavior for all undeclared extensions.
+
origin
+The point of the material’s box about which the rotation happens.
+Possible value is any string containing one or two of: l
for
+left, r
for right, b
for bottom, c
for center,
+t
for top, and B
for baseline. Thus, the first line here
-
-- type
-The type of file involved. This type is a string that must be defined
-in the printer driver. For instance, files with extensions .ps,
-.eps, or .ps.gz may all be classed as type eps
.
-All files of the same type will be input with the same internal command
-by the printer driver. For example, the file types that pdftex
-recognizes are: jpg
, jbig2
, mps
, pdf
,
-png
, tif
.
+
+\rotatebox[origin=c]{180}{moon}
+\rotatebox[origin=lB]{180}{LeBateau}
+
+
+will turn the picture upside down from the center while the second will
+turn its picture upside down about its left baseline. (The character
+c
gives the horizontal center in bc
or tc
but gives
+the vertical center in lc
or rc
, and gives both in
+c
.) The default is lB
.
-- size-file extension
-The extension of the file to be read to determine the size of the
-graphic, if there is such a file. It may be the same as extension
-but it may be different.
-
-As an example, consider a PostScript graphic. To make it smaller, it
-might be compressed into a .ps.gz file. Compressed files are not
-easily read by LaTeX so you can put the bounding box information in a
-separate file. If size-file extension is empty then you must
-specify size information in the arguments of \includegraphics
.
-
-If the driver file has a procedure for reading size files for
-type
then that will be used, otherwise it will use the procedure
-for reading .eps files. (Thus you may specify the size of bitmap
-files in a file with a PostScript style %%BoundingBox
line if no
-other format is available.)
+
x, y
+Specify an arbitrary point of rotation with
+\rotatebox[x=TeX dimension,y=TeX
+dimension]{...}
(see Units of length). These give the offset
+from the box’s reference point.
-- command
-A command that will be applied to the file. This is often left
-empty. This command must start with a single backward quote. Thus,
-\DeclareGraphicsRule{.eps.gz}{eps}{.eps.bb}{`gunzip -c
-#1}
specifies that any file with the extension .eps.gz should
-be treated as an eps
file, with the BoundingBox information
-stored in the file with extension .eps.bb, and that the command
-gunzip -c
will run on your platform to decompresses the file.
-
-Such a command is specific to your platform. In addition, your TeX
-system must allow you to run external commands; as a security measure
-modern systems restrict running commands unless you explicitly allow it.
-See the documentation for your TeX distribution.
+
units
+This key allows you to change the default of degrees counterclockwise.
+Setting units=-360
changes the direction to degrees clockwise and
+setting units=6.283185
changes to radians counterclockwise.
-
-
-
-
-
-22.3 Commands for graphics
-
-
-
-
-These are the commands available with the graphics
and
-graphicx
packages.
-
-
-
-
+
+
22.3.1 \includegraphics
+21.3.3 \scalebox
¶
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-Synopses for graphics
package:
+
Synopses:
-\includegraphics{filename}
-\includegraphics[urx,ury]{filename}
-\includegraphics[llx,lly][urx,ury]{filename}
-\includegraphics*{filename}
-\includegraphics*[urx,ury]{filename}
-\includegraphics*[llx,lly][urx,ury]{filename}
+\scalebox{horizontal factor}{material}
+\scalebox{horizontal factor}[vertical factor]{material}
+\reflectbox{material}
-Synopses for graphicx
package:
+
Scale the material.
+
+This example halves the size, both horizontally and vertically, of the
+first text and doubles the size of the second.
-\includegraphics{filename}
-\includegraphics[key-value list]{filename}
-\includegraphics*{filename}
-\includegraphics*[key-value list]{filename}
+\scalebox{0.5}{DRINK ME} and \scalebox{2.0}{Eat Me}
-Include a graphics file. The starred form \includegraphics*
will
-clip the graphic to the size specified, while for the unstarred form any
-part of the graphic that is outside the box of the specified size will
-over-print the surrounding area.
+
If you do not specify the optional vertical factor then it
+defaults to the same value as the horizontal factor.
-This
+
You can use this command to resize a graphic, as here.
-\usepackage{graphicx} % in preamble
- ...
-\begin{center}
- \includegraphics{plot.pdf}
-\end{center}
+\scalebox{0.5}{\includegraphics{lion}}
-will incorporate into the document the graphic in plot.pdf,
-centered and at its nominal size. You can also give a path to the file,
-as with \includegraphics{graphics/plot.pdf}
. To specify a list
-of locations to search for the file, see \graphicspath
.
-
-If your filename includes spaces then put it in double quotes. An example
-is \includegraphics{"sister picture.jpg"}
.
-
-The \includegraphics{filename}
command decides on the
-type of graphic by splitting filename on the first dot. You can
-instead use filename with no dot, as in
-\includegraphics{turing}
, and then LaTeX tries a sequence of
-extensions such as .png
and .pdf
until it finds a file
-with that extension (see \DeclareGraphicsExtensions
).
-
-If your file name contains dots before the extension then you can hide
-them with curly braces, as in
-\includegraphics{{plot.2018.03.12.a}.pdf}
. Or, if you use
-the graphicx
package then you can use the options type
and
-ext
; see below. This and other filename issues are also handled
-with the package grffile.
+
If you use the graphicx
package then you can accomplish the same
+thing with optional arguments to \includegraphics
+(see \includegraphics
).
-This example puts a graphic in a figure
environment so LaTeX can
-move it to the next page if fitting it on the current page is awkward
-(see figure
).
+
The \reflectbox
command abbreviates
+\scalebox{-1}[1]{material}
. Thus, Able was
+I\reflectbox{Able was I}
will show the phrase ‘Able was I’
+immediately followed by its mirror reflection against a vertical axis.
-
-\begin{figure}
- \centering
- \includegraphics[width=3cm]{lungxray.jpg}
- \caption{The evidence is overwhelming: don't smoke.} \label{fig:xray}
-\end{figure}
-
-This places a graphic that will not float, so it is sure to appear at
-this point in the document even if makes LaTeX stretch the text or
-resort to blank areas on the page. It will be centered and will have a
-caption.
+
+
+
-
+21.3.4 \resizebox
¶
+
+
+
+
+
+
+
+
+
+Synopses:
-\usepackage{caption} % in preamble
- ...
-\begin{center}
- \includegraphics{pix/nix.png}
- \captionof{figure}{The spirit of the night} \label{pix:nix} % optional
-\end{center}
+\resizebox{horizontal length}{vertical length}{material}
+\resizebox*{horizontal length}{vertical length}{material}
-This example puts a box with a graphic side by side with one having
-text, with the two vertically centered.
+
Given a size, such as 3cm
, transform material to make it
+that size. If either horizontal length or vertical length
+is an exclamation point !
then the other argument is used
+to determine a scale factor for both directions.
+
+This example makes the graphic be a half inch wide and scales it
+vertically by the same factor to keep it from being distorted.
-\newcommand*{\vcenteredhbox}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}
- ...
-\begin{center}
- \vcenteredhbox{\includegraphics[width=0.4\textwidth]{plot}}
- \hspace{1em}
- \vcenteredhbox{\begin{minipage}{0.4\textwidth}
- \begin{displaymath}
- f(x)=x\cdot \sin (1/x)
- \end{displaymath}
- \end{minipage}}
-\end{center}
+\resizebox{0.5in}{!}{\includegraphics{lion}}
-If you use the graphics
package then the only options involve the
-size of the graphic (but see \rotatebox
and \scalebox
).
-When one optional argument is present then it is
-[urx,ury]
and it gives the coordinates of the top
-right corner of the image, as a pair of TeX dimensions (see Units of length). If the units are omitted they default to bp
. In
-this case, the lower left corner of the image is assumed to be at (0,0).
-If two optional arguments are present then the leading one is
-[llx,lly]
, specifying the coordinates of the image’s
-lower left. Thus, \includegraphics[1in,0.618in]{...}
calls for
-the graphic to be placed so it is 1 inch wide and 0.618 inches
-tall and so its origin is at (0,0).
+
The unstarred form \resizebox
takes vertical length to be
+the box’s height while the starred form \resizebox*
takes it to
+be height+depth. For instance, make the text have a height+depth of a
+quarter-inch with \resizebox*{!}{0.25in}{\parbox{3.5in}{This
+box has both height and depth.}}
.
-The graphicx
package gives you many more options. Specify them
-in a key-value form, as here.
+
You can use \depth
, \height
, \totalheight
, and
+\width
to refer to the original size of the box. Thus, make the
+text two inches wide but keep the original height with
+\resizebox{2in}{\height}{Two inches}
.
+
+
+
+
+
+
+
-
+
-
+22 Color ¶
+
+
+
+You can add color to text, rules, etc. You can also have color in a box
+or on an entire page and write text on top of it.
+
+Color support comes as an additional package. So put
+\usepackage{color}
in your document preamble to use the
+commands described here.
+
+Many other packages also supplement LaTeX’s color abilities.
+Particularly worth mentioning is xcolor, which is widely used and
+significantly extends the capabilities described here, including adding
+‘HTML’ and ‘Hsb’ color models.
+
+
+
+
+
+
+22.1 color
package options ¶
+
+
+
+
+Synopsis (must be in the document preamble):
-\begin{center}
- \includegraphics[width=1in,angle=90]{lion}
- \hspace{2em}
- \includegraphics[angle=90,width=1in]{lion}
-\end{center}
+\usepackage[comma-separated option list]{color}
-The options are read left-to-right. So the first graphic above is made
-one inch wide and then rotated, while the second is rotated and then
-made one inch wide. Thus, unless the graphic is perfectly square, the
-two will end with different widths and heights.
+
When you load the color package there are two kinds of available
+options.
-There are many options. The primary ones are listed first.
+
The first specifies the printer driver. LaTeX doesn’t contain
+information about different output systems but instead depends on
+information stored in a file. Normally you should not specify the
+driver option in the document, and instead rely on your system’s
+default. One advantage of this is that it makes the document portable
+across systems. For completeness we include a list of the drivers. The
+currently relevant ones are: dvipdfmx, dvips,
+dvisvgm, luatex, pdftex, xetex. The two
+xdvi and oztex are essentially aliases for dvips
+(and xdvi is monochrome). Ones that should not be used for new
+systems are: dvipdf, dvipdfm, dviwin,
+dvipsone, emtex, pctexps, pctexwin,
+pctexhp, pctex32, truetex, tcidvi,
+vtex (and dviwindo is an alias for dvipsone).
-
-
-Note that a graphic is placed by LaTeX into a box, which is
-traditionally referred to as its bounding box (distinct from the
-PostScript BoundingBox described below). The graphic’s printed area may
-go beyond this box, or sit inside this box, but when LaTeX makes up a
-page it puts together boxes and this is the box allocated for the
-graphic.
+
The second kind of options, beyond the drivers, are below.
-
-width
-The graphic will be shown so its bounding box is this width. An example
-is \includegraphics[width=1in]{plot}
. You can use the standard
-TeX dimensions (see Units of length) and also convenient is
-\linewidth
, or in a two-column document, \columnwidth
-(see Page layout parameters). An example is that by using the
-calc package you can make the graphic be 1 cm narrower than
-the width of the text with
-\includegraphics[width=\linewidth-1.0cm]{hefferon.jpg}
.
+
monochrome
+Disable the color commands, so that they do not generate errors but do
+not generate color either.
-height
-The graphic will be shown so its bounding box is this height. You can
-use the standard TeX dimensions (see Units of length), and also
-convenient are \pageheight
and \textheight
(see Page layout parameters). For instance, the command
-\includegraphics[height=0.25\textheight]{godel}
will make the
-graphic a quarter of the height of the text area.
+
dvipsnames
+Make available a list of 68 color names that are often used,
+particularly in legacy documents. These color names were originally
+provided by the dvips driver, giving the option name.
-totalheight
-The graphic will be shown so its bounding box has this height plus
-depth. This differs from the height if the graphic was rotated. For
-instance, if it has been rotated by -90 then it will have zero height
-but a large depth.
+
nodvipsnames
+Do not load that list of color names, saving LaTeX a tiny amount of
+memory space.
-keepaspectratio
-If set to true
, or just specified as here
-
-
-\includegraphics[...,keepaspectratio,...]{...}
-
+
-and you give as options both width
and height
(or
-totalheight
), then LaTeX will make the graphic is as large as
-possible without distortion. That is, LaTeX will ensure that neither
-is the graphic wider than width
nor taller than height
(or
-totalheight
).
+
+
+
+
+
+22.2 Color models ¶
+
+
+
+A color model is a way of representing colors. LaTeX’s
+capabilities depend on the printer driver. However, the pdftex,
+xetex, and luatex printer drivers are today by far the
+most commonly used. The models below work for those drivers. All but
+one of these is also supported by essentially all other printer drivers
+used today.
-
-scale
-Factor by which to scale the graphic. To make a graphic twice its
-nominal size, enter \includegraphics[scale=2.0]{...}
. This
-number may be any value; a number between 0 and 1 will shrink the
-graphic and a negative number will reflect it.
+
Note that color combination can be additive or subtractive. Additive
+mixes colors of light, so that for instance combining full intensities
+of red, green, and blue produces white. Subtractive mixes pigments,
+such as with inks, so that combining full intensity of cyan, magenta,
+and yellow makes black.
-
-angle
-Rotate the graphic. The angle is taken in degrees and counterclockwise.
-The graphic is rotated about its origin
; see that option. For a
-complete description of how rotated material is typeset,
-see \rotatebox
.
+
+
+cmyk
+A comma-separated list with four real numbers between 0 and 1,
+inclusive. The first number is the intensity of cyan, the second is
+magenta, and the others are yellow and black. A number value of 0 means
+minimal intensity, while a 1 is for full intensity. This model is often
+used in color printing. It is a subtractive model.
-
-origin
-The point of the graphic about which the rotation happens. Possible
-values are any string containing one or two of: l
for left,
-r
for right, b
for bottom, c
for center, t
-for top, and B
for baseline. Thus, entering the command
-\includegraphics[angle=180,origin=c]{moon}
will turn the
-picture upside down about that picture’s center, while the command
-\includegraphics[angle=180,origin=lB]{LeBateau}
will turn its
-picture upside down about its left baseline. (The character c
-gives the horizontal center in bc
or tc
, but gives the
-vertical center in lc
or rc
.) The default is lB
.
+
+gray
+A single real number between 0 and 1, inclusive. The colors are shades
+of grey. The number 0 produces black while 1 gives white.
+
+
+rgb
+A comma-separated list with three real numbers between 0 and 1,
+inclusive. The first number is the intensity of the red component, the
+second is green, and the third the blue. A number value of 0 means that
+none of that component is added in, while a 1 means full intensity.
+This is an additive model.
+
+
+RGB
+(pdftex, xetex, luatex drivers) A comma-separated
+list with three integers between 0 and 255, inclusive. This model is a
+convenience for using rgb
since outside of LaTeX colors are
+often described in a red-green-blue model using numbers in this range.
+The values entered here are converted to the rgb
model by
+dividing by 255.
-To rotate about an arbitrary point, see \rotatebox
.
+
+named
+Colors are accessed by name, such as ‘PrussianBlue’. The list of
+names depends on the driver, but all support the names ‘black’,
+‘blue’, ‘cyan’, ‘green’, ‘magenta’, ‘red’,
+‘white’, and ‘yellow’ (See the dvipsnames
option in
+color
package options).
-These are lesser-used options.
-
-
-
-viewport
-Pick out a subregion of the graphic to show. Takes four arguments,
-separated by spaces and given in TeX dimensions, as with
-\includegraphics[.., viewport=0in 0in 1in 0.618in]{...}
. When
-the unit is omitted, the dimensions default to big
-points, bp
. They are taken relative to the origin specified
-by the bounding box. See also the trim
option.
-
-
-trim
-Gives parts of the graphic to not show. Takes four arguments, separated
-by spaces, that are given in TeX dimensions, as with
-\includegraphics[.., trim= 0in 0.1in 0.2in 0.3in, ...]{...}
.
-These give the amounts of the graphic not to show, that is, LaTeX
-will crop the picture by 0 inches on the left, 0.1 inches on
-the bottom, 0.2 inches on the right, and 0.3 inches on the
-top. See also the viewport
option.
+
+
+
+
+
+22.3 Commands for color ¶
+
+
+
+These are the commands available with the color package.
-
-clip
-If set to true
, or just specified as here
+
+
+
+
+
+22.3.1 Define colors ¶
+
+
+
+
+
+Synopsis:
-\includegraphics[...,clip,...]{...}
+\definecolor{name}{model}{specification}
-then the graphic is cropped to the bounding box. This is the same as
-using the starred form of the command,
-\includegraphics*[...]{...}
.
-
-
-page
-Give the page number of a multi-page PDF file. The default is
-page=1
.
-
-
-pagebox
-Specifies which bounding box to use for PDF files from among
-mediabox
, cropbox
, bleedbox
, trimbox
, or
-artbox
. PDF files do not have the BoundingBox that PostScript
-files have, but may specify up to four predefined rectangles. The
-MediaBox gives the boundaries of the physical medium. The CropBox is the
-region to which the contents of the page are to be clipped when
-displayed. The BleedBox is the region to which the contents of the page
-should be clipped in production. The TrimBox is the intended dimensions
-of the finished page. The ArtBox is the extent of the page’s meaningful
-content. The driver will set the image size based on CropBox if
-present, otherwise it will not use one of the others, with a
-driver-defined order of preference. MediaBox is always present.
-
-
-interpolate
-Enable or disable interpolation of raster images by the viewer. Can be
-set with interpolate=true
or just specified as here.
+
Give the name name to the color. For example, after this
-\includegraphics[...,interpolate,...]{...}
+\definecolor{silver}{rgb}{0.75,0.75,0.74}
-
-quiet
-Do not write information to the log. You can set it with
-quiet=true
or just specified it with
-\includegraphics[...,quiet,...]{...}
,
+
you can use that color name with Hi ho,
+\textcolor{silver}{Silver}!
.
-
-draft
-If you set it with draft=true
or just specify it with
+
This example gives the color a more abstract name, so it could change and
+not be misleading.
-\includegraphics[...,draft,...]{...}
+\definecolor{logocolor}{RGB}{145,92,131} % RGB needs pdflatex
+\newcommand{\logo}{\textcolor{logocolor}{Bob's Big Bagels}}
-then the graphic will not appear in the document, possibly saving color
-printer ink. Instead, LaTeX will put an empty box of the correct
-size with the filename printed in it.
+
Often a document’s colors are defined in the preamble, or in the class
+or style, rather than in the document body.
-
-
-These options address the bounding box for Encapsulated PostScript
-graphic files, which have a size specified with a line
-%%BoundingBox
that appears in the file. It has four values,
-giving the lower x coordinate, lower y coordinate, upper
-x coordinate, and upper y coordinate. The units are
-PostScript points, equivalent to TeX’s big points, 1/72 inch.
-For example, if an .eps file has the line %%BoundingBox 10
-20 40 80
then its natural size is 30/72 inch wide by
-60/72 inch tall.
-
-
-
-bb
-Specify the bounding box of the displayed region. The argument is four
-dimensions separated by spaces, as with \includegraphics[.., bb=
-0in 0in 1in 0.618in]{...}
. Usually \includegraphics
reads the
-BoundingBox numbers from the EPS file automatically, so this option is
-only useful if the bounding box is missing from that file or if you want
-to change it.
-
-
-bbllx, bblly, bburx, bbury
-Set the bounding box. These four are obsolete, but are retained for
-compatibility with old packages.
-
-
-natwidth, natheight
-An alternative for bb
. Setting
+
+
+
+
+22.3.2 Colored text ¶
+
+
+
+
+Synopses:
-\includegraphics[...,natwidth=1in,natheight=0.618in,...]{...}
+\textcolor{name}{...}
+\textcolor[color model]{color specification}{...}
-is the same as setting bb=0 0 1in 0.618in
.
-
-
-hiresbb
-If set to true
, or just specified as with
+
or
-\includegraphics[...,hiresbb,...]{...}
+\color{name}
+\color[color model]{color specification}
-then LaTeX will look for %%HiResBoundingBox
lines instead of
-%%BoundingBox
lines. (The BoundingBox
lines use only
-natural numbers while the HiResBoundingBox
lines use decimals;
-both use units equivalent to TeX’s big points, 1/72 inch.) To
-override a prior setting of true
, you can set it to false
.
+
The affected text gets the color. This line
-
-
+
+\textcolor{magenta}{My name is Ozymandias, King of Kings;}
+Look on my works, ye Mighty, and despair!
+
-These following options allow a user to override LaTeX’s method of
-choosing the graphic type based on the filename extension. An example
-is that \includegraphics[type=png,ext=.xxx,read=.xxx]{lion}
-will read the file lion.xxx as though it were
-lion.png. For more on these, see \DeclareGraphicsRule
.
-
-
-
-type
-Specify the graphics type.
-
-
-ext
-Specify the graphics extension.
-Only use this in conjunction with the option type
.
-
-
-read
-Specify the file extension of the read file.
-Only use this in conjunction with the option type
.
-
-
-command
-Specify a command to be applied to this file. Only use this in
-conjunction with the option type
. See Command line options,
-for a discussion of enabling the \write18
functionality to run
-external commands.
+
causes the first half to be in magenta while the rest is in black. You
+can use a color declared with \definecolor
in exactly the same
+way that we just used the builtin color ‘magenta’.
-
-
-
-
-
-
-
+
-22.3.2 \rotatebox
+
+\definecolor{MidlifeCrisisRed}{rgb}{1.0,0.11,0.0}
+I'm thinking about getting a \textcolor{MidlifeCrisisRed}{sports car}.
+
-
-
-
-
+The two \textcolor
and \color
differ in that the first is
+a command form, enclosing the text to be colored as an argument. Often
+this form is more convenient, or at least more explicit. The second
+form is a declaration, as in The moon is made of {\color{green}
+green} cheese
, so it is in effect until the end of the current group
+or environment. This is sometimes useful when writing macros or as
+below where it colors everything inside the center
environment,
+including the vertical and horizontal lines.
+
+
+\begin{center} \color{blue}
+ \begin{tabular}{l|r}
+ UL &UR \\ \hline
+ LL &LR
+ \end{tabular}
+\end{center}
+
-Synopsis if you use the graphics
package:
+
You can use color in equations. A document might have this definition
+in the preamble
-\rotatebox{angle}{material}
+\definecolor{highlightcolor}{RGB}{225,15,0}
-Synopses if you use the graphicx
package:
+
and then contain this equation.
-\rotatebox{angle}{material}
-\rotatebox[key-value list]{angle}{material}
+\begin{equation}
+ \int_a^b \textcolor{highlightcolor}{f'(x)}\,dx=f(b)-f(a)
+\end{equation}
-Put material in a box and rotate it angle degrees
-counterclockwise.
-
-This example rotates the table column heads forty-five degrees.
+
Typically the colors used in a document are declared in a class or style
+but sometimes you want a one-off. Those are the second forms in the
+synopses.
-\begin{tabular}{ll}
- \rotatebox{45}{Character} &\rotatebox{45}{NATO phonetic} \\
- A &AL-FAH \\
- B &BRAH-VOH
-\end{tabular}
+Colors of \textcolor[rgb]{0.33,0.14,0.47}{Purple} and
+{\color[rgb]{0.72,0.60,0.37}Gold} for the team.
-The material can be anything that goes in a box, including a graphic.
+
The format of color specification depends on the color model
+(see Color models). For instance, while rgb
takes three
+numbers, gray
takes only one.
- \rotatebox[origin=c]{45}{\includegraphics[width=1in]{lion}}
+The selection was \textcolor[gray]{0.5}{grayed out}.
-To place the rotated material, the first step is that LaTeX sets
-material in a box, with a reference point on the left baseline.
-The second step is the rotation, by default about the reference point.
-The third step is that LaTeX computes a box to bound the rotated
-material. Fourth, LaTeX moves this box horizontally so that the left
-edge of this new bounding box coincides with the left edge of the box
-from the first step (they need not coincide vertically). This new
-bounding box, in its new position, is what LaTeX uses as the box when
-typesetting this material.
-
-If you use the graphics
package then the rotation is about the
-reference point of the box. If you use the graphicx
package
-then these are the options that can go in the key-value list,
-but note that you can get the same effect without needing this
-package, except for the x
and y
options
-(see \includegraphics
).
-
-
-origin
-The point of the material’s box about which the rotation happens.
-Possible value is any string containing one or two of: l
for
-left, r
for right, b
for bottom, c
for center,
-t
for top, and B
for baseline. Thus, the first line here
+
Colors inside colors do not combine. Thus
-\rotatebox[origin=c]{180}{moon}
-\rotatebox[origin=lB]{180}{LeBateau}
+\textcolor{green}{kind of \textcolor{blue}{blue}}
-will turn the picture upside down from the center while the second will
-turn its picture upside down about its left baseline. (The character
-c
gives the horizontal center in bc
or tc
but gives
-the vertical center in lc
or rc
, and gives both in
-c
.) The default is lB
.
-
-
-x, y
-Specify an arbitrary point of rotation with
-\rotatebox[x=TeX dimension,y=TeX
-dimension]{...}
(see Units of length). These give the offset
-from the box’s reference point.
-
-
-units
-This key allows you to change the default of degrees counterclockwise.
-Setting units=-360
changes the direction to degrees clockwise and
-setting units=6.283185
changes to radians counterclockwise.
+
has a final word that is blue, not a combination of blue and green.
-
-
-
-
+
22.3.3 \scalebox
+22.3.3 Colored boxes ¶
-
-
-
-
-
-
-
-
+
+
+
Synopses:
-\scalebox{horizontal factor}{material}
-\scalebox{horizontal factor}[vertical factor]{material}
-\reflectbox{material}
+\colorbox{name}{...}
+\colorbox[model name]{box background color}{...}
-Scale the material.
-
-This example halves the size, both horizontally and vertically, of the
-first text and doubles the size of the second.
+
or
-\scalebox{0.5}{DRINK ME} and \scalebox{2.0}{Eat Me}
+\fcolorbox{frame color}{box background color}{...}
+\fcolorbox[model name]{frame color}{box background color}{...}
-If you do not specify the optional vertical factor then it
-defaults to the same value as the horizontal factor.
+
Make a box with the stated background color. The \fcolorbox
+command puts a frame around the box. For instance this
-You can use this command to resize a graphic, as here.
+
+Name:~\colorbox{cyan}{\makebox[5cm][l]{\strut}}
+
+
+makes a cyan-colored box that is five centimeters long and gets its
+depth and height from the \strut
(so the depth is
+-.3\baselineskip
and the height is \baselineskip
). This
+puts white text on a blue background.
-\scalebox{0.5}{\includegraphics{lion}}
+\colorbox{blue}{\textcolor{white}{Welcome to the machine.}}
-If you use the graphicx
package then you can accomplish the same
-thing with optional arguments to \includegraphics
-(see \includegraphics
).
+
The \fcolorbox
commands use the same parameters as \fbox
+(see \fbox
& \framebox
), \fboxrule
and \fboxsep
, to
+set the thickness of the rule and the boundary between the box interior
+and the surrounding rule. LaTeX’s defaults are 0.4pt
and
+3pt
, respectively.
-The \reflectbox
command abbreviates
-\scalebox{-1}[1]{material}
. Thus, Able was
-I\reflectbox{Able was I}
will show the phrase ‘Able was I’
-immediately followed by its mirror reflection against a vertical axis.
+
This example changes the thickness of the border to 0.8 points. Note
+that it is surrounded by curly braces so that the change ends at the end
+of the second line.
+
+{\setlength{\fboxrule}{0.8pt}
+\fcolorbox{black}{red}{Under no circumstances turn this knob.}}
+
+
-
-
+
22.3.4 \resizebox
+22.3.4 Colored pages ¶
-
-
-
-
-
-
-
+
+
+
+
Synopses:
-\resizebox{horizontal length}{vertical length}{material}
-\resizebox*{horizontal length}{vertical length}{material}
+\pagecolor{name}
+\pagecolor[color model]{color specification}
+\nopagecolor
-Given a size, such as 3cm
, transform material to make it
-that size. If either horizontal length or vertical length
-is an exclamation point !
then the other argument is used
-to determine a scale factor for both directions.
-
-This example makes the graphic be a half inch wide and scales it
-vertically by the same factor to keep it from being distorted.
+
The first two set the background of the page, and all subsequent pages,
+to the color. For an explanation of the specification in the second
+form see Colored text. The third returns the background to normal,
+which is a transparent background. (If that is not supported use
+\pagecolor{white}
, although that will make a white background
+rather than the default transparent background.)
-\resizebox{0.5in}{!}{\includegraphics{lion}}
+ ...
+\pagecolor{cyan}
+ ...
+\nopagecolor
-The unstarred form \resizebox
takes vertical length to be
-the box’s height while the starred form \resizebox*
takes it to
-be height+depth. For instance, make the text have a height+depth of a
-quarter-inch with \resizebox*{!}{0.25in}{\parbox{3.5in}{This
-box has both height and depth.}}
.
-
-You can use \depth
, \height
, \totalheight
, and
-\width
to refer to the original size of the box. Thus, make the
-text two inches wide but keep the original height with
-\resizebox{2in}{\height}{Two inches}
.
-
@@ -20090,9 +20956,9 @@
-22.3.4 \resiz
23 Special insertions
+23 Special insertions ¶
@@ -20103,7 +20969,7 @@ 23 Special insertions
-- Reserved characters
+- Printing special characters
- Upper and lower case
- Symbols by font position
- Text symbols
@@ -20114,26 +20980,28 @@ 23 Special insertions
\today
-
+
23.1 Reserved characters
+23.1 Printing special characters ¶
-
-
-
-
-LaTeX sets aside the following characters for special purposes. For
-example, the percent sign %
is for comments. They are
-called reserved characters or special characters. They are
-all discussed elsewhere in this manual.
+
+
+
+
+
+
LaTeX sets aside a few characters for special purposes; they are
+called reserved characters or special characters. Here they are:
# $ % & { } _ ~ ^ \
+The meaning of all the special characters is given elsewhere
+in this manual (see Reserved characters).
+
@@ -20143,8 +21011,8 @@ 23.1 Reserved characters
If you want a reserved character to be printed as itself, in the text
body font, for all but the final three characters in that list simply
-put a backslash \
in front of the character. Thus,
-typing \$1.23
will produce $1.23
in your output.
+put a \
in front of the character. Thus, typing \$1.23
+will produce $1.23
in your output.
@@ -20155,13 +21023,13 @@ 23.1 Reserved characters
font circumflex use \^{}
. To get a backslash in the font of
the text body, enter \textbackslash{}
.
-To produce the reserved characters in a typewriter font use
-\verb!!
as below (the double backslash \\
in the
-example is only there to split the lines in the output).
+
To produce the reserved characters in a typewriter font, use
+\verb!!
as below (the \newline
in the example is there
+only to split the lines in the output).
\begin{center}
- \# \$ \% \& \{ \} \_ \~{} \^{} \textbackslash \\
+ \# \$ \% \& \{ \} \_ \~{} \^{} \textbackslash \newline
\verb!# $ % & { } _ ~ ^ \!
\end{center}
@@ -20172,9 +21040,9 @@ 23.1 Reserved characters
23.2 Upper and lower case
+23.2 Upper and lower case ¶
@@ -20256,7 +21124,7 @@ 23.2 Upper and lower case
Next: Text symbols, Previous: Upper and lower case, Up: Special insertions [Contents][Index]
-
-23.3 Symbols by font position
+23.3 Symbols by font position ¶
@@ -20281,7 +21149,7 @@ 23.3 Symbols by font positio
Next: Accents, Previous: Symbols by font position, Up: Special insertions [Contents][Index]
-
-23.4 Text symbols
+23.4 Text symbols ¶
@@ -20298,38 +21166,40 @@ 23.4 Text symbols
TS1
font encoding).
-\copyright
¶
-\textcopyright
¶
+\copyright
¶
+\textcopyright
¶
-
© The copyright symbol.
-\dag
¶
+\dag
¶
-
† The dagger symbol (in text).
-\ddag
¶
+\ddag
¶
-
‡ The double dagger symbol (in text).
-\LaTeX
¶
+\LaTeX
¶
-
The LaTeX logo.
-\LaTeXe
¶
+\LaTeXe
¶
-
The LaTeX2e logo.
-\guillemotleft («)
¶
-\guillemotright (»)
¶
-\guilsinglleft (‹)
¶
-\guilsinglright (›)
¶
+\guillemetleft («)
¶
+\guillemetright (»)
¶
+\guillemotleft («)
¶
+\guillemotright (»)
¶
+\guilsinglleft (‹)
¶
+\guilsinglright (›)
¶
-
@@ -20338,41 +21208,45 @@
23.4 Text symbols
+
«, », ‹, ›
Double and single angle quotation marks, commonly used in French.
+The commands @guillemotleft
and @guillemotright
are
+synonyms for @guillemet...
; these are misspellings inherited
+from Adobe. (Guillemots are seabirds; guillemets are French quotes.)
-\ldots
¶
-\textellipsis
¶
-\dots
¶
+\ldots
¶
+\textellipsis
¶
+\dots
¶
-
… An ellipsis (three dots at the baseline): \ldots
and
\dots
also work in math mode (see Dots, horizontal or vertical). See that math
mode ellipsis description for additional general information.
-\lq
¶
+\lq
¶
-
‘ Left (opening) quote.
-\P
¶
-\textparagraph
¶
+\P
¶
+\textparagraph
¶
-
¶ Paragraph sign (pilcrow).
-\pounds
¶
-\textsterling
¶
+\pounds
¶
+\textsterling
¶
-
£ English pounds sterling.
-\quotedblbase („)
¶
-\quotesinglbase (‚)
¶
+\quotedblbase („)
¶
+\quotesinglbase (‚)
¶
-
@@ -20380,43 +21254,43 @@
23.4 Text symbols
Double and single quotation marks on the baseline.
-\rq
¶
+\rq
¶
-
’ Right (closing) quote.
-\S
¶
-\textsection
¶
+\S
¶
+\textsection
¶
-
§ Section sign.
-\TeX
¶
+\TeX
¶
-
The TeX logo.
-\textasciicircum
¶
+\textasciicircum
¶
-
^ ASCII circumflex.
-\textasciitilde
¶
+\textasciitilde
¶
-
~ ASCII tilde.
-\textasteriskcentered
¶
+\textasteriskcentered
¶
-
* Centered asterisk.
-\textbackslash
¶
+\textbackslash
¶
-
\ Backslash. However, \texttt{\textbackslash}
produces a roman
(not typewriter) backslash by default; for a typewriter backslash, it
@@ -20428,52 +21302,52 @@
23.4 Text symbols
-\textbar
¶
+\textbar
¶
-
| Vertical bar.
-\textbardbl
¶
+\textbardbl
¶
-
⏸ Double vertical bar.
-\textbigcircle
¶
+\textbigcircle
¶
-
◯, Big circle symbol.
-\textbraceleft
¶
+\textbraceleft
¶
-
{ Left brace. See remarks at \textbackslash
above about
making \texttt{\textbraceleft}
produce a typewriter brace.
-\textbraceright
¶
+\textbraceright
¶
-
} Right brace. See remarks at \textbackslash
above about
making \texttt{\textbraceright}
produce a typewriter brace.
-\textbullet
¶
+\textbullet
¶
-
• Bullet.
-\textcircled{letter}
¶
+\textcircled{letter}
¶
-
Ⓐ, Circle around letter.
-\textcompwordmark
¶
-\textcapitalcompwordmark
¶
-\textascendercompwordmark
¶
+\textcompwordmark
¶
+\textcapitalcompwordmark
¶
+\textascendercompwordmark
¶
-
@@ -20484,24 +21358,24 @@
23.4 Text symbols
while the \textascendercompwordmark
form has the ascender height.
-\textdagger
¶
+\textdagger
¶
-
† Dagger.
-\textdaggerdbl
¶
+\textdaggerdbl
¶
-
‡ Double dagger.
-\textdollar (or \$
)
¶
+\textdollar (or \$
)
¶
-
$ Dollar sign.
-\textemdash (or ---
)
¶
+\textemdash (or ---
)
¶
-
— Em-dash. Used for punctuation, usually similar to commas or
parentheses, as in ‘The playoffs---if you're lucky
@@ -20509,12 +21383,12 @@ 23.4 Text symbols
for spacing around em-dashes vary widely.
-\textendash (or --
)
¶
+\textendash (or --
)
¶
-
– En-dash. Used for ranges, as in ‘see pages 12--14
’.
-\texteuro
¶
+\texteuro
¶
-
@@ -20529,12 +21403,12 @@
23.4 Text symbols
Euro symbol (Unicode U+20AC).
-\textexclamdown (or !`
)
¶
+\textexclamdown (or !`
)
¶
-
¡ Upside down exclamation point.
-\textfiguredash
¶
+\textfiguredash
¶
-
Dash used between numerals, Unicode U+2012. Defined in the June 2021
release of LaTeX. When used in pdfTeX, approximated by an
@@ -20543,30 +21417,30 @@
23.4 Text symbols
to the log file.
-\textgreater
¶
+\textgreater
¶
-
> Greater than symbol.
-\texthorizontalbar
¶
+\texthorizontalbar
¶
-
Horizontal bar character, Unicode U+2015. Defined in the June 2021
release of LaTeX. Behavior as with \textfiguredash
above;
the pdfTeX approximation is an em-dash.
-\textless
¶
+\textless
¶
-
< Less than symbol.
-\textleftarrow
¶
+\textleftarrow
¶
-
←, Left arrow.
-\textnonbreakinghyphen
¶
+\textnonbreakinghyphen
¶
-
Non-breaking hyphen character, Unicode U+2011. Defined in the June
@@ -20575,8 +21449,8 @@
23.4 Text symbols
breaks disallowed after).
-\textordfeminine
¶
-\textordmasculine
¶
+\textordfeminine
¶
+\textordmasculine
¶
-
@@ -20584,50 +21458,50 @@
23.4 Text symbols
ª, º Feminine and masculine ordinal symbols.
-\textperiodcentered
¶
+\textperiodcentered
¶
-
· Centered period.
-\textquestiondown (or ?`
)
¶
+\textquestiondown (or ?`
)
¶
-
¿ Upside down question mark.
-\textquotedblleft (or ``
)
¶
+\textquotedblleft (or ``
)
¶
-
“ Double left quote.
-\textquotedblright (or ''
)
¶
+\textquotedblright (or ''
)
¶
-
” Double right quote.
-\textquoteleft (or `
)
¶
+\textquoteleft (or `
)
¶
-
‘ Single left quote.
-\textquoteright (or '
)
¶
+\textquoteright (or '
)
¶
-
’ Single right quote.
-\textquotesingle
¶
+\textquotesingle
¶
-
', Straight single quote. (From TS1 encoding.)
-\textquotestraightbase
¶
-\textquotestraightdblbase
¶
+\textquotestraightbase
¶
+\textquotestraightdblbase
¶
-
@@ -20635,40 +21509,40 @@
23.4 Text symbols
Single and double straight quotes on the baseline.
-\textregistered
¶
+\textregistered
¶
-
® Registered symbol.
-\textrightarrow
¶
+\textrightarrow
¶
-
→, Right arrow.
-\textthreequartersemdash
¶
+\textthreequartersemdash
¶
-
﹘, “Three-quarters” em-dash, between en-dash and em-dash.
-\texttrademark
¶
+\texttrademark
¶
-
™ Trademark symbol.
-\texttwelveudash
¶
+\texttwelveudash
¶
-
﹘, “Two-thirds” em-dash, between en-dash and em-dash.
-\textunderscore
¶
+\textunderscore
¶
-
_ Underscore.
-\textvisiblespace
¶
+\textvisiblespace
¶
-
␣, Visible space symbol.
@@ -20683,7 +21557,7 @@ 23.4 Text symbols
Next: Additional Latin letters, Previous: Text symbols, Up: Special insertions [Contents][Index]
-
-23.5 Accents
+23.5 Accents ¶
@@ -20720,61 +21594,61 @@ 23.5 Accents
accented.
-\"
¶
-\capitaldieresis
--
+
-
-
ö Umlaut (dieresis).
+\"
¶
+\capitaldieresis
+ö Umlaut (dieresis).
-\'
¶
-\capitalacute
--
+
-
-
ó Acute accent.
+\'
¶
+\capitalacute
+ó Acute accent.
-\.
¶
--
+
-
-
ȯ Dot accent.
+\.
¶
+ȯ Dot accent.
-\=
¶
-\capitalmacron
--
+
-
-
ō Macron (overbar) accent.
+\=
¶
+\capitalmacron
+ō Macron (overbar) accent.
-\^
¶
-\capitalcircumflex
--
+
-
-
ô Circumflex (hat) accent.
+\^
¶
+\capitalcircumflex
+ô Circumflex (hat) accent.
-\`
¶
-\capitalgrave
--
+
-
-
ò Grave accent.
+\`
¶
+\capitalgrave
+ò Grave accent.
-\~
¶
-\capitaltilde
--
+
-
-
ñ Tilde accent.
+\~
¶
+\capitaltilde
+ñ Tilde accent.
-\b
¶
--
-
o̲ Bar accent underneath.
+
-
+
\b
¶
+o̲ Bar accent underneath.
@@ -20785,68 +21659,68 @@ 23.5 Accents
Over- and Underlining.
-\c
¶
-\capitalcedilla
--
+
-
-
ç Cedilla accent underneath.
+\c
¶
+\capitalcedilla
+ç Cedilla accent underneath.
-\d
¶
-\capitaldotaccent
--
+
-
-
ọ Dot accent underneath.
+\d
¶
+\capitaldotaccent
+ọ Dot accent underneath.
-\H
¶
-\capitalhungarumlaut
--
+
-
-
ő Long Hungarian umlaut accent.
+\H
¶
+\capitalhungarumlaut
+ő Long Hungarian umlaut accent.
-\k
¶
-\capitalogonek
--
+
-
-
ǫ Ogonek. Not available in the OT1 encoding.
+\k
¶
+\capitalogonek
+ǫ Ogonek. Not available in the OT1 encoding.
-\r
¶
-\capitalring
--
+
-
-
o̊ Ring accent.
+\r
¶
+\capitalring
+o̊ Ring accent.
-\t
¶
-\capitaltie
-\newtie
-\capitalnewtie
--
+
-
-
Tie-after accent (used for transliterating from Cyrillic, such as in the
+\t
¶
+\capitaltie
+\newtie
+\capitalnewtie
+Tie-after accent (used for transliterating from Cyrillic, such as in the
ALA-LC romanization). It expects that the argument has two characters.
The \newtie
form is centered in its box.
-\u
¶
-\capitalbreve
--
+
-
-
ŏ Breve accent.
+\u
¶
+\capitalbreve
+ŏ Breve accent.
-\v
¶
-\capitalcaron
--
+
-
-
ǒ Háček (check, caron) accent.
+\v
¶
+\capitalcaron
+ǒ Háček (check, caron) accent.
@@ -20862,7 +21736,7 @@ 23.5 Accents
-23.5.1 \accent
+23.5.1 \accent
¶
Synopsis:
@@ -20920,12 +21794,12 @@
23.5.1 \accent
Next: inputenc
package, Previous: Accents, Up: Special insertions [Contents][Index]
-23.6 Additional Latin letters
+23.6 Additional Latin letters ¶
-
+
@@ -20934,86 +21808,86 @@ 23.6 Additional Latin letter
than English.
-\aa
¶
-\AA
--
+
-
-
å and Å.
+\aa
¶
+\AA
+å and Å.
-\ae
¶
-\AE
--
+
-
-
æ and Æ.
+\ae
¶
+\AE
+æ and Æ.
-\dh
¶
-\DH
--
+
-
-
Icelandic letter eth: ð and Ð. Not available with OT1
+\dh
¶
+\DH
+Icelandic letter eth: ð and Ð. Not available with OT1
encoding, you need the fontenc package to select an alternate
font encoding, such as T1.
-\dj
¶
+-
+
\dj
¶
\DJ
--
-
Crossed d and D, a.k.a. capital and small letter d with stroke. Not
+
Crossed d and D, a.k.a. capital and small letter d with stroke. Not
available with OT1 encoding, you need the fontenc package to
select an alternate font encoding, such as T1.
- \ij
¶
-\IJ
--
+
-
-
ij and IJ (except somewhat closer together than appears here).
+\ij
¶
+\IJ
+ij and IJ (except somewhat closer together than appears here).
-\l
¶
-\L
--
+
-
-
ł and Ł.
+\l
¶
+\L
+ł and Ł.
-\ng
¶
+-
+
\ng
¶
\NG
--
-
Lappish letter eng, also used in phonetics.
+
Lappish letter eng, also used in phonetics.
- \o
¶
-\O
--
+
-
-
ø and Ø.
+\o
¶
+\O
+ø and Ø.
-\oe
¶
-\OE
--
+
-
-
œ and Œ.
+\oe
¶
+\OE
+œ and Œ.
-\ss
¶
-\SS
--
+
-
-
ß and SS.
+\ss
¶
+\SS
+ß and SS.
-\th
¶
-\TH
--
+
-
-
Icelandic letter thorn: þ and Þ. Not available with OT1
+\th
¶
+\TH
+Icelandic letter thorn: þ and Þ. Not available with OT1
encoding, you need the fontenc package to select an alternate
font encoding, such as T1.
@@ -21028,7 +21902,7 @@ 23.6 Additional Latin letter
Next: \rule
, Previous: Additional Latin letters, Up: Special insertions [Contents][Index]
-
+23.7 inputenc
package
+23.7 inputenc
package ¶
@@ -21038,60 +21912,59 @@ 23.7 inputenc\usepackage[encoding-name]{inputenc}
-
+Declare the input file’s text encoding to be encoding-name. The
-default, if this package is not loaded, is UTF-8. Technically,
-specifying the encoding name is optional, but in practice it is not
-useful to omit it.
-
-
-
-
-In a computer file, the characters are stored according to a scheme
-called the encoding. There are many different encodings. The
-simplest is ASCII, which supports 95 printable characters, not enough
-for most of the world’s languages. For instance, to typeset the
-a-umlaut character ‘ä’ in an ASCII-encoded LaTeX source file, the
-sequence \"a
is used. This would make source files for anything
-but English hard to read; even for English, often a more extensive
-encoding is more convenient.
+
Declare the input file’s text encoding to be encoding-name. (For
+basic background, see Input encodings). The default, if this
+package is not loaded, is UTF-8. Technically, specifying the encoding
+name is optional, but in practice it is not useful to omit it.
-The modern encoding standard, in some ways a union of the others, is
-UTF-8, one of the representations of Unicode. This is the default for
-LaTeX since 2018.
-
-The inputenc
package is how LaTeX knows what encoding is
-used. For instance, the following command explicitly says that the
-input file is UTF-8 (note the lack of a dash).
+
The inputenc
package tells LaTeX what encoding is used. For
+instance, the following command explicitly says that the input file is
+UTF-8 (note the lack of a dash).
\usepackage[utf8]{inputenc}
+The most common values for encoding-name are: ascii
,
+latin1
, latin2
, latin3
, latin4
,
+latin5
, latin9
, latin10
, utf8
.
+
Caution: use inputenc
only with the pdfTeX engine
-(see TeX engines). (The XeTeX and LuaTeX engines assume
-that the input file is UTF-8 encoded.) If you invoke LaTeX with
-either the xelatex
command or the lualatex
-command, and try to declare a non-UTF-8 encoding with inputenc
,
-such as latin1
, then you will get the error inputenc is
-not designed for xetex or luatex
.
+(see TeX engines); with xelatex
or
+lualatex
, declaring a non-UTF-8 encoding with
+inputenc
, such as latin1
, will get the error
+inputenc is not designed for xetex or luatex
.
An inputenc
package error such as Invalid UTF-8 byte "96
means that some of the material in the input file does not follow the
encoding scheme. Often these errors come from copying material from a
-document that uses a different encoding than the input file; this one
-is a left single quote from a web page using latin1
inside a
-LaTeX input file that uses UTF-8. The simplest solution is to
-replace the non-UTF-8 character with its UTF-8 equivalent, or use a
-LaTeX equivalent command or character.
+document that uses a different encoding than the input file. The
+simplest solution is often to replace the non-UTF-8 character with a
+UTF-8 or LaTeX equivalent.
+
+
+
+
+
+
+If you need to process a non-UTF-8 document with LuaTeX, you can
+use the luainputenc
package
+(https://ctan.org/pkg/luainputenc). With XeTeX, the
+\XeTeXinputencoding
and \XeTeXdefaultencoding
primitives
+can be used (for an explanation and examples, see
+https://tex.stackexchange.com/questions/324948).
+
+
+
+It’s also possible to re-encode a document from an 8-bit encoding to
+UTF-8 outside of TeX, using system utilities. For example,
+‘recode latin1..utf8’ or ‘iconv -f latin1 -t utf8’.
-In some documents, such as a collection of journal articles from a
+
In a few documents, such as a collection of journal articles from a
variety of authors, changing the encoding in mid-document may be
-necessary. Use the command
-\inputencoding{encoding-name}
. The most common values
-for encoding-name are: ascii
, latin1
,
-latin2
, latin3
, latin4
, latin5
,
-latin9
, latin10
, and utf8
.
+necessary. You can use the command
+\inputencoding{encoding-name}
for this.
@@ -21101,7 +21974,7 @@ 23.7 inputenc
Next: \today
, Previous: inputenc
package, Up: Special insertions [Contents][Index]
-
-23.8 \rule
+23.8 \rule
¶
@@ -21156,7 +22029,7 @@ 23.8 \rule
Previous: \rule
, Up: Special insertions [Contents][Index]
-23.9 \today
+23.9 \today
¶
@@ -21212,7 +22085,7 @@ 23.9 \today
Next: Front/back matter, Previous: Special insertions, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-
-24 Splitting the input
+24 Splitting the input ¶
@@ -21276,7 +22149,7 @@ 24 Splitting the input
Next: \include
& \includeonly
, Up: Splitting the input [Contents][Index]
-24.1 \endinput
+24.1 \endinput
¶
@@ -21323,7 +22196,7 @@ 24.1 \endinput
Next: \input
, Previous: \endinput
, Up: Splitting the input [Contents][Index]
-24.2 \include
& \includeonly
+24.2 \include
& \includeonly
¶
@@ -21471,7 +22344,7 @@ 24.2
Previous: \include
& \includeonly
, Up: Splitting the input [Contents][Index]
-
-24.3 \input
+24.3 \input
¶
@@ -21527,7 +22400,7 @@ 24.3 \input
Next: Letters, Previous: Splitting the input, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-25 Front/back matter
+25 Front/back matter ¶
@@ -21541,7 +22414,7 @@ 25 Front/back matter
Next: Indexes, Up: Front/back matter [Contents][Index]
-25.1 Table of contents, list of figures, list of tables
+25.1 Table of contents, list of figures, list of tables ¶
@@ -21715,7 +22588,7 @@ \addcontentsline
, Up: Table of contents, list of figures, list of tables [Contents][Index]
-25.1.1 \@dottedtocline
+25.1.1 \@dottedtocline
¶
@@ -21765,7 +22638,7 @@ 25.1.1 \addtocontents
, Previous: \@dottedtocline
, Up: Table of contents, list of figures, list of tables [Contents][Index]
-25.1.2 \addcontentsline
+25.1.2 \addcontentsline
¶
@@ -21877,7 +22750,7 @@ 25.1.2
Next: \contentsline
, Previous: \addcontentsline
, Up: Table of contents, list of figures, list of tables [Contents][Index]
-25.1.3 \addtocontents
+25.1.3 \addtocontents
¶
@@ -21958,7 +22831,7 @@ 25.1.3 \a
Next: \nofiles
, Previous: \addtocontents
, Up: Table of contents, list of figures, list of tables [Contents][Index]
-25.1.4 \contentsline
+25.1.4 \contentsline
¶
@@ -22031,7 +22904,7 @@ 25.1.4 \co
Next: \numberline
, Previous: \contentsline
, Up: Table of contents, list of figures, list of tables [Contents][Index]
-25.1.5 \nofiles
+25.1.5 \nofiles
¶
@@ -22070,7 +22943,7 @@ 25.1.5 \nofiles
Previous: \nofiles
, Up: Table of contents, list of figures, list of tables [Contents][Index]
-25.1.6 \numberline
+25.1.6 \numberline
¶
@@ -22120,7 +22993,7 @@ 25.1.6 \numb
Next: Glossaries, Previous: Table of contents, list of figures, list of tables, Up: Front/back matter [Contents][Index]
-25.2 Indexes
+25.2 Indexes ¶
@@ -22205,7 +23078,7 @@ 25.2 Indexes
Next: \index
, Up: Indexes [Contents][Index]
-25.2.1 Produce the index manually
+25.2.1 Produce the index manually ¶
@@ -22253,7 +23126,7 @@ 25.2.1 Produce the inde
Next: makeindex
, Previous: Produce the index manually, Up: Indexes [Contents][Index]
-25.2.2 \index
+25.2.2 \index
¶
@@ -22417,7 +23290,7 @@ 25.2.2 \index
Next: \printindex
, Previous: \index
, Up: Indexes [Contents][Index]
-25.2.3 makeindex
+25.2.3 makeindex
¶
@@ -22479,16 +23352,16 @@ 25.2.3 makeindex
-preamble
¶
+preamble
¶
Preamble of the output index file. Defines the context in which the index is
formatted. Default: "\\begin{theindex}\n"
.
-postamble
¶
+postamble
¶
Postamble of the output index file. Default: "\n\n\\end{theindex}\n"
.
-group_skip
¶
+group_skip
¶
-
Traditionally index items are broken into groups, typically a group for
entries starting with letter ‘a’, etc. This specifier gives what
@@ -22497,7 +23370,7 @@
25.2.3 makeindex
length, by default 10pt plus5pt minus3pt
).
-lethead_flag
¶
+lethead_flag
¶
An integer. It governs what is inserted for a new group or letter. If
it is 0 (which is the default) then other than group_skip
nothing
will be inserted before the group. If it is positive then at a new
@@ -22507,93 +23380,93 @@
25.2.3 makeindex
is 0.
-lethead_prefix
¶
+lethead_prefix
¶
If a new group begins with a different letter then this is the prefix
inserted before the new letter header. Default: ""
-lethead_suffix
¶
+lethead_suffix
¶
If a group begins with a different letter then this is the suffix
inserted after the new letter header. Default: ""
.
-item_0
¶
+item_0
¶
What is put between two level 0 items. Default: "\n \\item
"
.
-item_1
¶
+item_1
¶
Put between two level 1 items. Default: "\n \\subitem "
.
-item_2
¶
+item_2
¶
put between two level 2 items. Default: "\n \\subsubitem "
.
-item_01
¶
+item_01
¶
What is put between a level 0 item and a level 1 item.
Default: "\n \\subitem "
.
-item_x1
¶
+item_x1
¶
What is put between a level 0 item and a level 1 item in the
case that the level 0 item doesn’t have any page numbers (as in
\index{aaa|see{bbb}}
). Default: "\n \\subitem "
.
-item_12
¶
+item_12
¶
What is put between a level 1 item and a level 2 item.
Default: "\n \\subsubitem "
.
-item_x2
¶
+item_x2
¶
What is put between a level 1 item and a level 2 item, if the
level 1 item doesn’t have page numbers. Default: "\n
\\subsubitem "
.
-delim_0
¶
+delim_0
¶
Delimiter put between a level 0 key and its first page
number. Default: a comma followed by a blank, ", "
.
-delim_1
¶
+delim_1
¶
Delimiter put between a level 1 key and its first page
number. Default: a comma followed by a blank, ", "
.
-delim_2
¶
+delim_2
¶
Delimiter between a level 2 key and its first page number. Default:
a comma followed by a blank, ", "
.
-delim_n
¶
+delim_n
¶
Delimiter between two page numbers for the same key (at any
level). Default: a comma followed by a blank, ", "
.
-delim_r
¶
+delim_r
¶
What is put between the starting and ending page numbers of a range.
Default: "--"
.
-line_max
¶
+line_max
¶
An integer. Maximum length of an index entry’s line in the output,
beyond which the line wraps. Default: 72
.
-indent_space
¶
+indent_space
¶
What is inserted at the start of a wrapped line. Default:
"\t\t"
.
-indent_length
¶
+indent_length
¶
A number. The length of the wrapped line indentation. The default
indent_space
is two tabs and each tab is eight spaces so the
default here is 16
.
-page_precedence
¶
+page_precedence
¶
A document may have pages numbered in different ways. For example, a
book may have front matter pages numbered in lowercase roman while main
matter pages are in arabic. This string specifies the order in which
@@ -22627,7 +23500,7 @@
25.2.3 makeindex
Previous: makeindex
, Up: Indexes [Contents][Index]
-25.2.4 \printindex
+25.2.4 \printindex
¶
@@ -22658,7 +23531,7 @@ 25.2.4 \p
Previous: Indexes, Up: Front/back matter [Contents][Index]
-25.3 Glossaries
+25.3 Glossaries ¶
@@ -22732,7 +23605,7 @@ 25.3 Glossaries
Next: \gls
, Up: Glossaries [Contents][Index]
-25.3.1 \newglossaryentry
+25.3.1 \newglossaryentry
¶
@@ -22781,26 +23654,26 @@ 25.3.1
-name
¶
+name
¶
(Required.) The word, phrase, or symbol that you are defining.
-description
¶
+description
¶
(Required.) The description that will appear in the glossary.
If this has more than one paragraph then you must use the second command
form given in the synopsis.
-plural
¶
+plural
¶
The plural form of name. Refer to the plural form using
\glspl
or \Glspl
(see \gls
).
-sort
¶
+sort
¶
How to place this entry in the list of entries that the glossary holds.
-symbol
¶
+symbol
¶
A symbol, such as a mathematical symbol, besides the name.
@@ -22814,7 +23687,7 @@ 25.3.1
Previous: \newglossaryentry
, Up: Glossaries [Contents][Index]
-25.3.2 \gls
+25.3.2 \gls
¶
@@ -22860,7 +23733,7 @@ 25.3.2 \gls
<
Next: Input/output, Previous: Front/back matter, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-26 Letters
+26 Letters ¶
@@ -22970,7 +23843,7 @@ 26 Letters
Next: \cc
, Up: Letters [Contents][Index]
-26.1 \address
+26.1 \address
¶
@@ -23008,7 +23881,7 @@ 26.1 \address
Next: \closing
, Previous: \address
, Up: Letters [Contents][Index]
-26.2 \cc
+26.2 \cc
¶
@@ -23038,7 +23911,7 @@ 26.2 \cc
Next: \encl
, Previous: \cc
, Up: Letters [Contents][Index]
-26.3 \closing
+26.3 \closing
¶
@@ -23065,7 +23938,7 @@ 26.3 \closing
Next: \location
, Previous: \closing
, Up: Letters [Contents][Index]
-26.4 \encl
+26.4 \encl
¶
@@ -23094,7 +23967,7 @@ 26.4 \encl
Next: \makelabels
, Previous: \encl
, Up: Letters [Contents][Index]
-26.5 \location
+26.5 \location
¶
@@ -23115,7 +23988,7 @@ 26.5 \location
Next: \name
, Previous: \location
, Up: Letters [Contents][Index]
-26.6 \makelabels
+26.6 \makelabels
¶
@@ -23189,7 +24062,7 @@ 26.6 \makelabel
Next: \opening
, Previous: \makelabels
, Up: Letters [Contents][Index]
-26.7 \name
+26.7 \name
¶
@@ -23210,7 +24083,7 @@ 26.7 \name
Next: \ps
, Previous: \name
, Up: Letters [Contents][Index]
-26.8 \opening
+26.8 \opening
¶
@@ -23236,7 +24109,7 @@ 26.8 \opening
Next: \signature
, Previous: \opening
, Up: Letters [Contents][Index]
-26.9 \ps
+26.9 \ps
¶
@@ -23261,7 +24134,7 @@ 26.9 \ps
Next: \telephone
, Previous: \ps
, Up: Letters [Contents][Index]
-26.10 \signature
+26.10 \signature
¶
Synopsis:
@@ -23313,7 +24186,7 @@ 26.10 \signature
Previous: \signature
, Up: Letters [Contents][Index]
-26.11 \telephone
+26.11 \telephone
¶
@@ -23337,7 +24210,7 @@ 26.11 \telephone
Next: Command line interface, Previous: Letters, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-27 Input/output
+27 Input/output ¶
@@ -23364,7 +24237,7 @@ 27 Input/output
Next: \read
, Up: Input/output [Contents][Index]
-27.1 \openin
& \openout
+27.1 \openin
& \openout
¶
@@ -23455,7 +24328,7 @@ 27.1 \typein
, Previous: \openin
& \openout
, Up: Input/output [Contents][Index]
-27.2 \read
+27.2 \read
¶
@@ -23506,7 +24379,7 @@ 27.2 \read
Next: \typeout
, Previous: \read
, Up: Input/output [Contents][Index]
-27.3 \typein
+27.3 \typein
¶
@@ -23570,7 +24443,7 @@ 27.3 \typein
Next: \write
, Previous: \typein
, Up: Input/output [Contents][Index]
-27.4 \typeout
+27.4 \typeout
¶
@@ -23619,7 +24492,7 @@ 27.4 \typeout
Previous: \typeout
, Up: Input/output [Contents][Index]
-27.5 \write
+27.5 \write
¶
@@ -23777,7 +24650,7 @@ 27.5 \write
Next: \message
, Up: \write
[Contents][Index]
-27.5.1 \write
and security
+27.5.1 \write
and security ¶
@@ -23816,7 +24689,7 @@ 27.5.1 \wlog
, Previous: \write
and security, Up: \write
[Contents][Index]
-27.5.2 \message
+27.5.2 \message
¶
@@ -23880,7 +24753,7 @@ 27.5.2 \message
Next: \write18
, Previous: \message
, Up: \write
[Contents][Index]
-27.5.3 \wlog
+27.5.3 \wlog
¶
@@ -23913,7 +24786,7 @@ 27.5.3 \wlog
Previous: \wlog
, Up: \write
[Contents][Index]
-27.5.4 \write18
+27.5.4 \write18
¶
@@ -24034,7 +24907,7 @@ 27.5.4 \write18
Next: Document templates, Previous: Input/output, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-28 Command line interface
+28 Command line interface ¶
@@ -24103,7 +24976,7 @@ 28 Command line interface
Next: Command line input, Up: Command line interface [Contents][Index]
-28.1 Command line options
+28.1 Command line options ¶
@@ -24120,25 +24993,22 @@ 28.1 Command line options
spaces around the ‘=’. We will generally use the ‘=’ syntax.
--
-
--version
+-version
¶
Show the current version, like ‘pdfTeX 3.14159265-2.6-1.40.16 (TeX
Live 2015/Debian)’ along with a small amount of additional information,
and exit.
-
--help
+-help
¶
Give a brief usage message that is useful as a prompt and exit.
-
-
--interaction=mode
¶
--
+
+-
-
TeX compiles a document in one of four interaction modes:
+
+-interaction=mode
¶
+TeX compiles a document in one of four interaction modes:
batchmode
, nonstopmode
, scrollmode
,
errorstopmode
. In errorstopmode (the default), TeX
stops at each error and asks for user intervention. In batchmode
@@ -24157,19 +25027,17 @@
28.1 Command line options
eliminates most terminal output.
-
-
-
--jobname=string
+-
+
+
-jobname=string
¶
Set the value of TeX’s jobname to the string. The log file
and output file will then be named string.log and
string.pdf. see Jobname.
-
-
-
--output-directory=directory
+
+-
+
-output-directory=directory
¶
Write files in the directory directory. It must already exist.
This applies to all external files created by TeX or LaTeX, such
as the .log file for the run, the .aux, .toc,
@@ -24182,14 +25050,13 @@
28.1 Command line options
directory (in which LaTeX was run) remains unchanged, and is also
checked for input files.
-
-
+
+-
-
---enable-write18
+--enable-write18
¶
--disable-write18
--shell-escape
--no-shell-escape
@@ -24209,15 +25076,13 @@ 28.1 Command line options
\write18{ls -l}
, then you do not get an error but the log
file says ‘runsystem(ls -l)...disabled’.
-
--halt-on-error
+-halt-on-error
¶
Stop processing at the first error.
-
-
--file-line-error
+-
+
-file-line-error
¶
-no-file-line-error
Enable or disable filename:lineno:error
-style
error messages. These are only available with TeX Live or MacTeX.
@@ -24232,7 +25097,7 @@
28.1 Command line options
Next: Jobname, Previous: Command line options, Up: Command line interface [Contents][Index]
-28.2 Command line input
+28.2 Command line input ¶
@@ -24288,7 +25153,7 @@ 28.2 Command line input
The jobname
option is there because otherwise both files would be
called main.pdf and the second would overwrite the
-first. (see Jobname.)
+first (see Jobname).
In this example we use the command line to select which parts of a
document to include. For a book named mybook.tex and structured
@@ -24321,7 +25186,7 @@
28.2 Command line input
Next: Recovering from errors, Previous: Command line input, Up: Command line interface [Contents][Index]
-28.3 Jobname
+28.3 Jobname ¶
@@ -24339,19 +25204,19 @@ 28.3 Jobname
In general, LaTeX is invoked as latex-engine
options argument
, where latex-engine is
-pdflatex
, lualatex
, etc. (see TeX engines).
-If argument does not start with a backslash, as is the case above
-with thesis
, then TeX considers it to be the name of the file
-to input as the main document. This file is referred to as the root
-file (see Splitting the input, and \input
). The name of
-that root file, without the .tex extension if any, is the
-jobname. If argument does start with a backslash, or if TeX is
-in interactive mode, then it waits for the first \input
command,
-and the jobname is the argument to \input
.
+pdflatex
, lualatex
, etc. (see TeX engines). If argument does not start with a backslash, as is
+the case above with thesis
, then TeX considers it to be the
+name of the file to input as the main document. This file is referred
+to as the root file (see Splitting the input, and
+\input
). The name of that root file, without the .tex
+extension if any, is the jobname. If argument does start with a
+backslash, or if TeX is in interactive mode, then it waits for the
+first \input
command, and the jobname is the argument to
+\input
.
There are two more possibilities for the jobname. It can be directly
specified with the -jobname
option, as in pdflatex
--jobname=myname
(see Command line input for a real example).
+-jobname=myname
(see Command line input for a practical example).
@@ -24420,7 +25285,7 @@ 28.3 Jobname
Previous: Jobname, Up: Command line interface [Contents][Index]
-28.4 Recovering from errors
+28.4 Recovering from errors ¶
If LaTeX finds an error in your document then it gives you an error
message and prompts you with a question mark, ?
. For instance,
@@ -24476,7 +25341,7 @@
28.4 Recovering from errors
Next: Index, Previous: Command line interface, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-Appendix A Document templates
+Appendix A Document templates ¶
@@ -24499,7 +25364,7 @@ Appendix A Document templates
Next: article
template, Up: Document templates [Contents][Index]
-A.1 beamer
template
+A.1 beamer
template ¶
@@ -24542,7 +25407,7 @@ A.1 beamer
Next: book
template, Previous: beamer
template, Up: Document templates [Contents][Index]
-A.2 article
template
+A.2 article
template ¶
@@ -24574,7 +25439,7 @@ A.2 article
Next: Larger book
template, Previous: article
template, Up: Document templates [Contents][Index]
-A.3 book
template
+A.3 book
template ¶
@@ -24606,7 +25471,7 @@ A.3 book
temp
Previous: book
template, Up: Document templates [Contents][Index]
-A.4 Larger book
template
+A.4 Larger book
template ¶
@@ -24674,37 +25539,43 @@ A.4 Larger bo
Previous: Document templates, Up: LaTeX2e: An unofficial reference manual [Contents][Index]
-Index
+Index ¶
-