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?

  • 1
    Welcome to TeX.SX! Like this: tex.stackexchange.com/q/512379/134574, or this: tex.stackexchange.com/q/522945/134574? Feb 10, 2020 at 11:30
  • 1
    You probably need to be a bit more specific, what exactly are the chars you are looking for?
    – daleif
    Feb 10, 2020 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.
    – jam
    Feb 10, 2020 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
    – jam
    Feb 10, 2020 at 12:13

1 Answer 1


You should probably use newunicodechar package. https://ctan.org/pkg/newunicodechar

  • 1
    Thanks, this is exactly what I needed.
    – jam
    Feb 10, 2020 at 12:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .