[Tex/LaTex] Emoji in pdflatex

charactersgraphicstitlesunicode

Update: By adding \def\emojione{\scalerel*{\includegraphics{1F4D5.pdf}}{X}} in the preamble with the respective PDF file, I am able to use emoji in the body text. However, if I put \emojione{} in the chapter title, it returns several errors.


I'm trying to display emoji characters in my chapter headings. I have tried numerous solutions, all of which do not work. I came across solutions for XeLaTeX, but unfortunately it is not compatible with other commands in my document. As for pdflatex, I came across this which seems to be the most promising, however it only displays the Unicode name and not the character itself. I also came across this package, however the installation fails.

Any help would be greatly appreciated! I am using pdflatex with Shell Escape, and dvipdfmx on macOS. Here is my code:

\documentclass{tufte-book}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{circuitikz}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{eso-pic}
\usepackage{xcolor}
\usepackage{graphicx}
\graphicspath{{../images/}}

\newcommand\BackgroundPic{%
\put(-225,-355){%
\parbox[b][\paperheight]{\paperwidth}{%
\vfill
\centering
\includegraphics[height=1.45\paperheight,%
keepaspectratio]{circuitscover}%
\vfill
}}}

\DeclareUnicodeCharacter {1F55A} {\clockTen}
\protected\def \clockTen {<<Clock Ten, U+1F55A>>}

\setlength{\parindent}{0pt}
\colorlet{darkgray}{white!15!black}
\title[Electronic Circuits]{%
  \setlength{\parindent}{0pt}%
Electronic \par Circuits}
\author{Richard Robinson}
\begin{document}
\AddToShipoutPicture*{\BackgroundPic}
\frontmatter
\maketitle
\setlength{\parindent}{0pt}
\mainmatter

%%%

\chapter{Introduction 🕚}


\end{document}

Best Answer

If you want the "use a pdf" method, and if you want to use a command inside sectioning titles you normally should define them so that they are robust and don't break when they wander to the toc or the header:

\documentclass{book}
\usepackage{scalerel,graphicx,xparse}

\NewDocumentCommand\emojione{}{\scalerel*{\includegraphics{example-image-duck}}{X}}

\begin{document}
 \tableofcontents

 \chapter{emoji \emojione}

 \emojione

\end{document}

enter image description here