Tazinho/Advanced-R-Solutions

Fix emojis in PDF output

Opened this issue · 2 comments

The encoding issue in the PDF output (see e.g. S4 emoji exercises), are also in the whole R6 chapter. E.g. the colors (heart, spade, etc.) for my_deck$draw(52) are not correctly rendered.

just found this commit hadley/adv-r@3915c3a, which seems to offer a solution for the emojis in s4.

I've just applied Hadley's "emoji embedding strategy" for the emojis in S4.

The strategy comes down to creating latex-code to include and inline image of the emoji (which is downloaded automatically), when the output-type is pdf. Because this code is generated by code, it only works as an inline command - otherwise the code will be evaluated.

Because of this is doesn't work for the the R6 emoji. Here, I've instead tried to use the https://github.com/mreq/xelatex-emoji latex-package, but couldn't get it to work (with the rmarkdown).
I've replaced the ♠ with SPADE for now etc.

Maybe @hadley has a good suggestion how to fix this. As we've seen in the print it's actually not solved in Advanced R yet also. 🤓