[texhax] if condition: is macro body empty?

Susan Dittmar SDittmar at eureca.de
Thu Feb 12 09:35:17 CET 2009


Thanks, Daleif, for your answer. I had a look at ifmtarg, but could not get
it to work at all in the case I need. Perhaps because I do not really
understand the \expandafter magic.
My impression is that \@ifmtarg{\buffer}{YES}{NO} will always typeset NO
no matter what the contents of \buffer is.

I continued trying and came closer to understand what it is that does not
work:

\documentclass{article}
\usepackage{ifthen}

\newcommand{\buffer}{}
\makeatletter
\newcommand{\fillbuffer}[1]{%
	\g at addto@macro{\buffer}{\item #1}%
}
\makeatother

\begin{document}

% create a list of items:
\fillbuffer{First part.}
\fillbuffer{Second part.}
\fillbuffer{Third part.}
\fillbuffer{Fourth part.}

% now print the item list:

This works: 
\begin{itemize}
\buffer
\end{itemize}

Unfortunately I need some conditionals like this:
%\ifthenelse{\equal{\buffer}{}}{}{%
%	\begin{itemize}
%	\buffer
%	\end{itemize}
%}%

\end{document}

If I remove the first itemize block and activate the second, the error
message is:

! Use of \@item doesn't match its definition.
\@ifnextchar ...eserved at d =#1\def \reserved at a {#2}
                                                  \def \reserved at b
{#3}\futu...
l.24 \ifthenelse{\equal{\buffer}{}}
                                   {}{%
?



If I keep the first itemize block and activate the second, the error
message is:

! Undefined control sequence.
\itemize ...nce \@itemdepth \@ne \edef \@itemitem 
                                                  {labelitem\romannumeral
\t...
l.24 \ifthenelse{\equal{\buffer}{}}
                                   {}{%
?



Time is pressing and I do not know where to look for alternatives :-(

Any hints are greatly appreciated,

	Susan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://tug.org/pipermail/texhax/attachments/20090212/05afc2eb/attachment.bin 


More information about the texhax mailing list