我想创建一个肖克利二极管,以便可以在我的电路中使用它。它的符号是:
这是我的 LaTeX 代码:
\documentclass[margin=3mm]{standalone}
\usepackage[american, siunitx]{circuitikz}
\tikzset{tbulb/.style={cute inductor,n=aux,append after command={(aux)
node[draw,circle,inner sep=.35cm]{}}}}
\begin{document}
\begin{tikzpicture}
\draw
%(0,0) -- (0,2)
(0,0) to[sV<=$V$] (0,5)
(0,5) to[D*](4,5)
(4,5) to (4,0)
(0,0) to[tbulb] (4,0)
;
\fill[white] (1.74,4.5) -- (1.74,5) -- (2.29,5) -- cycle;
\end{tikzpicture}
\end{document}
这是编译后的输出图像:
我看到有人用它\tikzset
来创建自己的符号,我该如何使用它来创建肖克利二极管?我尝试删除node[draw,circle,inner sep=.35cm]
并放置它,fill[white] (1.74,4.5) -- (1.74,5) -- (2.29,5) -- cycle
但它没有编译
答案1
肖克利二极管的形状将包含在 1.5.3 版本中(感谢您指出需要!)。目前,您可以使用这个“独立”版本:
\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage[siunitx, RPvoltages]{circuitikz}
\makeatletter
%% Black Shockley diode
\pgfcircdeclarebipolescaled{diodes}
{}
{\ctikzvalof{bipoles/diode/height}}
{fullshockleydiode}
{\ctikzvalof{bipoles/diode/height}}
{\ctikzvalof{bipoles/diode/width}}
{
\pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
\pgfscope
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
\pgfpathclose
\pgf@circ@fill@strokecolor
\pgfusepath{draw,fill}
\endpgfscope
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
\pgfusepath{draw}
}
\pgfcirc@activate@bipole@simple{l}{fullshockleydiode}
\pgfcirc@style@to@style{fullshockleydiode}{shockD*}
\makeatother
\begin{document}
\begin{circuitikz}[]
\draw (0,0) to [sV=V] ++(0,3) to[shockD*] ++(3,0)
-- ++(0,-3) to[bulb] (0,0);
\end{circuitikz}
\end{document}