Fonts & Character Sets ⇒ Changing mapping of single characters
-
- Posts: 3
- Joined: Sun Feb 01, 2009 2:12 am
Changing mapping of single characters
Details: I want all instances of ``, '', and --- to output a left single quote, a right single quote, and an en dash respectively. I need to do this for one of two copies of a document I'm making. The other will retain the default mapping.
Thanks
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Changing mapping of single characters
Nevertheless, a crude hack makes it possible to change the meaning of characters. But this will most certainly fail if your document contains anything else than simple text. Sometimes hacks like this are fun to play with, but generally I strongly advise against them because they alter the most basic parts of LaTeX fundamentally and are highly fragile.
Code: Select all
\documentclass{article}\makeatletter\let\normal@asciigrave`\let\normal@asciiapos'\let\normal@asciihyphen-\catcode96 13\catcode39 13\catcode45 13\def`{\normal@asciigrave\@ifnextchar`\@gobble\@empty}\def'{\normal@asciiapos\@ifnextchar'\@gobble\@empty}\def-{\@ifnextchar-\check@emdash\normal@asciihyphen}\def\check@emdash-{\textendash\@ifnextchar-\@gobble\@empty}\makeatother\begin{document}``aa''---bb\end{document}