3

Here is a minimal example that took me a long time to identify what was causing this behavior.

In most of the examples in the tabularray documentation the colspec key is the first to be indicated. However, if you want to use @{} to remove spaces before the first column and after the last one, colspec must come after colsep.

Is this normal, intended behavior or is it a bug? Or is the @{} syntax discouraged with tabularray?

Thanks for your insights and have a nice day.

%%%% MWE
\documentclass{scrartcl}

\usepackage{tabularray}

\begin{document}

\begin{tblr}{
  colsep=12pt,
  colspec={|@{}lcr@{}|},
}
  a & b & c
\end{tblr}

\begin{tblr}{
  % colspec first, @{} does not work
  colspec={|@{}lcr@{}|},
  colsep=12pt,
  % column{1}={leftsep=0pt},  % needed to have the same effect as @{} before first column
  % column{Z}={rightsep=0pt},  % needed to have the same effect as @{} after last column
}
  a & b & c
\end{tblr}
\end{document}
%%%%

1 Answer 1

5

As the author of tabularray package, I can confirm that @{} is a supported syntax.

Since both @{} and colsep change the sizes of column separation, it is a normal behaviour that they will overwrite each other.

In more details, colsep=12pt is a shortcut for

column{1} = {leftsep=12pt,rightsep=12pt},
column{2} = {leftsep=12pt,rightsep=12pt},
column{3} = {leftsep=12pt,rightsep=12pt},

while colspec={|@{}lcr@{}|} is a shortcut for

hline{1},
column{1} = {leftsep=0pt,halign=l},
column{2} = {halign=c},
column{3} = {halign=r,rightsep=0pt},
hline{3},

Therefore you need to put colsep before colspec in this use case.

6
  • I don't see @{} mentioned in the tabularray documentation, so maybe you can add this explanation tot he manual? Mar 29, 2022 at 10:19
  • Thank you for the detailed answer. Actually I had a problem understanding what colsep had an effect on. As colsep means column separation, I expected that it would only change the space between 2 columns. Since there is no column to the left of the first column, I didn't think that colsep should also change leftsep of the first column. And the same reasoning for the right of the last column.
    – Xorios
    Mar 29, 2022 at 10:55
  • Moreover I find it a bit confusing that when one indicates colsep=12pt the separation between 2 columns is in fact 24pt : 12pt space on the right of column 1 + 12pt on the left of column 2 = 24pt separation between column 1 and 2. I don't know if others would have the same conception as me, and I know it's a mostly semantic misunderstanding based on the key name but as said in the question, it took me a long time to debug my non minimal file.
    – Xorios
    Mar 29, 2022 at 10:57
  • A big thank you @L.J.R. for the development of tabularray in any case. It's super powerful and thanks to it I can now have all my tables looking exactly like what I want.
    – Xorios
    Mar 29, 2022 at 10:58
  • @PietervanOostrum You are right. Although many aspects in tabularray are the same as those in tabular, it is still better to make the documentation seft-contained.
    – L.J.R.
    Mar 29, 2022 at 11:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .