Professional slashbox alternative
No vertical rules and no vertical words. The column of inputs can be topped by the word "Input" and the output columns can be easily grouped. I suggest two possibilities.
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{l*{6}{c}}
\toprule
& \multicolumn{6}{c}{Output} \\
\cmidrule(lr){2-7}
Input & int8\_t & int16\_t & int32\_t & uint8\_t & uint16\_t & uint32\_t \\
\midrule
int8\_t & a & b & c & d & e & f \\
int16\_t & g & h & i & j & k & l \\
int32\_t & m & n & o & p & q & r \\
uint8\_t & s & t & u & v & w & x \\
uint16\_t & y & z & a & b & c & d \\
uint32\_t & e & f & g & h & i & j \\
\bottomrule
\end{tabular}
\bigskip
\begin{tabular}{l*{6}{c}}
\toprule
& \multicolumn{6}{c}{Output} \\
\cmidrule(lr){2-7}
Input & int8\_t & int16\_t & int32\_t & uint8\_t & uint16\_t & uint32\_t \\
\cmidrule(lr){1-1}
\cmidrule(lr){2-7}
int8\_t & a & b & c & d & e & f \\
int16\_t & g & h & i & j & k & l \\
int32\_t & m & n & o & p & q & r \\
uint8\_t & s & t & u & v & w & x \\
uint16\_t & y & z & a & b & c & d \\
uint32\_t & e & f & g & h & i & j \\
\bottomrule
\end{tabular}
\end{document}
First of all, as I suggested in my comment, I would rather have the \midrule
one row below:
I think grouping 'Output' with the headers makes more sense, logically, just as you did with 'Input'.
As an alternative to the slashbox
package there is diagbox
. The description in the documentation states:
diagbox
is a modern alternative ofslashbox
.
I also like it better, is easier to customize and the diagonal line (now drawn with pict2e
) is much nicer. Here's an example using it:
\begin{table}
\centering
\begin{tabular}{l|*{6}r}
\toprule
\diagbox{Input}{Output} & int8\_t & int16\_t & int32\_t & uint8\_t & uint16\_t & uint32\_t \\
\midrule
int8\_t & a & b & c & d & e & f \\
int16\_t & g & h & i & j & k & l \\
int32\_t & m & n & o & p & q & r \\
uint8\_t & s & t & u & v & w & x \\
uint16\_t & y & z & a & b & c & d \\
uint32\_t & e & f & g & h & i & j \\
\bottomrule
\end{tabular}%
\label{tab:addanotherlabel}%
\end{table}%
Overall a good result, but I was a bit dissatisfied with the placement of 'Output', so I tweaked the table. (Fortunately, diagbox
is rather flexible.) The final result I came up with is a heavily modified (but IMHO visually the most appealing) version:
\begin{table}
\centering
\begin{tabular}{l|*{6}r}
\toprule
%\backslashbox{Input}{Output} & int8\_t & int16\_t & int32\_t & uint8\_t & uint16\_t & uint32\_t \\
\diagbox[width=2.5cm, height=2.5cm]{\raisebox{5pt}{\hspace*{0.25cm}Input}}{\raisebox{-1.27cm}{\rotatebox{90}{Output}}} & \raisebox{-0.25cm}{\rotatebox{90}{int8\_t}} & \raisebox{-0.25cm}{\rotatebox{90}{int16\_t}} & \raisebox{-0.25cm}{\rotatebox{90}{int32\_t}} & \raisebox{-0.25cm}{\rotatebox{90}{uint8\_t}} & \raisebox{-0.25cm}{\rotatebox{90}{uint16\_t}} & \raisebox{-0.25cm}{\rotatebox{90}{uint32\_t}} \\
\midrule\\
\hspace*{0.25cm}int8\_t & a & b & c & d & e & f \\ \\
\hspace*{0.25cm}int16\_t & g & h & i & j & k & l \\ \\
\hspace*{0.25cm}int32\_t & m & n & o & p & q & r \\ \\
\hspace*{0.25cm}uint8\_t & s & t & u & v & w & x \\ \\
\hspace*{0.25cm}uint16\_t & y & z & a & b & c & d \\ \\
\hspace*{0.25cm}uint32\_t & e & f & g & h & i & j \\ \\
\bottomrule
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
On a final note, I believe vertical lines are sometimes necessary and I don't think there is anything wrong with using one here. It is a guide for the eye to help separate logical groups from each other (e.g. headers from raw data) in the table. (For a discussion see here: Why not use vertical lines ('|') in a tabular?)