# Node at each end of arrow, Tikz

I'm drawing a vertical arrow and I want to have a node at each end, but tikz seems to be putting the lower node in funny places:

This is the arrow with the node above in the right place:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\tikzset{>=latex}
\begin{document}
\begin{tikzpicture}

\draw[->] (0,-3.5) -- (0,2) node[above, scale = 1.3] {$\varepsilon$};

\end{tikzpicture}
\end{document}


Now I want to put a node at the bottom end of the line. I can't work out where to put the second node command. I've tried these two:

\draw[->] node[below]{$M$} (0,-3.5) -- (0,2) node[above, scale = 1.3] {$\varepsilon$};

\draw[->] (0,-3.5) -- (0,2) node[above, scale = 1.3] {$\varepsilon$} node[below]{$M$};


but the first one puts the node half-way along the line of the arrow and the second puts the node just below the arrowhead.

Am I doing something obviously wrong?

Thanks.

• Try this \draw[->] (0,-3.5) node[below]{$M$}-- (0,2) node[above, scale = 1.3] {$\varepsilon$}; – Jesse Apr 8 '14 at 10:44
• You can also use \draw[->] (0,-3.5) -- (0,2) node[above, scale = 1.3] {$\varepsilon$} node[pos=0,below] {$M$};. – Gonzalo Medina Apr 8 '14 at 15:15
• @Jesse, would you like to write an answer, or is there another question we might dupe this to? – Paul Gessler Jan 10 '15 at 20:37

## 1 Answer

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}