![circuitikz 中的蜂鸣器符号](https://linux22.com/image/448567/circuitikz%20%E4%B8%AD%E7%9A%84%E8%9C%82%E9%B8%A3%E5%99%A8%E7%AC%A6%E5%8F%B7.png)
我怀念 circuitikz 中蜂鸣器的符号。蜂鸣器的标签和方向应该像“按钮”一样工作。符号中的“腿”应该是符号的一部分。所以不需要画额外的线。使用符号作为我的例子。缩放蜂鸣器的选项肯定是有意义的。
\documentclass[border=10pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) coordinate (p0) to[vsource, name=vsource]
(0,2) coordinate (p1) --
++(1,0) coordinate (p2) --
++(0,1) coordinate (p3) to[push button, l_=$T_1$]
++(2,0) coordinate (p4) --
++(0,-1) coordinate (p7);
\draw (p2) --
++(0,-1) coordinate (p5) to[push button, l^=$T_2$]
++(2,0) coordinate (p6) --
(p7) to[buzzer, l^=$B_1$]
++(2,0) coordinate (p8) to[buzzer, l_=$B_2$]
++(0,-2) coordinate (p9) to[buzzer, l_=$B_3$]
(p0);
\node[inner sep=2pt, anchor=south east] at (vsource.e) {\tiny $+$};
\node[inner sep=2pt, anchor=north east] at (vsource.w) {\tiny $-$};
\end{circuitikz}
\end{document}
预期输出:
我知道可以在电路中定义一个新的双极子,但我的知识(目前)还不够。
答案1
更新
以下形状将在 1.5.0 版本中可用:https://github.com/circuitikz/circuitikz/pull/624
原始答案
有很多符号在链接页面上--- 可能它们属于与电子学不同的领域,而电子学是我的领域 ;-) 和 的主要目标circuitikz
。无论如何,添加其中一些应该不难。
这是一个“快速而粗糙”的解决方案。我只是复制了“ mic
”(如手册中有关新组件的章节中所述),然后对其进行了修改。
\documentclass[border=10pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{circuitikz}
\makeatletter
\ctikzset{bipoles/buzzer/height/.initial=0.6}%
\ctikzset{bipoles/buzzer/depth/.initial=.1}%
\ctikzset{bipoles/buzzer/width/.initial=.4}%
%
\pgfcircdeclarebipolescaled{misc}
{}
{\ctikzvalof{bipoles/buzzer/depth}}
{buzzer}
{\ctikzvalof{bipoles/buzzer/height}}
{\ctikzvalof{bipoles/buzzer/width}}{%
\pgfscope
\pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
\pgfpatharc{0}{180}{\pgf@circ@res@right}
\pgf@circ@draworfill
\endpgfscope
\pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.4\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
\pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{.4\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{0pt}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
\pgfusepath{draw}
}
\pgfcirc@activate@bipole@simple{l}{buzzer}
\makeatother
\begin{document}
\begin{circuitikz}
\draw (0,0) coordinate (p0) to[vsource, name=vsource]
(0,2) coordinate (p1) --
++(1,0) coordinate (p2) --
++(0,1) coordinate (p3) to[push button, l_=$T_1$]
++(2,0) coordinate (p4) --
++(0,-1) coordinate (p7);
\draw (p2) --
++(0,-1) coordinate (p5) to[push button, l^=$T_2$]
++(2,0) coordinate (p6) --
(p7) to[buzzer, l^=$B_1$]
++(2,0) coordinate (p8) to[buzzer, l_=$B_2$]
++(0,-2) coordinate (p9) to[buzzer, l_=$B_3$]
(p0);
\node[inner sep=2pt, anchor=south east] at (vsource.e) {\tiny $+$};
\node[inner sep=2pt, anchor=north east] at (vsource.w) {\tiny $-$};
\end{circuitikz}
\end{document}