Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I reverse some arrows of the diagram given by the code below?

\begin{tikzpicture}
  % Tell it where the nodes are
  \node (A) {$A$};
  \node (B) [below=of A] {$B$};
  \node (C) [right=of A] {$C$};
  \node (D) [right=of B] {$D$};
  % Tell it what arrows to draw
  \draw[-stealth] (A)-- node[left] {\small $i$} (B);
  \draw[-stealth] (B)-- node [below] {\small $g$} (D);
  \draw[-stealth] (A)-- node [above] {\small $j$} (C);
  \draw[-stealth] (C)-- node [right] {\small $k$} (D);
\end{tikzpicture}
share|improve this question
    
Do you want to add extra arrows or just change the direction of some of the existing arrows? –  Gonzalo Medina Dec 8 '11 at 20:23
    
Just to change the directions of some/all of them. Thank you –  Nadori Dec 8 '11 at 20:27
add comment

1 Answer

up vote 7 down vote accepted

You can either interchange - and the specification of the arrow tip, or you can also interchange the order of the nodes; the following code shows both options:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}
  \node (A) {$A$}; 
  \node (B) [below=of A] {$B$}; 
  \node (C) [right=of A] {$C$}; 
  \node (D) [right=of B] {$D$};
  \draw[-stealth] (A)-- node[left] {\small $i$} (B); 
  \draw[-stealth] (B)-- node [below] {\small $g$} (D); 
  \draw[-stealth] (A)-- node [above] {\small $j$} (C); 
  \draw[-stealth] (C)-- node [right] {\small $k$} (D); 
\end{tikzpicture}

\begin{tikzpicture}
  \node (A) {$A$}; 
  \node (B) [below=of A] {$B$}; 
  \node (C) [right=of A] {$C$}; 
  \node (D) [right=of B] {$D$};
  \draw[stealth-] (A)-- node[left] {\small $i$} (B); 
  \draw[stealth-] (B)-- node [below] {\small $g$} (D); 
  \draw[-stealth] (C)-- node [above] {\small $j$} (A); 
  \draw[-stealth] (D)-- node [right] {\small $k$} (C); 
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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