LaTeX provides commands for inserting characters that have a special meaning do not correspond to simple characters you can type.
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.
# $ % & { } _ ~ ^ \
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.
As to the last three characters, to get a tilde in the text body font
use \~{}
(omitting the curly braces would result in the next
character receiving a tilde accent). Similarly, to get a get a text
body font circumflex use \^{}
. 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 \\
is only
there to split the lines).
\begin{center} \# \$ \% \& \{ \} \_ \~{} \^{} \textbackslash \\ \verb!# $ % & { } _ ~ ^ \! \end{center}
Synopsis:
\uppercase{text} \lowercase{text} \MakeUppercase{text} \MakeLowercase{text}
Change the case of characters. The TeX primitives commands
\uppercase
and \lowercase
only work for American
characters. The LaTeX commands \MakeUppercase
and
\MakeLowercase
commands also change characters accessed by
commands such as \ae
or \aa
. The commands
\MakeUppercase
and \MakeLowercase
are robust but they have
moving arguments (see \protect).
These commands do not change the case of letters used in the name of a
command within text. But they do change the case of every other
Latin letter inside the argument text. Thus,
\MakeUppercase{Let $y=f(x)$
} produces ‘LET Y=F(X)’. Another
example is that the name of an environment will be changed, so that
\MakeUppercase{\begin{tabular} ... \end{tabular}}
will
produce an error because the first half is changed to
\begin{TABULAR}
.
LaTeX uses the same fixed table for changing case throughout a document, The table used is designed for the font encoding T1; this works well with the standard TeX fonts for all Latin alphabets but will cause problems when using other alphabets.
To change the case of text that results from a macro inside text
you need to do expansion. Here the \Schoolname
produces
‘COLLEGE OF MATHEMATICS’.
\newcommand{\schoolname}{College of Mathematics} \newcommand{\Schoolname}{\expandafter\MakeUppercase \expandafter{\schoolname}}
The textcase package brings some of the missing feature of the
standard LaTeX commands \MakeUppercase
and
\MakeLowerCase
.
To uppercase only the first letter of words, you can use the package mfirstuc.
You can access any character of the current font using its number with
the \symbol
command. For example, the visible space character
used in the \verb*
command has the code decimal 32, so it can be
typed as \symbol{32}
.
You can also specify numbers in octal (base 8) by using a '
prefix, or hexadecimal (base 16) with a "
prefix, so the previous
example could also be written as \symbol{'40}
or
\symbol{"20}
.
LaTeX provides commands to generate a number of non-letter symbols in
running text. Some of these, especially the more obscure ones, are not
available in OT1. Unless you are using XeLaTeX or LuaLaTeX then
you may need to load the textcomp
package.
\copyright
\textcopyright
© The copyright symbol.
\dag
† The dagger symbol (in text).
\ddag
‡ The double dagger symbol (in text).
\LaTeX
The LaTeX logo.
\LaTeXe
The LaTeX2e logo.
\guillemotleft («)
\guillemotright (»)
\guilsinglleft (‹)
\guilsinglright (›)
«, », ‹, › Double and single angle quotation marks, commonly used in French.
\ldots
\dots
\textellipsis
… An ellipsis (three dots at the baseline): \ldots
and \dots
also work in math mode.
\lq
‘ Left (opening) quote.
\P
\textparagraph
¶ Paragraph sign (pilcrow).
\pounds
\textsterling
£ English pounds sterling.
\quotedblbase („)
\quotesinglbase (‚)
„ and ‚ Double and single quotation marks on the baseline.
\rq
’ Right (closing) quote.
\S
\textsection
§ Section sign.
\TeX
The TeX logo.
\textasciicircum
^ ASCII circumflex.
\textasciitilde
~ ASCII tilde.
\textasteriskcentered
* Centered asterisk.
\textbackslash
\ Backslash.
\textbar
| Vertical bar.
\textbardbl
⏸ Double vertical bar.
\textbigcircle
◯ Big circle symbol.
\textbraceleft
{ Left brace.
\textbraceright
} Right brace.
\textbullet
• Bullet.
\textcircled{letter}
Ⓐ Circle around letter.
\textcompwordmark
\textcapitalcompwordmark
\textascendercompwordmark
Used to separate letters that would normally ligature. For example,
f\textcompwordmark i
produces ‘fi’ without a ligature. This
is most useful in non-English languages. The
\textcapitalcompwordmark
form has the cap height of the font
while the \textascendercompwordmark
form has the ascender height.
\textdagger
† Dagger.
\textdaggerdbl
‡ Double dagger.
\textdollar (or \$
)
$ Dollar sign.
\textemdash (or ---
)
— Em-dash (used for punctuation, as in
The playoffs --- if you are fortunate enough to make the playoffs ---
is more like a sprint.
).
\textendash (or --
)
– En-dash (used for ranges, as in See pages 12--14
).
\texteuro
The Euro symbol: €. For an alternative glyph design, try the eurosym package; also, most fonts nowadays come with their own Euro symbol (Unicode U+20AC).
\textexclamdown (or !`
)
¡ Upside down exclamation point.
\textgreater
> Greater than symbol.
\textless
< Less than symbol.
\textleftarrow
← Left arrow.
\textordfeminine
\textordmasculine
ª, º Feminine and masculine ordinal symbols.
\textperiodcentered
· Centered period.
\textquestiondown (or ?`
)
¿ Upside down question mark.
\textquotedblleft (or ``
)
“ Double left quote.
\textquotedblright (or ''
)
” Double right quote.
\textquoteleft (or `
)
‘ Single left quote.
\textquoteright (or '
)
’ Single right quote.
\textquotesingle
' Straight single quote. (From TS1 encoding.)
\textquotestraightbase
\textquotestraightdblbase
Single and double straight quotes on the baseline.
\textregistered
® Registered symbol.
\textrightarrow
→ Right arrow.
\textthreequartersemdash
﹘ “Three-quarters” em-dash, between en-dash and em-dash.
\texttrademark
™ Trademark symbol.
\texttwelveudash
﹘ “Two-thirds” em-dash, between en-dash and em-dash.
\textunderscore
_ Underscore.
\textvisiblespace
␣ Visible space symbol.
LaTeX has wide support for many of the world’s scripts and languages,
through the babel
package and related support if you are using
pdfLaTeX, or polyglossia if you are using XeLaTeX or
LuaLaTeX. This section does not cover that support. It only lists
the core LaTeX commands for creating accented characters. The
\capital...
commands shown here produce alternative forms for use
with capital letters. These are not available with OT1.
Below, to make them easier to find, the accents are all illustrated with lowercase ‘o’.
Note that \i
produces a dotless i,
and \j
produces a dotless j.
These are often used in place of their dotted counterparts when they are
accented.
\"
\capitaldieresis
ö Umlaut (dieresis).
\'
\capitalacute
ó Acute accent.
\.
ȯ Dot accent.
\=
\capitalmacron
ō Macron (overbar) accent.
\^
\capitalcircumflex
ô Circumflex (hat) accent.
\`
\capitalgrave
ò Grave accent.
\~
\capitaltilde
ñ Tilde accent.
\b
o_ Bar accent underneath.
Related to this, \underbar{text}
produces a bar under
text. The argument is always processed in LR mode
(see Modes). The bar is always a fixed position under the baseline,
thus crossing through descenders. See also \underline
in
Math miscellany.
\c
\capitalcedilla
ç Cedilla accent underneath.
\d
\capitaldotaccent
ọ Dot accent underneath.
\H
\capitalhungarumlaut
ő Long Hungarian umlaut accent.
\k
\capitalogonek
ǫ Ogonek. Not available in the OT1 encoding.
\r
\capitalring
o* Ring accent.
\t
\capitaltie
\newtie
\capitalnewtie
oo[ Tie-after accent. The \newtie
form is centered in
its box.
\u
\capitalbreve
ŏ Breve accent.
\v
\capitalcaron
ǒ Háček (check, caron) accent.
Here are the basic LaTeX commands for inserting letters beyond A–Z that extend the Latin alphabet, used primarily in languages other than English.
\aa
\AA
å and Å.
\ae
\AE
æ and Æ.
\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
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).
\l
\L
ł and Ł.
\ng
\NG
Lappish letter eng, also used in phonetics.
\o
\O
ø and Ø.
\oe
\OE
œ and Œ.
\ss
\SS
ß and SS.
\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.
\rule
Synopsis, one of:
\rule{width}{thickness} \rule[raise]{width}{thickness}
Produce a rule, a filled-in rectangle.
This produces a rectangular blob, sometimes called a Halmos symbol, often used to mark the end of a proof.
\newcommand{\qedsymbol}{\rule{0.4em}{2ex}}
The amsthm package includes this command, with a somewhat different-looking symbol.
The mandatory arguments give the horizontal width and vertical thickness of the rectangle. They are rigid lengths (see Lengths). The optional argument raise is also a rigid length, and tells LaTeX how much to raise the rule above the baseline, or lower it if the length is negative.
This produces a line, a rectangle that is wide but not tall.
\noindent\rule{\textwidth}{0.4pt}
The line is the width of the page and 0.4 points tall. This line thickness is common in LaTeX.
A rule that has zero width, or zero thickness, will not show up in the output, but can cause LaTeX to change the output around it. See \strut for examples.
\today
Synopsis:
\today
Produce today’s date in the format ‘month dd, yyyy’. An example of a date in that format is ‘July 4, 1976’.
Multilingual packages such as babel or polyglossia, or
classes such as lettre, will localize \today
. For example,
the following will output ‘4 juillet 1976’:
\year=1976 \month=7 \day=4 \documentclass{minimal} \usepackage[french]{babel} \begin{document} \today \end{document}
\today
uses the counters \day
, \month
, and
\year
(see \day & \month & \year).
A number of package on CTAN work with dates. One is datetime package which can produce a wide variety of date formats, including ISO standards.
The date is not updated as the LaTeX process runs, so in principle the date could be incorrect by the time the program finishes.