2

I have taken a look at a number of questions about using longtable inside a multicols environment, particularly this one, where a multicolslongtable environment was defined. Note I am not nesting multicols though.

The environment is fine except in the case where there's also a page break. The first column will end up being too long and the second too short. Following page breaks are fine (I don't need a second page break in this case, but I guess it's worth mentioning!).

Below is a minimal example with screenshot.

\documentclass[a4paper]{article}
\usepackage{longtable}
\usepackage{multicol}

\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}
\def\exampletext{This is just a small text with a few longer choiceofwords also.}
\def\ttt{\exampletext\exampletext\exampletext\exampletext\exampletext}
\ttt\ttt\ttt

\ttt\ttt\ttt

\def\r{Aaaa & 0010 & text \tabularnewline}
\def\rr{\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r}
\begin{multicols}{2}
\begin{multicolslongtable}{lll}
\rr\rr\rr\rr\rr\rr\rr\rr\rr\rr\rr
\end{multicolslongtable}
\end{multicols}
\end{document}

screenshot of problem

jonaslb
  • 171

0 Answers0