I am having a problem with some code and I could use some help. I have been using this implementation for a long time now and no problems before.
Here is how I store all my variables
\newcommand{\@srulesI}{}
\newcommand{\@srulesII}{}
\newcommand{\srules}[2]{
\renewcommand\@srulesI{#1}
\renewcommand\@srulesII{#2}}%%%%%
Here is the logic for it.
\if\@srulesII\@emptymacro
\else
\begin{minipage}{\linewidth}
\raggedright
{\bfseries \rule{0em}{1.5em}\@srulesI}
\@srulesII
\end{minipage}
\fi
These pieces of code work
\srules{}{}%%%%%
\srules{}{asdf}%%%%%
\srules{asdf}{}%%%%%
\srules{asdf}{asdf}%%%%%
\srules{asdf}{asdf\rule{0.5in}{0.5in}}%%%%%
This piece of code doesnt work, which is coincidentally the one I need.
\srules{asdf}{\rule{0.5in}{0.5in}}%%%%%
It gives an error of "Incomplete \if; all text was ignored after line 40. "
Does anyone know why? I dont know why the \rule
makes the compiler have a fit.
Second question. Is what I am doing really the best way to declare and store variables? Cause I have like 50 variables and my .cls
file is getting huge.
\if
and\ifx
for understanding why\ifx
should be used instead of\if
.