4

The problem seems to result from the 'auto' option of tikzpicture. I have this problem as part of a bigger tikzpicture which mixes elements like blocks with circuitikz elements. Therefore the 'auto' option is handy, but somehow conflicts with circuitikz's labeling. So I have the following minimal example:

\documentclass[]{standalone}
\usepackage{circuitikz}

\begin{document}
\begin{tikzpicture}[auto]
    \draw (0,0) to[L, l=$L$, i=$i_L$] (3,0);
\end{tikzpicture}
\end{document}

Which results in: Slightly misplaced arrow tip

The tip of the arrow of the current label is not exactly on the line, but rather slightly above it. If the 'auto' option is not used, everything is fine.

I do not understand why this happens. Can someone explain this behavior? Is there a way to use 'auto' and circuitikz together?

Thanks

  • which version of circuitikz are you using? I am getting error with version: 0.8.3 – nidhin Oct 29 at 13:54
  • @nidhin I'm using version 0.9.5. I updated from 0.9.4 since I thought that might play a role. – quexor Oct 29 at 14:06
  • 3
    How about just switching off auto in that path? \draw (0,0) to[L, l=$L$, i=$i_L$,auto=false] (3,0);. – Schrödinger's cat Oct 29 at 18:17
  • 1
    The arrow is also a node. I am not sure what auto is doing here... I will check when I can. At least I'll add a notice to the manual ;-) – Rmano Oct 29 at 21:23
  • 1
    @Schrödinger'scat thanks --- I applied your suggestion on the main repository. So it will be fixed (swept under the carpet? ;-) maybe) with the next version, if no one says that the fix is wrong... github.com/circuitikz/circuitikz/issues/307 github.com/circuitikz/circuitikz/pull/308 – Rmano Oct 30 at 9:00
4

Disable auto for current arrow by setting:

\ctikzset{i/.append style={auto=false}}

enter image description here

\documentclass[border=3mm]{standalone}
\usepackage{circuitikz}
\ctikzset{i/.append style={auto=false}}
\begin{document}
\begin{tikzpicture}[auto]
\draw (0,0) to[L, l=$L$, i=$i_L$] (3,0);   
\draw (0,-1) -- ++(4,0) node[midway]{\texttt{auto} works};
\end{tikzpicture}
\end{document}
  • 1
    Yes, that's a convenient way to deal with it :) Actually, voltage arrows face the same problem which can be fixed this way too: v/.append style={auto=false}. – quexor Oct 30 at 8:13
  • @quexor voltage arrows are also fixed with i/.append style={auto=false}. – nidhin Oct 31 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.