我必须画一个箭头指向一张桌子,就像这张图一样。
答案1
并作为 LaTeX 文档。
\documentclass{article}
\usepackage{array}
\begin{document}
\def\arraystretch{2}
\begin{tabular}{@{}r|>{\ttfamily}c|}\cline{2-2}
& x \\\cline{2-2}
& c \\\cline{2-2}
& control link \\\cline{2-2}
\noalign{\smash{\llap{\lower2pt\hbox{\tt fp$\longrightarrow$}}}}
& return address\\\cline{2-2}
& a[9] \\\cline{2-2}
\end{tabular}
\end{document}
答案2
为了绘制堆栈图,我曾经使用过可以生成 TeX 的 Groff PIC 处理器。PIC 是来自 Unix Troff 工具的一种图表语言。对于下面的示例,PIC 代码如下所示:
down
box wid 0.9 height (8/25) dotted "incoming"
ptr("$k = 0$" rjust)
box wid 0.9 height (12/25) "spills"
{ "~~completed region" ljust at last box .e }
box wid 0.9 height (4/25)
box wid 0.9 height (4/25) "\tt a"
{ "~~newly allocated slot in" ljust "~~region under construction" ljust at last box .e }
ptr("$k = -12$ (cursor)" rjust)
box wid 0.9 height (14/25) dotted "not yet" "allocated"
显然,这不是一个纯 TeX 解决方案,但描述语言足够高级,可以标记设计空间中的一个有趣点。
答案3
以下是使用 Plain 的快速模型:
\vbox{
\offinterlineskip % remove skips so that the \vrule's span the whole lineheight
\mathsurround=3pt % consistent surrounding hspace for the arrow
\everycr={\noalign{\hrule}}
\halign{
% begin preamble
\vphantom{$\Big($}#% for every line, insert a invisible Big paren, to
% account for the lack of interlineskip
&\vrule\enspace\hfil#\hfil\enspace\vrule\cr
% end preamble
&\tt x\cr
&\tt c\cr
&control link\cr
\noalign{\smash{\llap{\lower2pt\hbox{\tt fp$\longrightarrow$}}}}
% ^ place the fp arrow outside the alignment, \smash'ed (so it doesn't take
% any vertical space), left over-lapping (\llap), and lowered (so it's on
% the same level as the horizontal rule.
&return address\cr
&\tt a[9]\cr
}
}
\bye
答案4
一种方法是制作一个 Tikz 图像,如下所示,将表格的每个单元格作为节点,然后只要引用正确,您就可以从文档中的任何位置连接箭头。 如何在多个表格单元格周围绘制线条