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? – Phelype Oleinik Feb 10 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 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

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

|improve this answer|||||
  • 1
    Thanks, this is exactly what I needed. – J. M. Feb 10 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.