Special LaTeX characters

Besides the common upper- and lowercase letters, digits and punctuation characters, that can simply by typed with the editor, some characters are reserved for LaTeX commands. They cannot be used directly in the source. Usually they can be printed if preceded by a backslash:

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{ll}
\toprule
\multicolumn{2}{c}{\textbf{Special \LaTeX\ characters}}\\
\midrule
Number sign:  & \# \\
Dollar sign:  & \$ \\
Percent sign: & \% \\
Underscore:   & \_ \\
Ampersand:    & \& \\
Braces:       & \{ \} \\
Circumflex:   & \^{}  \\
\bottomrule
\end{tabular}
\end{document}

Output:

LaTeX symbols

Some characters might not appear as expected. Try:

\documentclass{article}
\begin{document}
Pipe sign: |
 
Less than: <
 
Greater than: >
\end{document}

Output:

OT1 encoding

Just adding one line to the preamble specifying T1 fontencoding helps:

\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
Pipe sign: |
 
Less than: <
 
Greater than: >
\end{document}

Output:

T1 encoding

15. June 2008 by stefan
Categories: Uncategorized | 8 comments

Comments (8)

  1. Ah, yes, but what if you are already using UTF-8 encoding?

  2. Hi Ruquay,

    UTF-8 encoding means input (character) encoding, not font encoding. Also if you add

    \usepackage[utf8]{inputenc}

    the output of the pipe sign | and of the < and > symbols would still be wrong, without T1 font encoding.

    Stefan

  3. Stafan,

    so what is your suggestion? If I usepackage[utf8]{inputenc} to be able process utf-8 encoded sources, what should I do to be able to write and | easily in utf-8 encoded sources?

    Thank you,
    Ash

  4. I mean usepackage[T1]{fontenc} and
    usepackage[utf8]{inputenc}
    does not work together.

  5. They work together. Perhaps show what doesn’t work for you. | works usepackage[T1]{fontenc}, and still does if you use usepackage[utf8]{inputenc} in addition.

  6. Perhaps the tilde (~) and backslash () should be listed as special LaTeX characters?

  7. I just add \usepackage[utf8]{inputenc} and then I write | in the text and it worked

  8. However, none of the TIPA inputs work in a bibtex file. You can alternatively just use $\mid$ for the pipe anywhere (math mode).

Leave a Reply to Christian DiCanio Cancel reply

Required fields are marked *