# Labelling voltages for a transformer with CircuiTikz

I am drawing a rectifier circuit and I want to label the voltage across a winding of the transformer (the voltage between A1 and A2, also between B1 and L2.midtap, between B2 and L2.midtap). I can only label the voltage across a circuit element, but I want to label the voltage between two nodes.

This looks quite odd and I've no idea why.

Here's my code

\begin{circuitikz}[american, scale=0.8]
\ctikzset{t/.style={
transformer core,
inductors/width=1.8,
inductors/coils=8,
}
\draw (0,4) node[t, anchor=A1](T){};
\node [ocirc] at (T.A1){}; \node [ocirc] at (T.A2){};
\draw (T-L2.midtap) to[short, -*] (T.B1 |- T-L2.midtap) node[ground]{}
to[short,-] ++(1,0)
to[R=$R$,-] ++(1,0)
to[short,-*] ++(1,0) node[name=a]{};
\draw (T.B1) to[D=$D_1$] (T.B1 -| a)
--(a) --(T.B2 -| a);
\draw (T.B2) to[D=$D_2$] (T.B2 -| a);
\end{circuitikz}

• See pages 133-134 of the circuitikz manual for examples of transformers labels. Also, 1cm is not enough room for a resistor. Oct 13, 2023 at 15:13

I added all the labels from the example. See the tikz manual for calc labeling protocol. There are other ways to position the nodes, but I needed to get them to line up for both circ and text.

\documentclass{standalone}
\usepackage{circuitikz}% includes calc

\begin{document}

\begin{circuitikz}[american, scale=0.8]
\ctikzset{t/.style={
transformer core,
inductors/width=1.8,
inductors/coils=8,
}
\draw (0,4) node[t, anchor=A1](T){};
\draw (T.A1) node[below]{$+$}
(T.A2) node[above]{$-$}
($(T.A1)!0.5!(T.A2)$) node{$v_I$}
(T.outer dot A1) ++(0,0.7cm) node[circ]{}
(T.outer dot B1) ++(0,0.7cm) node[circ]{} node[right]{$+$}
(T.outer dot B1) node[right]{$v_S$}
($(T.outer dot B1)!0.4!(T.outer dot B2)$) node[right]{$-$}
($(T.outer dot B1)!0.6!(T.outer dot B2)$) node[circ]{} node[right]{$+$}
(T.outer dot B2) node[right]{$v_S$}
(T.outer dot B2) ++(0,-0.7cm) node[right]{$-$};
\node [ocirc] at (T.A1){}; \node [ocirc] at (T.A2){};
\draw (T-L2.midtap) to[short, -*] (T.B1 |- T-L2.midtap) node[ground]{}
to[R=$R$,-*] ++(3,0) coordinate (a);
\draw (T.B1) to[D=$D_1$] (T.B1 -| a)
--(a) --(T.B2 -| a);
\draw (T.B2) to[D=$D_2$] (T.B2 -| a);
\end{circuitikz}

\end{document}