I'd like to convert markdown text like:

This is a smile ๐Ÿ˜€

To a PDF with the emoji on it. To be clear, I want to be able to insert the emoji character itself in the source text, not something like :smile:.

How can I do this with Pandoc?


Try replacing the :smile: with HTML like so:

This is a smile <img src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f604.png"/>
| improve this answer | |
  • 1
    Thing is I have sources with literal emoji already and I'm specifically trying to not have to replace them with anything, but have the unicode characters be properly rendered directly. – Helder S Ribeiro Oct 22 '18 at 23:36

After initially having read the OP too superficially (overlooking his need to NOT use :smile: & friends in his source Markdown), here is a better answer. Try one of these:

pandoc my.markdown -o emoji.pdf --pdf-engine=lualatex -V mainfonts="DejaVu Sans"
pandoc my.markdown -o emoji.pdf --pdf-engine=xelatex  -V mainfonts="DejaVu Sans"

If you use the default pdf-engine (pdflatex), you'll not succeed, but get an error like

 ! Package inputenc Error: Unicode character ๐Ÿ˜€ (U+1F600)
 (inputenc)                not set up for use with LaTeX.

If you do not specify the mainfonts param, you'll get an warning message of

 [WARNING] Missing character: There is no ๐Ÿ˜„ (U+1F604) in font [lmroman10-regular]:+tlig;

for XeLaTeX and of

 [WARNING] Missing character: There is no ๐Ÿ˜„ in font [lmroman10-regular]:mapping=tex-text;!

for LuaLaTeX. While both will be producing a PDF, they'll have no emoji where you wanted it.


Thanks to @jpnadas for noticing a typo in my answer. The parameter should be -V mainfont=... (not -V mainfonts!).

I leave it to the reader(s) to test the correct commands and look at their results:

pandoc -o emoji.pdf --pdf-engine=lualatex -V mainfont="DejaVu Sans"
pandoc -o emoji.pdf --pdf-engine=xelatex  -V mainfont="DejaVu Sans"
| improve this answer | |
  • 1
    I think there is a typo in your answer, shouldn't the parameter be mainfont, as in -V mainfont="DejaVu Sans"? – jpnadas Oct 7 '19 at 10:20
  • 1
    @jpnadas: You are right. Thanks for noticing. I'll fix it. – Kurt Pfeifle Oct 7 '19 at 13:45
  • 1
    Is there another font I could try? I'm using MacTex 2019 Distribution on a Mac. I just get an error with xelatex: "kpathsea:make_tex: Invalid filename `DejaVu Sans', contains ' '" and "! Package fontspec Error: The font "DejaVu Sans" cannot be found." With lualatex I'm getting the warning message you list above: "[WARNING] Missing character: There is no ๐ŸŒ– (U+1F316) (U+1F316) in font DejaVuSans:mode=node;scrip". I see that the space was removed. Not sure what did that. I specified the font as "DejaVu Sans" – Michael Welch Mar 10 at 20:58

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.