Closed jonhall closed 10 months ago
Using >{<text>}
in colspec
is equivalent to setting column key preto=<text>
, and unfortunately currently effects of preto
and appto
always accumulate hence there's no user interface to reset them.
Below is an attempt. It provides a new cell key clear={comma-separated list of selective cell keys}
so that using \SetCell[c=2]{l, clear=preto}
achieves what you want.
```tex
\documentclass{article}
\usepackage{tabularray}
\usepackage{xpatch}
\makeatletter
\ExplSyntaxOn
% redefined to clear new specs "preto" and "appto" in addition
\xapptocmd \__tblr_clear_spec_lists:
{
\__tblr_clear_one_spec_lists:n { preto } % added
\__tblr_clear_one_spec_lists:n { appto } % added
}
{} \PatchFailed
% redefined to use new spec "preto"
\cs_gset_protected:Npn \__tblr_cell_preto_text:nnn #1 #2 #3
{
\tl_set:Nx \l__tblr_cell_text_tl { \__tblr_spec_item:nn { preto } { [#1][#2] } }
\tl_put_left:Nn \l__tblr_cell_text_tl {#3}
\__tblr_spec_gput:nnV { preto } { [#1][#2] } \l__tblr_cell_text_tl
}
% redefined to use new spec "appto"
\cs_gset_protected:Npn \__tblr_cell_appto_text:nnn #1 #2 #3
{
\tl_set:Nx \l__tblr_cell_text_tl { \__tblr_spec_item:ne { appto } { [#1][#2] } }
\tl_put_right:Nn \l__tblr_cell_text_tl {#3}
\__tblr_spec_gput:neV { appto } { [#1][#2] } \l__tblr_cell_text_tl
}
\xpatchcmd \__tblr_get_cell_text_real:nn
{ \tl_set:Nx \l__tblr_c_tl { \__tblr_spec_item:ne { text } {[#1][#2]} } }
{
\tl_set:Nx \l__tblr_c_tl {
\exp_not:e { \__tblr_spec_item:ne { preto } {[#1][#2]} }
\__tblr_spec_item:ne { text } {[#1][#2]}
\exp_not:e { \__tblr_spec_item:ne { appto } {[#1][#2]} }
}
}
{ } \PatchFailed
\msg_new:nnn { tabularray } { clear-not-implemented }
{
Clearing ~ effect ~ of ~ cell ~ key ~ ``#1'' ~
is ~ not ~ implemented ~ (yet).
}
\keys_define:nn { tblr-cell-spec }
{
% clear = {
Thank you ever so much for this response. It is very much appreciated.
I will work with it and come back with further suggestions, if I have any.
I'd like the SetCell style to remove the initial '
>{Indent:}
', as it does the intermediate '|
'.Is that it doesn't a bug or a feature?