Tikz - 更改 pmos 的符号

Tikz - 更改 pmos 的符号

在这样简单的代码中出现的默认 pmos 符号

\documentclass{article}
\usepackage{tikz}
\usepackage{circuitikz}

\begin{document}
\begin{center}
\begin{tikzpicture}[american]

\ctikzset{tripoles/mos style/arrows}

\draw (0,0) node[pmos,anchor=source] (M1){}; 

\end{tikzpicture}
\end{center}
\end{document}

它的门上有一个粗体点。我找到了一些代码,可能是组件的定义源文件,在行\pgfcircdeclaremos{pmos}

无论是否使用该源文件,有没有办法删除点?

我想要获得一个与 nmos 符号完全相等的 pmos 符号(除了箭头不同),所以我想从 pmos 中移除点但不移除箭头。

答案1

以下是一个可能的解决方案。我已将pmos定义从pgfcirctripoles.sty文件复制到序言中,并注释掉了绘制圆圈的最后几行。就这样。

\documentclass{article}
\usepackage{tikz}
\usepackage{circuitikz}

\makeatletter
\pgfcircdeclaremos{pmos}{
          \anchor{S}{
            \northeast
          }
          \anchor{source}{
            \northeast
          }
          \anchor{D}{
            \northeast
            \pgf@y=-\pgf@y
          }
          \anchor{drain}{
            \northeast
            \pgf@y=-\pgf@y
          }
}{%
            \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}}
            \pgfpathlineto{\pgfpoint
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left}
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}}
            \pgfusepath{draw}

        \ifpgf@circuit@mos@arrows
            \pgfscope             
            \pgfslopedattimetrue 
            \pgfallowupsidedownattimetrue
            \pgfresetnontranslationattimefalse
            \pgftransformlineattime{.4}{%
                \pgfpoint%
                    {\pgf@circ@res@right}%
                    {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}%
            }{%
                \pgfpoint
                    {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left}%
                    {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}%
            }
            \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
            \endpgfscope
        \fi

            \pgfscope
            \pgfpathmoveto{\pgfpoint
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left}
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@up}}
            \pgfpathlineto{\pgfpoint
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left}
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@down}}
            \pgfsetlinewidth{2\pgflinewidth}
            \pgfusepath{draw}
            \endpgfscope

            \pgfpathmoveto{\pgfpoint
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left}
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}      

            \pgfpathmoveto{\pgfpoint
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left}
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}}
            \pgfpathlineto{\pgfpoint
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left}
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}}


            \pgfpathmoveto{\pgfpoint
                {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left}
                {\pgf@circ@res@up+\pgf@circ@res@down}}
            \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}}
            \pgfusepath{draw}

%           \pgfpathcircle{\pgfpoint
%               {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left - \pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgfkeysvalueof{/tikz/circuitikz/bipoles/length}}
%               {\pgf@circ@res@up+\pgf@circ@res@down}}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgfkeysvalueof{/tikz/circuitikz/bipoles/length}}
%           \pgfusepath{draw,fill}      

}
\makeatother

\begin{document}
\begin{center}
\begin{tikzpicture}[american]

\ctikzset{tripoles/mos style/arrows}

\draw (0,0) node[pmos,anchor=source] (M1){new pmos}; 

\draw (0,2) node[nmos,anchor=source] (M2){nmos}; 
\end{tikzpicture}
\end{center}
\end{document}

在此处输入图片描述

相关内容