Emoji support for XeLaTeX documents
Clone this repo into your texmf
folder or to the project folder. Clone emoji images named after the utf8 code - I recommend EmojiOne.
Note: Tex doesn't natively support SVG, so if you download the vector emojis, you can convert them to PDFs with the following command on Mac and Linux: (assumes you have installed the librsvg2-bin package in Linux
# For Mac OS X:
$ brew install librsvg
# For Linux:
$ sudo apt-get install librsvg2-bin
# Then, run:
$ rsvg-convert -f pdf -o <emoji-UTF-code>.pdf <emoji-UTF-code>.svg
If you don't want to hand convert massive emoji SVGs, run the svgs-to-pdfs
command (included this repo) in the folder where the SVGs are:
./svgs-to-pdfs ./*.svg
Use the xelatexemoji
package. Enjoy :)
\documentclass{article}
\usepackage{xltxtra}
\usepackage{xelatexemoji}
\setmainfont{Ubuntu}
\begin{document}
Hello, 🌎. Lorem 😃 😄 😅 😆 ipsum dolor.
\end{document}
yields (using the great EmojiOne images)
By default, xelatex-emoji expects the images to be in images/utf8code.png
. You can change the path and extension by creating your own \xelatexemojipath
command.
\newcommand{\xelatexemojipath}[1]{mycustompath/#1.pdf}
To generate the flag codes:
ruby bin/generate_flags.rb > xelatexemoji-flags.sty