0

I want to make a book where one letter has a different rendering from how it usually looks.

I tried

\newcommand{\oldvs}{z}
\catcode`\z=\active
\defz{\stackengine{0pt}{\oldvs}{\~}{O}{c}{F}{T}{L}}
\newcommand{\oldVS}{Z}
\catcode`\Z=\active
\defZ{\stackengine{0pt}{\oldVS}{\~}{O}{c}{F}{T}{L}}

However, this also banned it in commands, and, although I've placed it right before \begin{document}, it affects loading of some .sty files. I don't know why they are loaded after that part; I use an existing template (fancyBook) and don't think switching to a different one would help.

Is there a way to achieve this goal without having to manually put something else each time?

UPD (not about the main point): The code above doesn't produce what I want; a better way is \stackengine{0pt}{z}{$\sim$}{O}{c}{F}{T}{L}} and \stackengine{0pt}{Z}{$\sim$}{O}{c}{F}{T}{L}, respectively.

UPD2: An even better way is \stackengine{0pt}{z}{\textasciitilde}{O}{c}{F}{T}{L} and \stackengine{0pt}{Z}{\raisebox{0.3ex}{\textasciitilde}}{O}{c}{F}{T}{L}, respectively. Also, I currently have a version where this is implemented in a way that requires me to add some additional characters into the source code; my question is if there is a way to do so without that

2
  • 1
    changing the catcode of z/Z generally is quite daring. You should at least doing it after begin document (and then don't use any command with a z in it.) Dec 28, 2022 at 16:39
  • You could try using a LuaLaTeX callback, something like tex.stackexchange.com/questions/631567/… for example.
    – Marijn
    Dec 28, 2022 at 17:05

0

You must log in to answer this question.

Browse other questions tagged .