Is it possible to have definitions take effect at the beginning of the first cell of a tabular row (using array.sty
, if relevant), and still leave room for \multicolumn
, \hline
, etc.? The problem is, of course, that these commands begin with \omit
, which gets upset by anything having been put into the cell already.
I've been able to hack around the issue (by using globals and simulating scopes, or by creating my own multicolumn command), but I'm wondering if there's some simple, non-hacky way of doing this? Intuitively, it seems to me that there's no real call for concern about there having been a definition earlier in the cell, as that doesn't use the formatting that isn't being changed…?
I'm aware that there cannot be contents before \omit
, and, yes, in general you'd want to put stuff inside a \multicoumn
, for example – but what I'm specifically after here is specifically placing the definitions before \omit
. (If that isn't possible in any way, I have other, less satisfying solutions :-)
My thought was that perhaps there was something similar to \use_none:n
that would actually perform the definition, but not leave any tokens in the input stream – perhaps by applying \exp_args:No
to \use_none:n
to perform the definition.
Here's an MWE:
\documentclass{article}
\usepackage{array, expl3}
\begin{document}
\ExplSyntaxOn
% % Problem with \omit
% \begin{tabular}{ll}
% Goodbye, & cruel \\
% \tl_set:Nn \l_mlh_place_tl {World}
% \multicolumn{2}{l}{\l_mlh_place_tl}
% \end{tabular}
%
% % No definition happens
% \begin{tabular}{ll}
% Goodbye, & cruel \\
% \use_none:n { \tl_set:Nn \l_mlh_place_tl {world} }
% \multicolumn{2}{l}{\l_mlh_place_tl}
% \end{tabular}
% Still no definition happens
\begin{tabular}{ll}
Goodbye, & cruel \\
\exp_args:No \use_none:n { \tl_set:Nn \l_mlh_place_tl {world} }
\multicolumn{2}{l}{\l_mlh_place_tl}
\end{tabular}
\ExplSyntaxOff
\end{document}
\multicolumn{2}{>{\def\l_mlh_place_tl{world}}{\l_mlh_place_tl}
? – David Carlisle Apr 5 '19 at 9:56\midrule
or the like without having things break down. – Magnus Lie Hetland Apr 5 '19 at 10:00\multicolumn{2}{L}
and your custom command is inserted at the start of every cell. – David Carlisle Apr 5 '19 at 10:04