2

I try to put a very large table inside a pdf:

\begin{table}
\begin{center}
   \caption{ \textit{Title}. Some comments.}
    \begin{tabular}{llllllll}
    \hline
    Parameter       & bbbbbb & cccccc & dddddd & eeeee & fffff & gggggg & hhhhh \\ \hline
    Parameter 1     & 111111  & 111111  & 111111 & 111111 & 111111 & 111111 & 111111 \\
    Parameter 2     & 0.0    & 0.0   & 0.0  & 0.0  & 0.0  & 0.0  & 0.0      \\
    Parameter 3   & 0.0    & 0.0   & 0.0  & 0.0  & 0.0  & 0.0  & 0.0        \\
    Parameter 4   & 444444  & 444444  & 444444 & 444444 & 444444 & 444444 & 444444 \\
     Parameter ...   & .....  & .....  & ..... & ..... & ..... & ..... & ..... \\ \hline

    \end{tabular}
 \end{center}
\end{table}

I read the help in Table out of margin but I can't be able to found a very simple way to show this table because also in this case the table go out from the margin. Maybe I make some mistakes using \sisetup{table-format=1.4e06,exponent-product = \cdot}.

Can You help me to found a solution?

Thanks.

  • 2
    Well, this one doesn't go into the margin, so it's hard to say what's the best solution. Please give a MWE. – Bernard Aug 7 '14 at 21:20
  • 1
    It's difficult to understand what the problem is here. Can you include a MWE and maybe a sketch of what you want to achieve? – Andy Clifton Aug 7 '14 at 21:21
1

As one option, you can use adjustbox package and provide max width as 1.1\textwidth. Then the table is restricted to that width only if it is wider than 1.1\textwidth. Also use center option to center that table.

\documentclass[a4paper]{article}
\usepackage{adjustbox}
\usepackage{kantlipsum}   %% just for demo
\usepackage{showframe}   %% just for demo
\begin{document}
\kant[1]
\begin{table}[htb]
\caption{ \textit{Title}. Some comments.}
\begin{adjustbox}{max width=1.1\textwidth,center}
\begin{tabular}{llllllll}
\hline
Parameter    & bbbbbb  & cccccc & dddddd & eeeee  & fffff  & gggggg & hhhhh  \\ \hline
Parameter 1  & 111111  & 111111 & 111111 & 111111 & 111111 & 111111 & 111111 \\
Parameter 2  & 0.0     & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    \\
Parameter 3  & 0.0     & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    \\
Parameter 4  & 444444  & 444444 & 444444 & 444444 & 444444 & 444444 & 444444 \\
Parameter ...& .....   & .....  & .....  & .....  & .....  & .....  & .....  \\ \hline
\end{tabular}
\end{adjustbox}
\end{table}
\kant[2]
\end{document}

enter image description here

Since your table is not wider than 1.1\textwidth, it is not resized.

Another option is to use \makebox

\documentclass[a4paper]{article}
\usepackage{kantlipsum}   %% just for demo
\usepackage{showframe}   %% just for demo
\begin{document}
\kant[1]
\begin{table}[htb]
\caption{ \textit{Title}. Some comments.}
\makebox[\textwidth][c]{%
\begin{tabular}{llllllll}
\hline
Parameter    & bbbbbb  & cccccc & dddddd & eeeee  & fffff  & gggggg & hhhhh  \\ \hline
Parameter 1  & 111111  & 111111 & 111111 & 111111 & 111111 & 111111 & 111111 \\
Parameter 2  & 0.0     & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    \\
Parameter 3  & 0.0     & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    \\
Parameter 4  & 444444  & 444444 & 444444 & 444444 & 444444 & 444444 & 444444 \\
Parameter ...& .....   & .....  & .....  & .....  & .....  & .....  & .....  \\ \hline
\end{tabular}
}
\end{table}
\kant[2]
\end{document}
2

A good way to easily identify bad boxes is to use the draft option of most document classes, which prints a black box to the right of every overful box.

The code below shows you where is the bad box:

\documentclass[a4paper,draft]{article}
\begin{document}

\begin{table}
\caption{ \textit{Title}. Some comments.}
\centering
\begin{tabular}{llllllll}   
\hline
Parameter    & bbbbbb  & cccccc & dddddd & eeeee  & fffff  & gggggg & hhhhh  \\ \hline
Parameter 1  & 111111  & 111111 & 111111 & 111111 & 111111 & 111111 & 111111 \\
Parameter 2  & 0.0     & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    \\
Parameter 3  & 0.0     & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    \\
Parameter 4  & 444444  & 444444 & 444444 & 444444 & 444444 & 444444 & 444444 \\
Parameter ...& .....   & .....  & .....  & .....  & .....  & .....  & .....  \\ \hline
\end{tabular}
\end{table}

\end{document}

The overful boxes are indicated by black boxes to the right as this:

enter image description here

The error message says:

Overfull \hbox (24.80644pt too wide) in paragraph at lines 7--16

In this case you can simply make room for 25pt extra space without making the table smaller. I choose 25pt as indicated by the error message. Here is how you do it:

\documentclass[a4paper,draft]{article}
\begin{document}

\begin{table}
\caption{ \textit{Title}. Some comments.}
\centering
\begin{tabular}{llllllll}   
\hline
Parameter    & bbbbbb  & cccccc & dddddd & eeeee  & fffff  & gggggg & hhhhh  \\ \hline
Parameter 1  & 111111  & 111111 & 111111 & 111111 & 111111 & 111111 & 111111 \\
Parameter 2  & 0.0     & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    \\
Parameter 3  & 0.0     & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    & 0.0    \\
Parameter 4  & 444444  & 444444 & 444444 & 444444 & 444444 & 444444 & 444444 \\
Parameter ...& .....   & .....  & .....  & .....  & .....  & .....  & .....  \\ \hline
\end{tabular}\hspace*{-25pt}
\end{table}

\end{document}

The table then looks like this (without any warnings):

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.