TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

• To replace ‘ and ’ with the more computer-like (and more visibly distinct) ` and ' within a verbatim environment, use the upquote package. Outside of verbatim, you can use \char18 and \char13 to get the modified quote characters. (The former is actually a grave accent.)

( http://mirror.ox.ac.uk/sites/ctan.org/info/symbols/comprehensive/symbols-a4.pdf )

However, pdflatex/xelatex on

\Huge \char13 


enter image description here

What's happening?

share|improve this question
Looking at the symbols-a4 source, I found it used \texttt{\char13}, which works. But e.g. \textbf{\texttt{\char13}} produces nothing. – Mohan Nov 20 '12 at 11:29
up vote 5 down vote accepted

You need to add


or some other encoding where the character is in slot 13.

But better is never to do this, using \char in that way undercuts the entire LaTeX font encoding mechanism as you have seen. All user level LaTeX commands are designed to be aware of the current font encoding and use an appropriate definition, but if you use the TeX primitive \char you just get whatever is in that position on the current font which is of course highly dependent on the font encoding.

As you noted in the comments the OT1 encoding used for the classic TeX fonts is not really a uniform encoding at all, different fonts (even the same style font at different sizes) are encoded differently. The tt font uses a font encoding that is slightly closer to ASCII than cmr so the verbatim listings work in plain TeX.

share|improve this answer
Thank you for the explanation. What is the 'right' way to get a (pref. bold) ' outside a verb? – Mohan Nov 20 '12 at 11:32
\textquotesingle in the standard textcomp package should give you a straight quote. – David Carlisle Nov 20 '12 at 11:40
Unfortunately not -- my collaborator inserted fontspec for some Unicode-ish reason, and it's messing up \textquotesingle. Edit: importing fontenc/textcomp after fontspec fixes it. Thanks! – Mohan Nov 20 '12 at 11:44
If you are using xetex and unicode fonts I assume you could just enter U+2032 (′) directly as that's the unicode slot for a straight quote (PRIME) – David Carlisle Nov 20 '12 at 11:58

Your Answer


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.