Latex - tables taking up too much room

  • Context: LaTeX 
  • Thread starter Thread starter lavster
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary
SUMMARY

The discussion focuses on optimizing the layout of multiple tables in LaTeX to reduce excessive spacing between them. Users identified that LaTeX's default settings, including external spacings and internal padding, contribute to larger gaps compared to word processors like Microsoft Word. Solutions include using a single table float for multiple tables and adjusting the tabular environment to minimize spacing. The floating behavior of tables in LaTeX can also affect their arrangement on the page, leading to varying results based on the number of tables and surrounding text.

PREREQUISITES
  • Understanding of LaTeX table environments
  • Familiarity with the tabular environment in LaTeX
  • Knowledge of LaTeX floating mechanisms
  • Basic LaTeX syntax for captions and labels
NEXT STEPS
  • Explore LaTeX table float options and their impact on layout
  • Learn how to customize spacing in LaTeX using the \setlength command
  • Investigate the use of minipage for side-by-side table arrangements
  • Study advanced LaTeX table packages like 'booktabs' for improved aesthetics
USEFUL FOR

LaTeX users, academic writers, and researchers who need to format tables efficiently in their documents.

lavster
Messages
213
Reaction score
0
Hi,
when i have multiple tables together the spacing between them is large and takes up unnecessary room. I have 5 tables which span the entire width and are one ontop of the other. If i was to put these tables into word they would fit into the one page. However, on latex the are spread over two pages due to the huge gaps between them (they don't even make it look nice). How do i get around this issue and force them to be closer together?
Thanks in advance
 
Physics news on Phys.org
Can you show us the tex?
I cannot tell what you've done from the description. We only need the bit with the tables and the header to support them.

Generally:

Word uses smaller margins than LaTeX defaults, so you can fit more horizontally across the page.

In LaTeX a table is an environment and so has the same external spacings as any environment (iirc: 0.5 line above and below). It also has internal padding.

It can be prettier if you float the tables - you can get into trouble if you try for too much fine control over how LaTeX places things.
 
Okay thanks. here is an example of a table:


\begin{table}[htp]
\caption{Caption goes here}
\begin{center}
\begin{tabular}{c c c c c c}

\hline\hline
Plan (\%) & 1 & 2& 3 & 4 & 5\\
\hline
Max & 108.7 & 108.1 & 109.2 & 108.7 & 109 \\
Min & 86.2 & 88.4 & 91.6 & 92.3 & 89.6 \\
\end{tabular}
\label{p5}
\end{center}
\end{table}

I don't mind how many fit in one line - its how many fits in a page - i personally think it looks silly when there is huge gaps

Thanks
 
Well I can fit six of those on one page of a standard A4 layout in the default article single-page style. They look OK to me - about 2.5-3 lines between them.

I can pack them closer by including more than one tabular environment inside a table environment.

[later] Hmmm ... fiddling around I managed to get BIG spaces so I only had four to a page. That was ugly! But I saw what happened - if there are few tables, they will get spaced out. If I add more floating tables they got packed together again. If there was text, it ended up shifting the tables around too. Maybe that's what happened with you?

If your tables have a natural grouping and you want them all together, try putting them all in the same table float.
 
i didnt include all the info but you appear to see what my probem in anyway...

Do you mean do this:

\begin{table}[htp]
\caption{Caption goes here}
\begin{center}
\begin{tabular}{c c c c c c}

\hline\hline
Plan (\%) & 1 & 2& 3 & 4 & 5\\
\hline
Max & 108.7 & 108.1 & 109.2 & 108.7 & 109 \\
Min & 86.2 & 88.4 & 91.6 & 92.3 & 89.6 \\
\end{tabular}
\label{p5}
\end{center}

\caption{Caption goes here}
\begin{center}
\begin{tabular}{c c c c c c}

\hline\hline
Plan (\%) & 1 & 2& 3 & 4 & 5\\
\hline
Max & 108.7 & 108.1 & 109.2 & 108.7 & 109 \\
Min & 86.2 & 88.4 & 91.6 & 92.3 & 89.6 \\
\end{tabular}
\label{p5}
\end{center}
\end{table}

I tried to do the minipage environment thing but it didnt work for me. It just kind of did two tables side by side and overlapping. But yeah all my tables are connected so i want them to be all next to each other.

Thanks
 
I think you need to put tex inside code tags - but you have the idea - except you only need one center environment inside the table environment.
Code:
\begin{table}[htp]
  \begin{center}
    \caption{Caption1 goes here}
    \begin{tabular}{c c c c c c}
\hline\hline
Plan (\%) &  1       &  2       &  3       & 	4      &  5     \\
\hline
Max &  108.7 &  108.1 &  109.2 &  108.7 &  109  \\
Min &  86.2   &  88.4  &  91.6   &  92.3  &  89.6 \\
    \end{tabular}
 
    \caption{Caption 2goes here}
    \begin{tabular}{c c c c c c}
\hline\hline
Plan (\%) &  1       &  2       &  3       & 	4      &  5     \\
\hline
Max         &  108.7 &  108.1 &  109.2 &  108.7 &  109  \\
Min          &  86.2   &  88.4  &  91.6   &  92.3  &  89.6 \\
    \end{tabular}
  \end{center}
\end{table}
... each environment starts and ends with a paragraph break, except tabular, they can add up. You can also create your own special table environment to tell it not to do this... for advanced users though, I've never needed to.
 
Last edited:
Fantastic! this works exactly how i wanted it to! thanks :)
 
No worries.

Of course you don't have to float the tables :)
 
what do you mean by float the tables?
 
  • #10
"floating" is when the position of a page element is not fixed. You float a table with the \begin{table} ... the table won't always appear right where you insert the \begin.

This is useful because it allows LaTeX to adjust where it puts tables in the text for different page sizes, if you have 2 columns, if you add more text later, or whatever. With more wysiwyg publishing tools you fix the position of tables and graphics and "wrap" text around them, instead, but html prefers to use floats so, for eg, web pages can adjust to different screen sizes.

I suspect the floating algorithm is what has been messing with the spacing - I was getting 4 tables to a page: evenly spaced on the page. But it went compact when I changed the number of tables and/or the amount of additional text.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 11 ·
Replies
11
Views
8K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K