3
\documentclass[a4paper,12pt, DIV=15]{scrartcl}
% Zeichnen
\usepackage{tikz}
\usepackage{circuitikz}

\begin{document}
    \begin{circuitikz}[european, scale=1]
        \draw
            (0,0) to [voltage source, v=$\underline{U}_{in}$]
            (0,2)
        ;
    \end{circuitikz}
\end{document}

outputOfCode

How do I change the direction of the arrow without changing coordinates?

2
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. A suggestion: Do us a favour and change your username to something more telling than "user1234". Sep 20, 2014 at 8:04
  • real name or display name? what is user name? Sep 20, 2014 at 9:11

1 Answer 1

6

To determine the direction of the arrow, the package takes into account how the path has been set up.

In the current case you draw the path from (0,0) towards (0,2) hence the arrow points to the last coordinate. To have it in the other direction, thus you may want to use:

\draw
    (0,2) to [voltage source, v=$\underline{U}_{in}$]
    (0,0)
;

This leads to:

enter image description here

If you want to keep the label and the arrow on the left side, you may want to use v_ syntax

\draw
    (0,2) to [voltage source, v_=$\underline{U}_{in}$]
    (0,0)
;

The result:

enter image description here

After the comment from the package author, here it follows an example which shows how to use the different syntax the package provides:

\documentclass[border=10pt]{standalone}
\usepackage{circuitikz} 
\begin{document}
\begin{circuitikz} 
\draw
    (0,0) to [voltage source, v^<=$\underline{U}_{in}$]
    (0,2)
;
\end{circuitikz}
\quad
\begin{circuitikz}
\draw
    (0,0) to [voltage source, v_<=$\underline{U}_{in}$]
    (0,2)
;
\end{circuitikz}
\quad
\begin{circuitikz}
\draw
    (0,0) to [voltage source, v^>=$\underline{U}_{in}$]
    (0,2)
;
\end{circuitikz}
\quad
\begin{circuitikz}
\draw
    (0,0) to [voltage source, v_>=$\underline{U}_{in}$]
    (0,2)
;
\end{circuitikz}
\end{document}

The result:

enter image description here

8
  • Is there an option to change direction without changing from (0,0) -- (0,2) to (0,2) -- (0,0)? For example with resistors it should work. Sep 20, 2014 at 9:17
  • @Michael12342345: I'm not aware of any options for that, but it may be the case. Have you tried with resistors? Sep 20, 2014 at 9:23
  • 1
    The syntax of v is one of the following: v^>=... (above the element, in the direction of the path), v^<=... (above the element, in the opposite direction), v_>=... (below the element, in the direction), v_<=...
    – kenshin
    Sep 20, 2014 at 10:37
  • @kenshin: True! After a couple of years I already forgot few tricks. I will update later the answer. Thanks :) Sep 20, 2014 at 11:34
  • 1
    @Michael12342345 Works for me: \documentclass[tikz]{article} \usepackage{circuitikz} \begin{document} \begin{circuitikz} \draw (0,0) to [R, v<=$U$] (0,2) to [R, v>=$U$] (0,4) (2,0) to [V, v<=$U$] (2,2) to [V, v>=$U$] (2,4) ; \end{circuitikz} \end{document}
    – kenshin
    Sep 20, 2014 at 14:53

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.