TransWikia.com

Tabu command replacement

TeX - LaTeX Asked on July 7, 2021

I am currently setting up a fresh LaTeX environment and trying to incorporate all my old files. They use the tabu package a lot. Since it is very outdated, giving errors etc. I decided to replace it with a similar, but updated package.

Question 1: Is there a current package out there that provides the same features as tabu? I saw some latex-table-package-overviews, but most of them list tabu as "all-rounder" with the comment: don’t use it, but without advice for a replacement.

Question 2: We have a lot of tabus, thousands of them. It would take weeks to go through all the documents and replace them all. Can you imagine a possibility to create a self-made tabu-environment based on a possible package (from Question 1). Ideally I will be able to define this globally and the files with tabus will still be working and the tables appear as close as possible to the old one.

Edit:

The features we use mostly are

  • the "to"-specifier for a given width of the tabu
  • the horizontal adjustment properties. Mentionable are the "standard" X[1c], the semi-automatic X[-1c] and the math-mode-included versions as X[-1c$]; all also in combination with the syntax for a number n of those, like n*{X[-1c$]}
  • extrarowsep=.. as vertical alignment
  • tabucline{-} and tabucline{X-Y}

I guess that would be our main uses of the tabu-features. There are also some longtabus in our works, but only just a few. I also have prepared an MWE (at least I tried as well as I can) for some of the mentioned features:

    documentclass[a4paper]{article}
    usepackage[T1]{fontenc}
    usepackage[utf8]{inputenc}
    usepackage{amsmath}
    usepackage{tabu}

    begin{document}
    begin{center} 
    begin{tabu}to 0.8linewidth{|X[-1c]|X[-1c]|X[-1c]|} 
    tabucline{-}
    Test & X & Y tabucline{-}
    Test & Z & A tabucline{-}
    end{tabu}
    end{center}

    begin{center}
    {extrarowsep=5pt
    begin{tabu}to 0.7linewidth{*4{|X[-1c$]}|}
    alpha & beta & gamma & delta tabucline{2-3}
    alpha & beta & gamma & delta
    end{tabu}}
    end{center}
    end{document}

Edit 2:

The fact that there is no solution conveys the impression that this (at least the general tabu features replacement) might be of some interest and something worth taking a deeper look. So for the first step I want to construct some tables with the same features and results but without using the tabu-package. As it might be the wrong place to expand this question any further, I started a new one here: Tabularx with calculated column widths that use the whole table width

One Answer

The new LaTeX3 package tabularray is an alternative for the outdated tabu package:

documentclass{article}
usepackage{tabularray}
begin{document}
begin{tblr}{width=0.8linewidth,colspec={|*{3}{X[2,l]|X[-2,r]|}},rowsep=4pt}
hline[1pt]
 1     & 2    & 3     & 4     & 5       & 6    
cline{1-3}
 alpha & beta & gamma & delta & epsilon & zeta 
cline[dashed]{-}
 1     & 2    & 3     & 4     & 5       & 6    
cline{1,3,5}
 alpha & beta & gamma & delta & epsilon & zeta 
hline[1pt]
end{tblr}
end{document} 

enter image description here

Answered by L.J.R. on July 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP