[Tex/LaTex] How to automatically replace one letter with another before rendering

letterssymbols

Short version

I use the letter X in my document. When I convert the *.tex to *.pdf, I want all occurrences of X to be replaced with Y, akin to if I opened the "search and replace" function in the text editor and replaced X with Y.

Long version

There is a certain letter in Russian language known as Yo (ั‘) which is a cause of a long-running holywar. Some people use it everywhere where it is appropriate in accordance with the rules of orthography. Some people replace it with the letter Ye (ะต) everywhere where it is still possible to understand the word. And some people simply do not use it at all. Sadly, many scientific journals (for whatever reason) fall in the last category.

I want to write proper, grammatically correct text using ั‘ everywhere it is needed, and still be able to easily tell LaTeX to compile the "umlautless" version of the document.

Best Answer

The following settings in the preamble

\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{0451}{\"{e}}

will produce ั‘ as composed character. Of course this can be also used to produce the umlautless version

\DeclareUnicodeCharacter{0451}{e}