TransWikia.com

How can I center my circuit?

TeX - LaTeX Asked on November 1, 2021

documentclass[11pt,letterpaper]{article} 

usepackage[latin1]{inputenc}
usepackage{graphicx}
usepackage{geometry}[top=2cm,bottom=2cm,hmargin=2.5cm]
usepackage[american]{circuitikz}

begin{document}


begin{figure}centering

begin {circuitikz} [scale = 0.7] [american][H]
draw

(0,0) node[op amp] (opamp1) {}

(6,-0.7) node[op amp] (opamp2) {}

(opamp1.-) to [short,-] ++ (-2,0)

to [R, l_=$1K$] ++(-5,0) node[left]{$V_1$}

to [V, l_=$3;V$] ++(0,-3)

to node[ground]{} ++(0,0)



(-6.5,-4) to node[ground]{} ++(0,0)

to [V, v=$6;V$, invert] ++(0,3)

to [R, l_=$1K$] ++(3,0)

to [short,-*] ++(0,1.7)

to [short,-] ++(0,3)

to [R, l_=$1K$] ++ (3,0)

to[short,-] ++(0,0) coordinate (leftC)

to (leftC -| opamp1.out)

to[short,-*] (opamp1.out)

  

(opamp1.+) to [short,-] ++ (-1,0)

to node[ground]{} ++(0,-1)



(opamp1.out) [short,-] ++(0,0)

to [R, l_=$1K$] ++ (2,0) 

coordinate (leftC)

to (leftC -| opamp2.-)

to[short,-] (opamp2.-)



(opamp2.-) to [short, *-] ++(0,3) 

 to [short, -] ++(2,0) 

to [R, l_=$2K Omega$] ++(3,0)

to [short, -] ++(0,-3.7) 

coordinate (leftC) 

to (leftC -| opamp2.out)

to[short,-] (opamp2.out)  



(opamp2.up) to [short, -]  ++(0,5)

to [short, -] ++(8,0)

to [V,l_=$15v$] ++(0,-4) 

to [V,l_=$15v$] ++(0,-4) 

 to[short,-] ++(0,0) coordinate (leftC)

  to (leftC -| opamp2.down)

  to[short,-] (opamp2.down)



(opamp1.up) to [short, -]  ++(0,4.3)

to [short, -] ++(6,0)

 

(opamp1.down) to [short, -]  ++(0,-2.15)

to [short, -] ++(6,0)



(opamp2.+) -| ++(0,-0.4) node[ground]{}



(opamp2.out) to [short, -o] ++(3,0) node[right]{$V_o$}



(13.9,0)[short,*-] ++(0,1) to node[ground]{} ++(2,0)

;

end{circuitikz}

end{figure}

end{document}

enter image description here

2 Answers

I would redraw your circuit scheme as follows:

documentclass[11pt]{article}
usepackage[letterpaper, 
            vmargin=2cm, hmargin=2.5cm]{geometry}
usepackage[american,siunitx]{circuitikz}

%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%

begin{document}
    begin{figure}
    centering
    ctikzset{bipoles/length=1cm, nodes width=0.08}
begin{circuitikz}
node[op amp] (oa1) {};
draw   (oa1.out)   to [R=1<kiloohm>,*-*] ++ (2,0)
                    node[op amp,anchor=-] (oa2) {}
        (oa1.-)     -- ++ (-1,0)                coordinate (aux1)   
                    --  ++ (0,1)                coordinate (aux2)
                    to [R=1<kiloohm>] ++ (2,0) 
                    --  (aux2 -| oa1.out) -- (oa1.out)
        (oa1.+)     -- ++ (0,-0.5) node[ground] {}
%
        (aux1)      to [R=1<kiloohm>,*-] ++(-3.5,0) node[left] {$V_1$}
                    to [V_=3<volt>] ++ (0,-1.5)
                    node[ground] {}
        (aux1)      -- ++ (0,-1)
                    to [R=1<kiloohm>] ++(-2,0) node[left] {$V_1$}
                    to [V_=6<volt>] ++ (0,-1.5)
                    node[ground] {}
%%
        (oa2.out)   to [short,  -*] ++ (1,0)    coordinate (aux3)
        (oa2.-)     |-  ++ (1,1)                coordinate (aux4)
                    to [R=2<kiloohm>]  (aux4 -| aux3) -- (aux3)
                    to [short, -o] ++ (1,0) node[right] {$V_o$}
        (oa2.+)     -- ++ (0,-0.5) node[ground] {}
%%% suply
        (oa1.up)    |- ($(oa2.up)+(0,2)$)       
                    -- ++ (4,0)                 coordinate (aux5)
        (oa2.up)    -- (oa2.up |- aux5)
        (aux5)      to [V_=15<volt>,-*]    (aux5 |- oa2.out)
        (oa1.down)  |- ($(oa2.down)-(0,2)$)
                    -- ++ (4,0)                 coordinate (aux6)
        (aux5 |- oa2.out)   to [V_=-15<volt>]    (aux6)
        (aux5 |- oa2.out)   -| ++ (1,-0.5) node[ground] {}
    ;
end{circuitikz}
    end{figure}
end{document}

which after compilation gives:

enter image description here

(red lines mark text width)

In above MWE are in comparison to yours changed:

  • size of bipoles are reduced
  • used is siunitx notation for units
  • all circuits elements are positioned relative to neighbors one and slightly reduced
  • image scaling is omitted
  • also is omitted unknown circuitikz option H

Edit: Corrected is scheme. Now is as OP provide it in question.

Answered by Zarko on November 1, 2021

Remove centering and add the following line for hspace -- rest no change -- your figure will always extend into margins being large

enter image description here

begin{figure}
hspace{-2cm}
........
end{figure}

Answered by js bibra on November 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP