The following code works, although I have a feeling my \settowidth method of discarding the output is not how it should be done:
\documentclass{article} \newlength{\trashlength} \long\def\ignoreoutput#1{% \settowidth{\trashlength}{#1}% } \long\def\command#1{ This \gdef\stuff{Stored: #1} shouldn't be here. } %% Should not raise Missing \begin{document} error here: %\ignoreoutput{\command} \begin{document} % Should produce "nothing": no\ignoreoutput{\command{Side %\par %%%%% this breaks everything. effect!}}thing. % Should output the text previously stored: \ifx\stuff\undefined No side effect. \else \stuff \fi \end{document} When uncommenting the \par though, it breaks: with Paragraph ended before \@settodim was complete.
So how do I ignore commands that allow long input?