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"/>
  • 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. – hsribei 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 -o emoji.pdf --pdf-engine=lualatex -V mainfonts="DejaVu Sans"
pandoc -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.

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.