tikz-cd v0.9b 中的水平线角度有错误吗?

tikz-cd v0.9b 中的水平线角度有错误吗?

我发现了 tikz-cd v0.9b 中的另一个错误。请看以下代码:

\documentclass[11pt]{article}

\usepackage{amsmath} %maths
\usepackage{tikz-cd}
\usetikzlibrary{arrows}


\title{}
\date{}                                          
\tikzset{
   commutative diagrams/.cd,
   arrow style = tikz,
   diagrams={>=latex}}

\begin{document}
\begin{tikzpicture}[commutative diagrams/every diagram,column sep = 3em]
       \matrix (m) [matrix of math nodes, nodes in empty cells]{
       |(Names)|N'&|(N)|N\\
       |(T)|T&|(TTilde)|\widetilde{T}\\
       };
       \path [commutative diagrams/.cd, every arrow, every label] 
          (Names) edge [commutative diagrams/hook] (N)
                         edge node [left] {$\sigma$} (T)
          (N) edge [dotted] node {$\tilde{\sigma} \text{ for unique } \tilde{\sigma}$} (TTilde)
          (T) edge [commutative diagrams/hook] node [below] {$\eta_{T}$} (TTilde)
       ;
\end{tikzpicture}

\end{document}  

使用 v 0.3c 我们得到以下输出:

所有箭头正确对齐

然而,在 v 0.9b 中,从 T 到 Ttilde 的底部首一箭头略微向上倾斜:

现在底部的箭头不稳了

我猜测目标锚点的计算方式不同,这与目标物体的额外高度有关?

答案1

如果仔细观察,另一个水平箭头也略微倾斜。您可以使用垂直坐标系:

(Names) edge [commutative diagrams/hook] (N.west|-Names)

(T) edge [commutative diagrams/hook] node [below] {$\eta_{T}$} (TTilde.west|-T)

或者更好的是,tikz-cd直接使用(如下面的第二段代码):

\documentclass[11pt]{article}
\usepackage{amsmath} %maths
\usepackage{tikz-cd}
\usetikzlibrary{arrows}

\title{}
\date{}                                          
\tikzset{
   commutative diagrams/.cd,
   arrow style = tikz,
   diagrams={>=latex}}

\begin{document}

\begin{tikzpicture}[commutative diagrams/every diagram,column sep = 3em]
       \matrix (m) [matrix of math nodes, nodes in empty cells]{
       |(Names)|N'&|(N)|N\\
       |(T)|T&|(TTilde)|\widetilde{T}\\
       };
       \path [commutative diagrams/.cd, every arrow, every label] 
          (Names) edge [commutative diagrams/hook] (N.west|-Names)
                         edge node [left] {$\sigma$} (T)
          (N) edge [dotted] node {$\tilde{\sigma} \text{ for unique } \tilde{\sigma}$} (TTilde)
          (T) edge [commutative diagrams/hook] node [below] {$\eta_{T}$} (TTilde.west|-T)
       ;
\end{tikzpicture}

\begin{tikzcd}[column sep = 3em]
N'\ar[hook]{r}\ar{d}[swap]{\sigma}
& 
N\ar[dotted]{d}{\tilde{\sigma} \text{ for unique } \tilde{\sigma}} \\
T\ar[hook]{r}[swap]{\eta_{T}} 
& \widetilde{T}
\end{tikzcd}

\end{document} 

在此处输入图片描述

答案2

上方的水平箭头不是完全水平的。但是,如果您使用非常简单的环境,则没有问题tikzcd- 并且代码要短得多(总共 4 行!)才能获得相同的结果。只需比较两种做事方式:

\documentclass[10pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath} 
\usepackage{tikz-cd}
\usetikzlibrary{arrows}

\tikzset{
   normal line/.style={-stealth},
   descr/.style={fill=white,inner sep=2.5pt},
   commutative diagrams/.cd,
   arrow style=tikz,
   diagrams={>=latex}}

\begin{document}

  \begin{tikzpicture}[commutative diagrams/every diagram,column sep = 3em]
       \matrix (m) [matrix of math nodes, nodes in empty cells]{
       |(Names)|N'&|(N)|N\\
       |(T)|T&|(TTilde)|\widetilde{T}\\
       };
       \path [commutative diagrams/.cd, every arrow, every label]
          (Names) edge [commutative diagrams/hook] (N)
                         edge node [left] {$\sigma$} (T)
          (N) edge [dotted] node {$\tilde{\sigma} \text{ for unique } \tilde{\sigma}$} (TTilde)
          (T) edge [commutative diagrams/hook] node [below] {$\eta_{T}$} (TTilde)
       ;
\end{tikzpicture}
\bigskip

\begin{tikzcd}[column sep = 3em]
  N’ \arrow[d, swap,  "\sigma"] \arrow[r, hook] &  N \arrow[d, dotted, "\widetilde\sigma \enspace\text{for unique}\enspace \widetilde\sigma"] \\
  T \arrow[r, hook,swap,   "\eta_T"]  & \widetilde T
\end{tikzcd}

\end{document}

在此处输入图片描述

相关内容