2
\begin{circuitikz}
\draw (5,2) node[op amp] (opamp) {}
(0.5,2.5) to [short, o-, i^>=$I_{in}$] (2,2.5)
to [R, l=$R_{in}$] (opamp.-)
(0.5,2.5) node[above] {$V_{in}$}
(3.8,1) node [ground] {}
to [short] (opamp.+)
(3.8,3.5) to [R, l=$R_{load}$] (6.2,3.5)
(3.8,3.5) to [short, -*] (opamp.-)
(6.2,3.5) to [short, -*, i^>=$I_{load}$] (opamp.out)
(opamp.out) to [short, -o] (7, 2);
\end{circuitikz}

I have this code, I want to know how to change the plus and minus signs size freely, if it is plausible, bigger, smaller.

Thanks in advance.

1
  • While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. Commented Nov 13, 2014 at 21:14

2 Answers 2

4

I can't see how to patch the command, so if you include a copy of the definition of the op amp shape, you can change it as desired. Below, I have provided a \SetScaleFactor{} macro to show you how to adjust the scale factor applied to the - and + sings of the opamp:

enter image description here

Code:

\documentclass{article}
\usepackage{circuitikz}

\makeatletter
\newcommand*{\@SetScaleFactor}{1}%
\newcommand*{\SetScaleFactor}[1]{\edef\@SetScaleFactor{#1}}%
\newcommand*{\ScaleSymb}[1]{\scriptsize\ \scalebox{\@SetScaleFactor}{#1}}%
\pgfdeclareshape{op amp}
    {
      \anchor{center}{\pgfpointorigin}
      \savedanchor\northwest{%
        \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
        \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@y
        \pgf@y=.5\pgf@y
        \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
        \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@x
        \pgf@x=.5\pgf@x
      }
      \anchor{south}{
        \northwest
        \pgf@y=-\pgf@y
      }
      \anchor{north}{
        \northwest
      }
      \savedanchor\left{%
        \pgf@y=0pt
      }
      \savedanchor\inOne{%
        \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
        \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@y
        \pgf@y=.5\pgf@y
        \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@y
        \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
        \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@x
        \pgf@x=.5\pgf@x
      }   
      \anchor{-}{
        \inOne
      }
      \anchor{+}{
        \inOne
        \pgf@y=-\pgf@y
      }
      \savedanchor\up{%
        \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
        \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/height}\pgf@y
        \pgf@y=.5\pgf@y
        \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
        \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/width}\pgf@x
        \pgf@x=.5\pgf@x
            \pgf@circ@res@up = \pgf@y 
            \pgf@circ@res@right = -\pgf@x
            \pgf@circ@res@left = \pgf@x
        \pgfpointlineattime{
            \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/up pos}}{
            \pgfpoint{
                \pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}
                {\pgf@circ@res@up}}
            {\pgfpoint{.7\pgf@circ@res@right}{0pt}}
      }
      \anchor{up}{
        \up
      }
      \anchor{down}{
        \up
        \pgf@y=-\pgf@y
      }
      \anchor{out}{
        \northwest
        \pgf@y=0pt
        \pgf@x=-\pgf@x
      }
        \anchor{west}{
            \left
          }
          \anchor{east}{
            \left
            \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

    \pgfpathmoveto{\pgfpoint
        {\pgf@circ@res@left}
        {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint
        {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}
        {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}}
    \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@up}]{\ScaleSymb{$-$}}


    \pgfpathmoveto{\pgfpoint
        {\pgf@circ@res@left}
        {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}}
    \pgfpathlineto{\pgfpoint
        {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}
        {\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}}
    \pgftext[left, at=\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/port width}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/op amp/input height}\pgf@circ@res@down}]{\ScaleSymb{$+$}}

    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
    \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}

    \pgfusepath{draw}


    \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
      }
    }
\makeatother

\begin{document}
\begin{circuitikz}
    \draw (5,2) node[op amp, font=\tiny] (opamp) {}
    (0.5,2.5) to [short, o-, i^>=$I_{in}$] (2,2.5)
    to [R, l=$R_{in}$] (opamp.-)
    (0.5,2.5) node[above] {$V_{in}$}
    (3.8,1) node [ground] {}
    to [short] (opamp.+)
    (3.8,3.5) to [R, l=$R_{load}$] (6.2,3.5)
    (3.8,3.5) to [short, -*] (opamp.-)
    (6.2,3.5) to [short, -*, i^>=$I_{load}$] (opamp.out)
    (opamp.out) to [short, -o] (7, 2);

    \node at (5,0) {\textbackslash SetScaleFactor=1 (default)};
\end{circuitikz}
%
\SetScaleFactor{2.0}%
\begin{circuitikz}
    \draw (5,2) node[op amp, font=\tiny] (opamp) {}
    (0.5,2.5) to [short, o-, i^>=$I_{in}$] (2,2.5)
    to [R, l=$R_{in}$] (opamp.-)
    (0.5,2.5) node[above] {$V_{in}$}
    (3.8,1) node [ground] {}
    to [short] (opamp.+)
    (3.8,3.5) to [R, l=$R_{load}$] (6.2,3.5)
    (3.8,3.5) to [short, -*] (opamp.-)
    (6.2,3.5) to [short, -*, i^>=$I_{load}$] (opamp.out)
    (opamp.out) to [short, -o] (7, 2);

    \node at (5,0) {\textbackslash SetScaleFactor=2};
\end{circuitikz}
\end{document}
1
2

An alternative is to define a myopamp macro that erases the default op amp polarities and redraw it with scaling options, as show below.

\newcommand{\myopamp}[2] % #1 = name , #2 = scaling factor
{\draw[thick] (#1){};
 \filldraw[white] (#1.+) +(16pt,0) circle(3pt)  
                  (#1.-) +(16pt,0) circle(3pt);
 \draw[]          (#1.+) +(18pt,0) node(){\scalebox{#2}{$+$}}
                  (#1.-) +(18pt,0) node(){\scalebox{#2}{$-$}};
}

enter image description here

Code

\documentclass[border=5mm]{standalone}  
\usepackage[american,siunitx]{circuitikz}
%\usetikzlibrary{arrows,calc,positioning}

\newcommand{\myopamp}[2] % #1 = name , #2 = scaling factor
{\draw[thick] (#1){};
 \filldraw[white]  (#1.+) +(16pt,0) circle(3pt)  
                   (#1.-) +(16pt,0)circle(3pt);
 \draw[]           (#1.+) +(18pt,0) node(){\scalebox{#2}{$+$}}
                   (#1.-) +(18pt,0) node(){\scalebox{#2}{$-$}};
}

\begin{document}  

\begin{circuitikz}
\node at (5,5) {OP's result};
\draw (5,2) node[op amp] (opamp) {}
(0.5,2.5) to [short, o-, i^>=$I_{in}$] (2,2.5)
to [R, l=$R_{in}$] (opamp.-)
(0.5,2.5) node[above] {$V_{in}$}
(3.8,1) node [ground] {}
to [short] (opamp.+)
(3.8,3.5) to [R, l=$R_{load}$] (6.2,3.5)
(3.8,3.5) to [short, -*] (opamp.-)
(6.2,3.5) to [short, -*, i^>=$I_{load}$] (opamp.out)
(opamp.out) to [short, -o] (7, 2);
\end{circuitikz}



\begin{circuitikz}
\node at (5,5) {Proposed result};
\draw (5,2) node[op amp] (opamp) {};
\myopamp{opamp}{2}  %  add this command here
\draw (0.5,2.5) to [short, o-, i^>=$I_{in}$] (2,2.5)
to [R, l=$R_{in}$] (opamp.-)
(0.5,2.5) node[above] {$V_{in}$}
(3.8,1) node [ground] {}
to [short] (opamp.+)
(3.8,3.5) to [R, l=$R_{load}$] (6.2,3.5)
(3.8,3.5) to [short, -*] (opamp.-)
(6.2,3.5) to [short, -*, i^>=$I_{load}$] (opamp.out)
(opamp.out) to [short, -o] (7, 2);
\end{circuitikz}

\end{document}

You must log in to answer this question.

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