Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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).

share|improve this question
add comment

2 Answers

up vote 14 down vote accepted

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.

share|improve this answer
add comment

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.