bug in fancybox

Denis Girou Denis.Girou at idris.fr
Thu Sep 4 22:21:29 CEST 1997


-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------

    Eric.Picheral> I just discover what seems to be a bug in the new version of
    Eric.Picheral> fancybox.sty.

    D.G.>   After verification, I see that it is a side effect that I never detect in a
    D.G.> correction I made on fancybox.sty

    D.G.>   For your case, it is enough to remove this correction:
    D.G.> %\newcount\c at tocdepth

    D.G.>   But it is a workaround because at this time the problem I detected (and
    D.G.> which was several times reported after - mainly by people using fancybox with
    D.G.> Seminar) with macros like \fancyput and \fancypage appear again.

    D.G.>   So what we have to do is to found a better correction than mine, with
    D.G.> no side effect...

  It is not an easy case and was hard to understand... But now I understand
where the original problem was, why defining \newcount\c at tocdepth solve it in
appearance and why the table of contents disappear as Eric Picheral mention it.

  The error message come from:

\newcommand*\l at section[2]{%
  \ifnum \c at tocdepth >\z@
    \addpenalty\@secpenalty
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb at xt@\@pnumwidth{\hss #2}\par
    \endgroup
  \fi}

which is called when using the \section macro (as in my error test case) but
also in a table of contents. Problem is that outside a TOC, there is an error
on \addpenalty\@secpenalty (and the following line too) which said that we are 
not in vertical mode. It explain why adding just \newcount\c at tocdepth solve
the problem: it reset also \c at tocdepth to 0, so the test is false and the
problematic macros not executed... It explain too why TOC become empty, as the
depth indicator is reset to 0...

  Nevertheless, I don't know why a problem occur here. What is sure is that
it is related to the internal mechanism to output the pages, that fancybox
redefine and which has drastically changed between LaTeX 209 (on which
fancybox is based) and 2e. As it is very TeXnical, I'm stricly unable to
update it for 2e. But after looking at the code of \@outputpage in 2e and a
lot of experiments, the following changes seems to work (even if I can't
justify them...)

  Thanks to fancybox users to tell me if they found new problems with these
modifications (don't forget to remove the \newcount\c at tocdepth line at the
beginning of the file).

D.G.


\def\fileversion{1.0/97 patch 2}
\def\filedate{1997/09/04}
% DG/SR modification begin - May 16, 1997
\providecommand\@begindvi{} % For rather old versions of LaTeX 2e
% DG/SR modification end

...........................................................................

\def\fb at outputpage{%
  \begingroup
% DG/SR modification begin - Sep. 4, 1997
% Problem FancyBox 1.0 <-> LaTeX 2e with the \fancypage, \fancyput,
% etc. macros when using commands like \section
    \let\protect\noexpand
% DG/SR modification end
    \catcode`\ =10
    \let\-\@dischyph
    \let\'\@acci
    \let\`\@accii
    \let\=\@acciii
    \if at specialpage
      \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
    \fi
    \if at twoside
      \ifodd\count\z@
        \let\@thehead\@oddhead
        \let\@thefoot\@oddfoot
        \let\@themargin\oddsidemargin
      \else
        \let\@thehead\@evenhead
        \let\@thefoot\@evenfoot
        \let\@themargin\evensidemargin
      \fi
    \fi
    \csname reset at font\endcsname
% DG/SR modification begin - Sep. 4, 1997
%    \normalsize
    \protect\normalsize
% DG/SR modification end
    \baselineskip\z@
    \lineskip\z@
    \let\par\@@par
    \ifx\this at fancypage\@empty\else
      \this at fancypage
      \gdef\this at fancypage{}%
    \fi
    \ifx\the at fancypage\@empty\else
      \setbox\@outputbox\hbox{\the at fancypage{\box\@outputbox}}%
    \fi
    \ifx\fb@@rotatepage\@empty\else
      \setbox\@outputbox\hbox{\fb@@rotatepage{\box\@outputbox}}%
    \fi
    \setbox\@outputbox\vbox{%
      \@tempdima=\wd\@outputbox
      \setbox\@tempboxa=\hbox to\@tempdima{%
        \let\label\@gobble
        \let\index\@gobble
        \let\glossary\@gobble
        \@thehead}%
      \ht\@tempboxa\headheight
      \dp\@tempboxa\z@
      \box\@tempboxa
      \vskip\headsep
      \box\@outputbox
      \baselineskip\footskip
      \hbox to\@tempdima{%
        \let\label\@gobble
        \let\index\@gobble
        \let\glossary\@gobble
        \@thefoot}}
    \ifx\the@@fancypage\@empty\else
      \setbox\@outputbox\hbox{\the@@fancypage{\box\@outputbox}}%
    \fi
    \setbox\@outputbox\vbox{%
% DG/SR modification begin - Sep. 4, 1997
      \set at typeset@protect
% DG/SR modification end
      \ifnum\fancyput at flag>-1 \do at fancyput\fi
      \vskip\topmargin
      \moveright\@themargin\box\@outputbox}%
    \ifx\fb at rotatepage\@empty\else
       \setbox\@outputbox\hbox{\lower\ht\@outputbox\box\@outputbox}%
       \dp\@outputbox\z@
       \wd\@outputbox\z@
       \setbox\@outputbox\hbox{\fb at rotatepage{\box\@outputbox}}%
       \expandafter\fb at setoffsets\fb at theoffsets
    \fi
    \shipout\box\@outputbox
    \global\@colht\textheight
  \endgroup
  \stepcounter{page}%
  \let\firstmark\botmark}

-----------------------------------------------------------------------------
The list interface (subscription, information, access to the archives) is on:
http://www.tug.org/cgi-bin/lwgate/pstricks
Otherway to unsubscribe, send mail to pstricks-request at mail.tug.org
with a blank subject and in body the line unsubscribe <email-address>
-----------------------------------------------------------------------------



More information about the PSTricks mailing list