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

6
\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

  • 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 3 '17 at 6: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 3 '17 at 7:03

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.