下图的 LaTeX 代码是什么?
我已附上我的代码:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\begin{document}
\begin{eqnarray}\label{cdofNLalgebra}
\setlength{\unitlength}{1cm}
\begin{array}{l}
\begin{picture}(4,2.6)
\put(1.4,2.3){$X$}
\put(1.7,2.4){\vector(1,0){2.3}}
\put(4.1,2.3){$Y$}
\put(4.1,2.2){\vector(0, -1){1.8}}
\put(4.2,1.2){$\pi_2$}
\put(3.6,0.0){$G(T)$}
\put(1.7,2.3){\vector(1,-1){2.0}}
\put(2.3,1.2){$\pi_1$}
\end{picture}
\end{array}
\end{eqnarray}
\end{document}
答案1
您也可以使用tikz-cd
。
输出
代码
\documentclass[tikz, margin=10pt]{standalone}
\usepackage{tikz-cd} % if tikz is already loaded, you can also use \usetikzlibrary{cd}
\begin{document}
\begin{tikzcd}[row sep=2cm]
& G(T) \arrow{dl}[swap]{\pi_1} \arrow[leftrightarrow]{dr}{\pi_2} & \\
X \arrow[rr] \arrow[ur, bend right=15,dashrightarrow] & & Y
\end{tikzcd}
\end{document}
答案2
这只是进行此类绘图的一般示例——如果您愿意,可以增加序言中箭头的弯曲角度
\documentclass[tikz, margin=3.14159mm]{standalone}
\usetikzlibrary{arrows.meta,
calc,
positioning,
quotes}
\begin{document}
\begin{tikzpicture}[
node distance = 35mm,
vertex/.style = {text width=3.2em, align=center},
every edge/.style = {-Straight Barb, draw, semithick},
bend angle=15 % <---
]
%
\node (B) [vertex] { $X$};
\node (C) [vertex, right=of B] { $Y$};
\node (A) [vertex, above=of $(B.north)!0.5!(C.north)$] { $G(T)$};
%
\draw (A) edge ["$\pi_1$" '] (B)
(B) edge [bend right, dashed] (A)
(C) edge [<->, "$\pi_2$" '] (A)
(B) edge [] (C);
\end{tikzpicture}
\end{document}