tikz-cd bug in horizontal line angle in v0.9b?

I have found what I think is another bug in tikz-cd v0.9b. Take the following code:

\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}


With v 0.3c we get the following output:

However, with v 0.9b, the bottom monic arrow from T to Ttilde slants upwards slightly:

I guess the target anchor is being calculated differently, something to do with the extra height of the target object?

-
Your code does not compile, as is. It would be helpful to provide a complete working example. And welcome to the site! –  Steven B. Segletes Apr 4 '14 at 12:36
I would just say |(T)|\vphantom{\widetilde{T}}T. –  Claudio Fiandrino Apr 4 '14 at 12:41
@StevenB.Segletes: Oops! I was working in LaTeXit and forgot to type in the begin/end document tags needed for a MWA. I have corrected the code now. –  Paul Vickers Apr 4 '14 at 12:45
@ClaudioFiandrino: Nice idea. I tried it out but it then leaves the arrow position higher than it ought to be. It also means I will need to go through and edit bunch of quite big diagrams to put in the phantom space (the one above was just a simple example to show the problem). It seems a bit of a hack, doesn't it? I wouldn't mind so much but until I upgraded to v 0.9b it all worked nicely. :-) –  Paul Vickers Apr 4 '14 at 12:50
Try adding the option commutative diagrams/every cell to the \matrix. Read about the asymmetrical rectangle shape in the tikz-cd manual if you want to understand what is going wrong in your example. –  Florêncio Neves Apr 24 '14 at 1:12

If you look closely, the other horizontal arrow is also slightly inclined. You can use the perpendicular coordinate system:

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


and

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


or better yet, use tikz-cd directly (as in the second code below):

\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}


-
I like the perpendicular solution the best for the simple reason that I have some pretty big diagrams with up to 16 nodes and arrows going everywhere! When I add to the diagram, the matrix layout makes it much easier to move nodes as the arrows declared in the path simply follow the nodes around. Doing that in tikzcd environment would be quite awkward for anything but simple diagrams. The coordinate system you demonstrated seems to work perfectly. Many thanks! –  Paul Vickers Apr 4 '14 at 13:11
@PaulVickers You're welcome! I've updated my answer; the other horizonyta hook was also slightly off, so the same method has to be used there (as in my updated answer). –  Gonzalo Medina Apr 4 '14 at 13:20
Yes, I've gone through my document adding the co-ordinates throughout and it looks much better. I wonder why this never happened in v 0.3c of tikz-cd though? –  Paul Vickers Apr 4 '14 at 13:44

The upper horizontal arrow is not quite horizontal. However there is no problem if you use a very simple tikzcd environment – and the code is much shorter (4lines in all!) for the same result. Just compare both ways of doing things:

\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}


-
I agree about the tikzcd solution, but one of the diagrams I'm working on would be a nightmare to layout that way. I only used the example above because it demonstrated the problem without lots of code. :-) I'd post an example here but I can't work out how to include an inline figure in a comment. –  Paul Vickers Apr 4 '14 at 13:42
But you can include a link to the figure, if that makes sense. –  Bernard Apr 4 '14 at 13:46
Yes, I see now that I could upload one to a website and link to it. But now that the problem has been solved I know how to make the big tikzpicture look right, so I guess there's nothing to be gained form posting a picture of it here. Thanks for all the suggestions though; much appreciated! –  Paul Vickers Apr 4 '14 at 14:21