lvjr / tabularray

Typeset tabulars and arrays with LaTeX3
https://ctan.org/pkg/tabularray
247 stars 22 forks source link

Provide child selector every for Nth row customization #301

Open lvjr opened 1 year ago

lvjr commented 1 year ago

Discussed in https://github.com/lvjr/tabularray/discussions/281

Originally posted by **carnatak** August 6, 2022 Firstly, LOVE tabularray. Made my code so much simpler. I would like to know if there's a way to customize the "Nth" row (in my case every 3rd row) in a tabularray. row{even} does this for even rows, but I want to customize it further. ```latex \documentclass{article} \usepackage{xcolor} \usepackage{tabularray} \begin{document} \begin{tblr}{row{even} = {font = \scriptsize ,fg = blue2}} \hline Alpha & Beta & Gamma \\ \hline Epsilon & Zeta & Eta \\ % I want to make every third row have a smaller font \scriptsize and have a smaller height \hline Iota & Kappa & Lambda \\ \hline \end{tblr} \end{document} ```
lvjr commented 1 year ago

It would be quite handy to provide a child selector every for Nth row customization.

With this new child selector, most ordinary users need not to write expl3 code.,

muzimuzhi commented 1 year ago
  • every{3} selects children with index of the form 1+3x

By convention users may expect every{3} will select 3, 6, 9, ..., hence the sequence 3+3x for x = 0, 1, 2, ... (or 3x for x = 1, 2, 3, ...), not 1+3x.

lvjr commented 1 year ago

Two reasons: (1) the default value of its optional argument is 1, which is the same as odd selector; (2) when a table is separated into some parts, the subhead rows are normally of indexes 1, 4, 7, 10, etc.