[Tugindia] Re: abstract and figure capton defintion

monsurate at vsnl.com monsurate at vsnl.com
Wed Oct 15 01:54:20 CEST 2003

> >\def\figurename{Fig}
> >\makeatletter
> >\long\def\@makecaption#1#2{%
> >  \vskip\abovecaptionskip
> >  \sbox\@tempboxa{#1:\par#2}% <--- changed
> >  \ifdim \wd\@tempboxa >\hsize
> >    #1:\par #2\par % <--- changed
> >  \else
> >    \global \@minipagefalse
> >    \hb at xt@\hsize{\hfil\box\@tempboxa\hfil}%
> >  \fi
> >  \vskip\belowcaptionskip}
> >\makeatother

This won't work for single line captions. A \par is ineffectual in
restricted horizontal mode, which is what a single line caption would
end up in, leaving you without even a space between the colon and the
caption text. Anyway, if all lines are centered, we can do away with
the test entirely.

   #1:\\ #2\par

Or if you still need different treatment for single line and multiple
line captions, use this instead:

   \ifdim \wd\@tempboxa >\hsize
     \global \@minipagefalse
     \hb at xt@\hsize{\hfil\box\@tempboxa\hfil}%

Rajiv Monsurate

More information about the tugindia mailing list