创建烤箱符号

创建烤箱符号

如何使用 tikz 和/或其他软件包在 LaTeX 中创建小烤箱符号?

我想要创建的符号如下所示:(调节器上带有黑色背景的符号,全部或尽可能多的符号)

在此处输入图片描述

在此处输入图片描述

答案1

绘制这样的符号非常简单,这里有三个快速写出的例子。

\documentclass[border=3mm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}[ultra thick,line cap=round]
 \draw ([yshift=2mm]120:0.4) -- (120:0.4) arc(120:420:0.4) -- ++ (0,0.2)
 foreach \X in {0,-30,...,-180} {(\X:0.5) -- (\X:0.75)};
 \draw[rounded corners] (-0.9,-0.9) rectangle (0.9,0.6);
\end{tikzpicture}
\begin{tikzpicture}[ultra thick,line cap=round]
 \draw[fill,rounded corners] foreach \X in {0,120,240} 
  {[rotate=\X] (0,0) to (0.5,0) to (-60:0.5) to cycle };
 \draw[line width=2mm] (-0.6,-0.6) -- (0.6,-0.6);
 \draw[rounded corners] (-0.9,-0.8) rectangle (0.9,0.7);
\end{tikzpicture}
\begin{tikzpicture}[ultra thick]
 \draw[fill] foreach \X in {0,120,240} 
  {[rotate=\X] (0,0) to[out=10,in=170] (0.5,0) to[out=-10,in=-50] (-60:0.5) 
        to[out=130,in=-40] cycle };
 \draw circle[radius=0.7cm];
 \draw[rounded corners] (-0.9,-0.8) rectangle (0.9,0.8);
\end{tikzpicture}
\end{document}

在此处输入图片描述

生成它们非常繁琐。顺便说一句,有很多这样的包fontawesome可能有一个或另一个符号(我没有检查),只需查看texdoc symbols

如果您想缩放它们,您可以使用nicescalerel包。

\documentclass{article}
\usepackage{tikz}
\usepackage{scalerel}
\newcommand\OvenBulb{\scalerel*{\begin{tikzpicture}[line width=3pt,line cap=round]
 \draw ([yshift=2mm]120:0.4) -- (120:0.4) arc(120:420:0.4) -- ++ (0,0.2)
 foreach \X in {0,-30,...,-180} {(\X:0.5) -- (\X:0.75)};
 \draw[rounded corners] (-0.9,-0.95) rectangle (0.9,0.6);
\end{tikzpicture}}{AA}}
\newcommand\OvenUnderVent{\scalerel*{\begin{tikzpicture}[line width=3pt,line cap=round]
 \draw[fill,rounded corners,very thick] foreach \X in {0,120,240} 
  {[rotate=\X] (0,0) to (0.5,0) to (-60:0.5) to cycle };
 \draw[line width=2mm] (-0.6,-0.6) -- (0.6,-0.6);
 \draw[rounded corners] (-0.9,-0.85) rectangle (0.9,0.7);
\end{tikzpicture}}{AA}}
\newcommand\OvenVent{\scalerel*{\begin{tikzpicture}[line width=3pt,line cap=round]
 \draw[fill,very thick] foreach \X in {0,120,240} 
  {[rotate=\X] (0,0) to[out=10,in=170] (0.5,0) to[out=-10,in=-50] (-60:0.5) 
        to[out=130,in=-40] cycle };
 \draw circle[radius=0.7cm];
 \draw[rounded corners] (-0.9,-0.85) rectangle (0.9,0.85);
\end{tikzpicture}}{AA}}
\begin{document}
A \OvenBulb\ B \OvenVent\ C \OvenUnderVent
\bigskip

{\Huge A \OvenBulb\ B \OvenVent\ C \OvenUnderVent}
\end{document}

在此处输入图片描述

实现相同目的的更有条理的方法是将这些内容定义为图片。然后,您可以使用 获得这些符号\OvenSymbol{bulb},也就是说,不必太担心宏的名称,并且tikzpicture当您希望组合它们时,还可以使用 any 中的图片。

\documentclass{article}
\usepackage{tikz}
\tikzset{pics/oven/.cd,
bulb/.style={code={
\draw ([yshift=2mm]120:0.4) -- (120:0.4) arc(120:420:0.4) -- ++ (0,0.2)
 foreach \X in {0,-30,...,-180} {(\X:0.5) -- (\X:0.75)};
 \draw[rounded corners] (-0.9,-0.95) rectangle (0.9,0.6);}},
under vent/.style={code={ 
 \draw[fill,rounded corners,very thick] foreach \X in {0,120,240} 
  {[rotate=\X] (0,0) to (0.5,0) to (-60:0.5) to cycle };
 \draw[line width=2mm] (-0.6,-0.6) -- (0.6,-0.6);
 \draw[rounded corners] (-0.9,-0.85) rectangle (0.9,0.7);}},
vent/.style={code={ 
 \draw[fill,very thick] foreach \X in {0,120,240} 
  {[rotate=\X] (0,0) to[out=10,in=170] (0.5,0) to[out=-10,in=-50] (-60:0.5) 
        to[out=130,in=-40] cycle };
 \draw circle[radius=0.7cm];
 \draw[rounded corners] (-0.9,-0.85) rectangle (0.9,0.85);
 }}}
\usepackage{scalerel}
\newcommand\OvenSymbol[2][]{\scalerel*{\begin{tikzpicture}[line width=3pt,line cap=round]
 \pic[#1]{oven/#2};
\end{tikzpicture}}{AA}}
\begin{document}
A \OvenSymbol{bulb}\ B \OvenSymbol{vent}\ C \OvenSymbol{under vent}
\bigskip

{\Huge \OvenSymbol{bulb}\ B \OvenSymbol{vent}\ C \OvenSymbol{under vent}}
\end{document}

还有很多话要说。我建议你读一读这次讨论

相关内容