[texhax] \if... \else... \fi command

Robin Fairbairns Robin.Fairbairns at cl.cam.ac.uk
Sun Jul 25 14:20:39 CEST 2004

> I'm a plain TeX user. I wrote:

in that case, you should have read the relevant documentation.  latex
is for people who don't want to understand the inner workings of tex,
not plain tex.

> \newtoks\filename
> \filename={file6}
>
> Then I want to write an if... \else...\fi' command
> which says yes' if \filename={file6} and no' in any other case.
>
> I tried with
>
> \if\filename file6 Yes \else No \fi
>
> but it goes on saying no', whereas I expect it should say yes'.
> What should the right syntax be? Can anyone help?

because it's comparing the token \filename (which is unexpandable)
with the token f, a doomed exercise.

\edef\tempa{\the\filename}
\def\tempb{file6}
\ifx\tempa\tempb yes\else no\fi

`