0

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.

\documentclass{article}

\begin{document}

Can this be handled in latex?

\end{document}

Geoff
  • 2,637
  • 1
    how do you compile? with pdflatex or one of the unicode engines? – Ulrike Fischer Apr 23 '21 at 15:54
  • Compiled with pdflatex – Geoff Apr 23 '21 at 16:01
  • \DeclareUnicodeCharacter{1F44D}{some emoji} – Ulrike Fischer Apr 23 '21 at 16:05
  • Is 1F44D particularly for this emoji? I see that it is. So I assume then that there is no simple general way to read such objects and deal with them. – Geoff Apr 23 '21 at 16:13
  • 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 – Phelype Oleinik Apr 24 '21 at 02: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 05:18
  • Thank you for the suggestion to use another engine. I never thought about it. – Geoff Apr 24 '21 at 09:36

1 Answers1

2

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

\fontfam[LMfonts]
\load[emoji]
\catcode`\=13  \def{{\emojifont\string}}

Can this be handled in OpTeX? Yes.

\bye

wipet
  • 74,238
  • 1
    with lualatex you can simply define a fallback: https://tex.stackexchange.com/a/572220/2388. But the question was about pdflatex. – Ulrike Fischer Apr 23 '21 at 17:37