在 latex 2 中绘制图表

在 latex 2 中绘制图表

我想要像下面的输出。希望有人能帮忙。谢谢!

在此处输入图片描述

在此处输入图片描述

答案1

问题出在哪里?有关 LaTeX 代码,请参见下图。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz-cd}
\parindent0pt
\begin{document}
Step 1: Arrange the nodes.

\begin{tikzcd}
  0 & X   & M   \\
  0 & X/A & M/A \\
    & N 
\end{tikzcd}

\bigskip
Step 2: Add the arrows.

\begin{tikzcd}
  0 \ar[r] & X  \ar[r]\ar[d] & M  \ar[d]\ar[ldd,dashed]\\
  0 \ar[r] & X/A\ar[r]\ar[d] & M/A\ar[ld,dashed]       \\
           & N 
\end{tikzcd}

\bigskip
Step 3: Add labels to the arrows.

\begin{tikzcd}
  0 \ar[r] & X  \ar[r,"j"]\ar[d,"p'"] & M  \ar[d,"p"]\ar[ldd,dashed,"\exists h'"] \\
  0 \ar[r] & X/A\ar[r]\ar[d,"f"]      & M/A\ar[ld,dashed,"\exists h"]             \\
           & N 
\end{tikzcd}

\bigskip
Step 4: Fine-tuning.

\begin{tikzcd}
  0 \ar[r] & X  \ar[r,"j"]\ar[d,"p'",swap] & M  \ar[d,"p"]\ar[ldd,dashed,"\exists h'",swap,pos=0.25]\\
  0 \ar[r] & X/A\ar[r]\ar[d,"f",swap]      & M/A\ar[ld,dashed,"\exists h"]                          \\
           & N 
\end{tikzcd}
\end{document}

相关内容