4

Here is the diagram I want to draw:

enter image description here

I got a help on drawing the following from here :

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{cd}

\begin{document}
    $$\begin{tikzcd}
        & P \ar[dl, dashed, "\tilde{f}" ']
        \ar[d, "f"]     \\
        A \ar[r,twoheadrightarrow,"g" ']    & B 
    \end{tikzcd}$$
\end{document}

But how can I put the arrow with the 0 in this diagram? could someone show me this please?

4
\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{cd}

\begin{document}
    \[\begin{tikzcd}
        & P \ar[dl, dashed, "\tilde{f}" ']
        \ar[d, "f"]     \\
        A \ar[r,twoheadrightarrow,"g" ']   & B  \arrow[r, twoheadrightarrow] & 0
    \end{tikzcd}\]
\end{document}

enter image description here

1
  • 2
    Don't use $$ in LaTeX! Instead them use \[ and \] respectively.
    – Zarko
    Feb 15 at 6:19
6

The original figure, I think, it is done with package. In fact the classic tips are the same. The font used it is (mtpro2) where in this link you can find the version lite.

I have changed the font with newtxtext (clone of Times New Roman) and newtxmath. I think that it is very close with your image.

\documentclass[a4paper,12pt]{article}
\usepackage[all]{xy}
\usepackage{newtxtext,newtxmath}
\begin{document}
\xymatrix@R=2pc@C=3pc{
& P \ar[d]^{id} \ar@{-->}[dl]_{\mu} &\\
M \ar[r]^{\varphi} & P\ar[r] & 0
}

\end{document}

enter image description here

Addendum 1: ## To have the twoheadrightarrow you can use the code \ar@{>>} (see the MWE):

\documentclass[a4paper,12pt]{article}
\usepackage[all]{xy}
\usepackage{newtxtext,newtxmath}
\begin{document}
\xymatrix@R=2pc@C=3pc{
& P \ar[d]^{id} \ar@{-->}[dl]_{\mu} &\\
M \ar@{>>}[r]^{\varphi} & P\ar@{>>}[r] & 0
}
\end{document}

enter image description here

If you want the tips of you can use the options [all, cmtip]:

\documentclass[a4paper,12pt]{article}
\usepackage[all,cmtip]{xy}
\usepackage{newtxtext,newtxmath}
\begin{document}
\xymatrix@R=2pc@C=3pc{
& P \ar[d]^{id} \ar@{-->}[dl]_{\mu} &\\
M \ar@{>>}[r]^{\varphi} & P\ar@{>>}[r] & 0
}
\end{document}

enter image description here

4

Another possible answer than @Roland's, would be to use \usetikzlibrary{matrix}. That would look like

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}
    \begin{tikzpicture}%
        \matrix[matrix of math nodes,row sep=1cm, column sep=1cm]{%
            && |(P)| P \\
            & |(M)| M & |(Ptwo)| P & |(zero)| 0 \\
        };%
        \draw[dashed,->,very thick](P)--(M) node[above,pos=0.5]{\(\mu\)};%
        \draw[->>,very thick](P)--(Ptwo) node[right,pos=0.5]{id};%
        \draw[->>,very thick](M)--(Ptwo) node[above,pos=0.5]{\(\varphi\)};%
        \draw[->,very thick](Ptwo)--(zero);%
    \end{tikzpicture}%
\end{document}

That would give the display:

enter image description here

Nota Bene: You can play around and change [row sep=1cm, column sep=1cm] to modify the spacing and make it as you wish.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.