59

Inside a beamer presentation, I would like to compare and contrast several alternatives. For each, I would like to highlight the "pros" (with a \item[\Large\smiley]), the "cons" (with a \item[\Large\frownie]) and "neutral" observations. Is there a symbol with a face that is neither happy, nor sad, but rather neutral?

3

9 Answers 9

69

Here is a tikz version where you can use \Simley{<smile_level>} and control the smile level (setting shown below in the image) with 1 begin very happy, to -1 being very unhappy:

enter image description here

You can actually use larger numbers, but the results may not be desirable. The 1.75 fudge factor in the code below was used so that the reasonable range is -1...1 so you can adjust those as desired.

Code:

\documentclass{article}
\usepackage{tikz}

\newcommand{\Simley}[1]{%
\begin{tikzpicture}[scale=0.11]
    \newcommand*{\SmileyRadius}{1.0}%
    \draw [fill=brown!10] (0,0) circle (\SmileyRadius)% outside circle
        %node [yshift=-0.22*\SmileyRadius cm] {\tiny #1}% uncomment this to see the smile factor
        ;  

    \pgfmathsetmacro{\eyeX}{0.5*\SmileyRadius*cos(30)}
    \pgfmathsetmacro{\eyeY}{0.5*\SmileyRadius*sin(30)}
    \draw [fill=cyan,draw=none] (\eyeX,\eyeY) circle (0.15cm);
    \draw [fill=cyan,draw=none] (-\eyeX,\eyeY) circle (0.15cm);

    \pgfmathsetmacro{\xScale}{2*\eyeX/180}
    \pgfmathsetmacro{\yScale}{1.0*\eyeY}
    \draw[color=red, domain=-\eyeX:\eyeX]   
        plot ({\x},{
            -0.1+#1*0.15 % shift the smiley as smile decreases
            -#1*1.75*\yScale*(sin((\x+\eyeX)/\xScale))-\eyeY});
\end{tikzpicture}%
}%

\begin{document}
  \Simley{1}
  \Simley{0.5}
  \Simley{0}
  \Simley{-0.5}
  \Simley{-1}
\end{document}
6
  • 10
    This is great! \usepackage{tikzemoticon} and then all eyebrows etc. is set by parameters.
    – percusse
    Jun 8, 2012 at 6:01
  • 1
    @percusse: What?? There is a package for this already??? You should post an answer with an example. Jun 8, 2012 at 6:12
  • 2
    No, no. I can see it coming. Sorry, hahah. I just loved the idea.
    – percusse
    Jun 8, 2012 at 6:17
  • 2
    This answer is so incredibly cool. :) May I suggest lowering the mouth, as the "smiley_level" is decreasing? I tried \draw[domain=-\eyeX:\eyeX] plot ({\x},{-0.1+#1*0.15-#1*1.75*\yScale*(sin((\x+\eyeX)/\xScale))-\eyeY}); At any rate, I favor the idea of creating a tizemoticon package. :) Jun 8, 2012 at 8:19
  • 3
    I was already searching for the tikzemoticon package before I read the third reply. :)
    – Chris
    Jul 4, 2012 at 12:58
45

Here is a rather amusing one. Please adjust further for more expressive faces.

\documentclass{beamer}
\usepackage{tikz}

\newcommand{\smiley}{\tikz[baseline=-0.75ex,black]{
    \draw circle (2mm);
\node[fill,circle,inner sep=0.5pt] (left eye) at (135:0.8mm) {};
\node[fill,circle,inner sep=0.5pt] (right eye) at (45:0.8mm) {};
\draw (-145:0.9mm) arc (-120:-60:1.5mm);
    }
}

\newcommand{\frownie}{\tikz[baseline=-0.75ex,black]{
    \draw circle (2mm);
\node[fill,circle,inner sep=0.5pt] (left eye) at (135:0.8mm) {};
\node[fill,circle,inner sep=0.5pt] (right eye) at (45:0.8mm) {};
\draw (-145:0.9mm) arc (120:60:1.5mm);
    }
}

\newcommand{\neutranie}{\tikz[baseline=-0.75ex,black]{
    \draw circle (2mm);
\node[fill,circle,inner sep=0.5pt] (left eye) at (135:0.8mm) {};
\node[fill,circle,inner sep=0.5pt] (right eye) at (45:0.8mm) {};
\draw (-135:0.9mm) -- (-45:0.9mm);
    }
}

\begin{document}
\begin{frame}{Pros, Cons and others}
\begin{itemize}
    \item[\smiley] Yay!
    \item[\frownie] Bah!
    \item[\neutranie] Wadeva...
\end{itemize}
\end{frame}
\end{document}

enter image description here

1
  • 1
    This is good, how to make it colorful?
    – wayne
    Feb 1, 2015 at 5:45
39

Here is for fun a non-Tikz solution from Knuth himself. Originally published in his paper with the apt name Stable Husbands.

enter image description here

\documentclass{article}
%% Knuths smile box from 
%\centerline{\bf Stable Husbands}
%\bigskip
%\centerline{\sl Donald E. Knuth, Rajeev Motwani, and Boris Pittel}
%\centerline{\sl  Computer Science Department, Stanford University}
\def\pfbox % new experimental version (DEK, November 88)
{{\ooalign{\hfil\lower.06ex % a smiley face
 \hbox{$\scriptscriptstyle\frown$}\hfil\crcr
 \hfil\lower.7ex\hbox{\"{}}\hfil\crcr
 \mathhexbox20D}}}
\begin{document}
\Huge \pfbox
\end{document}

And of course this is a mathematician's frown \texttt{\meaning\frown}. Change the \frown to a minus sign to get a very neutral one:

enter image description here

32

Unicode defines lots of emoticons: There is ☺ and ☹ at U+263A and U+2639, and there are many more from U+1F601 onward. The neutral one is 😐 U+1F610 NEUTRAL FACE. So, all you need is a font that includes these characters (like DejaVu Sans) and use it with XeLaTeX or LuaLaTeX. E.g.,

% Compile with xelatex or lualatex and DejaVu Sans installed on your system.
\documentclass{beamer}
\usepackage{fontspec}

\newfontfamily\DejaSans{DejaVu Sans}
\newcommand\good{{\color{green}\DejaSans ☺}}
\newcommand\neutral{{\color{blue}\DejaSans 😐}}
\newcommand\bad{{\color{red}\DejaSans ☹}}

\begin{document}
\begin{frame}
  \begin{itemize}
    \item[\good] Unicode provides a lot of emoticons
    \item[\neutral] They even have cat faces: {\DejaSans 😺}
    \item[\bad] Few fonts actually include these characters.
  \end{itemize}
  More samples: {\DejaSans 😁😂😃😇😉😈😋😍😱}
\end{frame}
\end{document}

example

5
  • 17
    How can you be neutral about having cat-faced emoticons??
    – matth
    Jul 3, 2012 at 20:29
  • 1
    Using this with pdflatex seems to be non-trivial, so I posted a dedicated question.
    – Raphael
    Nov 14, 2012 at 22:01
  • 1
    @Raphael: Just run lualatex instead of pdflatex. It doesn't hurt...
    – Caramdir
    Nov 15, 2012 at 1:01
  • 1
    I'm sure it doesn't (xelatex works as well), but this particular document is supposed to work on machines/installations I don't know. :/
    – Raphael
    Nov 15, 2012 at 10:50
  • 2
    With \setsansfont{DejaVu Sans} you can directly use Unicode smileys without \DejaSans
    – Jakob
    Oct 30, 2014 at 8:53
27

Update 4

I'm not an emoticon expert, so I draw some basic emoticons. Finally I changed the names now I define emoticon happy, emoticon sad , emoticon straight face and emoticon wink. I would put the final library on my site now. The shapes are not perfect because, there is a problem when I add some text inside.

First I created the file: tikzlibraryshapes.emoticon.code.tex

% tikzlibraryshapes.emoticon.code.tex
% Basic emoticons
%
\pgfdeclareshape{emoticon happy}
{
  \inheritsavedanchors[from=circle] 
  \inheritanchorborder[from=circle]
  \inheritanchor[from=circle]{north}
  \inheritanchor[from=circle]{north west}
  \inheritanchor[from=circle]{north east}
  \inheritanchor[from=circle]{center}
  \inheritanchor[from=circle]{west}
  \inheritanchor[from=circle]{east}
  \inheritanchor[from=circle]{mid}
  \inheritanchor[from=circle]{mid west}
  \inheritanchor[from=circle]{mid east}
  \inheritanchor[from=circle]{base}
  \inheritanchor[from=circle]{base west}
  \inheritanchor[from=circle]{base east}
  \inheritanchor[from=circle]{south}
  \inheritanchor[from=circle]{south west}
  \inheritanchor[from=circle]{south east}
  \inheritbackgroundpath[from=circle]
  %
  % Background path
  %
  \inheritbackgroundpath[from=circle]
  \beforebackgroundpath{
    \pgfutil@tempdima=\radius%
    \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%  
    \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
    \color{black}
    \pgfpathellipse{\pgfqpoint{.25\pgfutil@tempdima}{.25\pgfutil@tempdima}}%
                   {\pgfqpoint{.1\pgfutil@tempdima}{0pt}}%
                   {\pgfqpoint{0pt}{.15\pgfutil@tempdima}}%
                    \pgfusepath{fill}% 
    \pgfpathellipse{\pgfqpoint{-.25\pgfutil@tempdima}{.25\pgfutil@tempdima}}%
                   {\pgfqpoint{.1\pgfutil@tempdima}{0pt}}%
                   {\pgfqpoint{0pt}{.15\pgfutil@tempdima}}%
                    \pgfusepath{fill}% 
                          \pgfusepath{stroke}%  
\begingroup
\pgfsetlinewidth{0.4pt}%
\pgflowlevelsynccm    
       \pgfpathmoveto{\pgfqpoint{-.353\pgfutil@tempdima}{-.353\pgfutil@tempdima}}%
      \pgfpatharc{-135}{-45}{.5\pgfutil@tempdima and .5\pgfutil@tempdima}%
      \pgfusepath{stroke}%
\endgroup    
  }} 

  \pgfdeclareshape{emoticon sad}
{
  \inheritsavedanchors[from=circle] 
  \inheritanchorborder[from=circle]
  \inheritanchor[from=circle]{north}
  \inheritanchor[from=circle]{north west}
  \inheritanchor[from=circle]{north east}
  \inheritanchor[from=circle]{center}
  \inheritanchor[from=circle]{west}
  \inheritanchor[from=circle]{east}
  \inheritanchor[from=circle]{mid}
  \inheritanchor[from=circle]{mid west}
  \inheritanchor[from=circle]{mid east}
  \inheritanchor[from=circle]{base}
  \inheritanchor[from=circle]{base west}
  \inheritanchor[from=circle]{base east}
  \inheritanchor[from=circle]{south}
  \inheritanchor[from=circle]{south west}
  \inheritanchor[from=circle]{south east}
  \inheritbackgroundpath[from=circle]
  %
  % Background path
  %
  \inheritbackgroundpath[from=circle]
  \beforebackgroundpath{
    \pgfutil@tempdima=\radius%
    \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%  
    \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
    \color{black}
    \pgfpathellipse{\pgfqpoint{.25\pgfutil@tempdima}{.25\pgfutil@tempdima}}%
                   {\pgfqpoint{.1\pgfutil@tempdima}{0pt}}%
                   {\pgfqpoint{0pt}{.15\pgfutil@tempdima}}%
                    \pgfusepath{fill}% 
    \pgfpathellipse{\pgfqpoint{-.25\pgfutil@tempdima}{.25\pgfutil@tempdima}}%
                   {\pgfqpoint{.1\pgfutil@tempdima}{0pt}}%
                   {\pgfqpoint{0pt}{.15\pgfutil@tempdima}}%
                    \pgfusepath{fill}% 
                          \pgfusepath{stroke}%  
\begingroup
\pgfsetlinewidth{0.4pt}%
\pgflowlevelsynccm    
      \pgfpathmoveto{\pgfqpoint{-.353\pgfutil@tempdima}{-.353\pgfutil@tempdima}}%
 \pgfpathcurveto{\pgfqpoint{-.353\pgfutil@tempdima}{-.353\pgfutil@tempdima}}
                {\pgfpoint{0pt}{-.153\pgfutil@tempdima}}
                {\pgfqpoint{.353\pgfutil@tempdima}{-.353\pgfutil@tempdima}}
      \pgfusepath{stroke}%
\endgroup    
  }}  

    \pgfdeclareshape{emoticon straight face}
{
  \inheritsavedanchors[from=circle] 
  \inheritanchorborder[from=circle]
  \inheritanchor[from=circle]{north}
  \inheritanchor[from=circle]{north west}
  \inheritanchor[from=circle]{north east}
  \inheritanchor[from=circle]{center}
  \inheritanchor[from=circle]{west}
  \inheritanchor[from=circle]{east}
  \inheritanchor[from=circle]{mid}
  \inheritanchor[from=circle]{mid west}
  \inheritanchor[from=circle]{mid east}
  \inheritanchor[from=circle]{base}
  \inheritanchor[from=circle]{base west}
  \inheritanchor[from=circle]{base east}
  \inheritanchor[from=circle]{south}
  \inheritanchor[from=circle]{south west}
  \inheritanchor[from=circle]{south east}
  \inheritbackgroundpath[from=circle]
  %
  % Background path
  %
  \inheritbackgroundpath[from=circle]
  \beforebackgroundpath{
    \pgfutil@tempdima=\radius%
    \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%  
    \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
    \color{black}
    \pgfpathellipse{\pgfqpoint{.25\pgfutil@tempdima}{.25\pgfutil@tempdima}}%
                   {\pgfqpoint{.1\pgfutil@tempdima}{0pt}}%
                   {\pgfqpoint{0pt}{.15\pgfutil@tempdima}}%
                    \pgfusepath{fill}% 
    \pgfpathellipse{\pgfqpoint{-.25\pgfutil@tempdima}{.25\pgfutil@tempdima}}%
                   {\pgfqpoint{.1\pgfutil@tempdima}{0pt}}%
                   {\pgfqpoint{0pt}{.15\pgfutil@tempdima}}%
                    \pgfusepath{fill}% 
                          \pgfusepath{stroke}%  
\begingroup
  \pgfsetlinewidth{0.4pt}%
  \pgflowlevelsynccm    
  \pgfpathmoveto{\pgfqpoint{-.353\pgfutil@tempdima}{-.353\pgfutil@tempdima}}%
  \pgfpathlineto{\pgfqpoint{.353\pgfutil@tempdima}{-.353\pgfutil@tempdima}}
  \pgfusepath{stroke}%
\endgroup    
  }}  
      \pgfdeclareshape{emoticon wink}
{
  \inheritsavedanchors[from=circle] 
  \inheritanchorborder[from=circle]
  \inheritanchor[from=circle]{north}
  \inheritanchor[from=circle]{north west}
  \inheritanchor[from=circle]{north east}
  \inheritanchor[from=circle]{center}
  \inheritanchor[from=circle]{west}
  \inheritanchor[from=circle]{east}
  \inheritanchor[from=circle]{mid}
  \inheritanchor[from=circle]{mid west}
  \inheritanchor[from=circle]{mid east}
  \inheritanchor[from=circle]{base}
  \inheritanchor[from=circle]{base west}
  \inheritanchor[from=circle]{base east}
  \inheritanchor[from=circle]{south}
  \inheritanchor[from=circle]{south west}
  \inheritanchor[from=circle]{south east}
  \inheritbackgroundpath[from=circle]
  %
  % Background path
  %
  \inheritbackgroundpath[from=circle]
  \beforebackgroundpath{
    \pgfutil@tempdima=\radius%
    \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%  
    \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
    \color{black}
    \pgfpathmoveto{\pgfqpoint{-.40\pgfutil@tempdima}{.25\pgfutil@tempdima}}% 
    \pgfpathcurveto{\pgfqpoint{-.40\pgfutil@tempdima}{.25\pgfutil@tempdima}}%
                {\pgfqpoint{-.25\pgfutil@tempdima}{.10\pgfutil@tempdima}}%
                {\pgfqpoint{-.10\pgfutil@tempdima}{.25\pgfutil@tempdima}}%        
    \pgfpathellipse{\pgfqpoint{.25\pgfutil@tempdima}{.25\pgfutil@tempdima}}%
                   {\pgfqpoint{.1\pgfutil@tempdima}{0pt}}%
                   {\pgfqpoint{0pt}{.15\pgfutil@tempdima}}%
    \pgfusepath{fill}%     
    \pgfusepath{stroke}%  
\begingroup
   \pgfsetlinewidth{0.4pt}%
   \pgflowlevelsynccm    
   \pgfpathmoveto{\pgfqpoint{-.353\pgfutil@tempdima}{-.353\pgfutil@tempdima}}%
   \pgfpatharc{-135}{-45}{.5\pgfutil@tempdima and .5\pgfutil@tempdima}%
   \pgfusepath{stroke}%
\endgroup      
  }}%        
\endinput

The name of the first emoticon is emoticon :-). The second is emoticon :-(. Here an example how to use these new shapes:

\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{shapes.emoticon}
\begin{document}

\vspace{1cm}
\tikz \node [shape=emoticon happy,draw,fill=yellow]  {};    
\tikz \node [shape=emoticon sad,draw,fill=yellow]  {};

\begin{tikzpicture}[ultra thick]
  \node [shape=emoticon happy,draw,scale=8,fill=orange]  {};
\end{tikzpicture}
\begin{tikzpicture}[ultra thick]
  \node [shape=emoticon sad,draw,scale=8,fill=orange]  {};
\end{tikzpicture} 
\begin{tikzpicture}[ultra thick]
  \node [shape=emoticon straight face,draw,scale=8,fill=orange]  {};
\end{tikzpicture}    
 \begin{tikzpicture}[ultra thick]
  \node [shape=emoticon wink,draw,scale=8,fill=orange]  {};
\end{tikzpicture}     
\end{document}          

enter image description here

14

The fontawesome package provides this possibility:

\documentclass{beamer}
\usepackage{fontawesome}

\begin{document}
\begin{frame}
\begin{description}
  \item[\faSmileO] good
  \item[\faMehO] indifferent
  \item[\faFrownO] bad
\end{description}
\end{frame}
\end{document}

enter image description here

5
  • 1
    it's nice, what about it in LaTex?
    – wayne
    Feb 1, 2015 at 5:33
  • 1
    @WangyanLi try it and you'll see: \faFrown (fontawesome is only supported in Xe/LuaLaTeX.) Feb 1, 2015 at 5:45
  • With the latest version of fontawesome, you must use \faSmileO, \faMehO and \faFrownO... Nov 6, 2015 at 14:54
  • 1
    @PaulGessler The fontawesome package works very well with pdflatex. Nov 6, 2015 at 14:55
  • @PaulGaborit it didn't at the time this answer was written... :-) Thanks, updated for the latest version. Nov 6, 2015 at 15:18
8

I use a stack to make the \SmileBarometer[<level>]. EDITED to make mood scale from -100 to 100.

EDITED to change eye color with mood. RE-EDITED to make eyes \Large.

As Andrew notes in a comment, one could set up macros like \def\SoSo{\SmileBarometer[0]} to lock in particular moods.

\documentclass{article}
\usepackage{xcolor,graphicx,stackengine}
\makeatletter
\newcommand\SmileBarometer[1][100]{%
  \savestack\Mouth{\if0#1\color{red}\rule{1.5ex}{.45pt}\else
    \color{red}\scalebox{.8}[#1]{\rotatebox{90}{\scalebox{.013}[1]{(}}}\fi}%
    \ifnum#1<0\relax\def\eyecolor{cyan!\the\numexpr100#1!red}\else
      \def\eyecolor{brown!\the\numexpr100-#1!cyan}\fi
  \stackinset{c}{}{c}{-2.5pt}{\Mouth}{%
  \stackinset{c}{}{c}{2pt}{\color{\eyecolor}\Large.\kern.7pt.}{\scalebox{1.5}{$\bigcirc$}}}}
\makeatother
\begin{document}
\SmileBarometer{}
\SmileBarometer[80]
\SmileBarometer[60]
\SmileBarometer[0]
\SmileBarometer[-60]
\SmileBarometer[-80]
\SmileBarometer[-100]
\end{document}

enter image description here

1
  • 1
    I might suggest setting up macros for these percentages instead, e.g. \superDuper, \meh, \dontAsk ... Nov 6, 2015 at 16:15
2

There is the tikzsymbols package which has some small variety of 2D and 3D smileys.
My MWE looks like this:

\documentclass{beamer}

\usepackage{tikzsymbols}

\begin{document}
    \begin{frame}
        \frametitle{Everything between \textbackslash frowney and \textbackslash smiley}
        \begin{itemize}
            \item[\cChangey{2}] There is even Schrödingers Cat \SchrodingersCat{0}
            \item[\cChangey{0}] Some commands are also available in German 
            \item[\cChangey{-2}] None \dTongey
        \end{itemize}
    \end{frame}
\end{document}

MWE

And here is a nice Story showing some of the smileys https://tex.stackexchange.com/a/227226/217553

2

With Unicode and lualatex

You can use Unicode emojis to insert all kinds of faces:

different emojis, mostly faces

Here's the complete source file:

\documentclass{beamer}
\usepackage{fontspec}

\newcommand{\emoji}[1]{%
  {\fontspec{Noto Color Emoji}[RawFeature={mode=harf}]{#1}}%
}

\begin{document}
\begin{frame}
  \begin{itemize}
    \item Happy: \emoji{🙂🥲😍😁😂😃😊🤓😇}
    \item Neutral: \emoji{😐🤐🥶🥸😬😶}
    \item Not amused: \emoji{🙁🤨😕😵🥱😠😱😿👿😭}
    \item More: \emoji{🎉🪃🍔🦾😶‍🌫️🦩🖖❤️‍🔥🥷🦬🕵️🧑🏼‍🔬🫖🧑🏽‍🦳👹}
  \end{itemize}
\end{frame}
\end{document}

Compile the file with lualatex.

This uses Noto Color Emoji as the font that renders the emojis. I installed the font on Arch Linux using

pacman -Sy noto-fonts-emoji

which put NotoColorEmoji.ttf in /usr/share/fonts/noto/.

The \emoji command is used to limit where text is rendered with the Noto Color Emoji font. Otherwise the non-emoji text such as "Happy: " wouldn't appear in the resulting PDF.


lualatex --version gives

This is LuaHBTeX, Version 1.12.0 (TeX Live 2020/Arch Linux)

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .