Here's an example using your idea of putting the headers horizontally and connecting them to the columns with arrows:
\documentclass{beamer}
\usepackage{tikz}
\usepackage{tabularx}
\newcommand*{\hnode}[1]{\tikz[remember picture] \node (#1) {};}
% I am actually using a similar theme
% The space ``wasted'' is similar for PaloAlto though
\usetheme{PaloAlto}
\begin{document}
\frame
{
\frametitle{Comparision of boost implemented graph classes}
\begin{tabular}{l}
%
% Column Headers, first column is empts
%
compressed\_sparse\_row\_graph\hnode{H3}\\
adjacency\_matrix\hnode{H2}\\
adjacency\_list\hnode{H1}\\
\\
\end{tabular}
\begin{tabularx}{\textwidth}{X c c c}
%
& \hnode{C1}
& \hnode{C2}
& \hnode{C3}\\
% Rows, I suspect I need about 10
% Class adjlist adjmatrix csrg
\hline
AdjacencyGraph & Yes & No & Yes \\
Interface \#2 & Yes & No & Yes \\
Interface \#3 & Yes & No & Yes \\
Interface \#4 & Yes & No & Yes \\
Interface \#5 & Yes & No & Yes \\
Interface \#6 & Yes & No & Yes \\
Interface \#7 & Yes & No & Yes \\
Interface \#8 & Yes & No & Yes \\
Interface \#9 & Yes & No & Yes \\
% Rest omitted
\end{tabularx}
\tikz[remember picture,overlay] \draw (H1) [very thick, red,->] -| (C1);
\tikz[remember picture,overlay] \draw (H2) [very thick, red,->] -| (C2);
\tikz[remember picture,overlay] \draw (H3) [very thick, red,->] -| (C3);
}
\end{document}
It actually looks pretty good, if I may say so myself.
One of possibilities is to use cellspace
package:
First the vertical space around booktabs
rules i reduced to zero pt, than is increased by macro \cellspacetoplimit
and \cellspacebottomlimit
to desired vertical (colored) gap:
\documentclass{article}
\usepackage[table,dvipsnames]{xcolor}
\usepackage{booktabs, cellspace, tabularx}
% Table settings
\renewcommand{\aboverulesep}{0pt}
\renewcommand{\belowrulesep}{0pt}
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}
\begin{document}
\begin{tabularx}{\textwidth}{SX Sl}% <-- S is append for activate additional vertical space
This is Header 1 & This is Header 2 \\
\toprule
\rowcolor{Apricot}
This is Text 1 & This is Text 2 \\\midrule
This is Text 1 & This is Text 2 \\\midrule
This is Text 1 & This is Text 2 \\
\bottomrule
\end{tabularx}
\end{document}
Addendum:
works around to second part of question. It need to introduce fake column (or to have zero distance between columns or white space with width of two \tabcolsep
):
This time without additional package but with tricks how to use \rowcolor
(for details see documentation for package colortbl
):
\documentclass{article}
\usepackage[table,dvipsnames]{xcolor}
\usepackage{booktabs, tabularx}
% Table settings
\renewcommand{\aboverulesep}{0pt}
\renewcommand{\belowrulesep}{0pt}
\begin{document}
\setlength\tabcolsep{0pt}
\renewcommand\arraystretch{1.2}
\begin{tabularx}{\textwidth}{ X c<{\hspace{12pt}} l }
This is Header 1 && This is Header 2 \\
\toprule
\rowcolor{Apricot}%[0pt]
This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is && This is Text 2 \\\midrule
This is Text 1 && This is Text 2 \\\midrule
This is Text 1 && This is Text 2 \\
\bottomrule
\end{tabularx}
\end{document}
Addendum (2):
After four years ... Now I would use new table package tabularray
. Using it for the MWE in above addendum is code simpler:
\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\noindent
\begin{tblr}{colspec = {@{} X[1,l] l @{}},
column{1} = {rightsep=12pt},
row{2} = {bg=Apricot},
}
This is Header 1 & This is Header 2 \\
\toprule
This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1 This is Text 1
& This is Text 2 \\
\midrule
This is Text 1 & This is Text 2 \\
\midrule
This is Text 1 & This is Text 2 \\
\bottomrule
\end{tblr}
\end{document}
Best Answer
Obviously
tabularx
doesn't have bugs, this is a documented feature.TX
sets the table several times, and restores latex counters but tex primitive counters can not be restored so easily. This defines a latex counter to shadow the\newcount
allocated counter defined byxcolor
.