zestedesavoir / latex-template

LaTeX template used for PDF exports
MIT License
16 stars 19 forks source link

tabu package is not longer maintained #135

Closed StaloneLab closed 6 months ago

StaloneLab commented 2 years ago

I was trying today to compile a very simple content using the template on TeX Live 2022, but couldn't get anything to work. After many trials, I narrowed the error down to the tabu package. For instance, this very simple code, which is supposed to work (taken for the document of tabu), doesn't:

\documentclass{article}
\usepackage{tabu}

\begin{document}
\begin{tabu} spread 30pt {|X|X|}
\hline
01234 56789 01234 56789 & 01234 56789 01234 56789 \tabularnewline
01234 56789 01234 56789 & 01234 56789 01234 56789 \tabularnewline
01234 56789 01234 56789 & 01234 56789 01234 56789 \tabularnewline
01234 56789 01234 56789 & 01234 56789 01234 56789 \tabularnewline
01234 56789 01234 56789 & 01234 56789 01234 56789 \tabularnewline
\hline
\end{tabu}
\end{document}

After searching, I found that the error was due to the tabu package not being maintained anymore, and therefore not working with TeX Live > 2019. You can find more information on the main repository: https://github.com/tabu-issues-for-future-maintainer/tabu .

While this is not a problem by now for ZdS, which uses the 2019 version, I think it might stop working anytime if we decide to update the distribution for any reason (likely because it would be updated in Debian). Would you have any idea of a replacement? I am not even sure why this package was used in the first place. Does it still offer something we need? I am including below an example of LaTeX generated by ZMarkdown so you can see an use case:

\documentclass[small]{zmdocument}

\usepackage{blindtext}
\title{Title}
\author{Author}
\licence[/opt/zds/app/dist/licenses/by-sa.svg]{CC BY-SA}{https://creativecommons.org/licenses/by-sa/4.0/legalcode}

\smileysPath{/opt/zds/app/dist/smileys/svg}
\makeglossaries

\begin{document}
\maketitle
\tableofcontents

\begin{LevelOneIntroduction}
The following table uses longtabu:

\begin{longtabu} spread 0pt {|X[-1]|X[-1]|X[-1]|} \hline
\rowfont[l]{\bfseries}
Column 1 & Column 2 & Column 3 \\ \hline
\rowfont[l]{}
A text a little bit longer in this column. And even more longer. & Text & Text \\ \hline
\end{longtabu}
\end{document}
pierre-24 commented 2 years ago

Oh boy, that one is an issue ... :'(

I am not even sure why this package was used in the first place. Does it still offer something we need?

Yeah: tables are a mess in latex, and this package allow for columns that resize with their content and the one of the table (a bit like in any text editor), something which is not possible with default latex tables.

According to https://maximsmol.medium.com/tabu-is-dead-long-live-tabularx-8ff907b66e56, we can switch (back?) to tabularx.

artragis commented 2 years ago

The last note seems to be interresting for us, no?

tabularx (see below), and xltabular (tabularx if you need multi-page tables)

StaloneLab commented 2 years ago

I looked at tabularx and xltabular, and I am left with two problems:

\begin{xltabular}{\textwidth}{|m{\dimexpr(\linewidth) / 4 - 2 * \tabcolsep}|m{\dimexpr(\linewidth) / 4 - 2 * \tabcolsep}|m{\dimexpr(\linewidth) / 4 - 2 * \tabcolsep}|} \hline
Column 1 & Column 2 & Column 3 \\ \hline
\endhead
A text a little bit longer in this column. And even more longer. & The text is actually so long we need a break inside the table. & Text \\ \hline
\end{xltabular}

Here is where I am left. I see that the work required to switch seems non-trivial, and might require new macros from the template side. Maybe we could inspire ourselves from some parts of tabu, but I cannot even understand one line of the package source.

pierre-24 commented 2 years ago

New challenger : tabularray (https://distrib-coffee.ipsl.jussieu.fr/pub/mirrors/ctan/macros/latex/contrib/tabularray/tabularray.pdf). They seem to cover both the long tables (see chapter 4) and the nasty tabu column types.

gilcot commented 1 year ago

I vote for tabularray too which is as widely used as tabularx (very simple drop-in replacement for some people) and xltabular. Question: did someone check how the same tables are exported by Pandoc?