# Commutative diagram with parallel arrows using Tikz (with matrix)

I have used the next code to get a commutative diagram:

\documentclass[10pt,a4paper]{article}

\usepackage[spanish]{babel}
\usepackage{amsmath}
\usepackage{tikz-cd}% diagramas

\begin{document}

%-----Diagrama-------
\deactivatequoting
$\begin{tikzpicture} \matrix(m)[matrix of math nodes, row sep=4em, column sep=3em, text height=1.5ex, text depth=0.25ex] { M & TN \\ & N \\ }; \path[->] (m-1-1) edge node[auto] {\psi\circ Y} (m-1-2); \path[->] (m-1-1) edge node[left] {\psi} (m-2-2); \path[->] (m-1-2) edge node[right] {\pi} (m-2-2); \path[->] (m-2-2) edge node[left] {Y} (m-1-2); \end{tikzpicture}$
\activatequoting
%-------------------

\end{document}


However, I would like two vertical parallel arrows and not a "leftrightarrow".

What is the solution?

It's much easier if you use tikz-cd:

\documentclass[10pt,a4paper]{article}

\usepackage[spanish]{babel}
\usepackage{amsmath}
\usepackage{tikz-cd}% diagramas
\usetikzlibrary{babel}

\begin{document}

$\begin{tikzcd}[column sep=huge,row sep=huge] M \arrow[r,"\psi\circ Y"] \arrow[dr,swap,"\psi"] & TN \arrow[d,shift left=.75ex,"\pi"] \\ & N \arrow[u,shift left=.75ex,"Y"] \end{tikzcd}$

\end{document}


The order of composition seems reversed, but it depends on the conventions you're using.

• Thanks. Yes, I use "f\circ g (x)=g(f(x))" (I don't know how write a formula in a comment). I like write first the the function that applies first. Mar 4 '17 at 18:49