[texhax] Equating conditionals

VAFA KHALIGHI vafaklg at gmail.com
Sat Sep 17 04:47:08 CEST 2011


I want to have a macro \eqnewif{#1}{#2} that if \if#1 is already defined by
\newif, then \if#1 and \if#2 is the same thing such that \#1true is the same
as \#2true and \#1false is the same as \#2false. This is what I have done:

 \documentclass{article}

\makeatletter

\newcommand*{\eq at newif}[2]{%

\expandafter\let\csname if#2\expandafter\endcsname\csname if#1\endcsname}

\def\eqnewif#1#2{\expandafter\newif\csname if#2\endcsname\eq at newif{#1}{#2}}

\newif\if at RTL

\eqnewif{@RTL}{@rl}

\@RTLtrue

\def\test{\if at rl RTL\else LTR\fi}

\makeatother

\begin{document}

\test

\end{document}


but it returns LTR instead RTL however if I move \def\test.. before
\@RTLtrue , then it behaves as I expect. How should I fix this?


Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110917/0882b60f/attachment.html>


More information about the texhax mailing list