[Tex/LaTex] How to center a circuitikz figure

circuitikzhorizontal alignmenttikz-pgf

I want to center the following code:

\documentclass{article}
\usepackage[european]{circuitikz}
\usepackage{amsmath}

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[h]
\begin{center}
\begin{circuitikz}
\draw
node[ocirc] (A) at(0,0) {}
node[ocirc] (B) at(0,-1) {}
node[currarrow, rotate = -90] at(0, -0.75) {};
\draw
(0, -0.75)
to[short, l=$U_1$] (0, -0.2); 
\draw (0,-1.05)
node[rground]{};
\draw (0,0)
to[R=$R_2$, o-*](3,0)
to[R=$R_2$, -*](6,0)
to[R=$R_2$, -*](9,0)
to[R=$R_2$, -*](12,0)
to[R=$R_1$, -*](15,0)
to[short, i=$I_2$, -o](16,0);
\draw (3,0)
to[short](3,1.5)
to[R=$R_3$](6,1.5)
to[short](15,1.5)
to[short](15,0);
\draw (4.5,-2)
node[op amp,yscale=1.01] {};
\node at (1.5,-5) {$
\begin{aligned}
\text{Ausgangsstrom:} \quad 
I_2 = \frac{U_1}{R_1} \quad \text{für}\; R_3=R_2-R_1
\end{aligned}
$};
\end{circuitikz}
\caption{Spannungsgesteuerte Stromquelle ohne Gleichtaktaussteuerung}
\end{center}
\end{figure}

\end{document}

Not centered circuit

Do not wonder why the circuit is not ready. Why does the \begin{center} and \end{center} command not work?

Best Answer

Well, Harish Kumar was faster than me ..., anyway, since as a matter of fact give answer in my comment, I just "publish" my redrawing of your circuits. I simplified it a bit, however in general it is similar to Harish Kumar answer:

\documentclass{article}
\usepackage[hmargin={30mm,30mm},
            height=247mm,
            a4paper]{geometry}
\usepackage[european]{circuitikz}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{showframe}

\begin{document}

\begin{figure}[h]\centering
\begin{circuitikz}
\draw   (0,0)   to[R=$R_2$, o-*]        ( 2,0)
                to[R=$R_2$, -*]         ( 4,0)
                to[R=$R_2$, -*]         ( 6,0)
                to[R=$R_2$, -*]         ( 8,0)
                to[R=$R_1$, -*]         (10,0)
                to[short, i=$I_2$, -o]  (11,0)
%   
        (2,0) -- (2,1.5) to[R=$R_3$]  (4,1.5) -| (10,0)
%
        (0,-1)  to[short, o-] (0,-1.2)node[rground] {};
\draw[shorten <=1mm,shorten >=1mm, ->]
        (0,0) -- node[left] {$U_1$} (0,-1);
\node[op amp,yscale=1.01] at (3.5,-2)  {};
\node at (3,-5) {Ausgangsstrom: $I_2 = \frac{U_1}{R_1}$ für $R_3=R_2-R_1$};
\end{circuitikz}
\caption{Spannungsgesteuerte Stromquelle ohne Gleichtaktaussteuerung}
\end{figure}
\end{document}

enter image description here

Related Question