[Tex/LaTex] How to draw parallel arrows in commutative diagrams with TikZ

diagramstikz-pgf

How do I draw two parallel arrows having the same domain and the same codomain in a commutative diagram with TikZ? For that matter, how do I draw any sort of parallel paths between two nodes? Do I need to explicitly shift the two paths myself? And if so how?

Best Answer

In addition to postaction here are two more ways:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
    \node (A) at (0,0) {$A$};
    \node (B) at (1,0) {$B$};
    \draw[transform canvas={yshift=0.3ex},->] (A) -- (B);
    \draw[transform canvas={yshift=-0.3ex},<-] (A) -- (B);
\end{tikzpicture} 

\begin{tikzpicture}
    \node (A) at (0,0) {$A$};
    \node (B) at (1,0) {$B$};
    \draw[->] (A.10) -- (B.170);
    \draw[<-] (A.350) -- (B.190);
\end{tikzpicture} 

\end{document}

Note that you need to use transform canvas as “normal” transforms leave the nodes fixed. The (A.10) syntax means a point on the boundary of A, 10 degrees counterclockwise from (A.east).