I have a document with several tables where the content is created dynamically. Therefore, I use the evaluate functionality of tabularray.
Along with that, on some of those table, I would need to also dynamically define if I have to add a footnote to that table or not. And here is my problem.
While creating the content, I have conditions defining if I have to add a specific footnote, but then, I end up with the
Test.tex: error: 67: Package tabularray Error: Unknown outer key name '\MyTableFootNote'. \end
Here is a small test with just the command manually created, so the error can be checked:
\documentclass[% 10pt,% paper=a4,% twoside=true,% openany,% ]{scrbook}% % \usepackage{tabularray}% \UseTblrLibrary{diagbox, functional, varwidth}% % \NewTblrTheme{MyTable}{% \SetTblrStyle{caption-tag}{red2}% \SetTblrStyle{caption-sep}{red2}% \SetTblrStyle{head}{font=\bfseries\itshape}% \SetTblrStyle{foot}{\itshape, fg=blue2}% }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document}% \begin{longtblr}% [% theme = MyTable,% label = {tab:TestTableA},% caption = {Test table},% note{$\dagger$} = {This is my remarks.}% ] {% colspec = X|X|X,% width = 1.0\linewidth,% measure = vbox,% rowhead = 1,% rowfoot = 0,% row{1} = {halign=center, font=\bfseries, c},% }% \hline% Test & Test & Test \\ \hline% Test & Line & \# 1 \\ \hline% Test & Line & \# 2 \\ \hline% Test & Line & \# 3 \\ \hline% \end{longtblr}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NewDocumentCommand\MyTableFootNote{}{note{$\dagger$} = {This is my remarks.}}% % \def\MyTableFootNote{note{a} = {This is my remarks.}}% \begin{longtblr}% [% theme = MyTable,% label = {tab:TestTableB},% caption = {Test table with the conditional foot note},% \MyTableFootNote% ] {% colspec = X|X|X,% width = 1.0\linewidth,% measure = vbox,% rowhead = 1,% rowfoot = 0,% row{1} = {halign=center, font=\bfseries, c},% }% \hline% Test & Test & Test \\ \hline% Test & Line & \# 1 \\ \hline% Test & Line & \# 2 \\ \hline% Test & Line & \# 3 \\ \hline% \end{longtblr}% % \end{document}% Thanks in advance for all the help,

\NewDocumentCommand. you can use\newcommandor\NewExpandableDocumentCommandif the stuff is expandable and can be handled safely. what kind of content might be in the footnote? do you control how that is generated? could it be treated as a string, say?\newcommand&\NewExpandableDocumentCommand, but both of them get me the same error.tabularray's manual for information about ways to pre-expand macros.