Skip to content

Instantly share code, notes, and snippets.

@LinqLover
Last active July 24, 2020 22:00
Show Gist options
  • Save LinqLover/8c92b9d77f3aa42b2ec4722f8634bd27 to your computer and use it in GitHub Desktop.
Save LinqLover/8c92b9d77f3aa42b2ec4722f8634bd27 to your computer and use it in GitHub Desktop.
How to include a unicode emoji into a LaTeX document

We make an example of the proposed process by inserting the 🦄 emoji into a TeX document.

  1. Find the unicode of your emoji

    Using Google Fu, we find out that the code point for our emoji is U+1F984.

  2. Download an SVG file of the emoji

    Be sure to use one consistent data source for all of your tweets. We are referring to twemoji for doing this.

    Download the SVG file from twemoji by adjusting this link: https://raw.githubusercontent.com/twitter/twemoji/master/assets/svg/1f984.svg

  3. Convert the SVG file into an EPS file

    There are certain packages for doing so such as includesvg, but I don't want to install inkscape on my machine, so I use an online converter:

    Go to https://convertio.co/de/svg-eps/ and insert the URL from step 2. Download the converted file into your LaTeX figures folder.

  4. Typeset the emoji in LaTeX

    This is how I could typeset emojis the best way in LaTeX:

    \usepackage{textcomp}  % Required for encoding \textbigcircle
    \usepackage{scalerel}  % Required for emoji \scalerel
    
    \def\🦄{\scalerel*{\includegraphics{figures/1f984.eps}}{\textrm{\textbigcircle}}}

    To use it, just write something like:

    I like \🦄s, and what's about you?

And here is MWE for it: https://de.overleaf.com/project/5f1b1a99a5e56800010e96df

PS: I always like to hear your simpler ideas!

@LinqLover
Copy link
Author

LinqLover commented Jul 24, 2020

Here is how it looks:

image

@LinqLover
Copy link
Author

Note: You cannot give unicode names to the commands in regular if you wish to use more than one unicode name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment