Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
2  
Related question: 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 7 '12 at 11:32
    
@doncherry Thanks for the comment. I was hoping for a solution without \includegraphics{} –  user1202136 Jun 7 '12 at 11:48
1  
looks at texample.net/tikz/examples/emoticons –  Alain Matthes Jun 8 '12 at 8:55

5 Answers 5

up vote 39 down vote accepted

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}
share|improve this answer
8  
This is great! \usepackage{tikzemoticon} and then all eyebrows etc. is set by parameters. –  percusse Jun 8 '12 at 6:01
1  
@percusse: What?? There is a package for this already??? You should post an answer with an example. –  Peter Grill Jun 8 '12 at 6:12
    
No, no. I can see it coming. Sorry, hahah. I just loved the idea. –  percusse Jun 8 '12 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. :) –  user1202136 Jun 8 '12 at 8:19
    
@user1202136: Have incorporated your suggestion. –  Peter Grill Jun 9 '12 at 2:12

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

share|improve this answer

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

share|improve this answer

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

share|improve this answer

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

share|improve this answer
4  
How can you be neutral about having cat-faced emoticons?? –  matth Jul 3 '12 at 20:29
    
Using this with pdflatex seems to be non-trivial, so I posted a dedicated question. –  Raphael Nov 14 '12 at 22:01
    
@Raphael: Just run lualatex instead of pdflatex. It doesn't hurt... –  Caramdir Nov 15 '12 at 1:01
    
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 '12 at 10:50
    
With \setsansfont{DejaVu Sans} you can directly use Unicode smileys without \DejaSans –  Jakob Oct 30 at 8:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.