[NTG-context] doifnextcharelse

Pablo Rodriguez oinos at gmx.es
Sun Jan 24 15:13:31 CET 2016


On 01/24/2016 02:30 PM, dr. Hans van der Meer wrote:
> I would like to differentiate on the following character being one of  X or not X.
> But cannot get it right in \doifnextcharelse.
> 
> For example 
> \def\mynextchar{\doifnextcharelse{X}{\def\Next{Y}}{\def\Next{Z}}\Next} delivers: ZX ZQ
> then input: \mynextchar X \mynextchar Q
> I hoped for YX ZQ, but it looks as if X tested false against X.
> 
> How to?

Hans,

the basic \def\mynextchar{\doifnextcharelse{x}{y}{z}} works.

With your sample:

    \def\mynextchar{
        \doifnextcharelse{X}
        {\def\Next{Y}\Next}
        {\def\Next{Z}\Next}}

I hope it helps,


Pablo
-- 
http://www.ousia.tk


More information about the ntg-context mailing list