Too long vertical lines in table

This is tricky. What you have is actually a 3-dimensional table that you want to represent as a 2-dimensional image on the page. There are 3 input values and 3³ = 27 output values.

I think what you want here is Occam's Razor...

  • Right-align first column
  • Pad inner columns (groups of 3) with extra horizontal space
  • Write 0.5 as fraction ½
  • Throw in some double-stroked rules (I know that sounds crazy, since it's a reverse-simplification)
  • Then remove as much as possible and see where that leads...

For example:

You could even play around with removing the vertical rules entirely and replacing them with vertical whitespace:

Maybe even rewrite the zeros as dashes, if the data still happens to make sense that way...

Note: I'm not sure that the latter two forms are actually clearer, even though they are less complex for the eyes to process. The reason is that, as mentioned earlier, this is inherently a 3-dimensional table with 27 values. The final two forms — which use horizontal rules only — muddy the dimensionality as they lead the eye to scan left-to-right. Compare and contrast this with the second form, in which the double-stroked rules serve to separate the three 3x3 grids from the labels above and to the left.

As much as I dislike vertical rules and double-stroked rules in general, I think the second form might actually be the clearest of the five shown here. I'd be curious to hear your thoughts.

In any event, below is the LaTeX source for the samples above.

 \documentclass{article}
 \usepackage{booktabs}
 \usepackage{nicefrac}
 \newcommand{\half}{\nicefrac{1}{2}}
 \begin{document}

 \begin{tabular}{|r||ccccc|ccccc|ccccc|}
 \hline
 ContainsPrize &&& A &&&&& B &&&&& C &&\\
 \hline
 MyChoice && A & B & C &&& A & B & C &&& A & B & C &\\
 \hline\hline
 openA &&     0 & 0 & 0 &&& 0 & \half & 1 &&& 0 & 1 & \half &\\
 openB && \half & 0 & 1 &&& 0 &     0 & 0 &&& 1 & 0 & \half &\\
 openC && \half & 1 & 0 &&& 1 & \half & 0 &&& 0 & 0 &     0 &\\
 \hline
 \end{tabular}

 \vskip 3em

 \begin{tabular}{r||ccccc|ccccc|ccccc}
 ContainsPrize &&& A &&&&& B &&&&& C &&\\
 \hline
 MyChoice && A & B & C &&& A & B & C &&& A & B & C &\\
 \hline\hline
 openA &&     0 & 0 & 0 &&& 0 & \half & 1 &&& 0 & 1 & \half &\\
 openB && \half & 0 & 1 &&& 0 &     0 & 0 &&& 1 & 0 & \half &\\
 openC && \half & 1 & 0 &&& 1 & \half & 0 &&& 0 & 0 &     0 &\\
 \end{tabular}

 \vskip 3em

 \begin{tabular}{r|ccccc|ccccc|ccccc}
 ContainsPrize &&& A &&&&& B &&&&& C &&\\
 \hline
 MyChoice && A & B & C &&& A & B & C &&& A & B & C &\\
 \hline
 openA &&     0 & 0 & 0 &&& 0 & \half & 1 &&& 0 & 1 & \half &\\
 openB && \half & 0 & 1 &&& 0 &     0 & 0 &&& 1 & 0 & \half &\\
 openC && \half & 1 & 0 &&& 1 & \half & 0 &&& 0 & 0 &     0 &\\
 \end{tabular}

 \vskip 4em

 \setlength{\tabcolsep}{.5em}
 \begin{tabular}{r c ccc c ccc c ccc}
 \toprule
 ContainsPrize &~~~~~~&~ & A & ~&~~~& ~ &     B & ~&~~~& ~ & C &     ~\\
 \midrule
 MyChoice      &&      A & B & C  &&  A &     B & C  &&  A & B &     C\\
 \toprule
 openA         &&      0 & 0 & 0  &&  0 & \half & 1  &&  0 & 1 & \half\\
 openB         &&  \half & 0 & 1  &&  0 &     0 & 0  &&  1 & 0 & \half\\
 openC         &&  \half & 1 & 0  &&  1 & \half & 0  &&  0 & 0 &     0\\
 \bottomrule
 \end{tabular}

 \vskip 4em

 \setlength{\tabcolsep}{.5em}
 \begin{tabular}{r c ccc c ccc c ccc}
 \toprule
 ContainsPrize &~~~~~~&~ & A & ~&~~~& ~ &     B & ~&~~~& ~ & C &     ~\\
 \midrule
 MyChoice      &&      A & B & C  &&  A &     B & C  &&  A & B &     C\\
 \toprule
 openA         &&     -- & -- & --  && -- & \half &  1 && -- &  1 & \half\\
 openB         &&  \half & -- &  1  && -- &    -- & -- &&  1 & -- & \half\\
 openC         &&  \half &  1 & --  &&  1 & \half & -- && -- & -- &    --\\
 \bottomrule
 \end{tabular}

 \end{document}

I had the exact same issue and solved it using

\hline \end{tabular}

instead of

\hline
\end{tabular}

I also had to use

\begin{tabular}{|c|c|c|c|c|c|} \hline

at the beginning of the environment.

Tags:

Rules

Tables