4

I would like to create a Shockley Diode so that I can use it in my circuits. Its symbol is:

enter image description here

This is my LaTeX code:

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

this is the output image after compiling:

enter image description here

I have seen that people use \tikzset to create its own symbols, how can I use it to create a Shockley Diode? I tried to remove node[draw,circle,inner sep=.35cm] and placed fill[white] (1.74,4.5) -- (1.74,5) -- (2.29,5) -- cycle but it didn't compile

1

1 Answer 1

7

The shapes for the Shockley diode will be included in version 1.5.3 (thanks to point out the need!). For now, you can use this "standalone" version:

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

standalone Shockley diode in action

3
  • I'm surprised that my problem and the solution you provided is going to change CircuiTikZ Source Code. Although I would like to understand better your code because I have some other missing components that I would like to use
    – Dau
    May 30, 2022 at 18:41
  • 1
    The code is basically low-level TikZ (see tikz.dev/base-design and following sections), and the structure circuitikz components have (there is a section near the end of the circuitikz manual).
    – Rmano
    May 30, 2022 at 18:59
  • 2
    Anyway, if the components are widely used/standard, you can always try with a component request on github.com/circuitikz/circuitikz/issues/new/choose
    – Rmano
    May 30, 2022 at 19:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .