12

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?

agentofuser
  • 7,677

2 Answers2

6

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 mainfont="DejaVu Sans"
pandoc my.markdown -o emoji.pdf --pdf-engine=xelatex  -V mainfont="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 mainfont 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;!

Update

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"
Kurt Pfeifle
  • 13,079
0

Try replacing the :smile: with HTML like so:

This is a smile <img src="https://github.com/images/icons/emoji/unicode/1f604.png"/>