edge
is a bit of a strange beast, and you need to use to
here instead:
\documentclass[11pt]{article}
\usepackage{amsmath}
\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]{
|(A)|A\\
|(B)|B\\
};
\draw[commutative diagrams/.cd, every arrow, every label,dashed]
(B.north east) to [bend right, dashed] (A.east);
\draw[commutative diagrams/.cd, every arrow, every label]
(B) edge [bend left] (A.west);
\end{tikzpicture}
\end{document}
I think what is happending with the edge
is that there are two paths, the first a very short one from (B)
to (B.north east)
. But I haven't yet be able to verify this.
Update: thanks to the pointer to https://tex.stackexchange.com/a/82495/15925
from Torbjørn T. this is indeed the case. In your code the main path, i.e. with the edge
parts removed, is
\draw[commutative diagrams/.cd, every arrow, every label,dashed]
(B.north east)
(B);
which in the above code produces
with the strangely placed arrowhead you experienced.
The full code for this last diagram is:
\documentclass[11pt]{article}
\usepackage{amsmath}
\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]{
|(A)|A\\
|(B)|B\\
};
\draw[commutative diagrams/.cd, every arrow, every label,dashed]
(B.north east)
(B);
\end{tikzpicture}
\end{document}
Here is a solution. A node needs a coordinate to go with. The first trial has no associated coordinate (need to put the node after a coordinate), thus causing errors. The second trial has a coordinate to associate to, but it is associated to the top node because the line was drawn from bottom to top. In such case, Gonzalo Medina's solution is crucial where pos=0
tells LaTeX to put the node at bottom. The whole length of line is considered to be 1. pos=0 means positioning it at staring point
, pos=0.5
means positioning it at the mid point
while pos=1
means positioning at the end point
. above, below, left and right
are for directional location, relative to the point of discussion.
Code
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\tikzset{>=latex}
\begin{document}
\begin{tikzpicture}
%\draw[->] (0,-3.5) -- (0,2) node[above, scale = 1.3] {$\varepsilon$};
\draw[->] (0,-3.5) node[below]{$M$} -- (0,2) node[above, scale = 1.3] {$\varepsilon$};
\end{tikzpicture}
\end{document}
Best Answer
There is an old arrow tip for just this,
|
. E.g.\draw [-|] (0,0) -- (1,1);
For all things arrow tips, see section 16.5 Reference: Arrow Tips in the manual. It describes the
arrows.meta
library. This library introduces a slightly different way of defining arrow tips,-{Bar[]}
, where the brackets can contain options for customizing the arrow tip.