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@
    \addvspace{1.0em \@plus\p@}%
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb at xt@\@pnumwidth{\hss #2}\par

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).


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


\def\fb at outputpage{%
% DG/SR modification begin - Sep. 4, 1997
% Problem FancyBox 1.0 <-> LaTeX 2e with the \fancypage, \fancyput,
% etc. macros when using commands like \section
% DG/SR modification end
    \catcode`\ =10
    \if at specialpage
    \if at twoside
    \csname reset at font\endcsname
% DG/SR modification begin - Sep. 4, 1997
%    \normalsize
% DG/SR modification end
    \ifx\this at fancypage\@empty\else
      \this at fancypage
      \gdef\this at fancypage{}%
    \ifx\the at fancypage\@empty\else
      \setbox\@outputbox\hbox{\the at fancypage{\box\@outputbox}}%
      \setbox\@tempboxa=\hbox to\@tempdima{%
      \hbox to\@tempdima{%
% DG/SR modification begin - Sep. 4, 1997
      \set at typeset@protect
% DG/SR modification end
      \ifnum\fancyput at flag>-1 \do at fancyput\fi
    \ifx\fb at rotatepage\@empty\else
       \setbox\@outputbox\hbox{\fb at rotatepage{\box\@outputbox}}%
       \expandafter\fb at setoffsets\fb at theoffsets

The list interface (subscription, information, access to the archives) is on:
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