是否可以制作一个枚举按钮,类似于下图所示的按钮?我将在外部文档(不是 TeX)中将它们用作图片。
答案1
另一种方法:
\documentclass[border=10pt,tikz,x11names]{standalone}
\usepackage[outline]{contour}
\usetikzlibrary{shadows}
\begin{document}
\begin{tikzpicture}[button/.style 2 args={
circle,
minimum size=0.75cm,
top color=#1!30!white,
bottom color=#1,
draw=#1!90!black,
thick,
append after command={
node[circle,draw=#1!90!white,
minimum size=0.68cm,
font=\sffamily]at(\tikzlastnode.center)
{\textcolor{white}{\contour{#1}{#2}}}
},
general shadow={
shadow xshift=.2ex, shadow yshift=-.2ex,
opacity=.5, fill=black!50,
}
}]
\foreach \buttoncolor[count=\i] in {red, DarkOrange1,Goldenrod1,Green3,blue!50!cyan,DarkOrchid2}
\node[button={\buttoncolor}{\i}] at (\i, 0){};
\foreach \buttoncolor[count=\xi,evaluate=\xi as \i using int(13-\xi)] in {Azure2,gray!25!white,Snow3,Snow4,black!80!white,black}
\node[button={\buttoncolor}{\i}] at (\xi, -1){};
\end{tikzpicture}
\end{document}
结果:
答案2
\documentclass[tikz,border=10pt]{standalone}
\usepackage[lining]{libertine}
\usetikzlibrary{shadows}
\begin{document}
\foreach \x/\Color in {1/red,2/red!50,3/orange,4/blue!50!green,5/blue}{
\begin{tikzpicture}
\fill[gray!20] (0.02,-0.03) circle (0.5cm);
\node[circle,minimum width=1cm,text=white,fill=\Color,font=\sffamily] at (0,0) {\x};
\draw[line width = 0.2pt,white!50!black] (0,0) circle (0.475cm);
\end{tikzpicture}
}
\foreach \x/\Color in {11/black!20,12/black!40,13/black!60,14/black!80,15/black}{
\begin{tikzpicture}
\fill[gray!20] (0.02,-0.03) circle (0.5cm);
\node[circle,minimum width=1cm,text=white,fill=\Color,font=\sffamily] at (0,0) {\x};
\draw[line width = 0.2pt,white!50!black] (0,0) circle (0.475cm);
\end{tikzpicture}
}
\end{document}