0   1   2   3
R   R   R   R
* a | b | c |
L   L   L   L

I would like to create a grid similar to the one above, it would be a grid with a single letter per cell and at each cell divider it would have R on the top and L on the bottom, and in addition to this numbers, starting at 0, at each cell divider; as shown above.

The * and ¯¯ characters are just for illustration purposes, and I would prefer an actual grid pattern.

  • Welcome to TeX SX! What exactly do you call a cell divider? – Bernard Jan 1 '16 at 15:09
  • So you want the R on top of the vertical lines? Not sure if that's possible with a regular tabular. – Alenanno Jan 1 '16 at 15:29

Without a bit more information about what the formatting is about, here's something slightly less than a brute force approach:




   \matrix [column sep=0pt,every node/.style={draw,inner sep=1.5ex,text depth=0.5ex,text height=1.5ex,anchor=base}]
     \node(m0) {a}; & \node(m1) {b}; & \node(m2) {c}; \\

  \foreach \myletter [count=\x from=0] in {0,1,2,3}
      \node[anchor=south] (R\x)  at (m\x.north west) {R};
      \node[anchor=north] (L\x)  at (m\x.south west) {L};
      \node[anchor=south] (R\x)  at (m2.north east) {R};
      \node[anchor=north] (L\x)  at (m2.south east) {L};
    \node[anchor=south]   at (R\x.north) {\x};



enter image description here

  • Thanks, that's what I was looking for. Any way to increase the size of the letters within the cells? – Khalid Jan 1 '16 at 18:37
  • @Khalid Inside of every node style, add font= and then add something among: \large, \Large, \LARGE, etc. – Alenanno Jan 3 '16 at 22:45

This is a simple solution with the blkarray package: I use the fact that different blocks, within a blockarray environment, can have different column separators:



    & & \\
    & & \\[-1.5ex]
    & & \\[-0.5ex]
    a & b & c \\[-1.2ex]
  \begin{block}{@{\makebox[0pt]{\tiny\textbullet}}*{3}{ >{\vardashfill}c@{\makebox[0pt]{\tiny\textbullet}}}}
    & & \\[-0.5ex]
    & & \\


enter image description here

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.