I am trying to draw a dimensioned line, <---- 2 cm ---- > in the x, and y directions on a circuit diagram. Using absolute coordinates, there is no problem. However, the display is faulty using relative coordinates, which cuts off part of the circuit. I haven't been able to correct this problem satisfactorily. I welcome any suggestions. A MWE example is included for each case.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC,positioning}
\begin{document}
% circuit with absolute coordinates
\begin{tikzpicture}[circuit ee IEC,
set resistor graphic = var resistor IEC graphic,>=stealth']
\draw (0,0) -- (0,2)
(0,2) to[resistor={info'={R}}](3,2)
(3,2) -- (3,0)
(3,0) to[battery={info'={$V$}}](0,0);
\draw [<->] (-0.6,0) -- (-0.6,2) node[midway,fill=white]{\small{y cm}};
\draw [<->] (-0.2,2.6) -- (3,2.6) node[midway,fill=white]{\small{x cm}};
\end{tikzpicture}
% circuit with relative coordinates
\begin{tikzpicture}[circuit ee IEC, >=stealth',%
set resistor graphic = var resistor IEC graphic]
\node (A) {};
\node (B) [above = 2cm of A] {};
\node (C) [right = 3cm of B] {};
\node (D) [right = 3cm of A] {};
\draw (A.base) -- (B.base)
(B.base) to[resistor={info'={R}}](C.base)
(C.base) -- (D.base)
(D.base) to[battery={info'={$V$}}](A.base);
\draw [<->] (A.west) -- (B.west) node[midway,fill=white]{\small{y cm}}; %!
\draw [<->] (B.north) -- (C.north) node[midway,fill=white]{\small{x cm}}; %!
\end{tikzpicture}
\end{document}
