答案1
一个可能的解决方案是使用 Tikz。这是结果
这是代码。
\documentclass[border={10pt}]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
[%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
box/.style={rectangle,draw=black, ultra thick, minimum size=1cm},
]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\foreach \x/\y in {0/9, 1/5,2/13,3/19,4/12,5/8,6/7,7/4,8/21,9/2,10/6,11/11}
\node[box] at (\x,0){\y};
\draw[decorate,decoration={brace,mirror},thick] (-.5,-.7) -- node[below]{abc} (3.5,-.7);
\draw[decorate,decoration={brace,mirror},thick] (3.5,-.7) -- node[below]{def} (7.5,-.7);
\draw[->,very thick] (3,1.2) -- node[above,yshift=2mm]{i} (3,.7);
\draw[->,very thick] (7,1.2) -- node[above,yshift=2mm]{j} (7,.7);
\end{tikzpicture}
\end{document}
笔记:循环可以以优雅而高效的方式实现,正如@Andrew 在下面的评论中所建议的那样
@\foreach \y [count=\x] in {9,5,13,19,12,8,7,4,21,2,6,11}{\node[box] at (\x-1,0){\y};}