7

I tried this:

\documentclass{scrartcl}
\usepackage[european, cuteinductors]{circuitikz}
\usetikzlibrary{arrows.meta, bending}
%wished arrow tip
\tikzset{> = Latex}

\begin{document}
  \begin{circuitikz}
    %this circuit shouldn't make sense
    \draw (0, 0) to [V = $U$, i = $I$] (0, 3)
                 to [vR = $R$, v<= $u_R$, i<= $i$] (3, 3)
                 to [C = $C$, v<= $u_C$, i<= $i$] (6, 3)
                 to [closing switch, v<= $u$, i<= $i$] (9, 3)
                 to [sV = $u$, i = $i$] (9, 0)
                 to [I<= $I$, v = $u$] (6, 0)
                 to [L = $L$, v<= $u_L$, i<= $i$] (3, 0)
                 to [sI<= $i$, v = $u$] (0, 0)
          (3, 3) to [opening switch, v = $u$, *-*] (3, 0)
          (6, 3) to [open, v = $u$, o-o] (6,0);
    %extra nodes for the mesh arrow
    \node (left of L)    at (3.5, .75) {M};
    \node (right of L) at (5.5, .75) {};
    \node (left of C)    at (3.5, 2) {};
    \node (right of C) at (5.5, 2) {};
    %the mesh arrow
    \draw
      [->] (right of L.west) .. controls (right of C.west) and (left of C.east)
                             .. (left of L.east);
  \end{circuitikz}
\end{document}

But it doesn't work. Any suggestions?

Thank you for your help and effort in advance!

Su-47
  • 2,508

1 Answers1

5

Unfortunately the arrow shape used in circuitikz is actually a node, of shape currarrow defined in the package. Hence, there is no easy way to change the shape to another arrow tip.

You can redefine the currarrow shape with something like the following:

\makeatletter
\pgfdeclareshape{currarrow}{
    \anchor{center}{
        \pgfpointorigin
    }
    \behindforegroundpath{      

        \pgfscope
        \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
        \divide \pgf@circ@res@step by 16
        \pgfsetarrows{->}
        \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
        \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@step}{0pt}}
        \pgfusepath{stroke}
        \endpgfscope
    }
}
\makeatother

This code simply redefines the shape to draw a simple line with the default arrow tip. Using \tikzset{> = Latex} then has the expected behavior.

rendering

  • Hello @TonioElGringo! Thank you for your answer! It looks almost good, but the arrow tips of the variable resistor and switches are still different. Is there a way to change them too? – Su-47 Oct 31 '17 at 21:48
  • @Su-47 unfortunately, the arrow tip for these components is hard coded to latex' in the package. You should open a request directly to the package author to ask for this feature. I think allowing more generic arrow tips in this package would be an easy fix. – TonioElGringo Nov 07 '17 at 13:22
  • Hello @TonioElGringo! Thank you for your comment! Sorry for the long delay. Hmm, I don't have a GitHub account. I'll see what one can do... – Su-47 Nov 17 '17 at 22:46
  • (2022-09-22) Notice that there is some more flexibility now (although much of the "arrows" are still hardcoded, for example, transistors one, etc. --- and not easy to change, too, because of delicate positioning issues; contributions would be most welcome). For currents, flows, and voltages, there is now the option of "enhanced v,i,f" that lets you access the relevant coordinates and draw your personal arrows. – Rmano Sep 22 '22 at 09:41
  • @Rmano Is there any documentation on this option ? I looked around but only found older posts on SE and the documentation points to https://tex.stackexchange.com/questions/549347/circuitikz-arrowhead/549354#549354 – A. Licari-Guillaume Dec 25 '23 at 09:20
  • @A.Licari-Guillaume, not really, no; circuitikz arrows are not TikZ arrows, really. There are several shapes used for that. I'd like to change that someday, but it's a lot of work... a "retirement project" ;-) – Rmano Dec 25 '23 at 16:44