0

Im trying to create the following:

enter image description here

I have tried:

\draw [dashed] (1,1) -- (4,5)node[anchor=north west] {Line};

however i cant figure out how to place the word in the enter of the line and not in it ends.

Thank you.

  • 2
    Add midway (which is the same as pos=0.5) to the node options, or place it immediately after --. – Torbjørn T. Jun 17 '17 at 12:14
1

enter image description here

\documentclass[tikz,margin=3mm]{standalone}
\usetikzlibrary{quotes}

\begin{document}
    \begin{tikzpicture}[auto]
\draw [dashed] (0,1) -- node[left] {Line} (3,5);
\draw [dashed] (1,1) -- node[above,sloped] {Line} (4,5);
\draw [dashed] (3,1) to ["Line"] (6,5);       % use library quotes
\draw [dashed] (4,1) to ["Line",sloped] (7,5);% use library quotes
    \end{tikzpicture}
\end{document}
| improve this answer | |

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