在 beamer 演示中,我想比较和对比几种替代方案。对于每种方案,我想强调“优点”(带有\item[\Large\smiley]
)、“缺点”(带有\item[\Large\frownie]
)和“中立”意见。是否有一个符号的表情既不快乐也不悲伤,而是中立的?
答案1
这是一个tikz
版本,您可以使用\Simley{<smile_level>}
和控制微笑级别(如下图所示设置)1
,从非常高兴到-1
非常不高兴:
实际上,您可以使用更大的数字,但结果可能不理想。1.75
下面代码中的模糊因子被使用,因此合理的范围是-1...1
您可以根据需要调整它们。
代码:
\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}
答案2
这是一张相当有趣的脸。请进一步调整以获得更具表现力的表情。
\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}
答案3
这是 Knuth 自己提出的一个非 Tikz 解决方案,仅供参考。最初发表在他的论文中,名字很贴切稳定的丈夫。
\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}
当然,这是数学家的皱眉。\texttt{\meaning\frown}.
将其改为\frown
减号,即可得到非常中性的符号:
答案4
更新 4
我不是表情符号专家,所以我画了一些基本的表情符号。最后我更改了现在我定义的 、 和 的名称emoticon happy
。emoticon sad
我emoticon straight face
现在emoticon wink
会将最终的库放在我的网站上。形状并不完美,因为当我在里面添加一些文本时会出现问题。
首先我创建了文件: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
第一个表情符号的名称是emoticon :-)
。第二个是emoticon :-(
。下面是如何使用这两个新形状的示例:
\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}