Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have to draw an arrow to a table like in this picture.

http://dl.dropbox.com/u/2793099/ex.png

share|improve this question

4 Answers 4

up vote 5 down vote accepted

And as a LaTeX document.

\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}
share|improve this answer

For the task of drawing stack diagrams I once used the Groff PIC processor which can emit TeX. PIC is a diagram language from the Unix Troff tool. For the example below, the PIC code looked like this:

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" 

enter image description here

Obviously this is not a pure TeX solution but the description language is suffiently high level to mark an interesting point in the design space.

share|improve this answer

Here's a quick mock-up with 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

share|improve this answer

One way to do would be by making a Tikz image as shown here make each cell of a table as node and then you can connect arrows from anywhere in the document as long as your references are correct. How to draw lines around multiple table cells

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.