1

I have drawn an arrow using a cycled path. I want to put a text node in the middle (relatively to x and y axis).

\documentclass{scrartcl}
    \usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
        \draw (4,0.25) -- ++(0,2.5) -- ++(-.25,0) -- ++(.5,.5) -- ++(.5,-.5) --++(-.25,0) -- ++(0,-2.5) -- cycle;
        \node at (4.25,1.5) [rotate=90, anchor=center] {\textbf{here!}};
        \draw (6,0.25) -- ++(0,2.5) -- ++(-.25,0) -- ++(.5,.5) -- ++(.5,-.5) --++(-.25,0) -- ++(0,-2.5) -- cycle node [pos=.5, rotate=90] {not there};
    \end{tikzpicture}
\end{document}

enter image description here

I have tried pos=.5 (as in \draw (0,0) rectangle (1,1) node [pos=.5] {here!};) and midway (as in \draw (0,0) -- (1,1) node [midway] {here!};) but it doesn't work...

2

You need to put node at right path ...

enter image description here

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{shapes.arrows}

\begin{document}
    \begin{tikzpicture}
        \draw (4,0.25) -- ++(0,2.5) -- ++(-.25,0) -- ++(.5,.5) -- ++(.5,-.5) --++(-.25,0) -- ++(0,-2.5) -- cycle;
        \node at (4.25,1.5) [rotate=90, anchor=center] {\textbf{here!}};

        \draw (6,0.25) -- node [text=red, sloped,below=-0.5pt] {I'm here} ++ (0,2.5) -- ++(-.25,0) -- ++(.5,.5) -- ++(.5,-.5) --++(-.25,0) -- ++(0,-2.5) -- cycle;

       \node[single arrow, draw, text=blue,
  minimum height=30mm, single arrow head extend=2.5mm,
  rotate=90,anchor=west]   at (8,0.25) {I'm in node};

    \end{tikzpicture}
\end{document}

However, see if use of shape single arrow (package shapes.arrows) better fit your needs. Example of its use is added (far right arrow).

1
  • Indeed, the shapes.arrows library addresses my needs for this particular example! Thank you. I'd like however to be able to do the same for more "exotic" shapes... in that sense, Solution #3 cannot apply, and #2 is not fully satisfactory, since I've to manually define the node (and it doesn't update if I change arrow width).
    – ebosi
    Jul 22 '16 at 7:59

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.