在这个 MWE 中,如何使针箭头变直并且独立于弯曲箭头形状的连接A
和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}
答案1
\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}