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



And as a LaTeX document.



    & 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}


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:

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.


Here's a quick mock-up with Plain:

  \offinterlineskip % remove skips so that the \vrule's span the whole lineheight
  \mathsurround=3pt % consistent surrounding hspace for the arrow
    % begin preamble
      \vphantom{$\Big($}#% for every line, insert a invisible Big paren, to
                         % account for the lack of interlineskip
    % 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


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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