11

When I try to use one of the more "hacky" methods of getting a literal "special character" (such as backslash or a brace) then I get a different character: backslash seems to be an open quote, left brace a dash, and right brace a close quote. What happened to my special characters?

\documentclass{minimal}

\begin{document}

\char`\\
\char`\{
\char`\}

\end{document}

produces: "-" (only the two "s are different).

David Carlisle
  • 757,742
Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751

2 Answers2

14

Your special characters are in the wrong font table that is loaded by default! Printing them using a different character set will bring them back!

\documentclass{minimal}
\begin{document}
  \texttt{\char`\\}\\
  \texttt{\char`\{}\\
  \texttt{\char`\}}\\
\end{document}

See Why do lower case mathcal letters show up as random symbols? for some help as to how to print a font table.

Moriambar
  • 11,466
yannisl
  • 117,160
9

As Yiannis wrote, it's the font table. However, using fontenc, you can get them to show up as you want.

\documentclass{minimal}
\usepackage[T1]{fontenc}
\begin{document}
\char`\\
\char`\{
\char`\}
\end{document}
David Carlisle
  • 757,742
TH.
  • 62,639