At 20:37 25.04.09, Heiko Oberdiek wrote: >On Sat, Apr 25, 2009 at 06:24:08PM +0200, Uwe Lück wrote: > > >On 24/04/2009, at 6:51 PM, Heiko Oberdiek wrote: > > >>%%% begin of fixed definition %%% > > >>\def\in@#1#2{% > > >> \def\in@@##1#1##2\in@@{% > > >> \def\in@@{##2}% > > >> \ifx\in@@\@empty > > >> \in@false > > >> \else > > >> \in@true > > >> \fi > > >> }% > > >> \in@@#2\@nil#1\in@@ > > >>} > > >>%%% end of fixed definition %%% > > > > (This uses \@nil.) Putting the second split into a macro to test it > against > > \@empty is safe, but one might dislike it as "slow". > >I prefer "safe". The difference in safety is that other proposals can be fooled by \in@ or \in@@ in \in@ arguments. The "safe" proposal still can be fooled by \@nil or so in \in@ arguments. > > Other proposals need > >I haven't seen any so far. 1. LaTeX-so-far, 2.changing it by just inserting a separator in the last line according to Morten: \def\in@#1#2{% \def\in@@##1#1##2##3\in@@{% \ifx\in@##2\in@false\else\in@true\fi}% \in@@#2\@nil#1\in@\in@@} (where I proposed to use \@in@ in place of \@nil), and 3. mine (expandable test without \in@). (Attached is a file with testing tools for the four versions.) In favour of Morten's: it is the least change (compatibility). >An expandable test could be used, e.g.: > \ifx\\##2\\% or something else as \\ >instead of > \def\in@@{##2}% > \ifx\in@@\@empty >But the disadvantage is that an unmatched \if..., \else or \fi inside ##2 >breaks the \if constructs of \in@@, thus it isn't safe. And because >exandibility isn't neede here (the first definition destroys this >property anyway), I have used the more safe test for emptiness in >my proposal. Right, on the other hand \in@{a}{a#} and \in@{b}{a#} work with the expandable tests only. Cheers, Uwe.