Consider this MWE:
\documentclass[11pt]{book}
\def\entrytest{WORD}
\def\entrycurrent{NOWORD}
% \def\entrycurrent{WORD}
\ifx\entrytest\entrycurrent
\newif\ifsomething
\somethingfalse
\fi
\ifx\entrytest\entrycurrent
\ifsomething\typeout{Yes}\else\typeout{No}\fi
\fi
\begin{document}
\end{document}
In the current case, I would have expected that \ifsomething\typeout...
would have been "protected" by the \ifx
that wraps it; but something is not right, because the code halts with:
...
No
! Extra \fi.
l.15 \fi
?
Of course, if \def\entrycurrent{WORD}
so all of the \ifx
s run in the "true" branch, then everything works as expected.
So how should I go about handling uses of \newif
s which may have been themselves conditionally defined?
\ifx\entrytest\entrycurrent \newif\ifsomething
is a FFFFFFFFFAQ:-) Move the\newif
before the\ifx
.\newif
in a conditional; I can only set its values conditionally, right?