1

I defined a customized nigfete node-style component which I haved used without having any issues until I installed version 1.3.4 of the CircuiTikZ package. However, now I am getting an "Undefined control sequence" error which I can't resolve.

See the following MWE, which redefines some basic parameters of the nigfete and adds a dot at the gate connection. The example works as expected with versions of CircuiTikZ prior to 1.3.4:

\documentclass[]{standalone}
\usepackage{circuitikzgit}
% Save the appropriate style file from https://circuitikz.github.io/circuitikz/ as circuitikzgit.sty 
% in the project folder; MWE works for versions < 1.3.4.

% Slight adjustments of the nigfete parameters
\makeatletter
\ctikzset{tripoles/mynigfete/width/.initial=.6}
\ctikzset{tripoles/mynigfete/gate height/.initial=.546}
\ctikzset{tripoles/mynigfete/base height/.initial=.65}
\ctikzset{tripoles/mynigfete/conn height/.initial=.546}
\ctikzset{tripoles/mynigfete/height/.initial=0.8}
\ctikzset{tripoles/mynigfete/bodydiode scale/.initial=.3}
\ctikzset{tripoles/mynigfete/bodydiode distance/.initial=.3}
\ctikzset{tripoles/mynigfete/bodydiode conn/.initial=.546}
\ctikzset{tripoles/mynigfete/curr direction/.initial=1}

\pgfdeclaretransistorwrapperaddbulk{mynigfete}{}{%
    \pgf@circuit@trans@depletiontypefalse
    \drawfetcore{nigfete}
    
    % SOURCE CONNECTION
    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
    \pgfusepath{draw}
    
    % SOLDER DOT at source-bulk connection
    \ifpgf@circuit@fet@solderdot
        \pgfscope
            \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
                \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
            \pgfnode{circ}{center}{}{}{}
        \endpgfscope{}
    \fi
    
    %% Gate Dot - Modification
    \pgfscope
        \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{
            \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
        \pgfnode{ocirc}{center}{}{}{}
    \endpgfscope{}
    %%
}
\pgf@circ@definetranspath{mynigfete}

\makeatother

\begin{document}
    \begin{tikzpicture}
        \draw (0,0) node[mynigfete] (S1) {};
    \end{tikzpicture}
\end{document}
0

1 Answer 1

2

Apart from a missing \makeatletter in the code (that I added after the \ctikzsets), let's see what happens — this could be helpful in the future:

p1d/1& [romano:~/tmp] % pdflatex lilla.tex
[...]
! Undefined control sequence.
\pgfmath@dimen@ ...men@@ #1=0.0pt\relax \pgfmath@ 
                                                  
l.52         \draw (0,0) node[mynigfete] (S1) {};
                                                 
? 

now press enter

! Missing number, treated as zero.
<to be read again> 
                   \pgfk@/tikz/circuitikz/tripoles/mynigfete/base width 
l.52         \draw (0,0) node[mynigfete] (S1) {};
                                                 
? 

so the core macros are looking for a base width dimension that is not here. Probably when reorganizing the transistors definition and when adding the circles I added it (can't remember now and forgot how to use git blame). Add it as

\ctikzset{tripoles/mynigfete/base width/.initial=.5}

and...

enter image description here

Full code:

\documentclass[]{standalone}
\usepackage{circuitikz}
% Save the appropriate style file from https://circuitikz.github.io/circuitikz/ as circuitikzgit.sty 
% in the project folder; MWE works for versions < 1.3.4.

% Slight adjustments of the nigfete parameters
\ctikzset{tripoles/mynigfete/width/.initial=.6}
\ctikzset{tripoles/mynigfete/gate height/.initial=.546}
\ctikzset{tripoles/mynigfete/base height/.initial=.65}
\ctikzset{tripoles/mynigfete/conn height/.initial=.546}
\ctikzset{tripoles/mynigfete/height/.initial=0.8}
\ctikzset{tripoles/mynigfete/bodydiode scale/.initial=.3}
\ctikzset{tripoles/mynigfete/bodydiode distance/.initial=.3}
\ctikzset{tripoles/mynigfete/bodydiode conn/.initial=.546}
\ctikzset{tripoles/mynigfete/curr direction/.initial=1}
% \ctikzset{tripoles/mynigfete/base width/.initial=.5}
\makeatletter

\pgfdeclaretransistorwrapperaddbulk{mynigfete}{}{%
    \pgf@circuit@trans@depletiontypefalse
    \drawfetcore{nigfete}
    
    % SOURCE CONNECTION
    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
    \pgfusepath{draw}
    
    % SOLDER DOT at source-bulk connection
    \ifpgf@circuit@fet@solderdot
        \pgfscope
            \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
                \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
            \pgfnode{circ}{center}{}{}{}
        \endpgfscope{}
    \fi
    
    %% Gate Dot - Modification
    \pgfscope
        \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{
            \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
        \pgfnode{ocirc}{center}{}{}{}
    \endpgfscope{}
    %%
}

\pgf@circ@definetranspath{mynigfete}

\makeatother

\begin{document}
    \begin{tikzpicture}
        \draw (0,0) node[mynigfete] (S1) {};
    \end{tikzpicture}
\end{document}

BTW: found, I added it to reorganize transistor's definition on 2021-01-04. So your modified transistor would have started failing at 1.3.0. This is the risk of using internal interfaces --- sorry for it.

1d [romano:~/software/ … /my-circuitikz/tex] master 128 ± git log -u -L 3059,3063:pgfcirctripoles.tex
commit 8b2f1db5973fa73d9d8c2cef44c1f28a12cae340
Author: Romano Giannetti <[email protected]>
Date:   Mon Jan 4 16:54:23 2021 +0100

    Group transistors (and the strandled switch)

diff --git a/tex/pgfcirctripoles.tex b/tex/pgfcirctripoles.tex
--- a/tex/pgfcirctripoles.tex
+++ b/tex/pgfcirctripoles.tex
@@ -1586,0 +1803,5 @@
+\ctikzset{tripoles/nigfete/conn height/.initial=.35}
+\ctikzset{tripoles/nigfete/height/.initial=1.1}
+\ctikzset{tripoles/nigfete/base width/.initial=.5}
+\ctikzset{tripoles/nigfete/gate width/.initial=.62}
+\ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
1
  • Works fine now. Thank you!
    – Saegi
    Commented Jun 29, 2021 at 13:34

You must log in to answer this question.

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