[texhax] bug in list of figures

T.M. Sommers tmsommers2 at gmail.com
Wed Jul 20 01:06:24 CEST 2011


On 7/19/2011 4:22 PM, Heiko Oberdiek wrote:
> On Mon, Jul 18, 2011 at 06:51:45PM -0400, T.M. Sommers wrote:
>
>> On 6/27/2011 10:15 AM, T.M. Sommers wrote:
>>> I believe this problem should be classified as a genuine bug, not
>>> a (mis)feature.
>>>
>>> I have a figure that appears very early in the first chapter of a
>>> book. It appears in the first column (using \twocolumn) of the
>>> first page of the chapter, under the chapter title but before any
>>> other text. So far, so good.
>>>
>>> The problem is that in the list of figures this first \addvspace
>>> appears after, not before, this figure, and it is thus separated
>> >from the other figures of the same chapter, which is ugly.
>
>> Here is a sample that demonstrates the problem.  I'd appreciate some
>> feedback on whether this is a genuine problem or whether I am doing
>> something stupid.
>
>> \documentclass[oneside,twocolumn]{book}
>
>> \begin{document}
>>
>> \listoffigures
>>
>> \chapter{one}
>>
>> Some random text. Some random text. Some random text.
>> \begin{figure}\centering Text in float.\caption{Caption}\end{figure}
>> Some random text. Some random text. Some random text.
>
> It's a problem of \chapter in class `book' in twocolumn mode.
> The chapter head is put as kind of float object at the top of the
> page. However this does not include the space writing for the
> list of figures. That is done at the start of the column text.
> However the first figures comes before and therefore its
> caption is put before the space.
>
> Try the following fix:
>
> \makeatletter
> \def\@chapter[#1]#2{%
>    \ifnum\c at secnumdepth>\m at ne
>      \if at mainmatter
>        \refstepcounter{chapter}%
>        \typeout{\@chapapp\space\thechapter.}%
>        \addcontentsline{toc}{chapter}%
>          {\protect\numberline{\thechapter}#1}%
>      \else
>        \addcontentsline{toc}{chapter}{#1}%
>      \fi
>    \else
>      \addcontentsline{toc}{chapter}{#1}%
>    \fi
>    % Fix: \chaptermark and \addtocontents are moved
>    % in \@topnewpage if twocolumn is active.
>    \if at twocolumn
>      \@topnewpage[%
>        \chaptermark{#1}%
>        \addtocontents{lof}{\protect\addvspace{10\p@}}%
>        \addtocontents{lot}{\protect\addvspace{10\p@}}%
>        \@makechapterhead{#2}%
>      ]%
>    \else
>      \chaptermark{#1}%
>      \addtocontents{lof}{\protect\addvspace{10\p@}}%
>      \addtocontents{lot}{\protect\addvspace{10\p@}}%
>      \@makechapterhead{#2}%
>      \@afterheading
>    \fi
> }
> \makeatother

Thanks; I'll try it.

-- 
T.M. Sommers -- tmsommers2 at gmail.com -- ab2sb


More information about the texhax mailing list