# [NTG-context] eating up &

Hans van der Meer hansm at science.uva.nl
Fri Jul 14 15:12:32 CEST 2006

Hans van der Meer wrote:

> I want to do something with & in (my homemade) tables (making it an
> active column separator).
> Now I have a macro with two arguments for parameters in Context
> style:
>
> \def\starttablex{\dodoubleargument\dostarttablex}
> \def\dostarttablex[#1][#2]{%
>
> Now for input:�\starttablex[][] & ... all is well,
> but for input: \starttablex[]� �& ... the ampersand appears to
> be eaten
> up by the double argument expansion.
>

After some experimenting with argument retrieval I guess I figured
out what happens here.
Reducing to one optional argument and crippling \dosingleempty to
\def\dosingleempty#1%
{\noshowargumenterror % \relax % prevents lookahead, brr
dosinglefakeempty#1}
There is no problem in processing the active &.
Therefore I conclude to the following: on inspecting the next
character with "\doifnextcharelse[%" the character which is compared
is the &. Being not equal to [ it is given back but -- if I remember
well -- there can be a catcode problem. I guess & still functions as
separator in the \halign template but no longer functions as a macro,
as it should in my code.

There might be no solution for this within TeX's limitations. But
maybe you can confirm cq. deny that from your knowledge of TeX (which
certainly is greater than mine).

Hans van der Meer