# How to draw this commutative diagram

Please, I want to draw the below diagram in latex and don't know how to go about it.

• Welcome to TeX.SE xymatrix is one of a good option, but post atleast the text, as no one wants to keyin ... Feb 27 at 9:19
• @MadyYuvi Hi :-) I am totally agree with you...For the user there is a documentation here jmilne.org/not/Mxymatrix.pdf or you can use tikz-cd package. Feb 27 at 9:29

I think a solution with tikz-cd has a more 'natural' feel. And once you have a diagram it can often easily be adapted to similar new ones.

\documentclass{article}
\usepackage{tikz-cd}
\usepackage{amssymb}

\begin{document}

\begin{tikzcd}
A  \arrow[rr,hook] \arrow[dr, "\varphi"'] & & M^+ \arrow[dl, "\varnothing"] \\
& S
\end{tikzcd}

\end{document}


• Quite likely it's \phi and not \varnothing (although I'm not sure one should use both \varphi and \phi). I removed the \LARGE instruction that might confuse the reader and, I guess, was just to make a bigger picture. Feb 27 at 11:36

You can do it with tikz-cd of course, but if you don't mean to learn this package and use it on a regular basis, I recommand to do it in plain TikZ, like this:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning,arrows}

\usepackage{amssymb}

\begin{document}

\begin{tikzpicture}
\node (A) {$A$};
\node[below right =of A] (S) {$S$};
\node[above right =of S] (M) {$M^+$};

\draw[right hook-latex] (A) -- (M);
\draw[-latex] (A) -- (S) node [midway,left] {$\varphi$};
\draw[-latex] (M) -- (S) node [midway,right] {$\varnothing$};
\end{tikzpicture}

\end{document}


• I disagree: the quality is definitely lower than the not-so-difficult tikz-cd form. Feb 27 at 11:38
• I agree that it can (and probably should) be drawn with tikz-cd. The only flaw I can see in my picture is the difference in length for both the diagonal arrows. But the diagram in tiz-cd has the same flaw (due to the math type of the node S). Feb 27 at 11:58

Just for comparison using xy package with the same tips of tikz-cd but with a not very good curved arrow.

\documentclass[a4paper,12pt]{article}
\usepackage[all,cmtip]{xy}
\usepackage{amssymb}
\begin{document}
\xymatrix@R=2.2pc@C=1.5pc{
A \,\ar[dr]_{\varphi} \ar@{^{(}->}[rr] & & M^{+}\ar[dl]^{\varnothing}\\
& S &
}
\end{document}


The code it is not very simple than tikz-cd but if I am able to do it, I think that one week you will be a very nice user to make commutative-diagrams.

PS: I will put \emptyset instead of \varnothing.