## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Table in multicolumn environment

Information and discussion about graphics, figures & tables in LaTeX documents.
lucia_
Posts: 2
Joined: Mon Sep 14, 2020 4:04 pm

### Table in multicolumn environment

Hi there,

I want to include a very long and narrow table in a Latex document. (I am in \documentclass{amsart} if that is relevant.) The table has almost 3000 rows and 3 narrow columns. When I inserted it using the normal tabular environment it spanned almost 80 pages!

Therefore, I would like to insert the table in a multicolumn environment, preferably with 3 columns, in order to save space. I would like the headings of the table to repeat each time the table starts in a new column. I would like to add a caption to the table which repeats on each new page. Finally, I would like the table to sit nicely with the rest of my text (it is part of an essay).

I am not an experienced user of Latex and pieced together some advice from forums online. Below is what I came up with. I would really appreciate some advice on how to improve on the problems I am having with what I have written so far. Alternatively, let me know if you have a better way of going about this.

I found some advice online saying to use the environment xtabular and the multicolumn environment, which I have transferred my table to, but I am having some problems.
- Originally I started the table midpage, after some other text relating to it. This meant that the table only had about 5 rows before it went onto the next column. This was fine for the first page. However, it continued only doing 5 rows in each column on the next new page i.e. not filling up the entire page! As a temporary fix, I added \newpage before the table, so now the table is spanning an entire page, but it means that I have a gap in my document. So, my first problem is getting the table to format nicely with the rest of the text. If it is necessary for the table to start on a newpage, that would be ok. As long as the text after the table filled the gap that it has left.
- My second problem is that the table is exceeding the margins which the rest of the text sits in. It seems to be fine everywhere except the bottom margin, where it is going over the page number and close to the bottom of the page.
- I don't know how to add a caption which repeats on every page that the table is on.
- This is a weird one. Only on the first column of the first page that the table is on, the table is finishing 1 row earlier than the entire rest of it.

This is in the preamble:

And in the main body of the document (I have changed the contents of the table):
\newpage\begin{multicols*}{3}\changenewpage \tablehead{\topruleApple & Banana & Orange \\*}\begin{xtabular}{    >{\centering\arraybackslash}p{\dimexpr.4\columnwidth-6\tabcolsep}    >{\centering\arraybackslash}p{\dimexpr.5\columnwidth-6\tabcolsep}    >{\centering\arraybackslash}p{\dimexpr.4\columnwidth-6\tabcolsep}}   \midrule 1  & 2  & 3 \\* \midrule 1  & 2  & 3 \\* \midrule1  & 2  & 3 \\* \midrule1  & 2  & 3 \\* \midrule%etc...1  & 2 & 3 \\* \bottomrule\label{table:results}\end{xtabular}\end{multicols*}

If I have not explained my problem well or you need any more information to help solve the problem, let me know! :)

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm
First question I asked myself: who would read 3000 rows of data? Is there any way you can convert your data into a plot of some sort?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

lucia_
Posts: 2
Joined: Mon Sep 14, 2020 4:04 pm
Hi Johannes,

Unfortunately, a plot would not be possible. But, now that you say that, you have inspired me to think that perhaps I could condense the data down in a different, more palatable way... Thanks! :)

For future reference, regarding the method that I was describing to construct a table over multiple columns, would you agree with the method that I used? Do you have any advice on how it could be better? Hate to leave a problem unsolved!

Best,

Lucia