# How to draw a diagram using tikzcd

I was said that tikszcd is good library to draw commutative diagrams. So I tried to practize it by drawing the diagram in https://math.stackexchange.com/questions/383006/0-rightarrow-m-rightarrow-m-rightarrow-m-rightarrow-0-exact-m-flat/494914#494914 . But how can I get the arrow from zero to M''(x)N'? I tried

$\begin{tikzcd} & 0\arrow{d}\\ 0\arrow{r} & M^\prime\otimes N^\prime \end{tikzcd}$


but it gave me mess.

Here are two solutions, one using tikz-cd the other using the psmatrix environment from pst-node. I could adjust the position of the vertical arrows with pst-node, which I don't know how to do with tikz-cd:

\documentclass[pdf]{article}
\usepackage{tikz-cd}

\begin{document}

$\begin{tikzcd} & & & 0 \arrow{d}\\ 0 \arrow{r} & M'\otimes N' \arrow{r}\arrow{d} & M\otimes N' \arrow{r}\arrow{d} & M''\otimes N' \arrow{r}\arrow{d} & 0\\% 0 \arrow{r} & M'\otimes N\arrow{r} & M\otimes N\arrow{r} & M''\otimes N \arrow{r} & 0 \end{tikzcd}$

\end{document}


\documentclass[pdf]{article}
\usepackage{pst-node}
\begin{document}

$\psset{arrows=->, arrowinset=0.25, linewidth=0.6pt, nodesep=3pt, labelsep=2pt, rowsep=0.7cm, colsep = 1.1cm} \everypsbox{\scriptstyle} \begin{psmatrix} %%% nodes & & & 0\\ 0 & M'\otimes N' & M\otimes N' & M''\otimes N'\hphantom{'} & 0\\% 0 & M'\otimes N\hphantom{'} & M\otimes N\hphantom{'} & M''\otimes N\hphantom{''} & 0 %%% horizontal arrows \ncline{1,4}{2,4} \ncline{2,1}{2,2} \ncline{2,2}{2,3} \ncline{2,3}{2,4} \ncline{2,4}{2,5} \ncline{3,1}{3,2} \ncline{3,2}{3,3} \ncline{3,3}{3,4} \ncline{3,4}{3,5} %%% vertical arrows \ncline{1,4}{2,4} \ncline[offset=0.8pt]{2,2}{3,2} \ncline[offset=-0.6pt]{2,3}{3,3} \ncline[offset=0.6pt]{2,4}{3,4} \end{psmatrix}$

\end{document}


• Hmm. I only got package ifplatform Warning and package auto-pst-pdf Error. Jan 17, 2015 at 15:59
• @student: I forgot to say you can compile pstricks code with pdflatex if you set the switch --enable-write18 ifd you're under MiKTeX, or shell-escape (TeX Live, MacTeX), for the compiler. Jan 17, 2015 at 16:10
• @student If you only use the tikz-cd version, you don't need \usepackage{pst-node}. In my opinion this answer is not very well laid out: there should be the code for the tikz-cd version and the pst-node version should be in a separate example document. Jan 19, 2015 at 8:53