SetTblrTemplate not works for contfoot-text,conthead-text
Version:2024A
In the following two examples, SetTblrTemplate works for head,foot in the example 1, but not works for contfoot-text,conthead-text in the example 2.
example 1: works normaly
\documentclass{article}
\usepackage{ctex}
\usepackage{xcolor}
\usepackage{tabularray}
\begin{document}
\SetTblrTemplate{head,foot}{empty}
%\SetTblrTemplate{contfoot-text,conthead-text}{empty}
\begin{longtblr}
[label=none]
{
colspec = {|X|X|X|}, width = 0.85\linewidth,
rowhead = 1,
}
\hline
Head & Head & Head \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta\TblrNote{a} & Eta \\
\hline
Iota & Kappa\TblrNote{$\dag$} & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta & Eta \\
\hline
Iota & Kappa & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Foot & Foot & Foot \\
\hline
\hline
Head & Head & Head \\
\hline
Head & Head & Head \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta\TblrNote{a} & Eta \\
\hline
Iota & Kappa\TblrNote{$\dag$} & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta & Eta \\
\hline
Iota & Kappa & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Foot & Foot & Foot \\
\hline
Head & Head & Head \\
\hline
Head & Head & Head \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta & Eta \\
\hline
Iota & Kappa & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Foot & Foot & Foot \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta & Eta \\
\hline
Iota & Kappa & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Epsilon & Zeta\TblrNote{a} & Eta \\
\hline
Iota & Kappa\TblrNote{$\dag$} & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta & Eta \\
\hline
Iota & Kappa & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Foot & Foot & Foot \\
\end{longtblr}
\end{document}
example 2: works abnormaly, and an error is raised:
! Use of ??? doesn't match its definition.
??? ! LaTeX Error: Erroneous variable \l__tblr_template_conthea... l.135 \end {longtblr} ?
\documentclass{article}
\usepackage{ctex}
\usepackage{xcolor}
\usepackage{tabularray}
\begin{document}
%\SetTblrTemplate{head,foot}{empty}
\SetTblrTemplate{contfoot-text,conthead-text}{empty}
\begin{longtblr}
[label=none]
{
colspec = {|X|X|X|}, width = 0.85\linewidth,
rowhead = 1,
}
\hline
Head & Head & Head \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta\TblrNote{a} & Eta \\
\hline
Iota & Kappa\TblrNote{$\dag$} & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta & Eta \\
\hline
Iota & Kappa & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Foot & Foot & Foot \\
\hline
\hline
Head & Head & Head \\
\hline
Head & Head & Head \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta\TblrNote{a} & Eta \\
\hline
Iota & Kappa\TblrNote{$\dag$} & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta & Eta \\
\hline
Iota & Kappa & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Foot & Foot & Foot \\
\hline
Head & Head & Head \\
\hline
Head & Head & Head \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta & Eta \\
\hline
Iota & Kappa & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Foot & Foot & Foot \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta & Eta \\
\hline
Iota & Kappa & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Epsilon & Zeta\TblrNote{a} & Eta \\
\hline
Iota & Kappa\TblrNote{$\dag$} & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Alpha & Beta & Gamma \\
\hline
Epsilon & Zeta & Eta \\
\hline
Iota & Kappa & Lambda \\
\hline
Nu & Xi & Omicron \\
\hline
Rho & Sigma & Tau \\
\hline
Phi & Chi & Psi \\
\hline
Foot & Foot & Foot \\
\end{longtblr}
\end{document}
However, the manual (section 4.2.1, page 40) says:
For each of the above elements (in table 4.4), two templates normal and empty are always defined. You can select one of them with \SetTblrTemplate command
is this a bug, or there is something I was missing?
Am 24.09.2024 um 16:36 schrieb @.*** @.***>:
In the following two examples, SetTblrTemplate works for head,foot in the example 1, but not works for contfoot-text,conthead-text in the example 2.
\documentclass{article} \usepackage{ctex} \usepackage{xcolor} \usepackage{tabularray}
\begin{document}
%\SetTblrTemplate{head,foot}{empty} \SetTblrTemplate{contfoot-text,conthead-text}{empty}
\DefTblrTemplate{contfoot-text}{default}{} \DefTblrTemplate{conthead-text}{default}{}
Worked for me
@hvoss49 yes, \DefTblrTemplate{contfoot-text}{default}{} works.
But, why SetTblrTemplate can not work? If it is designed so, the manual should be revised.
But, why
SetTblrTemplatecan not work? If it is designed so, the manual should be revised.
Because both conthead-text and contfoot-text elements have no empty template defined.
https://github.com/lvjr/tabularray/blob/913756cbd813a7d1b9e2bff00e58b8b0f49076bf/tabularray.sty#L4873-L4874 https://github.com/lvjr/tabularray/blob/913756cbd813a7d1b9e2bff00e58b8b0f49076bf/tabularray.sty#L4901-L4902
Instead, both conthead and contfoot elements do have empty templates which do nothing. Maybe that's the suggested user interfaces.
https://github.com/lvjr/tabularray/blob/913756cbd813a7d1b9e2bff00e58b8b0f49076bf/tabularray.sty#L4876
https://github.com/lvjr/tabularray/blob/913756cbd813a7d1b9e2bff00e58b8b0f49076bf/tabularray.sty#L4897
According to how the default conthead template is defined, to get empty heads for continued parts of a table, maybe one has to use \SetTblrTemplate{conthead}{empty} instead of just setting an empty conthead-text. Just see the \leavevmode and \par in \DefTblrTemplate { conthead } { normal } { ... }.
A similar argument holds for contfoot.
https://github.com/lvjr/tabularray/blob/913756cbd813a7d1b9e2bff00e58b8b0f49076bf/tabularray.sty#L4912-L4923
@muzimuzhi In other words, the instruction "For each of the above elements, two templates normal and empty are always defined." in the manual is inaccurate. So it is better to revise the manual for users who are not familiar with the implementation code.