I need to represent diodes using an obscure symbol that CircuiTikZ
does not provide. I have managed to hack together the following.
\makeatletter
\pgfcircdeclarebipole{}
{\ctikzvalof{bipoles/diode/height}}
{fauxled}
{\ctikzvalof{bipoles/diode/height}}
{\ctikzvalof{bipoles/diode/width}}
{
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
\pgfscope
\pgftransformxshift{\pgf@circ@res@left}
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
\pgfusepath{draw}
\endpgfscope
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
\pgfpathcircle{\pgfpointorigin}{1.7*\pgf@circ@res@right}
\pgfusepath{draw}
}
\def\pgf@circ@fauxled@path#1{\pgf@circ@bipole@path{fauxled}{#1}}
\compattikzset{faux led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fauxled@path}}
\makeatother
This does the job (of creating a new CircuiTikZ
component faux led
) to a first-order approximation, however, if a label
is attached to the component with \draw (0,0) to [faux led, label=LED] (4,0);
the label is a bit closer to the symbol than would be ideal.
How can I change the definition of the component, so that the label is placed further away from the symbol by default?
I don't have the opportunity to use TikZ
very often, and have never done any low-level stuff or drawn anything with the primitives before, so general comments on how to do a better job of writing components such as the above, would be most welcome.
Edit: Where can I find documentation for pgfcircdeclarebipole
? I'm clearly misunderstanding something about the meaning of its first few arguments.