# help for better circuitikz code

Does someone know how to get this result easier (without define the text in x/y-coordinates) and with possibilitiy of linebreaks?

\documentclass[]{scrbook}

\usepackage{circuitikz}

\begin{document}

\begin{circuitikz}[scale=1]
% How can I get this easier?
% Like this, but it does not work
% \node [ocirc, label=left:left-aligned{VCC1 out\newline IC523}] (z) at (2,1.5) {};
\node [ocirc, label={[xshift=-1.15cm, yshift=-0.1cm]VCC1 out}] (y) at (2,1.5) {};
\node [ocirc, label={[xshift=-1.0cm, yshift=-0.5cm]of IC523}] (x) at (2,1.5) {};
%
\draw [short,-o] (2,1.5) to [R, l_=$R1$] (5,1.5) to [short,-*] (5,1.5);
\draw (2,1.5) to [R,  l=$30 Ohm$] (5,1.5);
% how to define R2'' and 30 Ohm'' in one line?
% \draw (5,1.5) to [R, l_=$R2$, l=$30 Ohm$] (8,1.5) to [short,-*] (8,1.5);
% does not work
\draw (5,1.5) to [R, l_=$R2$] (8,1.5) to [short,-*] (8,1.5);
\draw (5,1.5) to [R, l=$30 Ohm$] (8,1.5);
%
\draw (8,1.5) to [C, l_=$C$] (11,1.5) to [short,-o] (11,1.5);
%How can I get MKS4-100 $100nF$ $100V$ RM7.5 in 4 lines?
% \draw (8,1.5) to [C, l=MKS4-100 \newline $100nF$ \newline $100V$ \newline RM7.5] (11,1.5);
% does not work
\draw (8,1.5) to [C, l=MKS4-100 $100nF$ $100V$ RM7.5] (11,1.5);
\node [ocirc, label=right:{out}] (y) at (11,1.5) {};

\end{circuitikz}

\end{document}


• Note: I edited my answer a bit after you accepted it, removing a bit more unnecessary code. – Torbjørn T. Nov 25 '17 at 22:35

In addition to the standard label, added with l, there is the possibility to add an "annotation", with a. Both can have _ or ^ after it to set the position. So you can do l_={..},a^={..}.

For nodes, you can add align=left (or center or right) to the options, and then you can use \\ to add a line break. I'm not very familiar with circuitikz, so I don't know how to add that style to a l label though, so I used a tabular instead, for the four-line label.

Note also the use of siunitx to write numbers with units. In general you can use \SI{number}{unit}, for circuitikz labels/annotations you use the shorthand number<unit>, as in the code below.

The entire thing can be written as a single path, without any repetitions of coordinates, as seen below:

\documentclass[]{scrbook}

\usepackage[siunitx]{circuitikz}

\begin{document}

\begin{circuitikz}[scale=1]
\draw [short,-o] (2,1.5)
node[ocirc,label={[align=left]left:VCC1 out\\of IC523}]{}
to [R, l_=$R_1$,a^=30<\ohm>,-*] (5,1.5)
to [R,l_=$R_2$,a^=30<\ohm>,-*] (8,1.5)
to [C, l_=$C$,a^={%
\begin{tabular}[b]{c}
MKS4-100\\

• Nice. You need a quite new version of circuitikz, tough... it's nice that you can download it as a single file from circuitikz.github.io/circuitikz – Rmano Nov 25 '17 at 22:35