Fonts & Character Sets ⇒ Changing mapping of single characters
-
untexnixal
- 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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
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}