hadley / emo

Easily insert emoji into R and RMarkdown
416 stars 53 forks source link

Use in pdf .Rmd #33

Closed aaronbaggett closed 6 years ago

aaronbaggett commented 7 years ago

Any chance of adding functionality to PDF R Markdown documents/presentations? 🙏

Without --latex-engine=xelatex, emo::ji("grinning") produces ! Package inputenc Error: Unicode char 😀 (U+1F600) (inputenc) not set up for use with LaTeX.

However, adding --latex-engine=xelatex will at least compile the document. Including ji(keyword) in an R chunk produces ##. Looks like r emo::ji(keyword) is altogether ignored.

cecilesauder commented 6 years ago

Same problem for me @romainfrancois can you fix it ? :pray: :unicorn:

dppalomar commented 6 years ago

I am using beamer_presentation with the option latex_engine: xelatex and it compiles well without error. If I open the .tex file generated, I can see the emoji there. So far so good... However, it's not there in the pdf file. I guess the font is missing or something... It would be great if this could be solved because then this package could be use for both html and pdf outputs in a transparent way. Thanks!!

romainfrancois commented 6 years ago

I don't think there is much we can do, this seems to be a LaTeX issue, i.e. can you make a LaTeX document with emoji at all ?

The only thing emo does is to include the right character, there's nothing we can do if that character is not picked up by what processes the document.

Some more details here: https://tex.stackexchange.com/questions/304156/how-would-i-go-about-adding-unicode-emoticons-into-latex

dppalomar commented 6 years ago

Thanks Romain, you were right that it was a LaTeX issue. I managed to solve the issue and I would like to share for others: It's as simple as including the right LaTeX package: \usepackage{xelatexemoji}. You can get it from here: https://github.com/mreq/xelatex-emoji. You still need to get the images of the different emojis that you use, for that I simply downloaded the .png files from here: http://www.unicode.org/emoji/charts/full-emoji-list.html. Very simple after I managed to get it working. I hope this is useful to others. Best Daniel