[Tex/LaTex] Tabularx environment problem

beamertabularx

I am running into a problem while using the following code and I have tried every means to diagnose the problem (ie: commenting the contents out), but I have not been successful at finding the bug.

The code is as follows:

\documentclass{beamer}
\usepackage{booktabs,makecell,multirow,tabularx}
\usepackage{ragged2e}
\renewcommand\theadfont{\normalfont\bfseries}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcolumntype{C}{>{\Centering\arraybackslash}X}
\newcommand\mc[1]{\multicolumn{2}{c}{#1}}

\setlength\parindent{0pt}
%\usepackage[justification=centering]{caption}
\usepackage{siunitx}
\usepackage{tikz}

\usepackage{adjustbox}

\begin{document}

\begin{frame}[shrink=30]{Summary Statistics}          
    \vspace*{2em}          
    \setlength{\tabcolsep}{4pt} 


\begin{tabularx}{\textwidth}{@{} l L *{10}{S[table-format=3.3]} @{}}
    \toprule   
\thead[lc]{Benchmark} & \thead{(1,1)} & {\thead{(2,1)}} & {\thead{(3,1)}} & {\thead{(4,1)}} & {\thead{(5,1)}} & {\thead{(6,1)}} \
    & {\thead{(7,1)}} & \thead{(8,1)} & {\thead{(9,1)}} & {\thead{(10,1)}} & {\thead{(11,1)}} & {\thead{(12,1)}} \\
    \midrule

(1,1) & 0.00 & 0.01 & 0.02 & 0.02 & 0.03 & 0.03 & 0.05 & 0.02 & 0.01 & 0.01 & 0.09 & 0.00 \\


\bottomrule 
\end{tabularx} 

\end{frame}

The message I am getting is: "extra } or $", but I have checked everywhere and I don't see any problems. Hence, I would appreciate any help and advice.

Best Answer

If the objective is to make the width of the table equal to the width of the textblock, using a tabular* environment instead of a tabularx environment (with a single X-like column) seems preferable.

Incidentally, you may want to rethink using bold lettering for the header row. Sandwiching the header row between \toprule and \midrule is more than enough to give it all the visual prominence it requires; too much bold material quickly risks creating a vulgar look. The second table in the screenshot below demonstrates that (in my opinion) bold lettering is quite unnecessary.

enter image description here

\documentclass{beamer}
\usepackage{booktabs}

\begin{document}

\begin{frame}[shrink=30]{Summary Statistics}          
\vspace*{2em}          
% Let LaTeX determine amount of intercolumn whitespace
\setlength{\tabcolsep}{0pt} 

\begin{tabular*}{\textwidth}{l @{\extracolsep{\fill}} *{12}{c}}
\toprule   
\textbf{Benchmark}& \textbf{(1,1)} 
& \textbf{(2,1)}  & \textbf{(3,1)} & \textbf{(4,1)} & \textbf{(5,1)}  
& \textbf{(6,1)}  & \textbf{(7,1)} & \textbf{(8,1)}  & \textbf{(9,1)} 
& \textbf{(10,1)} & \textbf{(11,1)} & \textbf{(12,1)} \\
\midrule
(1,1) & 0.00 & 0.01 & 0.02 & 0.02 & 0.03 & 0.03 & 0.05 & 0.02 & 0.01 & 0.01 & 0.09 & 0.00 \\
\bottomrule 
\end{tabular*} 

\vspace*{2cm}
\begin{tabular*}{\textwidth}{l 
         @{\extracolsep{\fill}} *{12}{c}}
\toprule   
{Benchmark}& (1,1) 
& (2,1)  & (3,1) & (4,1) & (5,1)  & (6,1) & (7,1) 
& (8,1)  & (9,1) & (10,1)& (11,1) & (12,1) \\
\midrule
(1,1) & 0.00 & 0.01 & 0.02 & 0.02 & 0.03 & 0.03 & 0.05 & 0.02 & 0.01 & 0.01 & 0.09 & 0.00 \\
\bottomrule 
\end{tabular*} 


\end{frame}
\end{document}
Related Question