[Tex/LaTex] TikZ circuits: symbol for gas discharge tube

tikz-circuit-libtikz-pgf

In the TikZ circuit library, is there a symbol for a gas discharge tube?

In the manual I could not find anything regarding this (and the whole symbol list in there seems rather short, anyways).

Best Answer

Two things are required to get Lionel's node to work like the other circuit components: You need to declare the symbol using circuit declare symbol=<name>, set <name> graphic={shape=<shape name>, draw, transform shape,...}, and you need to construct the shape around the local origin.

Here's one way of doing this (note that I used the circle ee shape as the basis for the new symbol, because it already defines the input and output anchors.

\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}