3

I have an \item style command where I need to be able to suppress output for the following text. I can do this with \nullfont, but that seems like a poor hack. Is there a declaration that will suppress all output, along the lines of an \sbox0 but that is a declaration and not a command?

Here's a minimal working example (the real \myitem and the context in which it is used are more complicated).

\documentclass{report}

\newcommand{\myitem}[1]{%
  \nullfont% <-- want a better way to do this
}

\begin{document}
  \begin{enumerate}
    \item[foo] show this
    \myitem{bar} suppress this
    \item[foobar] show this too
  \end{enumerate}
\end{document}

Note that this is similar to this question but I can't modify the original tex source and thus don't have a handler for the end of the text associated with the item. There aren't paragraph skips between items.

Luke
  • 367
  • Related: http://tex.stackexchange.com/questions/100995/hide-a-certain-item-and-remove-the-left-empty-line The solution given there for description works also for enumerate (first level only). – egreg Apr 03 '13 at 15:52

1 Answers1

4

Since you say you don't have multiple paragraph entries you can use \par to end the item:

enter image description here

\documentclass{report}

\def\myitem{\setbox0\vbox\bgroup\def\par{\endgraf\egroup\par}}

\begin{document}
  \begin{enumerate}
    \item[foo] show this
    \myitem{bar} suppress this
    \item[foobar] show this too
  \end{enumerate}
\end{document}
David Carlisle
  • 757,742