1

Is an extension of this answer or this answer possible such that an additional argument to the issued command is passed directly without defining a new command or macro for each possible argument?

root
  • 418

1 Answers1

2

\collectcell takes an argument, which is applied to a brace group which contains the cell contents, there is no requirement that that first argument is a single token so you can do for example

\collectcell{\hyperlink{foo}}

which if the cell contents are ... & zzz & ...

will execute

 \hyperlink{foo}{zzz}

and make the intended link.

David Carlisle
  • 757,742
  • This is the same as I suggested in my more thorough answer to https://tex.stackexchange.com/questions/514223/insert-in-array-preamble-and-in-array-preamble – egreg Oct 30 '19 at 14:08
  • @egreg so it is (although that answer wasn't there when I started to write this:-) Close this one as dup? – David Carlisle Oct 30 '19 at 14:11
  • It's more complicated with \newcolumntype. Yes, it seems answered now under egreg's link. – root Oct 30 '19 at 14:34
  • @root no it's exactly the same, as egreg showed. \newcolumntype definitions are expanded out before the tabular starts so anything that ypu can do directly in a tabular preamble you can do in necolumntype – David Carlisle Oct 30 '19 at 14:37