Home > Software engineering >  PHP Converting UTF-8 to TeX/LaTeX Formatting?
PHP Converting UTF-8 to TeX/LaTeX Formatting?

Time:10-22

I have some strings that include encoding that would work with TeX, (For example they look like "Pi/~na Colada" instead of Piña Colada). Is there a simple way to convert this to show properly without creating my own function to convert the characters?

CodePudding user response:

No.

But:

  1. The tex.stackexchange.com wiki has a decent list of TeX accents.
  2. Then you just need to correlate them with their UTF-8 combining mark.
  3. Make sure you move the combining mark to after the character you want it combined with.
    • eg: "/~n" to "n" . $combining_mark
  4. You might then want to run it through intl's Normalizer in NFC form to compose the character into a single codepoint, if it exists.
  • Related