我在标记箭头时遇到了麻烦。这是我的代码:
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,minimum width=2em] {
\underleftarrow{lim}A_{i} & \\
A_j & A_k \\};
\path[-stealth]
(m-1-1) edge (m-2-1) []
edge (m-2-2)
(m-2-1.east|-m-2-2) edge (m-2-2);
\end{tikzpicture}
我该如何标记箭头?
谢谢。
答案1
使用强大的tikz-cd
软件包:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}
\varprojlim A_i \arrow[d,swap,"\pi_j"] \arrow[dr,"\pi_k"] \\
A_j \arrow[r,swap,"\alpha_j^k"] & A_k
\end{tikzcd}
\]
\end{document}
默认情况下,标签位于箭头的左侧(就像河流的左侧和右侧一样)。与swap
您交换一侧。
答案2
您想在带有箭头的 lim 运算符下方放置一些内容吗?那么可以在数学表达式中完成,将表达式再次\mathop
转换\underleftarrow
为数学运算符:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,
minimum width=2em] {
\mathop{\underleftarrow{lim}}\limits_{\text{label}}A_{i} & \\
A_j & A_k \\};
\path[-stealth]
(m-1-1) edge (m-2-1) []
edge (m-2-2)
(m-2-1.east|-m-2-2) edge (m-2-2);
\end{tikzpicture}
\end{document}
并且可以插入其他箭头的标签node
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,
minimum width=2em] {
\underleftarrow{lim}A_{i} & \\
A_j & A_k \\};
\path[-stealth]
(m-1-1) edge node[left] {label A} (m-2-1) []
edge node[above right] {label B} (m-2-2)
(m-2-1.east|-m-2-2) edge node[below] {label C} (m-2-2);
\end{tikzpicture}
\end{document}
还有一种sloped
变体:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,
minimum width=2em] {
\underleftarrow{lim}A_{i} & \\
A_j & A_k \\};
\path[-stealth]
(m-1-1) edge node[sloped, below] {label A} (m-2-1) []
edge node[sloped, above] {label B} (m-2-2)
(m-2-1.east|-m-2-2) edge node[below] {label C} (m-2-2);
\end{tikzpicture}
\end{document}