1

I am trying to replicate some of the body diode customization into my own circuit and I havent had much success.. The compiler seems not to recognize the style./color= whatevercoloritis ..

As a last resource, I just copied and pasted the example code into my environment and neither did it manage to introduce the colors.

Code shown below (the same as in the manual 1.6.0 page 113)

\begin{tikzpicture}[red solid thin bodydiode/.style={bodydiode,
circuitikz/transistor bodydiode/dash=none,
 circuitikz/transistor bodydiode/color=red,
 circuitikz/transistor bodydiode/relative thickness=0.3}]
 \draw (0,0) node (mosfet1) [nigfete,anchor=D,bodydiode] {$Q_1$};
 \draw[densely dashed] (3,0) node (mosfet1) [nigfete,anchor=D,bodydiode] {$Q_2$};
 \draw (6,0) node (mosfet1) [nigfete,anchor=D,bodydiode,
 circuitikz/transistor bodydiode/color=gray] {$Q_3$};
 \draw (0,-2) node (mosfet1) [nigfete,anchor=D,bodydiode,
 circuitikz/transistor bodydiode/dash={{2pt}{1pt}}] {$Q_4$};
 \draw[densely dashed] (3,-2) node (mosfet1) [nigfete,anchor=D,
 red solid thin bodydiode] {$Q_5$};
 \ctikzset{transistor bodydiode/relative thickness=.5}% from now on, in scope
 \draw[densely dotted] (6,-2) node (mosfet1) [nigfete,anchor=D,bodydiode,
 circuitikz/transistor bodydiode/dash=none] {$Q_6$};
 \path (7,0); %% adjust bounding box (node text is outside it!)
 \end{tikzpicture}

This is what I get when compiling the section shown above: compiled_section

I also tried to modify the color thru \ctikzset{tripoles/nigfete/bodydiode color./initial=gray} . Though, it did not change anything even though it did not pop up any warning/error message.

For the sack of whether the \ctikzset... was working or not.. I tried to change the scale of the bodydiode and it worked just fine as in the example below.

Default values:

\draw   (0,0) node[nigfete, anchor=D, bodydiode] (S1) {$S_1$} ;

default_scale

Modified bodydiode scale:

    \ctikzset{tripoles/nigfete/bodydiode scale/.initial=0.8}
    \draw   (0,0) node[nigfete, anchor=D, bodydiode] (S1) {$S_1$} ;

modified_scale

Is there any specific package that I should load, and I am missing, at the begining of the document in order to activate the style color for bodydiode customization? Is there anything else that I could introduce to customize the color of the bodydiode without actually introducing a bipole diode component in parallel with the MOSFET?

Thank you!

  • Which is the version of circuitikz are you using? Please add a \pgfcircversion somewhere in your document and check it. – Rmano Dec 11 '22 at 19:33
  • It shows as 1.5.2 ; I am loading the package in Overleaf as \usepackage{circuitikz} – otiuuaugusto Dec 11 '22 at 19:35
  • Yes --- that's too old. If you look at the changelog in the manual, the body diode styling was added at 1.5.4. You can look at https://tex.stackexchange.com/questions/524328/i-need-to-use-a-different-version-of-circuitikz-how-can-i-do-that (BTW, you should have add errors in overleaf; the little red square with numbers at the top-rightish...) – Rmano Dec 11 '22 at 19:38
  • Thanks. That solved the issue with the example from the manual.

    In order to modify the color for the mosfet and bodydiode, is that possible with the given declaration as in the example from the manual? I am trying to do the following:

    \draw   (0,0) node[nigfete, anchor=D, bodydiode, color=red, circuitikz/transistor bodydiode/color=gray] (S1) {$S_1$} ;
    

    But this seems the bodydiode... is overwritten by the color=red command . But the lines become gray but not the bodydiode itself

    Thanks

    – otiuuaugusto Dec 11 '22 at 19:56
  • do not add answer when they're not really answers. The better way is to edit your question (that will make it on the reopen list) or prepare another question. I hope my answer helps! – Rmano Dec 11 '22 at 20:18
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Rmano Dec 13 '22 at 06:35

1 Answers1

1

The first problem is that your version is too old; follow I need to use a different version of circuitikz. How can I do that? to solve that.

For the second question, you can't apply the style just to all the nigfetes, but you can apply that manually, and/or use styles:

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{circuitikz}
\begin{document}

\pgfcircversion

\begin{tikzpicture}[ % define styles bodydiode color/.style={bodydiode, circuitikz/transistor bodydiode/color=#1}, bodydiode red/.style={bodydiode color=red}, ] % "manually" \draw (0,0) node (mosfet1) [nigfete,anchor=D,bodydiode, circuitikz/transistor bodydiode/color=green ] {$Q_1$}; % with astyle with a parameter \draw (2,0) node (mosfet2) [nigfete, red, anchor=D, bodydiode color=blue] {$Q_1$}; % with a fixed style \draw (4,0) node (mosfet3) [nigfete,anchor=D, bodydiode red] {$Q_1$}; \end{tikzpicture} \end{document}

Rmano
  • 40,848
  • 3
  • 64
  • 125
  • Thank you.

    Regarding the "manually" command line, it seems a bit more natural for me (probably because I am learning how to use Circuitikz) as you just access the color attribute of that bodydiode in that specific node called mosfet1 . Though, in this example, it is not possible to change both bodydiode color attribute and mosfet color attribute, is that not correct? Thanks!

    Do you have any page, or tutorial, that I could follow in order to get to understand about defining styles?

    Thanks once again.

    – otiuuaugusto Dec 11 '22 at 20:18
  • Try \draw (0,0) node (mosfet1) [nigfete,red,anchor=D,bodydiode, circuitikz/transistor bodydiode/color=green ] {$Q_1$}; If you use color=red the effect is different, though, and quite confusing --- colors in circuitikz are difficult. There is a discussion in the manual, and a lengthy one on GitHub with TikZ experts. The main problem is that often circuitikz wants to fill with the draw color, and that's is not always known. – Rmano Dec 11 '22 at 21:15
  • ahaa, that is confusing.. indeed! Grazie mille.. I may not dare to open up this lengthy one at this moment in time... :) – otiuuaugusto Dec 11 '22 at 21:24
  • @otiuuaugusto also please read https://tex.stackexchange.com/help/someone-answers – Rmano Dec 12 '22 at 12:07