# In a LaTeX document how can I map a unicode character to LaTeX code?

I must use PdfLaTeX to compile, so no XeLaTeX.

I have some unicode characters in the document. I want to somehow declare with a LaTeX command in the header that whenever PdfLaTeX meets a certain unicode character in my document, it replaces it with some predefined LaTeX code.

Packages like utf8 don't cover all possibilities that is why I am asking how to do this explicitly character by character.

How can I do that?

• Welcome to TeX.SX! Like this: tex.stackexchange.com/q/512379/134574, or this: tex.stackexchange.com/q/522945/134574? – Phelype Oleinik Feb 10 at 11:30
• You probably need to be a bit more specific, what exactly are the chars you are looking for? – daleif Feb 10 at 11:35
• I have many word documents that contain math formulas. I convert them to latex with pandoc, but it leaves lots of unknown unicode characters. I could replace them by hand but its long to do for each file. – J. M. Feb 10 at 12:11
• One non latex solution to my problem, is just to write a script in whatever language to replace all unicode characters occurences by their relevant latex code – J. M. Feb 10 at 12:13