答案1
也许tikzmark
来自 Ti 的图书馆钾Z 就是您所需要的。有了它,您可以在文档的任意位置创建一个节点,然后使用它来绘制“覆盖”图。
像这样:
\documentclass {article}
\usepackage {lipsum} % for dummy text
\usepackage {tikz}
\usetikzlibrary{tikzmark}
\tikzset{every node/.style={minimum size=1.75ex}}
\begin{document}
\lipsum[1]
\[
A_{\tikzmarknode[red,draw,circle]{m1}{m}\times\tikzmarknode {n1}{n}} \quad\cdot\quad
B_{\tikzmarknode {n2}{n}\times\tikzmarknode[blue,draw,circle]{p1}{p}} \quad=\quad
AB_{\tikzmarknode[red,draw,circle]{m2}{m}\times\tikzmarknode[blue,draw,circle]{p2}{p}}
\]
\begin{tikzpicture}[remember picture,overlay]
\draw[red ,-latex] (m1.south) --++ (0,-1.5) -| (m2.south);
\draw[blue ,-latex] (p1.south) --++ (0,-1) -| (p2.south);
\draw[dashed] (n1.south) --++ (0,-1) -| (n2.south);
\end{tikzpicture}
\vspace{1.5cm} % we need space for the 'overlayed'` pciture
\lipsum[2]
\end{document}
编辑1:由于图片是“覆盖的”,您可能需要在图片和下面的文本之间添加一些垂直空间。
编辑2:n1
我把和节点里的圆圈去掉了n2
。原帖里没有这样的圆圈。
答案2
解决方案是pstricks
:将索引组件定义为相关类型的节点,并将它们与\ncbar
节点连接连接起来。
\documentclass {article}
\usepackage{sansmath}
\usepackage{pst-node}
\begin{document}
Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
\sansmath
\[ A_{\circlenode{ml}{m}\times\rnode{nA}{n}} \cdot
B_{\rule{0pt} {2.5ex}\rnode{nB}{n}\times\circlenode{pl}{p}} =
AB_{\circlenode{mr}{m}\times\circlenode{pr}{p}}
\psset{arrowinset=0.12, linejoin=1, angle=-90, dash=3pt 2pt}
\ncbar[armA=6mm]{->}{ml}{mr}
\ncbar{->}{pl}{pr}
\ncbar[linestyle=dashed, nodesep = 2pt]{-}{nA}{nB}
\]
\bigskip
Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
\end{document}