我正在尝试将一些体二极管定制复制到我自己的电路中,但没有取得太大成功。编译器似乎无法识别该样式。/color=whatevercoloritis..
作为最后的资源,我只是将示例代码复制并粘贴到我的环境中,但它也无法引入颜色。
代码如下所示(与手册 1.6.0 第 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}
我也尝试通过 修改颜色\ctikzset{tripoles/nigfete/bodydiode color./initial=gray}
。但是,即使没有弹出任何警告/错误消息,它也没有改变任何东西。
为了确定它是否\ctikzset...
正常工作,我尝试改变体二极管的规模,并且它工作正常,如下面的例子所示。
默认值:
\draw (0,0) node[nigfete, anchor=D, bodydiode] (S1) {$S_1$} ;
修改后的体二极管尺度:
\ctikzset{tripoles/nigfete/bodydiode scale/.initial=0.8}
\draw (0,0) node[nigfete, anchor=D, bodydiode] (S1) {$S_1$} ;
为了激活体二极管自定义的样式颜色,文档开头是否有任何特定的包需要加载,而我却没有找到?我还可以引入其他什么东西来自定义体二极管的颜色,而无需实际引入与 MOSFET 并联的双极二极管元件吗?
谢谢你!
答案1
第一个问题是你的版本太旧了;关注我需要使用其他版本的 circuitikz。我该怎么做?来解决这个问题。
对于第二个问题,您不能将样式应用于所有nigfete
s,但您可以手动应用它,和/或使用样式:
\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}