On Fri, Apr 13, 2007 at 02:07:16AM -0700, Bintu Vasudevan wrote:
when i redefine the macro used for floats (including figures and tables) so that single spacing is used. My tex file compile and as work fine.
But when i want to usepackage{color} is hangs througing with message: ============================================= ! Too many }'s. \color@endbox ->\color@endgroup \egroup
Typical error message in case of wrong use of \setbox that doesn't respect the color interface of LaTeX. This isn't specific for pdfTeX at all, thus these mailing lists are the wrong place.
Here is Redefined the macro defined ----------------------------------------------------------------------------------------------------- % (Note \def\figure{\@float{figure}set single spacing} doesn't work % because figure has an optional argument) \def\@xfloat#1[#2]{\ifhmode \@bsphack\@floatpenalty -\@Mii\else \@floatpenalty-\@Miii\fi\def\@captype{#1}\ifinner \@parmoderr\@floatpenalty\z@ \else\@next\@currbox\@freelist{\@tempcnta\csname ftype@#1\endcsname \multiply\@tempcnta\@xxxii\advance\@tempcnta\sixt@@n \@tfor \@tempa :=#2\do {\if\@tempa h\advance\@tempcnta \@ne\fi \if\@tempa t\advance\@tempcnta \tw@\fi \if\@tempa b\advance\@tempcnta 4\relax\fi \if\@tempa p\advance\@tempcnta 8\relax\fi }\global\count\@currbox\@tempcnta}\@fltovf\fi \global\setbox\@currbox\vbox\bgroup \def\baselinestretch{1}\@normalsize \boxmaxdepth\z@ \hsize\columnwidth \@parboxrestore} -----------------------------------------------------------------------------------------------------
\setbox\@currbox\vbox\bgroup ... <color stuff> \egroup
The color stuff uses \aftergroup to reset the color.
However, in case of an unprotected \setbox, see above, these
stuff, delayed by \aftergroup, is executed *after* the box
is constructed and assigned by \setbox.
LaTeX uses an additional grouping level. Without \color the
group commands are no-ops (\relax), color redefines these
hooks as \begingroup and \endgroup.
Look at the original \@xfloat:
...
\setbox\@currbox\color@vbox\normalcolor\vbox\bgroup
...
Without color:
\color@vbox = \relax
\normalcolor = \relax
\color@endbox = \relax
\color@begingroup = \relax
\color@endgroup = \relax
With color:
\color@vbox = \vbox\bgroup\color@begingroup
\normalcolor = \let\current@color\default@color\set@color
\color@endbox = \color@endgroup\egroup
\color@begingroup = \begingroup
\color@endgroup = \endgroup
Thus use either the LaTeX's higher level macros such as
\savebox, \sbox, minipage, \parbox
or use the low level hook commands. The minimal requirement
for color is an additional grouping level:
\setbox...=\vbox{\begingroup ...\endgroup}
Yours sincerely
Heiko