如何在 circuitikz 中绘制与运算放大器大小相同的三角形?

如何在 circuitikz 中绘制与运算放大器大小相同的三角形?

我有一个放大器,我想将其显示为与运算放大器相同的形状和大小,但没有 + 和 - 符号,也没有两个输入端口...有没有简单的方法可以做到这一点?该plain amp元件有两个输入端口,并且该buffer元件较小。

答案1

以下是我称之为 的形状的定义。将它们包含在您的序言中。下面是将和 并列在一起的simple amp示例。simple ampop amp

\documentclass[border=1mm]{standalone}
\usepackage{circuitikz}
%%% INCLUDE HERE THE CODE FROM BELOW DEFINING "simple amp"
\begin{document}
\begin{circuitikz}
  \draw (0,0) node[simple amp] {};
  \draw (3,0) node[op amp] {};
\end{circuitikz}
\end{document}

在此处输入图片描述

定义simple amp(元素代码的修改副本buffer

\makeatletter
\pgfdeclareshape{simple amp}
    {
      \anchor{center}{\pgfpointorigin}
      \savedanchor\northwest{%
        \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
        \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@y % <<<<< MODIFIED WRT. buffer
        \pgf@y=.5\pgf@y
        \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
        \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@x % <<<<< MODIFIED WRT. buffer
        \pgf@x=.5\pgf@x
      }
      \anchor{south}{
        \northwest
        \pgf@y=-\pgf@y
      }
      \savedanchor\left{%
        \pgf@y=0pt
      }
      \anchor{in}{
        \northwest
        \pgf@y=0pt
      }
      \anchor{out}{
        \northwest
        \pgf@y=0pt
        \pgf@x=-\pgf@x    }
      \backgroundpath{          
            \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}   
            \northwest
            \pgf@circ@res@up = \pgf@y 
            \pgf@circ@res@down = -\pgf@y
            \pgf@circ@res@right = -\pgf@x
            \pgf@circ@res@left = \pgf@x
    \pgfscope
        \pgfsetlinewidth{2\pgflinewidth}
        \pgftransformxshift{.7\pgf@circ@res@left}
        \pgf@circ@res@step=\pgf@circ@res@right
        \advance\pgf@circ@res@step by -\pgf@circ@res@left
        \pgf@circ@res@step=.7\pgf@circ@res@step
        \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
        \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
        \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
        \pgfusepath{draw}
    \endpgfscope
        \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
        \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
        \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
        \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
        \pgfusepath{draw}
      }
    }
\makeatother

相关内容