3

I have this issue where a voltage source won't invert the current coming out of it, it will only rotate the signs, the arrow will still come from the south of the node.

error

I basically need the current i coming out from the plus sign with both on the north, that is, the left source should be exactly like the one on the right. All sources drawn in a loop fashion, that is:

\draw
    (0, 0)  --
    (0, 0) to [V, i=$i$] (0, 3) --
    (3, 3) to [V, i=$i$] (3, 0) --
    (0, 0);

MWE for picture above

\documentclass[tikz]{standalone}
\usepackage[USenglish]{babel}
\usepackage[american, siunitx]{circuitikz}

\usetikzlibrary{babel}

\begin{document}

    \begin{tikzpicture}

        \draw [fill] (1.5, 3) circle (0.3ex) node [above] {a}; 
        \draw
            (0, 0)  --
            (0, 0) to [V, i=$i$] (0, 3) --
            (3, 3) to [V, i=$i$] (3, 0) --
            (0, 0);

    \end{tikzpicture}

\end{document}

MWE for attempts at fixing it

\documentclass{article}

\usepackage[USenglish]{babel}
% \let\latinencoding\relax

\usepackage[american, siunitx]{circuitikz}

\usetikzlibrary{babel}

\begin{document}

    \begin{center}

        \begin{circuitikz}

            \draw   (1,0) -- 
                    (0,0) to [V, invert, v=$V$, i=$i$]  (0,3)
                          -- (1,3);

        \end{circuitikz}

    \end{center}

\end{document}

With (0,0) to [V, invert, v=$V$, i=$i$] (0,3)

normal

With (0,0) to [V, v=$V$, i=$i$] (0,3)

invert

With (0,0) to [V, invert, v=$V$, i>=$i$] (0,3)

enter image description here

3

if i understood correctly, than you looking for

enter image description here

\documentclass[margin=3mm]{standalone}
\usepackage[american, siunitx]{circuitikz}

\begin{document}
    \begin{tikzpicture}
\draw   (0,0)   to [V, i_>=$i$, invert]     (0,3)
                to [short, -*]  (1.5,3) --  (3,3)
                to [V, i=$i$]   (3.0,0) --  (0,0);
    \end{tikzpicture}
\end{document}
  • Good looking out playboy. Seems like the fix was a simple _. I thought that _ was only for where to place the labels, had no idea about it setting where to place the parameters. Thanks. – Suppboi Aug 31 '18 at 6:28
  • @Suppboi, who/what is the playboy? invert invert element, in your case voltage source. for details see circuitikz documentation, page 43 (5.8 Mirroring and Inverting), – Zarko Aug 31 '18 at 6:33
4

By the manual you can control the orientation for currents using i>={Text} or i<={text} ... and their direction from voltage i>_={Text}, i<_={text}


ERRATUM

Seeing the result you want, I see that my solution was bad, @ zarko's answer uses and writes in the correct circuitikz syntax.

So it only remains to clarify the relative coordinates, using it allows to change the position of the entire circuit depending only on the initial coordinate, also that no longer consistent with the syntax of circuitikz it is possible to draw some segments in reverse and get the result, of course a bad practice but it serves to see the flexibility of tikz.

Additionally in green the options to reverse the current the position of the label and the side relative to the voltage node.

RESULT: enter image description here

MWE:

\documentclass[tikz]{standalone}
\usepackage[USenglish]{babel}
\usepackage[american, siunitx]{circuitikz}
\usetikzlibrary{babel}
\begin{document}
    \begin{tikzpicture}[
        %Environment styles.
        Note/.style={
            anchor=south,
            align=center,
            font=\scriptsize
        }
    ]
    \draw
    (0,0) node[anchor=south]{a}
        to [short,*-] ++ (1.5,0)
        to [V,i=$i$] ++ (0,-3)
        to [short] ++ (-3,0)
        to [V,i_>=$i$,invert] ++ (0,3)
        to [short] ++(1.5,0);

    \draw[color=blue]
    (6,0) coordinate (init) node[anchor=south]{a}
        to [short,*-] ++ (1.5,0)
        to [V,i=$i$] ++ (0,-3)
    (init)
        to [short] ++(-1.5,0)
        to [V,i=$i$] ++ (0,-3) -- ++(3,0);

    \draw[color=green!50!black]
    (-1.5,-5) coordinate (init2) node[Note]{Normal \\ \verb+i=$i$+}
        to [V,i=$i$] ++ (0,-3)
    (init2)++(1.5,0) node[Note]{Equivalent \\ \verb+i<=$i$+}
        to [V,i<=$i$] ++ (0,-3)
    (init2)++(3,0) node[Note]{Current \\ Reversed \\ \verb+i>=$i$+}
        to [V,i>=$i$] ++ (0,-3)
    (init2)++(4.5,0) node[Note]{Label \\ position \\ change\\ \verb+i_=$i$+}
        to [V,i_=$i$] ++ (0,-3)
    (init2)++(6,0) node[Note]{Equivalent \\ side \\ change\\ \verb+i^<=$i$+}
        to [V,i^<=$i$] ++ (0,-3)
    (init2)++(7.5,0) node[Note]{Current rev. \\ and side \\ change\\ \verb+i^>=$i$+}
        to [V,i^>=$i$] ++ (0,-3)
    (init2)++(9,0) node[Note]{Current rev. \\ side and \\ label \\ change\\ \verb+i_>=$i$+}
        to [V,i_>=$i$] ++ (0,-3);

        \end{tikzpicture}
\end{document}

Why tikz picture environment in standalone document class? It allows you to import the pdf output from the tikz standalone class using graphicx package, without loosing svg or vector properties, within figure environment in the main document scaled by the value \textwidth in:

\includegraphics[width=\textwidth]{tikz_drawing_in_standalone_class_pdf_output.pdf}
  • The arrow has to come out from the north of the source, and the plus sign must be on the north and the negative on the south – Suppboi Aug 31 '18 at 5:30
  • @Suppboi added a correction... – J Leon V. Aug 31 '18 at 5:41
  • is there any documentation on why absolute coordinates wont work? – Suppboi Aug 31 '18 at 5:48
  • I see what you did, you drew it from top to bottom. It needs to be done from bottom to top. In other words, the arrow must come out from the opposite side from which the source started being drawn, so that you can loop it with some more elements and have it in a single \draw statement. The problem I have is: if you loop two sources sourcing a single node north of the sources, one source will inevitably be wrong, if you were to draw the whole circuit with a single \draw statement – Suppboi Aug 31 '18 at 5:55
  • @J Leon V. I added a thorough description of the result I am looking for. – Suppboi Aug 31 '18 at 6:07

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.