I normally use the table and tabu environment to create my tables. I am new to LaTeX and after I while I realized tables look nicer when they use the whole page width rather than being just centered. I first tried \begin{tabu} to \textwidth {ccccccc} with the tabu environment as this is my preferred env. But this seemed to have no effect at all so I tried the adjustbox package but the problem is that even if I just define width=\textwidth and remove totalheight=\textheight and keepaspectratio from the parameters the table still gets scaled in both directions. I am not sure if you can use adjustbox really only to expand the table width? Perfect would be to really just use the tabu environment if that is somehow possible.

After doing a lot of google searches it looks like that the tabularx environment is the simplest to use when tables should be spanned across the page width. My problem is, however, that I don't even get a simple tabularx example to run. I have no clue why it does not work. The package as you will see is included. That means I wasn't able to try the following command to expand the table to page width: \begin{tabularx}{\textwidth}{ccccccc}

Here is my working example. I uncommented the tabularx example otherwise it would not compile. I know that I did not remove fontsize and and \changefont to keep the example as simple as possible but I definitely need the table to work like this that is why I kept it in:


\newcommand{\changefont}[3]{\fontfamily{#1} \fontseries{#2} \fontshape{#3} \selectfont}



\changefont{phv}{m}{n} % Change font to Helvetica
\fontsize{6}{9}\selectfont{ % Change font size to size 6 and line space to 9
% \begin{adjustbox}{width=\textwidth,totalheight=\textheight,keepaspectratio}
\begin{tabu} to \textwidth {lrrrrrr}

First & Second & Third & \multicolumn{2}{r}{MulticColumn} & \multicolumn{2}{r}{MultiColumn} \\
&       &       & \textit{HB}    & \textit{HC}   & \textit{HB}    & \textit{HC} \\
AXXXXXX & 0.001 & 0.051 & 1.07 & -1.10 & -0.32 & -0.80 \\
AYYYYYY & 0.308 & 0.123 & -1.80 & -2.35 & -0.55 & -0.70 \\
AZZZZZZ & 0.227 & 0.432 & -1.99 & 1.12  & -0.88 & 0.14 \\

\caption{This is the caption}


% \begin{table}
% \begin{tabularx}{ccccccc}
% \begin{tabularx}{\textwidth}{ccccccc}

% \toprule 
% \rowfont{\bfseries\itshape}
%   First & Second & Third & \multicolumn{2}{r}{MulticColumn} & \multicolumn{2}{r}{MultiColumn} \\
%       &       &       & \textit{HB}    & \textit{HC}   & \textit{HB}    & \textit{HC} \\
%     \midrule
%     AXXXXXX & 0.001 & 0.051 & 1.07 & -1.10 & -0.32 & -0.80 \\
%     AYYYYYY & 0.308 & 0.123 & -1.80 & -2.35 & -0.55 & -0.70 \\
%     AZZZZZZ & 0.227 & 0.432 & -1.99 & 1.12  & -0.88 & 0.14 \\
%     \bottomrule
% \end{tabularx}
% \end{table}


Here is my second table which I want to squeeze to page width:


\changefont{phv}{m}{n} % Change font to Helvetica

\fontsize{6}{9}\selectfont{ % Change font size to size 6 and line space to 9

\begin{tabu} to \textwidth {*13{X[c]}}

&       & A 1   & A 2   & A 3   & A 4   & A 5  &  A 6  & A 7  & A 8  & A 9  & A 10  &  A 11 \\



  • If you just stretch the lines' spaces, I guess the result will look awful. If, on the other hand, you enlarge the font size, the result will be jarring. Besides, tables with very long lines (much data on the line) will make your esteemed reader's eyes glaze over. – vonbrand Feb 4 '13 at 19:10
  • You need to use tabu's X columns: \begin{tabu} to \textwidth {*{7}{X[c]}} (*{<num>}{<col spec} is a short way of typing <num> times the same column specifications). – cgnieder Feb 4 '13 at 19:17
  • Thanks cgnieder, when I replace my \begin{tabu} line with yours my table gets expanded across the page width. That works fine. However, I just applied that approach to my second table having 13 columns. This table is actually to big for the page and I scaled it down using adjustbox. I thought I can also use this approach to basically squeeze the table to page width. However, I got an error so I reduced the table to only 1 row and still. I cannot see what's wrong. Or is this because this approach works only when the table is no bigger than the page widt? Please see above. I added the example – Josh Feb 4 '13 at 19:44
  • @Josh enclose the 13 in braces: *{13}{X[c]}. Without them the code shouldn't run without errors. – cgnieder Feb 4 '13 at 19:56
  • oh dear. sometimes you dont see the forest for the trees ;) thanks for that! – Josh Feb 4 '13 at 20:47

Summarizing my comments into an answer: you say you tried

\begin{tabu} to \textwidth {ccccccc}

as header for the table but didn't get a table that had \textwidth as width. That is because a c column gets the width of its contents. In order to stretch (or shrink) columns in a way so they fit \textwidth tabu (and also tabularx) needs the special column type X. So

\begin{tabu} to \textwidth {XXXXXXX}

should give a table of the specified width. However, the contents won't be centered any more. This is easily fixed since tabu's X columns have an optional argument where you can specify the behaviour:

\begin{tabu} to \textwidth {X[c]X[c]X[c]X[c]X[c]X[c]X[c]}

A tip: if you have a repeated number of the same column specifications it is possible to declare them all at once using the syntax *{<num>}{<spec>}. *4c would be equivalent to cccc. It would be better to use braces here, though, (*{4}{c}) so you don't forget them when you need them: if <num> or <spec> are longer than one token you have to enclose them: *{13}{X[c]}.

All in all this now leads to

\begin{tabu} to \textwidth {*{7}{X[c]}}

Let's see if it works:

% visualize page dimensions with a frame:


\begin{tabu} to \textwidth {|*{7}{X[c]|}}
  a & b & c & d & e & f & g \\
  a & b & c & d & e & f & g \\


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.