I'm reading output from where users put their own input into a latex document. It appears as though the users can include emojis. So my question, what is then minimal needed so that the following MWE will latex without error. Either the emoji is correctly handled or else ignored or even replaced by some box. The important thing for me is that the document latexs without error.


Can this be handled in latex?   👍
  • 1
    how do you compile? with pdflatex or one of the unicode engines? Apr 23 '21 at 15:54
  • Compiled with pdflatex
    – Geoff
    Apr 23 '21 at 16:01
  • \DeclareUnicodeCharacter{1F44D}{some emoji} Apr 23 '21 at 16:05
  • 1
    @Geoff Yes, the pdfTeX engine doesn't understand Unicode natively like LuaTeX or XeTeX do, so you have to create the mappings so that it knows what to do with each codepoint Apr 24 '21 at 2:16
  • 1
    @Geoff perhaps the simplests way to deal with emojis is to use another engine, There are a couple of good enginees developed this century that can be useful for you: xelatex and lualatex. Either of them implies dropping the inputenc and fontenc packages, and replacing them with fontspec aand then use a font with emoji support.
    – Aradnix
    Apr 24 '21 at 5:18

I can show, what you can do in OpTeX. I hope, that something similar is possible in LaTeX:

\catcode`\👍=13  \def👍{{\emojifont\string👍}}

Can this be handled in OpTeX?  👍  Yes.


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