[Tex/LaTex] TikZ: slightly move edge label

edgelabelstikz-pgf

In the MWE below, I would like to bump the label "10" up a bit so it doesn't overlap the line from B to D. There are several questions on stackexchange about edge label positioning but most are about moving it along the edge (using pos). This one proposes a solution using inner sep and outer sep, and/or changing the shape of the label's node, but that would also change the horizontal position. I don't want to do that, since I want the label to align with the label "3" on the edge above.

\documentclass[border=5]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}

\tikzset{stage/.style={draw,minimum width=15mm,minimum height=7mm}}

\begin{document}

    \begin{tikzpicture}

            \node [stage] (A) {A};
            \node [stage] (B) at ($ (A) +(3cm,0cm) $) {B};
            \node [stage] (C) at ($ (B) +(0cm,2cm) $) {C};
            \node [stage] (D) at ($ (B) +(3cm,1cm) $) {D};

            \path[->] (A.east) edge node[above,at start,anchor=south west]  {\small 2}  (B.west);
            \path[->] (C.east) edge node[above,at start,anchor=south west]  {\small 3}  (D.170);
            \path[->] (B.east) edge node[above,at start,anchor=south west]  {\small 10} (D.190);

    \end{tikzpicture}

\end{document}  

enter image description here

Suggestions?

Best Answer

Something like this?

shifted 10

I just added yshift=5pt to the node.

  \path[->] (B.east) edge node[above,at start,anchor=south west, yshift=5pt]  {\small 10} (D.190);

If you want to move it down instead, just make it a negative dimension.

  \path[->] (B.east) edge node[above,at start,anchor=south west, yshift=-5pt]  {\small 10} (D.190);

Code:

\documentclass[border=10pt,tikz]{standalone}
\usetikzlibrary{positioning,calc}
\tikzset{stage/.style={draw,minimum width=15mm,minimum height=7mm}}

\begin{document}
\begin{tikzpicture}
  \node [stage] (A) {A};
  \node [stage] (B) at ($ (A) +(3cm,0cm) $) {B};
  \node [stage] (C) at ($ (B) +(0cm,2cm) $) {C};
  \node [stage] (D) at ($ (B) +(3cm,1cm) $) {D};

  \path[->] (A.east) edge node[above,at start,anchor=south west]  {\small 2}  (B.west);
  \path[->] (C.east) edge node[above,at start,anchor=south west]  {\small 3}  (D.170);
  \path[->] (B.east) edge node[above,at start,anchor=south west, yshift=5pt]  {\small 10} (D.190);
\end{tikzpicture}
\end{document}