# CircuiTikZ - change position of voltage label along open draw

Is there a way to adjust the appearance of an voltage label between two points? For default the label $U_1$ will be placed midway of the voltage arrow, but I want it to appear at a point realtive to the length of the voltage arrow, for example at quarter way or at 70% way.

\usepackage[americaninductors, straightvoltages]{circuitikz}

\begin{document}
\begin{circuitikz}
\draw (0,0) to [open, v^=$U_1$] (2,0);
\end{circuitikz}
\end{document}


It depends basically on how new is your circuitikz. Since 1.2.1 you can use the coordinates for voltages and do something like that:

\documentclass[a4paper,12pt]{article}
\usepackage[EFvoltages, americaninductors, straightvoltages]{circuitikz}

\begin{document}
\begin{circuitikz}
\draw
(0,0) to [open, v, name=O1] (2,0);
\draw [thin, -Triangle] (O1-Vfrom) -- (O1-Vto) node[above, pos=0.2]{$U_1$};
\end{circuitikz}
\end{document}


Notice that I added the voltage direction option (please look at the warnings!). I copy here the relevant part of the manual...

I hope to have understand well. You can shift the label manually using with the command \mkern<value>...just this is like an example.

\documentclass[a4paper,12pt]{article}
\usepackage[americaninductors, straightvoltages]{circuitikz}

\begin{document}
\begin{circuitikz}
\draw (0,0) to [open, v^=$U_1$] (2,0);
\draw (0,0) to [open, v^=$\mkern30mu U_2$] (2,0);
\end{circuitikz}
\end{document}


• thanks, but I'm rather searching for an option to define a position relative to the length of the arrow. Like at the beginning or at quarter way. Aug 27 '20 at 16:12
• @DraUX Hence your question is relative to the lenght of an arrow (voltage)? If you prefer I delete my answer or later I will read the recent manual of circuitikz. Aug 27 '20 at 16:16
• I tried to specify my question. I hope it makes clear, for what I'm searching. Aug 27 '20 at 16:26

one solution is an extra node at the right position and replace the voltage label with a protected space like this

\documentclass[a4paper,12pt]{article}
\usepackage[americaninductors, straightvoltages]{circuitikz}

\begin{document}
\begin{circuitikz}
\draw
(0,0) to [open, v=\ ] (2,0)
(0.5,0) node[above]{$U_1$};
\end{circuitikz}
\end{document}


but its not a very smart solution...