I need to create a document with frequently changing between one and two columns and a lot of (long)tables and sometimes including a (multipage) pdf document. The complete document and resulting pdf is created automatically, so no possibility to inject column or page breaks manually.
I choose tabularray for it's wide and easy possibilites of row- and col-spanning as well as creating long tables.
I started with multicols package, but chapters with too many long tables have problems in correct column/page breaks.
...finally I found this post Balancing long table inside multicol in LaTeX
Any chance that this works with tabularray as well?
This is what it tried:
\documentclass[11pt, a5paper]{article}
\usepackage[margin=3cm]{geometry}
\usepackage{tabularray}
\usepackage{multicol}
\newsavebox\ltmcbox
\def\shortlipsum{\par Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque.\par}
\newcounter{entryno}
\setcounter{entryno}{1}
\def\tabline{Test & \the\value{entryno} & Description\addtocounter{entryno}{1}\}
\def\tablines{\tabline\tabline\tabline\tabline\tabline}
\begin{document}
\begin{multicols}{2}
\shortlipsum
\medskip
\setbox\ltmcbox\vbox{
\makeatletter\col@number\@ne
\begin{longtblr}[caption={}, label=none, entry=none]{colspec={lll}}
%\tablines\tablines\tablines\tablines\tablines\tablines
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
a & b & c\\
\end{longtblr}
\unskip
\unpenalty
\unpenalty}
\unvbox\ltmcbox
\medskip
\shortlipsum
\end{multicols}
\shortlipsum
\end{document}
Sorry for my ugly code, but I didn't get the tablines macros working inside the table.

\makeatletter\col@number\@neis not working for longtblr, but I don't know which variable would be the equivalent, or I'm on the wrong track... – Peter Weis Aug 12 '22 at 20:44longtblrputs the rows into several layers of boxes.longtableon the other hand puts it into a single box, which is removed by\unvbox\ltmcbox. It doesn't help to unbox thelongtblrseveral times because there are also other elements (like penalties or spaces or so, if I remember correctly) that makes it impossible to break the thing apart in standard LaTeX. Maybe some Lua code in Luatex could do it? – Pieter van Oostrum Aug 12 '22 at 21:47