为什么$\times 12$
不在路径的中心?
\documentclass[border=3pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[bob/.style={outer sep=0pt,text width=2.5em,align=center,draw}]
\node[bob] (A) {1200} ;
\node[bob,anchor=east] (B) at (A.west) {100} ;
\draw[>=stealth,->] (B.south)--++(0,-.3) -| (A.south)
node[pos=.5,fill=white,inner sep=1pt] {\small$\times12$};
\end{tikzpicture}
\end{document}
答案1
如果您只想将节点置于路径的水平部分的中心,您可以将路径分成三段:
\documentclass[border=3pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[bob/.style={outer sep=0pt,text width=2.5em,align=center,draw}]
\node[bob] (A) {1200} ;
\node[bob,anchor=east] (B) at (A.west) {100} ;
\draw[>=stealth,->] (B.south)--++(0,-.3)coordinate(h)
--node[fill=white,inner sep=1pt] {\small$\times12$}(h-|A.south)
--(A.south);
\end{tikzpicture}
\end{document}