I need to check several macros and do some actions only if their expansion is not empty nor space only.
In pseudo code I would look like this
\if\macroToBeTested
\doSomething
\doSomethingElse
\fi
macros \doSomething and \doSomethingElse should only execute if \macroToBeTested expands to something that contains at least one character which is not space.
How can I implement that? I prefer using something like this
\if\test{\macroToBeTested}%
\doSomething%
\doSomethingElse%
\fi
rather then anything like this
\test{\macroToBeTested}{%
\doSomething%
\doSomethingElse%
}
EDIT
Here is example (pseudocode)
\newcommand{\macroToBeTested}{ }%
Hello%
\if\test{\macro}%
World!%
\fi
This would print only "Hello", while this
\newcommand{\macroToBeTested}{ s }%
Hello%
\if\test{\macro}%
World!%
\fi
should print "Hello World!".
\givenmacro only works with arguments, it does not work correctly if argument of\givenis another macro. Your other code in answerhttp://tex.stackexchange.com/a/94931/3442 uses the other syntax (not\if...\else...\fi) – Rasto Jan 23 '13 at 00:05