4

tabularray, just like tabularx, performs "trial" passes with its tables to calculate the size of things before a final pass where the table is actually typeset. This means that the contents of the table get to be processed multiple times, with some known implications. For example, tabularray offers the counter library to restore the value of counters set inside a tabularray tables.

Here on the site, there are a number of techniques for identifying trial passes for tabularx, for example: https://tex.stackexchange.com/a/227155/105447, https://tex.stackexchange.com/a/352134/105447, and https://tex.stackexchange.com/a/640035/105447.

So, the question is, is there an "official" method of distinguishing a trial from a final pass in tabularray? Failing that, are there any known reliable techniques, similar or equivalent to the ones existing for tabularx?

A MWE for the problem:

\documentclass{article}

\usepackage{tabularray}

\NewDocumentCommand{\onlyfinal}{}{% % if trial % do nothing % else (if final) % do something, for example: \typeout{Dinner.} \typeout{Oh no!} % And, of course, no one wants dinner four times in a row. }

\begin{document}

\begin{tblr}{ colspec = {@{}X[c]X[l]X[c]X[r]X[c]@{}}, hlines, vlines, } 1 & 2 & 3 & 4\onlyfinal & 5 \ \end{tblr}

\end{document}

gusbrs
  • 13,740
  • 2
    there seem to be since last month \lTblrMeasuringBool, see https://github.com/lvjr/tabularray/issues/179 (i don't know if it is already on ctan). – Ulrike Fischer Feb 19 '23 at 20:02
  • @UlrikeFischer That's good news, and exactly what I need. Thank you. It seems not to be released yet, but will eventually arrive. Would you like to answer? – gusbrs Feb 19 '23 at 20:06

1 Answers1

0

(Answered by @UlrikeFischer in the comments).

Since last month, tabularray has \lTblrMeasuringBool for precisely this purpose (see https://github.com/lvjr/tabularray/issues/179). It is not yet released, but should eventually hit CTAN.

gusbrs
  • 13,740