# latex code diagram

It will be helpful if someone writes for me the code in latex for the following diagram and explain the code. The inverse limit is taken over s

• Someone did it, not for you but for everybody. See here: mirrors.ctan.org/macros/generic/diagrams/xypic/doc/xyguide.pdf – Sigur Apr 14 '15 at 18:25
• What would be helpful is if you could show us some effort in trying to create this diagram. Searching on the tag tikz-cd reveals a lot (for example, this post)... – Werner Apr 14 '15 at 18:25
• I would suggest that you start with this question: Commutative Diagrams and then try to make the diagram yourself using tikz-cd. If you have problems, post a minimal document showing what you have tried and then we can help you when you get stuck. – Alan Munn Apr 14 '15 at 18:26

This is a code that demonstrates two solutions: the psmatrix environment from pst-node (based on pstricks) and the tikz-cd environment from the homonymous package (based on tikz-pgf):

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

\begin{document}
\texttt{psmatrix solution: }
$\psset{arrows=->, arrowinset=0.25, linewidth=0.6pt, nodesep=3pt, rowsep=0.6cm, colsep = 1cm} \everypsbox{\scriptstyle} \begin{psmatrix} %%% nodes 0 & \varprojlim_{s} M/p^s & \varprojlim_{s} N/p^s & \varprojlim_{s} P/p^s& 0\\% 0 & M & N & P& 0 %%% horizontal arrows \ncline{1,1}{1,2} \ncline{1,2}{1,3} \ncline{1,3}{1,4} \ncline{1,4}{1,5} \ncline{2,1}{2,2} \ncline{2,2}{2,3} \ncline{2,3}{2,4} \ncline{2,4}{2,5} %%% vertical arrows \psset{nodesepA = -5pt} \ncline{1,2}{2,2} \ncline{1,3}{2,3} \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}$
\vskip 1cm

\texttt{tikz-cd solution: }
$\begin{tikzcd}\everymath{\displaystyle} 0 \arrow{r}& \smash{\varprojlim\limits_{s}} M/p^s \arrow{r}\arrow{d}& \smash{\varprojlim\limits_{s} }N/p^s \arrow{r}\arrow{d} & \smash{\varprojlim\limits_{s}} P/p^s\arrow{r}\arrow{d}& 0\\% 0 \arrow{r}& M \arrow{r}& N\arrow{r} & P\arrow{r}& 0 \end{tikzcd}$

\end{document}


• Why the useless \everymath{\displaystyle}? I'd define \newcommand{\dvarprojlim}[1]{\mathop{\mathstrut\varprojlim\limits_{#1}}} so the spacing after \dvarprojlim{s} would be good. – egreg Apr 14 '15 at 21:00
• @egreg; it's a residue of an attempt to avoid writing \limits repeatedly. I don't know why ythis happens (only in tikzcd). Thank you for the suggestion, I'll add it. – Bernard Apr 14 '15 at 21:10