1

I have a TeX document with emojis and I want to convert it into HTML using make4ht. Most of the emojis are not present in the final HTML.

The problem might be reproduced using the example provided here: Smileys in LaTeX

Compiling with:

make4ht -u -x emoji 

where the content of file emoji.tex is:

\documentclass{article}
\usepackage{fontspec}
\newfontfamily\DejaSans{DejaVu Sans}

\begin{document}
Some emoticons from Unicode: 

{\DejaSans ☺😐☹😁😂😃😇😉😈😋😍😱} and even cats: {\DejaSans 😺}!
\end{document}

The resulting HTML shows:

enter image description here

while the PDF shows:

enter image description here

How to fix it and get all emojis in the HTML?

1

Not all characters work out of the box in the XeTeX mode. Only Latin with most of diacritics works by default. It is because every supported character is turned into macro and that outputs special instruction for TeX4ht.

You can activate more characters using the \xeuniuseblock command. It activates selected. Unicode block. You can use the following configuration file for the Emoji support:

\Preamble{xhtml}
\xeuniuseblock{Emoticons}
\begin{document}
\EndPreamble

It now works even with XeTeX mode:

make4ht -x -c mycfg.cfg emoji

enter image description here

4
  • I got the following result: ☺ðŸ˜â˜¹ðŸ˜ðŸ˜‚😃😇😉😈😋ðŸ˜ðŸ˜± and even cats: 😺! – LEo Feb 11 at 12:11
  • 1
    @LEo does the -u option fix it? – michal.h21 Feb 11 at 12:29
  • @michal-h21 yes ... is it always necessary? – LEo Feb 11 at 13:23
  • It isn't necessary in up-to-date make4ht, but in your case probably is – michal.h21 Feb 11 at 13:27
2

make4ht --help says -u is obsolete, I get the same as you with -x (xetex) but with -l (luatex) I get

make4ht -l emoji

enter image description here

Note that the generated html isn't forcing the same fonts but with lualatex make4ht is letting the characters through and then general CSS fallback rules mean that these are being rendered by the first system installed font that has the characters (which is Segoe UI Emoji on this machine)

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.