24

Can someone help me please? I'm wondering how to draw this diagram with LaTeX. Thanks.

enter image description here

4
  • 8
    Welcome to TeX.SE! Such things can be drawn very conveniently with tikz-cd.
    – user121799
    Jan 6, 2019 at 22:53
  • 4
    Try \documentclass{article} \usepackage{tikz-cd} \begin{document} \begin{tikzcd} A \arrow[r,"b"] \arrow[d,"g"] & C \arrow[r,"\alpha"] \arrow[d,"\beta"]& D \arrow[d,"\gamma"]\\ B \arrow[rru,"h"] & B' \arrow[r,"\omega"] & D' \end{tikzcd} \end{document}
    – user121799
    Jan 6, 2019 at 22:59
  • @marmot You're flash. I lost many times with Captcha. :-(
    – Sebastiano
    Jan 6, 2019 at 23:08
  • 1
    @Sebastiano Slow marmots get caught by the eagles.
    – user121799
    Jan 6, 2019 at 23:09

4 Answers 4

32

You can easily draw your diagrams with the free online tool tikzcd-editor.

Screenshot:

enter image description here

Generated Code by clicking the {} button (not an MWE):

\begin{tikzcd}
A \arrow[d, "g"] \arrow[r, "f"] & B \arrow[r, "\alpha"] \arrow[d, "\gamma"] & D \arrow[d, "\beta"] \\
C \arrow[rru, "h"] & B' \arrow[r, "\lambda"] & D'
\end{tikzcd}

Link to live example

3
  • 4
    Certainly a very nice tool, where can you find the instructions for use?
    – AndréC
    Jan 7, 2019 at 16:50
  • Is it possible to remove the grid in the editor you linked above to take a screenshot? Oct 13, 2020 at 8:16
  • 1
    @ZhiltsoffIgor Yes, remove or comment out the line containing border: 2px dashed #ccc; in the .grid-cell class in master.css. Oct 13, 2020 at 8:45
13

Here is a proposal.

\documentclass{article} 
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}  
A \arrow[r,"b"] \arrow[d,"g"] & C \arrow[r,"\alpha"] \arrow[d,"\gamma",pos=0.4,swap]& D \arrow[d,"\beta"]\\
B \arrow[rru,"h",pos=0.7,swap] & B' \arrow[r,"\omega"] & D'
\end{tikzcd}
\end{document}

enter image description here

I added the proposal to prove that users are willing to help. However, the purpose of this site is not to get screen shots converted to LaTeX code. Rather, the idea is that you try something, and if you get stuck, you have a code that you can show and others will help you solve that problem.

0
10

My code is only "basic".

enter image description here

\documentclass{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
A \arrow[r, "f"] \arrow[d, "g"'] & B \arrow[r, "\alpha"] \arrow[d, "h"'] & D \arrow[d, "\beta"] \\
C \arrow[rru, "\gamma"'] & B' \arrow[r, "\lambda"'] & D'
\end{tikzcd}
\end{document}
0
9

Another possibility is with pstricks– more precisely the psmatrix environment:

\documentclass[border=8pt]{standalone}

\usepackage{pst-node, auto-pst-pdf}

\begin{document}

 $ \begin{psmatrix}[colsep =1.2cm, rowsep=1.2cm, nodesepA=2pt, nodesepB=1pt, shortput=nab, labelsep=1pt, arrows=->, arrowinset=0.12, linewidth=0.6pt]
A & B & D \\
C & B' & D'
%% horizontal maps
\ncline{1,1}{1,2}^{b}
\ncline{1,2}{1,3}^{\alpha}
\ncline{2,2}{2,3}_{\lambda}
%% oblique map
\ncline{2,1}{1,3}\naput[npos=0.7]{h}
%% vertical maps
\ncline{1,1}{2,1}<{g}
\ncline[border=1pt]{1,2}{2,2}\nbput[npos=0.35]{\gamma}
\ncline{1,3}{2,3} >{\beta}
\end{psmatrix} $

\end{document} 

enter image description here

1
  • ! Package auto-pst-pdf Error: "shell escape" (or "write18") is not enabled: auto-pst-pdf will not work!, use -shell-escape to resove
    – sunxd
    Aug 29 at 13:48

You must log in to answer this question.