# Writing commutative diagram in Latex

I am trying to write this in latex but cannot figure out how. I am trying to do the one on the right hand side. I was trying with tikzcd. Also when I am trying to write the latex for the one on left side, the first down arrow is shifted towards left. Here is my latex code. Below the pic, is the pic of what I am getting with the latex code below.

$\begin{tikzcd} K(x) : 0 \arrow{r} R \arrow{r}{x} \arrow{d}{y} & R \arrow{d}{y} \\ K(x) : 0 \arrow{r} R \arrow{r}{x} & R \end{tikzcd}$


Thanks !!!

• It's not really clear what's the diagram you want to draw. Dec 8, 2015 at 10:37

Basically you are doing it right. You have to shift the lower line by prepending a & and adjusting the arrows to point diagonal. The baseline inside the equation is corrected by “egreg's formula”.

\documentclass{article}
\usepackage{mathtools,tikz-cd}
\begin{document}
\begin{equation*}
K(x,y):
\begin{tikzcd}[baseline=\the\dimexpr\fontdimen22\textfont2\relax]
0 \ar[r] & R \ar[r,"z"]\ar[rd,"y"] & R \ar[r]\ar[rd,"y"]\ar[d,draw=none,"\otimes" description] & 0 \\
& 0 \ar[r] & R \ar[r,"-z" below] & R \ar[r] & 0 \\
\end{tikzcd}
\end{equation*}
\end{document} • You should be able to vertically center the diagram by including it in a gathered environment. Dec 8, 2015 at 10:54
• @uzumaki_naruto909 Is your question answered by this post? If not, please edit your question. If yes, please accept this answer here by clicking the check mark to its left and I will delete my comment here. Thank you. May 3, 2016 at 11:39