Inserting emojis in LaTeX documents on Overleaf
Note: The twemojis
package is not included in TeX Live, and therefore unavailable for use on Overleaf.
Emoji characters and the Overleaf editor
Overleaf cannot store files that contain NUL characters or edit files that contain characters from outside of Unicode's Basic Multilingual Plane (BMP).
Unicode assigned many emoji characters to code points outside the Basic Multilingual Plane: they are encoded in Plane 1, which means their code points are in the range U+10000–U+1FFFF, specifically U+1F000–U+1FFFF. This has an important consequence for anyone wishing to copy and paste emoji characters into the Overleaf editor. At present, Overleaf’s text editor can only handle characters within the Basic Multilingual Plane, although we hope future upgrades will introduce support for non-BMP characters.
If you paste an emoji such as 😀, or any other non-BMP character, into the Overleaf editor it will be converted to the characters ��. However, you can upload text files containing non-BMP UTF-8 sequences: they won't be editable within the Overleaf editor but you can insert those files within your document using appropriate LaTeX file-inclusion commands.
As shown in the examples below, you can insert emoji using suitable fonts and commands provided by LaTeX packages.
Monochrome emojis
You can use the \symbol
or \char
command in tandem with fontspec
, XƎLaTeX or LuaLaTeX and a suitable font. For example, without using the emoji
package, you can still insert monochrome emojis with the Symbola font:
Falling leaves: {\fontspec{Symbola}\symbol{"1F343}}
or
Falling leaves: {\fontspec{Symbola}\char"1F343}
Open this monochrome emoji example in Overleaf
This will give you the output
You can lookup the code points for emojis on this webpage.
Colour emojis
If you want to use colour emojis, have a look at the emoji
package, which uses the LuaLaTeX + HarfBuzz text-shaping engine to access colour emoji fonts correctly. You will need to change your project's compiler to be LuaLaTeX. You can then load the emoji
package, and write \emoji{leaves}
.
\documentclass[12pt]{article}
\usepackage{emoji}
\begin{document}
These are colour emojis using the \texttt{emoji} package and LuaLaTeX:
\emoji{leaves}
\emoji{rose}
You can use emoji-modifiers:
\emoji{woman-health-worker-medium-skin-tone}
\emoji{family-man-woman-girl-boy}
\emoji{flag-malaysia}
\emoji{flag-united-kingdom}
\end{document}
See this live example in Overleaf
You can look up the Unicode CLDR (Common Locale Data Repository) names here, but remember to replace spaces in the names with hyphens. Alternatively, you can look in the emoji
package documentation itself.
Choosing a different emoji font
On Overleaf the default emoji font is Noto Color Emoji. You can select a different emoji font:
\setemojifont{TwemojiMozilla}
\documentclass[12pt]{article}
\usepackage{emoji}
\begin{document}
\setemojifont{TwemojiMozilla}
These are colour emojis using the \texttt{emoji} package and LuaLaTeX:
\emoji{leaves}
\emoji{rose}
You can use emoji-modifiers:
\emoji{woman-health-worker-medium-skin-tone}
\emoji{family-man-woman-girl-boy}
\emoji{flag-malaysia}
\emoji{flag-united-kingdom}
\end{document}
Open this TwemojiMozilla example in Overleaf