1

I made this circuit, but I would like to separate the circuit into different subcircuits like the one shown in the image. I would like that by commenting on a subcircuit I can reproduce the other subcircuits, that is, show different parts of the circuit as requested.

enter image description here

\begin{circuitikz}[american]\draw

    %Inicio de la etapa de potencia
    (15,0) node[npn](Q5){$Q5$}
    (Q5.B) --++ (-1,0) coordinate (B)

    to[R,l_=$R_{17}$,*-*]++(0,3.54) coordinate (B1)% node[vcc](VCC){$+10\volt$}%Activar y desactivar para solo esta etapa
    -| (Q5.C)

    (B) to[C,l=$C_{7}$] ++ (-2,0) coordinate (F)%Desactivar para unir con las demás etapas.

    (B) --++(0,-1.5) coordinate (C) --++(1,0) --++ (0,-0.5) node[npn,anchor=C](Q4){$Q_{4}$}
    (C) --++(-1,0) --++(0,-0.71) node[potentiometershape, rotate=-90,anchor=west,label=south west:$R_{V1}$, font=\large](P){}
    (P.wiper) -| (Q4.B)
    (P.east) --++(0,-0.71) --++ (1,0) coordinate (D)
    (D) -| (Q4.E)

    (Q5.E) to[R, l = $R_{13}$,*-*]++ (0,-2) coordinate (A)
    to[C,l=$C_{5}$] ++ (2,0) to [R,l=$R_{L}$,*-*] ++(0,-2) node[vee](VEE){$-10\volt$}
    (A) to[R,l=$R_{14}$,*-*] ++(0,-2) node[pnp,anchor=E](Q6){$Q_{6}$} ++(0,-2)
    (Q6.B) --++(-1,0) coordinate (E)

    to[R,l=$R_{12}$,*-*] ++(0,-2) coordinate (G)% node[vee](VEE){$-10\volt$}%Activar y desactivar para solo esta etapa
    %
    -| (Q6.C)
    (D) -| (E)
    %Fin de la etapa de potencia


    %Inicio de la etapa de Incursora
    (F) to[R,l=$R_{16}$,*-*]++ (0,-7.54) coordinate (F1) -| (G)
    (F) to[C,l=$C_{4}$,*-*]++(-2,0) coordinate (F2) to[R,l=$R_{10}$,*-*] ++(0,-7.54) coordinate (F3) -| (F1)
    (F) node[pnp,anchor=C](Q3){$Q_{3}$} ++(0,2)
    (Q3.E) to[R,l=$R_{11}$,*-*] ++(0,2) coordinate (F4) -| (B1)
    (Q3.E) --++(1,0) to[C,l_=$C_{6}$,*-*]++(0,2) -| (B1)
    (Q3.B) -| (F2)
    (Q3.B) ++ (-1.16,0) coordinate (G1) to[R,l=$R_{15}$,*-*]++(0,2.77) coordinate (F5) -| (F4)

    (G1) to[C,l=$C_{2}$,*-*]++(-2,0) coordinate (G2)%Desactivar para unir con las demás etapas.

    %(F3) ++(1,0) node[vee](VEE){$-10\volt$}%Activar y desactivar para solo esta etapa
    %(F4) node[vcc](VCC){$+10\volt$}%Activar y desactivar para solo esta etapa
    %Fin de la etapa de Incursora


    %Inicio de la Etapa Diferencial
    (G2) to[R,l=$R_{8}$,*-*]++(0,2.77)  coordinate (H1) -| (F5)
    (G2) --++(0,-0.9) coordinate (H2) to[R,l=$R_{9}$,-*] ++(0,-7.41) coordinate(H3) -| (F3)
    (H2)--++(0,-0.6) coordinate (H4) --++(1,0) to[C,l=$C_{3}$] ++(0,-2) node[vee](VEE){$-10\volt$}
    (H4)--++(-0.5,0) node[npn,anchor=B,xscale=-1, label=left:$Q_{2}$](Q2) {}
    (Q2.E) --++ (0,-0.1) coordinate (I1) to[R,l=$R_{7}$] ++(0,-5.94) coordinate (H5) -| (H3)
    (Q2.C) to[R,l=$R_{6}$] ++(0,3.5) coordinate (H6) -| (H1)
    (I1) ++ (0,-1)to[R,l=$R_{5}$]++(-2,0) coordinate(I2) to[R,l=$R_4$] ++ (0,-4.94) coordinate (J1) -| (H5)
    (I2) --++ (0,1.1) node[npn,anchor=E](Q1){$Q_{1}$}
    (Q1.C) to[R,l=$R_{3}$] ++(0,3.5) coordinate(J2) -| (H6)
    (Q1.B) to[C,l=$C_{1}$] ++(-2,0) to[short,label=$V_{in}$,-o] ++(-0.5,0)
    (Q1.B)  ++ (-0.5,0) to[R,l=$R_{2}$] ++(0,-6.81) -| (J1)
    (Q1.B) ++ (-0.5,0) to[R,l=$R_{1}$] ++ (0,4.27) -| (J2)

    %(J1) ++(1,0) node[vee](VEE){$-10\volt$}%Activar y desactivar para solo esta etapa
    %(J2) ++(1,0) node[vcc](VCC){$+10\volt$}%Activar y desactivar para solo esta etapa
    %Fin de la Etapa Diferencial
;\end{circuitikz} 
2
  • Hi, welcome! I have some idea, but could you please post a complete but minimal example, not the fully fledged circuit? And could you specify in which way you want to separate them... As independent figures, as slides in beamer, whatever?
    – Rmano
    Commented Oct 21, 2023 at 9:49
  • Is separate the 3 stages (differential stage, power stage and other stage), in 3 subcircuits. Commented Oct 22, 2023 at 3:23

2 Answers 2

2

I will give you an idea on how I would do it if I need independent figures (like the ones for a book, say) and then a global one.

The trick is to have the main coordinates (starting, rails, etc) defined at the start of the circuit. Then you can draw each one of the stages independently, like in this example:

\documentclass[border=3mm]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}
    % first part. Start at (origin1), rails at VCC, VEE
    \coordinate (origin 1) at (0,0);
    \path (origin 1) ++ (0,4) coordinate(rail +);
    \path (origin 1) ++ (0,-4) coordinate(rail -);
    % drawing the sub circuit 1
    \iffalse
        \draw (origin 1) node[above]{$v_i$} to[short, o-*] ++(0.5,0)
        node[npn, anchor=B](Q1){Q1}
        (Q1.B) to[R] (Q1.B |- rail +) node[vcc]{}
        (Q1.B) to[R] (Q1.B |- rail -) node[vee]{}
        (Q1.C) to[R] (Q1.C |- rail +) node[vcc]{}
        (Q1.E) to[R] (Q1.E |- rail -) node[vee]{}
        (Q1.C) -- ++(1,0) coordinate(out 1);
        \coordinate (origin 2) at (out 1);
    \else
         \coordinate (origin 2) at (0,0);
    \fi
    % ok, now we have first subcircuit drawn.
    % Let's go with the second.
    % drawing the sub circuit 2
    \iftrue
        \draw (origin 2) node[above]{$v_{i_2}$} to[short, o-*] ++(0.5,0)
        node[npn, anchor=B](Q2){Q2}
        (Q2.B) to[R] (Q2.B |- rail +) node[vcc]{}
        (Q2.B) to[R] (Q2.B |- rail -) node[vee]{}
        (Q2.C) to[R] (Q2.C |- rail +) node[vcc]{}
        (Q2.E) to[R] (Q2.E |- rail -) node[vee]{}
        (Q2.C) -- ++(1,0) coordinate(out 2);
    \fi
\end{circuitikz}
\end{document}

If you compile this like it is, you have:

enter image description here

And with the second (or the first) \iftrue transformed to \iffalse, you have:

enter image description here enter image description here

Notice that the two stage are not graphically identical to the joined ones, but they are electrically the same.

Another option is to play with colors (you can wrap the first part of the circuit in scope groups and change for each figure).

\documentclass[border=2.7mm]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
    \begin{circuitikz}[scale=0.7, transform shape]
        % first part. Start at (origin1), rails at VCC, VEE
        \coordinate (origin 1) at (0,0);
        \path (origin 1) ++ (0,4) coordinate(rail +);
        \path (origin 1) ++ (0,-4) coordinate(rail -);
        % drawing the sub circuit 1
        \begin{scope}[color=gray!50]
            \draw (origin 1) node[above]{$v_i$} to[short, o-*] ++(0.5,0)
            node[npn, anchor=B](Q1){Q1}
            (Q1.B) to[R] (Q1.B |- rail +) node[vcc]{}
            (Q1.B) to[R] (Q1.B |- rail -) node[vee]{}
            (Q1.C) to[R] (Q1.C |- rail +) node[vcc]{}
            (Q1.E) to[R] (Q1.E |- rail -) node[vee]{}
            (Q1.C) -- ++(1,0) coordinate(out 1);
            \coordinate (origin 2) at (out 1);
        \end{scope}
        % ok, now we have first subcircuit drawn.
        % Let's go with the second.
        % drawing the sub circuit 2
        \begin{scope}[
            % color=gray!50 % uncomment to gray out the second stage
            ]
            \draw (origin 2) node[above]{$v_{i_2}$} to[short, o-*] ++(0.5,0)
            node[npn, anchor=B](Q2){Q2}
            (Q2.B) to[R] (Q2.B |- rail +) node[vcc]{}
            (Q2.B) to[R] (Q2.B |- rail -) node[vee]{}
            (Q2.C) to[R] (Q2.C |- rail +) node[vcc]{}
            (Q2.E) to[R] (Q2.E |- rail -) node[vee]{}
            (Q2.C) -- ++(1,0) coordinate(out 2);
        \end{scope}
    \end{circuitikz}
\end{document}

enter image description here

Finally, this solution (more or less) works perfectly with beamer:

\documentclass{beamer}
\usepackage[siunitx, RPvoltages]{circuitikz}
\tikzset{% see https://tex.stackexchange.com/q/84513/38080
    invisible/.style={color=gray!50},
    visible on/.style={alt=#1{}{invisible}},
    alt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
    },
  }\begin{document}
\begin{frame}
    \begin{circuitikz}[scale=0.7, transform shape]
        % first part. Start at (origin1), rails at VCC, VEE
        \coordinate (origin 1) at (0,0);
        \path (origin 1) ++ (0,4) coordinate(rail +);
        \path (origin 1) ++ (0,-4) coordinate(rail -);
        % drawing the sub circuit 1
        \begin{scope}[visible on=<{2,4-}>]
                \draw (origin 1) node[above]{$v_i$} to[short, o-*] ++(0.5,0)
                node[npn, anchor=B](Q1){Q1}
                (Q1.B) to[R] (Q1.B |- rail +) node[vcc]{}
                (Q1.B) to[R] (Q1.B |- rail -) node[vee]{}
                (Q1.C) to[R] (Q1.C |- rail +) node[vcc]{}
                (Q1.E) to[R] (Q1.E |- rail -) node[vee]{}
                (Q1.C) -- ++(1,0) coordinate(out 1);
                \coordinate (origin 2) at (out 1);
            \end{scope}
        % ok, now we have first subcircuit drawn.
        % Let's go with the second.
        % drawing the sub circuit 2
            \begin{scope}[visible on=<3->]
                \draw (origin 2) node[above]{$v_{i_2}$} to[short, o-*] ++(0.5,0)
                node[npn, anchor=B](Q2){Q2}
                (Q2.B) to[R] (Q2.B |- rail +) node[vcc]{}
                (Q2.B) to[R] (Q2.B |- rail -) node[vee]{}
                (Q2.C) to[R] (Q2.C |- rail +) node[vcc]{}
                (Q2.E) to[R] (Q2.E |- rail -) node[vee]{}
                (Q2.C) -- ++(1,0) coordinate(out 2);
            \end{scope}
    \end{circuitikz}
\end{frame}
\end{document}

enter image description here

0
\documentclass{standalone}
\usepackage{tikz}
\usepackage{circuitikz}
\usepackage{pgfplots}
\usepackage{siunitx}


\newcommand{\volt}{\si{\volt}}
\newcommand{\amp}{\si{\amp}}
\newcommand{\ohm}{\si{\ohm}}
\newcommand{\watt}{\si{\watt}}

\ctikzset{%
monopoles/vcc/arrow={Triangle[width=0.8*\scaledwidth, length=\scaledwidth]},
monopoles/vee/arrow={Triangle[width=6pt, length=8pt]},
resistors/thickness=3,
}


\begin{document}
\ctikzsubcircuitdef{power}{in 1,in 3,in 2}{
    coordinate (#1-in 1) to[R,l=$R_{17}$,*-*] ++(0,-4.50) coordinate (#1-in 3)
    (#1-in 3) --++(1.5,0) node[npn,anchor=B](Q5){$Q_{5}$}
    (#1-in 1) -| (Q5.C)
    (Q5.E) to[R,l=$R_{13}$,*-*] ++(0,-2) coordinate (A) to[C,l_=$C_{5}$] ++(2,0) to[R,l=$R_{L}$,*-*] ++(0,-2) node[vee](VEE){$-10\volt$}
    (A) to[R,l=$R_{14}$,*-*] ++(0,-2) node[pnp, anchor=E](Q6){$Q_{6}$}
    (#1-in 3) --++(0,-1.5) coordinate(A1) --++(1,0) --++ (0,-0.5) node[npn,anchor=C](Q4){$Q_{4}$}
    (Q4.E) --++(0,-0.5) --++(-1,0) coordinate(A2)
    (A1) --++(-1,0) --++(0,-0.71) node[potentiometershape, rotate=-90,anchor=west,label=south west:$R_{V1}$, font=\large](P){}
    (P.wiper) -| (Q4.B)
    (P.east) --++(0,-0.71) -| (A2)
    (A2) --++(0,-1.5) coordinate (A3) -| (Q6.B)
    (A3) to[R,l=$R_{12}$,*-] ++(0,-2) coordinate (#1-in 2)
    (Q6.C) --++(0,-1.5) -| (#1-in 2)
}

\ctikzsubcircuitdef{incursora}{in 1, in 2, in 3, out 1, out 2, out 3}{
coordinate (#1-in 3) --++(0.5,0) node[pnp, anchor=B](Q3){$Q_{3}$}
(#1-in 3) to[R,l=$R_{15}$,*-*] ++(0,3.23) coordinate (#1-in 1)
(#1-in 3) --++(0,-1.27) coordinate (B1) to[R,l=$R_{10}$,*-*] ++(0,-7.81) coordinate (#1-in 2)
(Q3.E) to[R,l=$R_{11}$,*-*] ++(0,2.46) coordinate (B3)
(Q3.E) --++(1.5,0) to[C,l=$C_{6}$,*-*] ++(0,2.46) coordinate (#1-out 1) --(B3) -| (#1-in 1)
(Q3.C) --++(0,-0.5) coordinate (#1-out 3) to[R,l=$R_{16}$,*-*] ++(0,-7.81) coordinate (#1-out 2) -| (#1-in 2)
(B1) --++(0.4,0) to[C,l=$C_{4}$] ++(0.5,0) -| (#1-out 3)
}

\ctikzsubcircuitdef{diferential}{in 1,out 1, out 2,out 3}{
    coordinate (#1-in 1) --++(1,0) node[npn, anchor=B](Q1){$Q_{1}$}
    (Q1.C) --++(0,1) coordinate (#1-out 3) to[R,l=$R_{3}$,*-] ++(0,2) coordinate (C)
    (Q1.E) to[R,l=$R_{4}$,*-] ++(0,-6) coordinate (C2)
    (#1-in 1) to[R,l=$R_{1}$,*-*] ++(0,5) -| (C)
    (#1-in 1) to[R,l=$R_{2}$,*-*] ++(0,-7.31) -| (C2)
    (Q1.E) to[R,l_=$R_{5}$,*-*] ++(2.5,0) coordinate (C3) to[R,l=$R_{7}$,*-*] ++(0,-6.54) coordinate (C6) -| (C2)
    (C3) node[npn,xscale=-1, anchor=E,label=left:$Q_{2}$](Q2){} ++(0,1.5)
    (Q2.C) to[R,l=$R_{6}$,*-*] ++(0,4.23) coordinate (C4) -| (C)
    (Q2.B) --++(0.5,0) coordinate (C5) to[R,l=$R_{9}$,*-*] ++(0,-7.31) coordinate (#1-out 2) -| (C6)
    (C5) to[R,l=$R_{8}$,*-*] ++(0,5) coordinate (#1-out 1) -| (C4)
    (C5) --++(1,0) to[C,l=$C_{3}$,*-*] ++(0,-2) node[vee](VEE){$-10\volt$}
}
\ctikzsubcircuitactivate{power}
\ctikzsubcircuitactivate{incursora}
\ctikzsubcircuitactivate{diferential}

\begin{circuitikz}\draw
    (0,0)\incursora{incur}{out 3} to[C,l=$C_{7}$,*-*]++(3,0) \power{power}{in 3}
    (incur-out 1) -| (power-in 1)
    (incur-out 2) -| (power-in 2)
    (incur-in 3) to[C,l=$C_{2}$,*-*]++(-6,0) \diferential{dif}{out 3}
    (incur-in 1) -| (dif-out 1)
    (incur-in 2) -| (dif-out 2)
    (dif-in 1) to[C,l=$C_{1}$,*-*] ++(-2,0) to[short,-o, label=$V_{in}$] ++(-0.5,0)
;\end{circuitikz}
\end{document} 
3
  • Yes, this is nice --- but still you need a strategy to "switch on" each one independently.
    – Rmano
    Commented Oct 23, 2023 at 9:12
  • Yes, but I don't use "switch on". How work it?? Commented Oct 23, 2023 at 23:27
  • 1
    Sorry, I fear we misunderstood each other. I mean that what I tried to do was a way to plot, using the same circuit code, one stage at time...
    – Rmano
    Commented Oct 24, 2023 at 7:10

You must log in to answer this question.

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