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:

\usepackage{array, expl3}



% % 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
    Goodbye, & cruel \\
    \exp_args:No \use_none:n { \tl_set:Nn \l_mlh_place_tl {world} }


  • why not simply \multicolumn{2}{>{\def\l_mlh_place_tl{world}}{\l_mlh_place_tl} ? Apr 5, 2019 at 9:56
  • That's one of the less satisfying solutions :-) The definitions are part of user configurations performed locally by a redefined line break command, and I want the user to be able to use, say, \midrule or the like without having things break down. Apr 5, 2019 at 10:00
  • if you defined it as a new column type say L then you could use L at the top and \multicolumn{2}{L} and your custom command is inserted at the start of every cell. Apr 5, 2019 at 10:04
  • Yes, I've used that solution, too. But the preamble is also user-configurable, and I'd like to keep it as simple as possible. I also have other solutions, including simulating my own scope stack (to avoid globals), and performing the definitions at the end of the previous line (as part of the redefined cr) – so, as is so often the case here on TeX SE, the specific MWA isn't the whole picture. I can solve the problem, but I'm wondering specifically about removing the imprint of definitions, so they can be put, e.g., at the beginning of the first cell of a row. Apr 5, 2019 at 10:07
  • But I am also interested in solving the problem this is motivated by, for sure, so thanks for the suggestions! I'm trying to figure out which way to go with this. I have a couple of implementations, but I'm trying different ways of cleaning it up, and the functionality I'm asking for would make one path more appealing. But maybe it's just a pipe dream :-) Apr 5, 2019 at 10:10

1 Answer 1


If you do not mind global definitions and you are at the start of a line you can use

\noalign{\gdef\l_mlh_place_tl {world}}

but to get before a general \multicolumn mid row you need to work harder, perhaps

enter image description here



    Goodbye, & cruel &zzz\\
   $\rightarrow$      &

  • Global definitions would have solved the problem on their own, for me – and are what I'm trying to work around. (Otherwise, I could just place the definitions before the line break.) The redefinition of \omit, and using \bgroup/\egroup to limit it, is really clever! And it'll work for \multicolumn, specifically, but not for other, similar things like, say, \hline and \midrule. (Note that in my motivating application, I don't need this mid-row, BTW.) Apr 5, 2019 at 10:40
  • But, as you said, it requires global definitions (which is what I'm trying to avoid), no? Apr 5, 2019 at 12:31
  • @MagnusLieHetland sorry I misread your comment yes \noalign is a group:-) (I will delete my comment above) Apr 5, 2019 at 13:31
  • No worries! Thanks for the input, anyway :-) I may end up combining several of these ideas, but it seems I may still have to use global definitions, and keep track of a stack of them myself, or something. (I could swear I recently saw a package that did something like that, but I haven't been able to find it again. Oh, well.) Apr 5, 2019 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .