ftp://ftp.dante.de/tex-archive/macros/l ... fmtarg.pdf
The following code is cribbed almost verbatim from the above document, except that I had to add \makeatletter and \makeatother to get it to compile without error. Also, the only way I could get the code to compile was to define the macros *after* \begin{document}, which seems to be the reverse of what one is supposed to do. Anyway, the code below compiles, but gives nonsense output. Could anybody please advise?
Code: Select all
\documentclass{article}
\usepackage{ifmtarg}
\begin{document}
\makeatletter
\newcommand{\isempty}{1}{%
\@ifmtarg{#1}{YES}{NO}}
\newcommand{\isnotempty}[1]{%
\@ifnotmtarg{#1}{YES}}
\makeatother
Output from these macros:\\
This line should return YES but returns \isempty{} \\
This line should return YES but returns \isempty{ } \\
This line should return NO but returns \isempty{E} \\
This line should return NO but returns \isempty{ E } \\
This line should return NO but returns \isnotempty{} \\
This line should return YES but returns \isnotempty{E} \\
\end{document}
i.e., I'm zero for 6, and in addition, there's the NO that's printed out, presumably coming from my definition of \isempty. I presume that the NO problem is related to all the others, but, as I said, I copied pretty much verbatim from the documentation.NO
Output from these macros:
This line should return YES but returns 1
This line should return YES but returns 1
This line should return NO but returns 1E
This line should return NO but returns 1 E
This line should return NO but returns
This line should return YES but returns YES
Thanks very much advance for any help!