I need to display arrays (vertically, not latex ones, basically a consecutive sequence of values) with their implicit positions and use the result as a node within a TikZ picture (or more precisely I want to draw lines to and from it that don't overlap anything of that node). So basically what I want is something like:


which should produce the following:

 0 | 23 |
 1 | 42 |

I guess the first part should be easily doable with node parts, but I have no idea for the rest and my knowledge of TikZ is rusty and limited.

  • 2
    Welcome to TeX.SE. What should lines connected? Can you provide a sketch of this? numbers in array or complete array? About this you are not clear. Regardless that your temporary knowledge is limited, you should tray do draw yourself at list nonworking example ... the best way to learn TikZ is "learning by doing" :-) – Zarko Aug 26 '16 at 16:19
  • 2
    You can also just post an example of the bit you know how to do and ask how to do the second bit you're stuck on. There's no point people spending time telling their grandmothers how to suck eggs, after all. – cfr Aug 26 '16 at 16:36
  • 1
    To be honest, I have no idea what you are trying to do or how you are trying to do it. – cfr Aug 26 '16 at 20:50

So is this something like you're after?

enter image description here

\node[coordinate] (#1-0-1) at (0,0) {};
\foreach [count=\i,evaluate=\i as \j using int(\i-1)] \x in {#2} {
  \node [below] (#1-\i-1) at (#1-\j-1.south) {\j};
  \node [right=1em,anchor=center] (#1-\i-2) at (#1-\i-1.east) {\x};
\node [draw,fit=(#1-1-2)(#1-\i-2)] (#1) {};



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.