在 TikZ 电路库中,是否有气体放电管的符号?
在手册中我找不到任何与此相关的内容(并且其中的整个符号列表似乎相当短)。
答案1
要使 Lionel 的节点像其他电路元件一样工作,需要做两件事:您需要使用 声明符号circuit declare symbol=<name>, set <name> graphic={shape=<shape name>, draw, transform shape,...}
,并且需要围绕局部原点构建形状。
这是实现此目的的一种方法(请注意,我使用形状circle ee
作为新符号的基础,因为它已经定义了input
和output
锚点。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits, shapes.gates.ee}
\begin{document}
\makeatletter
\pgfdeclareshape{neon lamp shape}
{
\inheritsavedanchors[from=circle ee]
\inheritanchor[from=circle ee]{center}
\inheritanchor[from=circle ee]{north}
\inheritanchor[from=circle ee]{south}
\inheritanchor[from=circle ee]{east}
\inheritanchor[from=circle ee]{west}
\inheritanchor[from=circle ee]{north east}
\inheritanchor[from=circle ee]{north west}
\inheritanchor[from=circle ee]{south east}
\inheritanchor[from=circle ee]{south west}
\inheritanchor[from=circle ee]{input}
\inheritanchor[from=circle ee]{output}
\inheritanchorborder[from=circle ee]
\backgroundpath{
\pgf@process{\radius}
\pgfutil@tempdima=\radius
\pgfpathcircle{\centerpoint}{\pgfutil@tempdima}
\pgfpathmoveto{\pgfpoint{-\pgfutil@tempdima}{0pt}}
\pgfpathlineto{\pgfpoint{-0.2\pgfutil@tempdima}{0pt}}
\pgfpathmoveto{\pgfpoint{-0.2\pgfutil@tempdima}{0.7\pgfutil@tempdima}}
\pgfpathlineto{\pgfpoint{-0.2\pgfutil@tempdima}{-0.7\pgfutil@tempdima}}
\pgfpathmoveto{\pgfpoint{\pgfutil@tempdima}{0pt}}
\pgfpathlineto{\pgfpoint{0.2\pgfutil@tempdima}{0pt}}
\pgfpathmoveto{\pgfpoint{0.2\pgfutil@tempdima}{0.7\pgfutil@tempdima}}
\pgfpathlineto{\pgfpoint{0.2\pgfutil@tempdima}{-0.7\pgfutil@tempdima}}
\pgfusepath{stroke}
\pgfpathcircle{\pgfqpoint{-0.4\pgfutil@tempdima}{-0.55\pgfutil@tempdima}}{.075\pgfutil@tempdima}
\pgfusepath{fill}
}
}
\makeatother
\begin{tikzpicture}[
circuit,
circuit declare symbol=neon lamp,
set neon lamp graphic={shape=neon lamp shape, draw, minimum size=1cm,transform shape}
]
\draw (0,0) to [neon lamp] (2,1);
\end{tikzpicture}
\end{document}
答案2
这是一个节点;它基于圆形,因此您可以使用键设置它的大小minimum width
。
它还没有完成(我无法使用语法to[...]
,而且我可能需要一些建议,因为我真的不知道如何做到这一点)
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits}
\begin{document}
\makeatletter
\pgfdeclareshape{neon lamp}
{
\inheritsavedanchors[from=circle]
\inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{north}
\inheritanchor[from=circle]{south}
\inheritanchor[from=circle]{east}
\inheritanchor[from=circle]{west}
\inheritanchor[from=circle]{north east}
\inheritanchor[from=circle]{north west}
\inheritanchor[from=circle]{south east}
\inheritanchor[from=circle]{south west}
\inheritanchorborder[from=circle]
\anchor{input}{\pgf@process{\radius} \pgf@x=\z@ \pgf@y=\radius}
\anchor{output}{\pgf@process{\radius} \pgf@y=\radius \pgf@x=2\pgf@y}
\backgroundpath{
\pgf@process{\radius}
\pgfutil@tempdima=\radius
\pgfpathcircle{\pgfqpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}{\pgfutil@tempdima}
\pgfpathmoveto{\pgfpoint{\z@}{\pgfutil@tempdima}}
\pgfpathlineto{\pgfpoint{.8\pgfutil@tempdima}{\pgfutil@tempdima}}
\pgfpathmoveto{\pgfpoint{.8\pgfutil@tempdima}{1.7\pgfutil@tempdima}}
\pgfpathlineto{\pgfpoint{.8\pgfutil@tempdima}{.3\pgfutil@tempdima}}
\pgfpathmoveto{\pgfpoint{2\pgfutil@tempdima}{\pgfutil@tempdima}}
\pgfpathlineto{\pgfpoint{1.2\pgfutil@tempdima}{\pgfutil@tempdima}}
\pgfpathmoveto{\pgfpoint{1.2\pgfutil@tempdima}{1.7\pgfutil@tempdima}}
\pgfpathlineto{\pgfpoint{1.2\pgfutil@tempdima}{.3\pgfutil@tempdima}}
\pgfpathcircle{\pgfqpoint{.55\pgfutil@tempdima}{.4\pgfutil@tempdima}}{.05\pgfutil@tempdima}
}
}
\makeatother
\begin{tikzpicture}
\node[shape=neon lamp,draw] (lamp) {};
\draw (lamp.input) -- ++(-.5,0);
\draw (lamp.output) -- ++(.5,0);
\end{tikzpicture}
\end{document}
答案3
PSTricks 解决方案
我意识到这个问题早已被遗忘。我也意识到 OP 询问了 Tikz,但在这种情况下,提供 PSTricks 解决方案可能仍然很有用。
我们pst-circ
有要使用的设置和机制:\newCircDipole
。例如:
\newCircDipole{neonlamp}%
\makeatletter%
\def\pst@draw@neonlamp{%
\pscircle(0,0){0.5}
\psline[linewidth=2\pslinewidth](-0.15,-0.3)(-0.15, 0.3)
\psline[linewidth=2\pslinewidth](0.15,-0.3)(0.15, 0.3)
\psdot[dotsize=0.1](0,0.3)
\wire(-0.6,0)(-0.15,0)
\wire(0.6,0)(0.15,0)
\pnode(-0.6,0){dipole@1}
\pnode(0.6,0){dipole@2}%
}%
\makeatother