I just learned about \detokenize
, so this question is likely a naive one.
Nonetheless, based on what I thought that I understood about \detokenize
, I would have expected \detokenize{_}
to render as _
.
However, when I compile the following MWE, \detokenize{_}
renders as something that seems to be U+05C4
U+02D9
(see @Qrrbrbirlbel's comment).
\documentclass{article}
\begin{document}
A\detokenize{_}B
\end{document}
However, when I add \usepackage[T1]{fontenc}
to the preamble, everything works as expected.
\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}
A\detokenize{_}B
\end{document}
What's going on here? My .tex
file is UTF-8 encoded, and I'm compiling on a Mac (OS X 10.9.1) with TeXShop (v. 3.26) if any of that is relevant here.
_
in the OT1 encoding. It is at position 0x5F (ASCII) in T1. At this position is˙
in OT1. – Qrrbrbirlbel Dec 20 '13 at 5:37fontspec
is the standard, which loads en encoding calledeu1
, giving you a wider support. Frequently loaded packages: Differences between pdfLaTeX and XeLaTeX – Johannes_B Dec 20 '13 at 8:27\string_
is easier than\detokenize{_}
, isn't it? But\_
is even easier (and works also with OT1). – egreg Dec 20 '13 at 10:39\string_
still produces˙
unless\usepackage[T1]{fontenc}
is loaded. And\_
isn't an option in this case. (This question arose as a result of one of the answers to my question about DOIs and BibTeX.) – Adam Liter Dec 20 '13 at 16:54