Unicode emoticons with pdflatex
Prepare the following file
% smilie.tex
\documentclass[preview]{standalone}
\usepackage{fontspec}
\setmainfont{DejaVu Sans}
\begin{document}
\end{document}
and compile it with XeLaTeX. Then you can use the glyph via the so built PDF file:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\usepackage{graphicx}
\newunicodechar{}{\includegraphics{smilie}}
\begin{document}
Here is a .
\end{document}
Probably some tweaking with the borders in the standalone
file is necessary.
You can get the height of an uppercase letter in the current font by saying
\includegraphics[height=\fontcharht\font`A]{smilie}
Here is my solution which is partially based on another post from tex.sx I am afraid I cannot find again:
In a nutshell: Download SVG from a database like twemoji (used by Twitter), convert it and scale it appropriately. Pros: Looks exactly like on Twitter or any other platform you desire. Does not require XeLaTeX. Con: Does not work completely automated.
We make an example of the proposed process by inserting the emoji into a TeX document.
Find the unicode of your emoji
Using Google Fu, we find out that the code point for our emoji is
U+1F984
.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
Convert the SVG file into an EPS file
There are certain packages for doing so such as
includesvg
, but I don't want to installinkscape
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.
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!