Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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).

share|improve this question
    
Nope, you will have to create your own. As with many other symbols. –  Count Zero Feb 21 '13 at 17:04
    
Is there any other package that provides better (meaning: more complete) circuit drawing functionality? –  Foo Bar Feb 21 '13 at 17:06
    
You can try circuitikz, but for specific things the manual way is required. –  Claudio Fiandrino Feb 21 '13 at 17:07
    
There is circuitikz, but I'm not sure it contains any gas discharge tube... –  Count Zero Feb 21 '13 at 17:07
1  
For example there: commons.wikimedia.org/wiki/File:Neon_lamp_schematics.svg –  Foo Bar Feb 21 '13 at 17:57
show 2 more comments

2 Answers 2

up vote 5 down vote accepted
+100

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}
share|improve this answer
    
Thanks; for my information, are this kind of information in the Tikz manual? –  Lionel MANSUY Feb 25 '13 at 8:54
    
@LionelMANSUY: The part about circuit declare symbol: Yes (section 29.2 "The Base Circuit Library"). The part about having to define the shape around the centre point: No (or I didn't find it), I deduced that from the offset that results otherwise. –  Jake Feb 25 '13 at 9:02
    
@Jack: is circuit declare symbol only related to circuits? I mean, I have started to make a small set of chemical process symbols (valve, pumps, ...). May I use such command to place valve for example? –  Lionel MANSUY Feb 25 '13 at 9:20
    
@LionelMANSUY: Yes, that'll work as well. You just need to make sure to use \begin{tikzpicture}[circuit] to activate that functionality. –  Jake Feb 25 '13 at 9:27
    
@Jake, the little circle should be filled. –  Luigi Feb 25 '13 at 10:36
show 1 more comment

Here is a node; it is based upon the circle shape, so you can set its size with the minimum width key.

It is not yet finished (I was not able to use it with the to[...] syntax, and I probably need some advices, because I don't really know how to make this)

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

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.