3

I am having problems trying to fit a table on page width. Here is a part of my code.

\begin{landscape}
\begin{table}[H] \scriptsize 
\setkeys{Gin}{keepaspectratio}
\resizebox*{1.8\textwidth}{2\textheight} {
   % \begin{adjustbox}{width=1.3\textwidth,center}
        \begin{tabular}{*{12}{ | c}}
    \toprule
...
    \bottomrule
  \end{tabular}
        }
    %\end{adjustbox}

\end{table}
\end{landscape}

T tried with adjustbox but it doesn't work (adjustbox.sty not found).

I use Texmaker (4.01) on Ubuntu 12.03 LTS.

2
  • 1
    Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you. Commented Apr 8, 2013 at 16:04
  • Please augment your code snippets (i) to tell us what the relevant page parameters are (paper size, margins, ...) and (ii) to give us (at least) 2 or 3 rows of actual content of the table. Without this information, it's going to be well nigh impossible to provide specific advice on how to address the issues you're facing.
    – Mico
    Commented Apr 8, 2013 at 18:49

2 Answers 2

5

Please always post complete small documents that show the problem. It is hard to offer advice for such a frament however

\begin{table}[H] 

avoid using H as it disables the float mechanism (which is the whole point of the table environment)

{1.8\textwidth}{2\textheight}

You should avoid scaling tables as it makes inconsistent font sizes, better to use \small or another suitable size (I see you have tried \scriptsize but teh \resizebox would negate any effects of the size change. But here you are scaling the table to be twice as big as the page so it has no chance of fitting.

You are using c columns which are as wide as their widest entry, perhaps you want p{1cm} columns for some width, to allow text in the entries to wrap to multiple lines. It is impossible to say given your fragment.

1

You can use the p, m or b column specifiers as described here,and assign them a width relative to \textwidth. This will force your column width. Then, you can scale your text using \tiny for example in your table. This should do the job.

5
  • Good advice apart from the last couple of sentences. The horizontal table width will not affect float position. Commented Apr 8, 2013 at 16:31
  • It usually happens to me that, if I have 2 floats side-by-side with width exactly 0.5\textwidth each, they might not get placed correctly and they go one after the other. I am not quite sure why this might happen, but setting each of them to 0.495\textwidth just fix the problem.
    – Bichoy
    Commented Apr 8, 2013 at 16:34
  • 1
    You can't have two floats side by side in latex. You can have two tables side by side in the same float but that is a different thing altogether. If two tables 0.5\textwidth wide do not fit then most likely you have missed a % at the end of the line and there is a word space between them. If the page is twice the width of A then AA will fit but A A will not. Commented Apr 8, 2013 at 16:37
  • Many thanks for your notice, I meant two tables/figures just in one float. And maybe you are right about the % thing ... this make sense for me! Thanks a lot :)
    – Bichoy
    Commented Apr 8, 2013 at 16:39
  • I corrected my comment. Many thanks for your interest and help.
    – Bichoy
    Commented Apr 8, 2013 at 16:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .