# Move table in book class documents

I need to add some tables in book class document. At times the table is wider than the text. This is no problem when it happens on odd pages since they have bigger right margins and I will bind from the left as shown below.

However, it becomes a problem when the table has to be on even pages as show below because binding happens on the right side and part of the table will be affected. Hence, it would be better to let the extra table take space on the left hand side instead of the right on even pages. How to achieve this, please? Thank you! My example is attached below.

    \documentclass[a4paper, twoside, hidelinks, 11pt]{book}

\usepackage{booktabs}
\usepackage{lipsum}

\begin{document}

\begin{table}[h]
\centering
\begin{tabular}{rccccc}
\toprule
Blah & Blah     & Blah & Blah     & Blah & Blah Blah Blah Blah \\ \midrule
-0.4    & -0.00495 & 0.02716  & 0.02719 & (0.70525, 1.34978) & (0.67622, 1.32378) \\
-0.3    & -0.00558 & 0.02534  & 0.02537 & (0.71227, 1.33488) & (0.68681, 1.31319) \\
-0.2    & -0.00616 & 0.02362  & 0.02366 & (0.71923, 1.32050) & (0.69718, 1.30282) \\
-0.1    & -0.00669 & 0.02201  & 0.02206 & (0.72613, 1.30662) & (0.70732, 1.29268) \\
0.1     & -0.00762 & 0.01909  & 0.01915 & (0.73968, 1.28034) & (0.72692, 1.27308) \\
0.2     & -0.00802 & 0.01776  & 0.01783 & (0.74636, 1.26790) & (0.73638, 1.26362) \\
0.3     & -0.00838 & 0.01652  & 0.01659 & (0.75294, 1.25591) & (0.74561, 1.25439) \\
0.4     & -0.00870 & 0.01536  & 0.01543 & (0.75945, 1.24439) & (0.75462, 1.24538) \\ \bottomrule
\end{tabular}
\end{table}

\lipsum[1-5]

\begin{table}[h]
\centering
\begin{tabular}{rccccc}
\toprule
Blah & Blah     & Blah & Blah     & Blah & Blah Blah Blah Blah \\ \midrule
-0.4    & -0.00495 & 0.02716  & 0.02719 & (0.70525, 1.34978) & (0.67622, 1.32378) \\
-0.3    & -0.00558 & 0.02534  & 0.02537 & (0.71227, 1.33488) & (0.68681, 1.31319) \\
-0.2    & -0.00616 & 0.02362  & 0.02366 & (0.71923, 1.32050) & (0.69718, 1.30282) \\
-0.1    & -0.00669 & 0.02201  & 0.02206 & (0.72613, 1.30662) & (0.70732, 1.29268) \\
0.1     & -0.00762 & 0.01909  & 0.01915 & (0.73968, 1.28034) & (0.72692, 1.27308) \\
0.2     & -0.00802 & 0.01776  & 0.01783 & (0.74636, 1.26790) & (0.73638, 1.26362) \\
0.3     & -0.00838 & 0.01652  & 0.01659 & (0.75294, 1.25591) & (0.74561, 1.25439) \\
0.4     & -0.00870 & 0.01536  & 0.01543 & (0.75945, 1.24439) & (0.75462, 1.24538) \\ \bottomrule
\end{tabular}
\end{table}

\end{document}

• @touhami I don't see \adjustwidth in the question :-) – Joseph Wright Aug 3 '15 at 6:22
• I'd say that a table that is too wide is a problem regardless. I'd try to reorganize the data to either not require wide tables (perhaps use other units, split the table into several, delete not-so-relevant columns, abbreviate headers and explain in the caption/surrounding text). Or, if nothing else works, typeset it sideways. – vonbrand Aug 3 '15 at 18:27

Try this one. It's similar to @Werner answer, but I automate tabular align.

\documentclass[a4paper, twoside, hidelinks, 11pt]{book}

\usepackage{booktabs}
\usepackage{lipsum}
\makeatletter
\newcommand*\mytabalign{%
\edef\sk@align{\ifodd\c@page l\else r\fi}
\makebox[\textwidth][\sk@align]}
\makeatother
\begin{document}

\begin{table}[h]
\centering
\mytabalign{\begin{tabular}{rccccc}
\toprule
Blah & Blah     & Blah & Blah     & Blah & Blah Blah Blah Blah \\ \midrule
-0.4    & -0.00495 & 0.02716  & 0.02719 & (0.70525, 1.34978) & (0.67622, 1.32378) \\
-0.3    & -0.00558 & 0.02534  & 0.02537 & (0.71227, 1.33488) & (0.68681, 1.31319) \\
-0.2    & -0.00616 & 0.02362  & 0.02366 & (0.71923, 1.32050) & (0.69718, 1.30282) \\
-0.1    & -0.00669 & 0.02201  & 0.02206 & (0.72613, 1.30662) & (0.70732, 1.29268) \\
0.1     & -0.00762 & 0.01909  & 0.01915 & (0.73968, 1.28034) & (0.72692, 1.27308) \\
0.2     & -0.00802 & 0.01776  & 0.01783 & (0.74636, 1.26790) & (0.73638, 1.26362) \\
0.3     & -0.00838 & 0.01652  & 0.01659 & (0.75294, 1.25591) & (0.74561, 1.25439) \\
0.4     & -0.00870 & 0.01536  & 0.01543 & (0.75945, 1.24439) & (0.75462, 1.24538) \\ \bottomrule
\end{tabular}}
\end{table}

\lipsum[1-5]

\begin{table}[h]
\centering

\mytabalign{\begin{tabular}{rccccc}
\toprule
Blah & Blah     & Blah & Blah     & Blah & Blah Blah Blah Blah \\ \midrule
-0.4    & -0.00495 & 0.02716  & 0.02719 & (0.70525, 1.34978) & (0.67622, 1.32378) \\
-0.3    & -0.00558 & 0.02534  & 0.02537 & (0.71227, 1.33488) & (0.68681, 1.31319) \\
-0.2    & -0.00616 & 0.02362  & 0.02366 & (0.71923, 1.32050) & (0.69718, 1.30282) \\
-0.1    & -0.00669 & 0.02201  & 0.02206 & (0.72613, 1.30662) & (0.70732, 1.29268) \\
0.1     & -0.00762 & 0.01909  & 0.01915 & (0.73968, 1.28034) & (0.72692, 1.27308) \\
0.2     & -0.00802 & 0.01776  & 0.01783 & (0.74636, 1.26790) & (0.73638, 1.26362) \\
0.3     & -0.00838 & 0.01652  & 0.01659 & (0.75294, 1.25591) & (0.74561, 1.25439) \\
0.4     & -0.00870 & 0.01536  & 0.01543 & (0.75945, 1.24439) & (0.75462, 1.24538) \\ \bottomrule
\end{tabular}}
\end{table}

\end{document}


I'm not sure it work propely in all situation, but it seems work well in this case (inside table environment).

• That is great. However, if I add \caption{}, the title will not be centered with respect to the table. – LaTeXFan Aug 3 '15 at 10:43
• @LaTeXfan Of course. Caption content is aligned respect the textwidth, while the tabular width is greater than textwidth. If you want caption centered respect the table, you can define \newcommand*\mytabalign{\makebox[\textwidth][c]} instead of my previous definition. – skevin93 Aug 3 '15 at 15:03

I would suggest compiling your book and wait to adjust such things right at the very end. At that time you can avoid overfull \hbox warnings for oversized odd-page tabulars using

\makebox[0pt][l]{\begin{tabular}{..}
...
\end{tabular}}


and even-page tabulars using

\raggedleft
\makebox[0pt][r]{\begin{tabular}{..}
...
\end{tabular}}


Here is your example in action:

\documentclass[a4paper, twoside]{book}

\usepackage{booktabs,lipsum}

\begin{document}

\begin{table}[h]
\makebox[0pt][l]{%
\begin{tabular}{rccccc}
\toprule
Blah & Blah     & Blah & Blah     & Blah & Blah Blah Blah Blah \\ \midrule
-0.4    & -0.00495 & 0.02716  & 0.02719 & (0.70525, 1.34978) & (0.67622, 1.32378) \\
-0.3    & -0.00558 & 0.02534  & 0.02537 & (0.71227, 1.33488) & (0.68681, 1.31319) \\
-0.2    & -0.00616 & 0.02362  & 0.02366 & (0.71923, 1.32050) & (0.69718, 1.30282) \\
-0.1    & -0.00669 & 0.02201  & 0.02206 & (0.72613, 1.30662) & (0.70732, 1.29268) \\
0.1     & -0.00762 & 0.01909  & 0.01915 & (0.73968, 1.28034) & (0.72692, 1.27308) \\
0.2     & -0.00802 & 0.01776  & 0.01783 & (0.74636, 1.26790) & (0.73638, 1.26362) \\
0.3     & -0.00838 & 0.01652  & 0.01659 & (0.75294, 1.25591) & (0.74561, 1.25439) \\
0.4     & -0.00870 & 0.01536  & 0.01543 & (0.75945, 1.24439) & (0.75462, 1.24538) \\
\bottomrule
\end{tabular}}
\end{table}

\lipsum[1-5]

\begin{table}[h]
\raggedleft
\makebox[0pt][r]{%
\begin{tabular}{rccccc}
\toprule
Blah & Blah     & Blah & Blah     & Blah & Blah Blah Blah Blah \\ \midrule
-0.4    & -0.00495 & 0.02716  & 0.02719 & (0.70525, 1.34978) & (0.67622, 1.32378) \\
-0.3    & -0.00558 & 0.02534  & 0.02537 & (0.71227, 1.33488) & (0.68681, 1.31319) \\
-0.2    & -0.00616 & 0.02362  & 0.02366 & (0.71923, 1.32050) & (0.69718, 1.30282) \\
-0.1    & -0.00669 & 0.02201  & 0.02206 & (0.72613, 1.30662) & (0.70732, 1.29268) \\
0.1     & -0.00762 & 0.01909  & 0.01915 & (0.73968, 1.28034) & (0.72692, 1.27308) \\
0.2     & -0.00802 & 0.01776  & 0.01783 & (0.74636, 1.26790) & (0.73638, 1.26362) \\
0.3     & -0.00838 & 0.01652  & 0.01659 & (0.75294, 1.25591) & (0.74561, 1.25439) \\
0.4     & -0.00870 & 0.01536  & 0.01543 & (0.75945, 1.24439) & (0.75462, 1.24538) \\
\bottomrule
\end{tabular}}
\end{table}

\end{document}


Automation of this procedure may indeed be possible, but it heavily depends on your typical use of tabular (inside floats and/or outside, for example).

• That is great. However, if I add \caption{}, the title will not be centered with respect to the table. Is there a way to fix that, please? – LaTeXFan Aug 3 '15 at 10:55

The main problem is your table being too large and this happens, because there is too much data in it for the text width you have :) As a consequence, I see different possibilities to resolve the issue:

1. Change the formatting of your table. You could, for example, display the pairs on two lines instead of using (... , ...). Or write .123 instead of 0.123, depending on the conventions used in your domain. Another way would be to use different scaling units, e.g. 2.716 instead of 0.02716 with the factor $10^{-2}$ written in the column title. Again, this can or cannot be feasible.

2. Use \small font size. This will make your table smaller. However, it can become more difficult to read, depending on the actual content you have.

3. Use the float environment table, put the table on a separate page and have it typeset in landscape format.

If none of these possibilities (or combinations thereof) work for you, you might try to force LaTeX to have the table protrude into the outer margin instead of the right margin. While writing this, I can see Werner already showed you how to do this.

A solution based on tabularx, and playing with \arraycolsep shows the table can be exactly textwidth wide. I added the siunitx package to format the numbers in the first four columns.

\documentclass[a4paper, twoside]{book}

\usepackage{booktabs, tabularx, siunitx, lipsum}
\renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash$}m{#1}<{$}}
\begin{document}

\lipsum[1]

\begin{table}[h]\setlength\extrarowheight{1.5pt}
\begin{tabularx}{\linewidth}{@{\,}S[table-format=-1.1]S[table-format=-1.5]S[table-format=1.5]S[table-format=1.5]XX @{\,}}
\toprule
{Blah} & Blah & Blah & Blah & \text{Blah} & \parbox{\hsize}{\centering Blah Blah Blah Blah} \\[1ex]
\midrule
-0.4 & -0.00495 & 0.02716 & 0.02719 & (0.70525, 1.34978) & (0.67622, 1.32378) \\
-0.3 & -0.00558 & 0.02534 & 0.02537 & (0.71227, 1.33488) & (0.68681, 1.31319) \\
-0.2 & -0.00616 & 0.02362 & 0.02366 & (0.71923, 1.32050) & (0.69718, 1.30282) \\
-0.1 & -0.00669 & 0.02201 & 0.02206 & (0.72613, 1.30662) & (0.70732, 1.29268) \\
0.1 & -0.00762 & 0.01909 & 0.01915 & (0.73968, 1.28034) & (0.72692, 1.27308) \\
0.2 & -0.00802 & 0.01776 & 0.01783 & (0.74636, 1.26790) & (0.73638, 1.26362) \\
0.3 & -0.00838 & 0.01652 & 0.01659 & (0.75294, 1.25591) & (0.74561, 1.25439) \\
0.4 & -0.00870 & 0.01536 & 0.01543 & (0.75945, 1.24439) & (0.75462, 1.24538) \\
\bottomrule
\end{tabularx}
\end{table}

\end{document}