How to make it so that following latex
\documentclass{article}
\begin{document}
n
\end{document}
produces a pdf with letter n replaced by m?
From How to automatically replace one letter with another before rendering I see one option is to
\catcode`\X=\active
\def X{Y}
But that don't work with letter n
\catcode`\n=\active
\def n{m}

\catcode`\n=\activedoesn't work if you put it into the preamble, because\begin{document}contains ann(and you have just changed the meaning ofn). It does work if you make the definition inside thedocumentenvironment and additionally open a group around it and the text it should affect (to avoid messing with\end{document}). But you still won't be able to use any commands withnin their name within that group. – moewe May 08 '19 at 05:27