Skip to content

Latest commit

 

History

History
66 lines (43 loc) · 1.94 KB

README.md

File metadata and controls

66 lines (43 loc) · 1.94 KB

xelatex-emoji

Emoji support for XeLaTeX documents

Installation

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 bin/convert_svgs_to_pdfs command (included this repo) in the folder where the SVGs are:

bin/convert_svgs_to_pdfs ./*.svg

Usage

Use the xelatexemoji package. Enjoy :)

Example layout

\documentclass{article}

\usepackage{xltxtra}
\usepackage{xelatexemoji}

\setmainfont{Ubuntu}

\begin{document}

  Hello, 🌎. Lorem 😃 😄 😅 😆 ipsum dolor.

\end{document}

yields (using the great EmojiOne images)

example result

Image path

By default, xelatex-emoji expects the images to be in images/utf8code.extension. The package supports the same image formats (extensions) as XeLaTeX.

For example: If you insert the emoji 👌 (code 1F44C) in your document, then the translation will work if the file images/1F44C.pdf or images/1F44C.png exist. If both exist, then XeLaTeX will use the “better” version images/1F44C.pdf.

You can change the emoji image path and extension by creating your own \xelatexemojipath command.

\newcommand{\xelatexemojipath}[1]{mycustompath/#1.pdf}

Development

To generate the flag codes:

ruby bin/generate_flags.rb > xelatexemoji-flags.sty