我有下面的图片,但我希望中间箭头的标签 $\tilde{f}$ 位于通过幻影箭头定义路径后添加的箭头的顶部。
有什么办法可以做到这一点?
% !TEX TS-program = XeLaTeX
\documentclass[draft]{article}
\usepackage{tikz-cd}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings,intersections}
\begin{document}
\tikzset{%
scalearrow/.style n args={3}{
decoration={
markings,
mark=at position (1-#1)/2*\pgfdecoratedpathlength
with {\coordinate (#2);},
mark=at position (1+#1)/2*\pgfdecoratedpathlength
with {\coordinate (#3);},
},
postaction=decorate,
}
}
\begin{tikzcd}
{ } &{} &{Set} &{} \\
{ } &{} &{\tilde{f}} &{} \\
{A} \ar[uurr,"!"] \ar[rrr,"f"'] \ar[rrr, shift left=5ex, phantom, scalearrow={0.1}{start}{end}] \ar[to path=(start) --(end), Rightarrow] &{} &{} &{B} \ar[uul, "\tilde{L}f"']&{} \\
\end{tikzcd}
\end{document}
答案1
但上面的图像是作为纯 TikZ 图片绘制的:
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{positioning,
quotes}
\begin{document}
\begin{tikzpicture}[
node distance = 24mm and 12 mm
]
\node (a) {$A$};
\node (s) [above right=of a] {Set};
\node (b) [below right=of s] {$B$};
%
\draw[->] (a) edge ["!"] (s)
(b) edge ["$\tilde{L}f$" '] (s)
(a) edge ["$f$"] (b);
%
\node (f) [below=9mm of s] {$\stackrel{\tilde{f}}{\Rightarrow}$};
\end{tikzpicture}
\end{document}
或者使用Longrightarrow
代替Rightarrow
:
最后加上tikz-cd
:
\documentclass[draft]{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
& & \mathrm{Set} & \\
& & \stackrel{\tilde{f}}{\Longrightarrow} & \\
A \ar[uurr,"!"] \ar[rrr,"f"']
& & & B \ar[uul, "\tilde{L}f"']&{} \\
\end{tikzcd}
\end{document}