CircuiTikZ: How to change the node options of labels and annotations?

The usual TikZ methods work, of course. Just add the node options to the path.

\documentclass[border=5mm]{standalone}
\usepackage[american]{circuitikz}
\begin{document}
    \begin{circuitikz}[thick]
        \draw[nodes={align=center}] (0,0) to[V, l= some very \\ long label  ,a=some very \\ long annotation] ++(2,0);
    \end{circuitikz}
\end{document}

enter image description here

Of course, you can distinguish between the labels, too.

\documentclass[border=5mm]{standalone}
\usepackage[american]{circuitikz}
\begin{document}
    \begin{circuitikz}[thick]
        \draw (0,0) to[V,nodes={align=center}, l= some very \\ long label  ,
        nodes={align=left,},a=some very \\ long annotation] ++(2,0);
    \end{circuitikz}
\end{document}

enter image description here

Or, for more complex operations, change locally the style of that element.

\documentclass[border=5mm]{standalone}
\usepackage[american]{circuitikz}
\begin{document}
    \begin{circuitikz}[thick]
        \draw (0,0) to[V,nodes={align=center}, l= some very \\ long label,
        bipole annotation style/.style={text=white,fill=blue,align=left},
        a=some very \\ long annotation] ++(2,0);
    \end{circuitikz}
\end{document}

enter image description here


Labels are actually implemented as separate nodes, so if you want to do something fancy, you might as well use separate nodes. With \centering, \\ works better than \newline.

Note that the actual width (5cm) is larger than the text, but since the text is centered you can't tell. You might also look at the varwidth package.

\documentclass[border=5mm]{standalone}
\usepackage[american]{circuitikz}

\begin{document}
    \begin{circuitikz}[thick]
        \draw (0,0) to[V, l={\parbox[b]{5cm}{\centering some very \\ long label}},
          a={\parbox[t]{5cm}{\centering some very \\ long annotation}}] ++(2,0);

        \draw (3,0) to[V, name=V1] ++(2,0);
        \node[above, text width=5cm, align=center] at (V1.n) {some very \\ long label};
        \node[below, text width=5cm, align=center] at (V1.s) {some very \\ long annotation};
    \end{circuitikz}
\end{document}

demo


Crude hack: put the label and annotation in a tabular environment.

\documentclass[border=5mm]{standalone}
\usepackage[american]{circuitikz}
\newcommand\ml[3][c]{\begin{tabular}[#2]{@{}#1@{}}#3\end{tabular}}
\begin{document}
    \begin{circuitikz}[thick]
      \draw (0,0) to[V, l=\ml{b}{some very \\ long label}  ,a=\ml{t}{some very \\ long
      annotation}] ++(2,0);
    \end{circuitikz}
\end{document}

enter image description here