Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss
Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

dblfloatfix bug

282 views
Skip to first unread message

mattias...@googlemail.com

unread,
Aug 21, 2008, 5:07:07 PM8/21/08
to
Hi,

I've had a problem with the figure placement a paper I've written. I
had loaded the dblfloatfix package in order to allow for twocolumn
floats at the bottom of the page. The result was that ordinary single-
column floats had sometimes also treated as twocolumn floats, thus
producing large empty areas next to them. I took me quite some time to
hunt down the bug, so I thought I'd share the resolution. It turned
out the dblfloatfix.sty was missing a check for twocolumn floats which
resulted in single-line bottom floats to be treated as twocolumn
floats. A corrected version of dblfloatfix is reproduced below, I've
commented the added check.

Btw. Whom should I contact to merge this fix back into the original
dblfloatfix package?

Cheers,

Mattias


%% This is the LaTeX package dblfloatfix which solves two problems:
%% a)~floats in a twocolumn document come out in the right order and
%% b)~allowed float positions are now [tbp].
%%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
\ProvidesPackage{dblfloatfix}[2003/11/18 v1.0 (MH)]
%%
%% USAGE:
%%
%% This package redefines internals of the LaTeX kernel by merging
%% the code of the packages fixltx2e (the fix2col part) and stfloats.
%%
%% If either of the packages stfloats or fix2col are loaded you will
%% get an error message and your document will probably not be able
%% to compile. So don't load them!
%%
%% When the new output routine for LaTeX3 is done, this package will
%% be obsolete. The sooner the better...
%%
%% If you're using the subfigure package this package will provide a
%% fix for \end@dblfloat by Steven Cochran (the author of subfigure).
%%
%% Morten H\o gholm, <moho...@student.cbs.dk>
\RequirePackage{fixltx2e}
%% An error message for those who didn't read the instructions.
\newcommand*{\DBLFIXerrormessage}[1]{%
\PackageError{dblfloatfix}{%
Don't use the #1 package!^^J%
Didn't you read the instructions in dblfloatfix.sty?!^^J%
You're in big trouble now...^^J%
Quit immediately (type `X') and correct the mistake}%
{Type `X' dammit!}%
}
%% A check for those users who don't read manuals.
\AtBeginDocument{%
\@ifpackageloaded{stfloats}{\DBLFIXerrormessage{stfloats}}{}%
\@ifpackageloaded{fix2col}{\DBLFIXerrormessage{fix2col}}{}%
%% Here's a fix by Steven Douglas Cochran (the author of subfigure).
%% It is needed in order to make subfigure work with this package as
%% both packages redefine \end@dblfloat.
\@ifpackageloaded{subfigure}{%
\typeout{Redefining \string\end@dblfloat\ for use with subfigure}%
\def\end@dblfloat{%
\if@twocolumn
\@listsubcaptions{\@captype}%
\@endfloatbox
\ifnum\@floatpenalty <\z@
\@largefloatcheck
\global\dp\@currbox1sp %
\expandafter\@gobble\subfig@end@float
\fi
\else
\end@float
\fi}%
}{}%
}
%% Here we go...
\def\@dblbotlist{}
\newcount\@dblbotnum
\newcounter{dblbotnumber}
\setcounter{dblbotnumber}{2}
\def\@dbflt#1{\@ifnextchar[{\@xdblfloat{#1}}{\@xdblfloat{#1}[tbp]}}

\def \@dblfloatplacement {%
\global \@dbltopnum \c@dbltopnumber
\global \@dblbotnum \c@dblbotnumber
\global \@dbltoproom \dbltopfraction\@colht
\@textmin \@colht
\advance \@textmin -\@dbltoproom
\@fpmin \dblfloatpagefraction\textheight
\@fptop \@dblfptop
\@fpsep \@dblfpsep
\@fpbot \@dblfpbot
\def\f@depth{1sp}%
}

\def\@addtodblcol{%
\begingroup
\@insertfalse
\@setfloattypecounts
\@getfpsbit \tw@
\ifodd\@tempcnta
\@flsetnum \@dbltopnum
\ifnum \@dbltopnum>\z@
\@tempswafalse
\ifdim \@dbltoproom>\ht\@currbox
\@tempswatrue
\else
\ifnum \@fpstype<\sixt@@n
\advance \@dbltoproom \@textmin
\ifdim \@dbltoproom>\ht\@currbox
\@tempswatrue
\fi
\advance \@dbltoproom -\@textmin
\fi
\fi
\if@tempswa
\@bitor \@currtype \@deferlist
\@testwrongwidth\@currbox
\if@test
\else
\@bitor \@currtype \@dblbotlist
\if@test
\else
\@tempdima -\ht\@currbox
\advance\@tempdima
-\ifx \@dbltoplist\@empty \dbltextfloatsep
\else \dblfloatsep
\fi
\global \advance \@dbltoproom \@tempdima
\global \advance \@colht \@tempdima
\global \advance \@dbltopnum \m@ne
\@cons \@dbltoplist \@currbox
\@inserttrue
\fi
\fi
\fi
\fi
\fi
\if@insert
\else
\@getfpsbit 4\relax
\ifodd\@tempcnta
\@flsetnum \@dblbotnum
\ifnum \@dblbotnum>\z@
\@tempswafalse
\ifdim \@dbltoproom>\ht\@currbox
\@tempswatrue
\else
\ifnum \@fpstype<\sixt@@n
\advance \@dbltoproom \@textmin
\ifdim \@dbltoproom>\ht\@currbox
\@tempswatrue
\fi
\advance \@dbltoproom -\@textmin
\fi
\fi
\if@tempswa
\@bitor \@currtype \@deferlist
% Test for twocolumn floats (2008/08/21 Mattias Nissler)
\@testwrongwidth\@currbox
\if@test
\else
\@tempdima -\ht\@currbox
\advance\@tempdima
-\ifx \@dblbotlist\@empty \dbltextfloatsep
\else \dblfloatsep
\fi
\global \advance \@dbltoproom \@tempdima
\global \advance \@colht \@tempdima
\global \advance \@dblbotnum \m@ne
\@cons \@dblbotlist \@currbox
\@inserttrue
\fi
\fi
\fi
\fi
\fi
\if@insert
\else
\@cons\@deferlist\@currbox
\fi
\endgroup
}

\def\@combinedblfloats{%
\ifx \@dbltoplist\@empty \else \@cdblflt \fi
\ifx \@dblbotlist\@empty \else \@cdblflb \fi
}

\def\@cdblflt{%
\setbox\@tempboxa \vbox{}%
\let \@elt \@comdblflelt
\@dbltoplist
\let \@elt \relax
\xdef \@freelist {\@freelist\@dbltoplist}%
\global\let \@dbltoplist \@empty
\setbox\@outputbox \vbox% to\textheight
{%\boxmaxdepth\maxdepth %% probably not needed, CAR
\unvbox\@tempboxa\vskip-\dblfloatsep
\ifnum \@dbltopnum>\m@ne
\dblfigrule
\fi
\vskip \dbltextfloatsep
\unvbox \@outputbox
}%
}

\def\@cdblflb{%
\setbox\@tempboxa \vbox{}%
\let \@elt \@comdblflelt
\@dblbotlist
\let \@elt \relax
\xdef \@freelist {\@freelist\@dblbotlist}%
\global\let \@dblbotlist \@empty
\setbox\@outputbox \vbox% to\textheight
{%\boxmaxdepth\maxdepth %% probably not needed, CAR
\unvbox\@outputbox
\vskip \dbltextfloatsep
\ifnum \@dblbotnum>\m@ne
\dblfigrule
\fi
\unvbox\@tempboxa
\vskip -\dblfloatsep
}%
}

\def \@doclearpage {%
\ifvoid\footins
\setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
\setbox\@tempboxa\box\@cclv
\xdef\@deferlist{\@toplist\@botlist\@deferlist}%
\global \let \@toplist \@empty
\global \let \@botlist \@empty
\global \@colroom \@colht
\ifx \@currlist\@empty
\else
\@latexerr{Float(s) lost}\@ehb
\global \let \@currlist \@empty
\fi
\@makefcolumn\@deferlist
\@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
\if@twocolumn
\if@firstcolumn
\xdef\@deferlist{\@dbltoplist\@dblbotlist\@deferlist}%
\global \let \@dbltoplist \@empty
\global \let \@dblbotlist \@empty
\global \@colht \textheight
\begingroup
\@dblfloatplacement
\@makefcolumn\@deferlist
\@whilesw\if@fcolmade \fi{\@outputpage
\@makefcolumn\@deferlist}%
\endgroup
\else
\vbox{}\clearpage
\fi
\fi
\ifx\@deferlist\@empty \else\clearpage \fi
\else
\setbox\@cclv\vbox{\box\@cclv\vfil}%
\@makecol\@opcol
\clearpage
\fi
}

\endinput

Joseph Wright

unread,
Aug 21, 2008, 5:25:35 PM8/21/08
to
mattias...@googlemail.com wrote:
> Btw. Whom should I contact to merge this fix back into the original
> dblfloatfix package?

It has Morten H{\o}gholm's initials and e-mail address in it, so I would
try him: morten....@gmail.com
--
Joseph Wright

mattias...@googlemail.com

unread,
Aug 22, 2008, 4:55:27 AM8/22/08
to
On 21 Aug., 23:25, Joseph Wright <joseph.wri...@morningstar2.co.uk>
wrote:

> It has Morten H{\o}gholm's initials and e-mail address in it, so I would
> try him: morten.hoegh...@gmail.com

Yes, I found it. I had somehow missed it when posting...

Mattias

0 new messages