19

I want to write diagonal arrows, with the label lay down to the arrow.

Something like this:

enter image description here

Here is my best attempt, but it does not work

\documentclass{article}
\usepackage{tikz}

\begin{document}
  \begin{tikzpicture}
    \node (A) at (0,0) {$\bullet$};
    \node (B) at (-2,-1) {$\bullet$};
    \draw[thick,->] (A) -- (B) node[midway,sloped,rotate=270] {$\frac 34$};
  \end{tikzpicture}
\end{document}

I just get this:

enter image description here

  • 1
    If you need it just once (or twice) you could use a xshift and yshift per node, but it doesn't make much sense for many nodes. – TeXnician Feb 16 '17 at 14:15
29

Just add left. Normally you'd want above, but because of the rotation you need left.

enter image description here

\documentclass{article}
\usepackage{tikz}

\begin{document}
  \begin{tikzpicture}
    \node (A) at (0,0) {$\bullet$};
    \node (B) at (-2,-1) {$\bullet$};
    \draw[thick,->] (A) -- (B) node[midway,sloped,left,rotate=270] {$\frac{3}{4}$};
  \end{tikzpicture}
\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.