For a long time, I have been looking for a nice way to have balanced tables inside a multicol environment. Especially, I would like to have automatically balancing multicol-tables inside a table
float. While I always thought that this is merely impossible with LaTeX in its current state, I have recently discovered an extraordinary useful answer on this topic:
Balancing long table inside multicol in LaTeX
However, when I apply this technique to the case I'm investigating, I encounter a somewhat odd behaviour. Please consider the following example:
\documentclass{article}
\usepackage{longtable}
\usepackage{multicol}
\usepackage{lipsum}
\title{Lorem ipsum}
\date{\today}
\author{\LaTeX}
\makeatletter
\newsavebox\ltmcbox
\newenvironment{multicolslongtable}[1]{
\setbox\ltmcbox\vbox\bgroup
\col@number\@ne
\begin{longtable}{#1}
}{
\end{longtable}
\unskip
\unpenalty
\unpenalty\egroup
\unvbox\ltmcbox
}
\makeatother
\begin{document}
\maketitle
\begin{multicols}{2}
\lipsum[1-3]
\begin{table*}[t]
\begin{multicols}{2}
\begin{multicolslongtable}{c l}
1 &Lorem\tabularnewline
2 &ipsum\tabularnewline
3 &dolor\tabularnewline
4 &si\tabularnewline
5 &amet\tabularnewline
6 &consectetuer\tabularnewline
7 &adipiscing\tabularnewline
8 &elit\tabularnewline
\end{multicolslongtable}
\end{multicols}
\caption{Words of the first sentence by index.}
\end{table*}
\lipsum[4-10]
\end{multicols}
\end{document}
Please note that:
- There is a large gap in the right column of the first page.
- The text of both columns overruns the boundary on the first page, but not on the subsequent page(s)
I would be glad for any suggestions on how to fix this and improve my multicolslongtable
environment.