I have tables which are quite long because they have between 9 and 25 columns. They don't even fit on a page with a landscape layout. I tried to resize them using resizebox as suggested here but it always raises an error.
This in my LaTeX-file:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{table}[ht]
\resizebox{\linewidth}{!}{%
\centering
\settowidth\mywidth{\textbf{\MakeUppercase{TABLENAME}}}
\begin{minipage}[t]{\mywidth}
\mbox{}\par
\textbf{\MakeUppercase{TABLENAME}}
\end{minipage}
%\[
\begin{tabular}[t]{ccccccccc}
\toprule
\multicolumn{1}{c}{\textbf{column 1}} & \multicolumn{1}{c}{column 2}} & \multicolumn{1}{c}{column 3} & \multicolumn{1}{c}{column 4} & \multicolumn{1}{c}{column 5} & \multicolumn{1}{c}{column 6} & \multicolumn{1}{c}{column 7} & \multicolumn{1}{c}{\textbf{column 8}} & \multicolumn{1}{c}{\textbf{column 9}}\\
\midrule
value & value & value & value & value & value & value & value & value \\
\bottomrule
\end{tabular}
%\]
\caption{My Caption}
\label{tbl:verylongtable}
}
\end{table}
\end{document}
And the exception I get is
pdflatex> ! You can't use '\hrule' here except with leaders
When I try to put the whole table environment inside the resizebox (and not only the code inside the table environment) I get the error:
pdflatex> ! Not in outer par mode
How can I scale my table anyway? I did not found a solution which works yet. And another side question: I read that in the line
\resizebox{\columnwidth}{!}{%
The %
is important. Why? I only know a percentage sign as a beginning of a comment.
\MakeUppercase{TABLENAME}
? Seems redundant... Also,\multicolumn{1}{c}{}
is not necessary in your case.%
is introducing a comment in that position see tex.stackexchange.com/questions/7453/…