5

In this MWE, how to make pin arrow straight and independent of the bent arrow shape connecting A and B?

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{arrows,chains}

\begin{document}
    \begin{tikzpicture}[
    start chain = going right,
    block/.style = {rectangle, draw, rounded corners, 
        text width=6em, align=center, minimum height=4em,
        on chain},
    every pin/.style = {inner sep=1mm, align=center, font=\footnotesize,
        pin distance=9mm, pin edge={angle 60-, solid, black}},
    ]
    \node[block] (A) {A};
    \node[block] (B) {B};

    \linespread{0.9}
    \draw[-latex'] (A) to[bend left] node[inner sep=0pt,
    pin=above:text] {}    (B);
    \end{tikzpicture}
\end{document}

enter image description here

Diaa
  • 9,599

1 Answers1

7
\documentclass[tikz,border=2mm]{standalone}
    \usetikzlibrary{arrows,chains}

\begin{document}
    \begin{tikzpicture}[
 start chain = going right,
block/.style = {rectangle, draw, rounded corners,
                text width=6em, align=center, minimum height=4em,
                on chain},
every pin/.style = {inner sep=1mm, align=center, font=\footnotesize,
                    pin distance=9mm, 
                    pin edge={angle 60-, 
                              line to, % added, now pin line is straight
                              black}},
                        ]
\node[block] (A) {A};
\node[block] (B) {B};

\linespread{0.9}
    \draw[-latex'] (A) to [bend left] node[inner sep=0pt,
                                pin=above:My very looooooong\\
                                text which is wider\\
                                than the arrow below] {}    (B);
    \end{tikzpicture}
\end{document}

enter image description here

Rmano
  • 40,848
  • 3
  • 64
  • 125
Zarko
  • 296,517
  • thanks for your answer. I have another question if you don't mind, how can I make the pin arrow head pointing to the text instead of the path joining A and B? – Diaa Apr 03 '17 at 06:59
  • 2
    direction of arrow is defined in pine edge options: instead pin edge={angle 60-, ... use pin edge={-angle 60, ... . by the way, i need some time to find option line to reading TikZ manual again ... :) – Zarko Apr 03 '17 at 07:03