1

Context

I have a dark coloured table header and white vertical lines in that header. I want to set these options as a default for the tblr environment. From the manual, page 32 I read that I can do so using the \SetTblrInner command. But when I do so, the vertical lines defined in the colspec don't align with the vertical lines coloured by vline.

MWE

This is my starting point:

\documentclass{article} \usepackage{xcolor} \usepackage{tabularray} \begin{document} \begin{table}[htp] \begin{tblr}{ colspec = {|l|l|l|}, row{1} = {bg=blue, fg=white, font=\bfseries}, hline{1,2,Z} = {}, vline{2-Y} = {1}{white}, } A & B & C\\ 1 & 2 & 3\\ 10 & 20 & 30\\ 100 & 200 & 300\\ \end{tblr} \end{table} \end{document} 

enter image description here

Now I move all options except the colspec (as that changes from table to table) into the \SetTblrInner command:

\documentclass{article} \usepackage{xcolor} \usepackage{tabularray} \SetTblrInner{ row{1} = {bg=blue, fg=white, font=\bfseries}, hline{1,2,Z} = {}, vline{2-Y} = {1}{white} } \begin{document} \begin{table}[htp] \begin{tblr}{ colspec = {|l|l|l|} } A & B & C\\ 1 & 2 & 3\\ 10 & 20 & 30\\ 100 & 200 & 300\\ \end{tblr} \end{table} \end{document} 

And I get this:
enter image description here

Changing the vline color and zooming in, it's visible that the thick white part is not actually the line, but a blank space between the vline line and the | line:

enter image description here

Question

How can I set default tblr options while also using colspec in the individual tables?

What I've tried

I have removed the intra-column pipe | from the colspec

colspec = {|lll|} 

and set the vertical lines completely in the \SetTblrInner part

\SetTblrInner{ ... vline{2-Y} = {2-Z}{black} } 

That removes the issue, but reduces flexibility.

1 Answer 1

1

If you leave also the | in the colspec you're drawing two vertical lines.
Leave them out and arrange the vline options.

\documentclass{article} \usepackage{xcolor} \usepackage{tabularray} \SetTblrInner{ row{1} = {bg=blue, fg=white, font=\bfseries}, hline{1,2,Z} = {}, vline{1,Z} = {}, vline{2-Y} = {1}{white}, vline{2-Y} = {2-Z}{}, } \begin{document} \begin{table}[htp] \begin{tblr}{ colspec = {lll} } A & B & C\\ 1 & 2 & 3\\ 10 & 20 & 30\\ 100 & 200 & 300\\ \end{tblr} \end{table} \end{document} 

enter image description here

This in not a workaround, it's a feature of the package.
It allows you to draw how many rules do you like, see this example:

\documentclass{article} \usepackage{xcolor} \usepackage{tabularray} \begin{document} \begin{table}[htp] \begin{tblr}{ colspec = {l|||l|||l} } A & B & C\\ 1 & 2 & 3\\ 10 & 20 & 30\\ 100 & 200 & 300\\ \end{tblr} \end{table} \end{document} 

enter image description here

Also an ordinary tabular would behave this way.

7
  • Thanks, I edited this workaround briefly after asking the question. I guess my issue is: why are the | lines not the same lines as the ones drawn by vline? Commented Dec 17, 2023 at 11:52
  • @SaaruLindestøkke It's a feature of the package, you can draw more then one line, see page 16 of the documentation, for example. Commented Dec 17, 2023 at 11:57
  • @SaaruLindestøkke See my renewed answer, hope it explains the reason of this behavior. Commented Dec 17, 2023 at 12:02
  • Ok, so the | symbol is simply not equal to a vline, right? These are just different things and I should not expect them to be usable interchangeably? Commented Dec 17, 2023 at 12:48
  • @SaaruLindestøkke They are the same. You can have more vline, too, with the same behavior. Commented Dec 17, 2023 at 13:30

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.