[comp.text.tex] Is this a bug in enumerate or the ifthen.sty file?

eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (10/15/90)

TeXhax@cs.washington.edu writes:

>Is this a bug in enumerate or the ifthen.sty file?
Neither.

>\documentstyle[ifthen]{article}
>\def\S{\boldsub{S}}
>\def\boldvar#1{{\hbox{\bf #1}}}
>\def\boldsub#1#2%
>    $\ifthenelse{\equal{#2}{}}%
>      {\boldvar{#1}}
>      $\ifthenelse{\equal{#2}{'}}%
>	$\ifmmode\boldvar{#1}'\else{\boldvar{#1}'{\fi}}
>	$\ifmmode\boldvar{#1}_{#2}\else{\boldvar{#1}_{#2}{\fi}}}
So essentially you \boldsup is a box.

>This puts the S in the wrong place:
>\begin{enumerate}
>	\item \S{} is primative\dots
>	\item \S{} is complicated\dots
>\end{enumerate}
Let me guess: after \item you are still in vertical mode, and
as a box is allowed in vertical mode TeX starts the paragraph
only at the text 'is primative' or 'is complicated'.

The error is really deep down in LaTeX, but you can
repair it by
\def\boldvar#1{{\leavevmode\hbox{\bf #1}}}
The \leavevmode forces TeX to start the paragraph.

>This does the right thing:
>\beginenumerate}
>	\item \mbox{} \S{} is primative\dots
>	\item \mbox{} \S{} is complicated\dots
>\end{enumerate}
It figures. This is the definition of \mbox:
\def\mbox#1{\leavevmode\hbox{#1}}


Victor.