Tikzcd:如何获得一条连续的垂直线?

Tikzcd:如何获得一条连续的垂直线?

为了说明“自由函子”相对于函子的含义$F$,我使用了下图

\usepackage{tikz,tikz-cd}
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzcd}[column sep=1cm, row sep=0.8cm]
\mathcal{C}_1 \arrow[rr,leftarrow,"F",dashed]&
\vert\arrow[dd,dash] 
& \mathcal{C}_2\\[-20pt] 
X \arrow[rr,"f",pos=0.3,dashed]
\arrow[rrd,dashed, "j",pos=0.41,swap]&      &  Y\\
\phantom{X}         &   \phantom{X}
&Free(X)\arrow[u, "\hat{f}"']
\end{tikzcd}
\caption{Solution $(X,j,Free(X))$ of the universal
 problem from $\mathcal{C}_1$ to $\mathcal{C}_2$ 
w.r.t.the functor $F$.}
\end{figure}
\end{document}

我想要垂直线(这里用 完成 \vert\arrow[dd,dash])。怎么做?

答案1

我认为您正在寻找的是start anchorend anchor键:

\documentclass{article}
\usepackage{tikz,tikz-cd}
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzcd}[column sep=1cm, row sep=0.8cm]
\mathcal{C}_1 \arrow[rr,leftarrow,"F",dashed]
    \arrow[dd,dash,
    start anchor={[xshift=4ex, yshift=4ex]},
    end anchor={[xshift=4ex]}
    ]&
& \mathcal{C}_2\\[-20pt] 
X \arrow[rr,"f",pos=0.3,dashed]
\arrow[rrd,dashed, "j",pos=0.41,swap]&      &  Y\\
\phantom{x}&& Free(X)\arrow[u, "\hat{f}"']
\end{tikzcd}
\caption{Solution $(X,j,Free(X))$ of the universal
 problem from $\mathcal{C}_1$ to $\mathcal{C}_2$ 
w.r.t.the functor $F$.}
\end{figure}
\end{document}

结果如下: 在此处输入图片描述

相关内容