答案1
答案2
我建议使用tikz-cd
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}[column sep=2em,row sep=2em]
A \arrow[r,"e"] \arrow[d,swap,"f"] & B \arrow[d,"g"] \\
C \arrow[r,swap,"m"] & D
\end{tikzcd}
\qquad
\begin{tikzcd}[column sep=4em,row sep=4em]
A \arrow[r,"e"] \arrow[d,swap,"f"] & B \arrow[d,"g"] \\
C \arrow[r,swap,"m"] & D
\end{tikzcd}
\]
\end{document}
关键swap
是要求将箭头标签设置在另一侧(默认在左侧,想象从源头看向目标)。
或者直接使用 Xy-pic。
\documentclass{article}
\usepackage{amsmath}
\usepackage[all,cmtip]{xy}
\begin{document}
\[
\xymatrix{
A \ar[r]^e \ar[d]_f & B \ar[d]^g \\
C \ar[r]_m & D
}
\qquad
\xymatrix@R+2pc@C+2pc{
A \ar[r]^e \ar[d]_f & B \ar[d]^g \\
C \ar[r]_m & D
}
\]
\end{document}