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?

percusse
  • 157,807
  • 2
    Related question: http://tex.stackexchange.com/q/3695/4012 -- possibly even a duplicate, if that question lists all the emoticons available in packages. I'm assuming though that someone will provide a TikZ answer here. – doncherry Jun 07 '12 at 11:32
  • @doncherry Thanks for the comment. I was hoping for a solution without \includegraphics{} – user1202136 Jun 07 '12 at 11:48
  • 1
    looks at http://www.texample.net/tikz/examples/emoticons/ – Alain Matthes Jun 08 '12 at 08:55

9 Answers9

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}

Peter Grill
  • 223,288
  • 10
    This is great! \usepackage{tikzemoticon} and then all eyebrows etc. is set by parameters. – percusse Jun 08 '12 at 06:01
  • 1
    @percusse: What?? There is a package for this already??? You should post an answer with an example. – Peter Grill Jun 08 '12 at 06:12
  • 2
    No, no. I can see it coming. Sorry, hahah. I just loved the idea. – percusse Jun 08 '12 at 06: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. :) – user1202136 Jun 08 '12 at 08:19
  • @user1202136: Have incorporated your suggestion. – Peter Grill Jun 09 '12 at 02:12
  • 3
    I was already searching for the tikzemoticon package before I read the third reply. :) – Chris Jul 04 '12 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

percusse
  • 157,807
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

yannisl
  • 117,160
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

Caramdir
  • 89,023
  • 26
  • 255
  • 291
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

Alain Matthes
  • 95,075
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

Paul Gessler
  • 29,607
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

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

DrecksHippy
  • 124
  • 10
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)