lvjr / tabularray

Typeset tabulars and arrays with LaTeX3
https://ctan.org/pkg/tabularray
258 stars 22 forks source link

tabularray doesn't work with multicol package #208

Open jgunstone opened 2 years ago

jgunstone commented 2 years ago

I've been looking into tables that format correctly with multiple columns for a while and tabularray seems to work excellently.

My issue is that i would only like multiple columns on sections of the document rather than the whole lot.

I'm looking to achieve a layout that looks like this: schedule_layout

I was able to reproduce the example from here and it worked well.

I tried to adapt the example shown to use the multicol package.
It worked, but the table formatted was ruined:

image

test.tex

\documentclass{article}
\usepackage[margin=15mm]{geometry}
\usepackage{tabularray}
\usepackage{multicol}

\usepackage[sfdefault,lf]{carlito}
%% The 'lf' option for lining figures
%% The 'sfdefault' option to make the base font sans serif
\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{\carlitoOsF #1}

\begin{document}

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.

{\begin{multicols}{2}
\begin{longtblr}[
  caption = {Long Long Long Tabular},
  entry = {Short Caption},
  label = {tblr:test},
]{
  colspec = {XXX}, hlines,
  rowhead = 2, rowfoot = 1,
  row{1-2,Z} = {font=\bfseries},
}
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 \end{longtblr}

 \begin{longtblr}[
  caption = {Long Long Long Tabular},
  entry = {Short Caption},
  label = {tblr:test},
]{
  colspec = {XXX}, hlines,
  rowhead = 2, rowfoot = 1,
  row{1-2,Z} = {font=\bfseries},
}
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 \end{longtblr}

 \begin{longtblr}[
  caption = {Long Long Long Tabular},
  entry = {Short Caption},
  label = {tblr:test},
]{
  colspec = {XXX}, hlines,
  rowhead = 2, rowfoot = 1,
  row{1-2,Z} = {font=\bfseries},
}
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 \end{longtblr}

\begin{longtblr}[
  caption = {Long Long Long Tabular},
  entry = {Short Caption},
  label = {tblr:test},
]{
  colspec = {XXX}, hlines,
  rowhead = 2, rowfoot = 1,
  row{1-2,Z} = {font=\bfseries},
}
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Foot    & Foot  & Foot    \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 \end{longtblr}

 \begin{longtblr}[
  caption = {Long Long Long Tabular},
  entry = {Short Caption},
  label = {tblr:test},
]{
  colspec = {XXX}, hlines,
  rowhead = 2, rowfoot = 1,
  row{1-2,Z} = {font=\bfseries},
}
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Foot    & Foot  & Foot    \\
\end{longtblr}

\end{multicols}
}

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.

\end{document}

are the packages incompatible? or is there a way to make them work together?

Many Thanks,

lvjr commented 2 years ago

It is not easy to make tabularray work well with multicol in every use case. I will find more time to look into this bug some day.

jgunstone commented 2 years ago

ok - thanks for the update

jrmanrique commented 1 year ago

The workaround presented here works for longtable (and derivatives like xltabular), but not for longtblr. Maybe this could help in looking for a solution.