[latexrefman] If you want @LaTeX{}'s standard @code{\chapter} command to do this

Vincent Belaïche vincent.belaiche at gmail.com
Sat Sep 3 06:05:43 CEST 2022


Dear Karl,

Thank you for your feedback. The wording is still surprising to me,
because if you add line '\let\cleardoublepage\clearemptydoublepage' to
the preamble, then not only '\chapter' will be affected, but indeed
any use of '\cleardoublepage'.

The way it is written assumes that the reader *does* know that under
the hood '\chapter' calls '\cleardoublepage', but 1) the silly reader
is not supposed to know this when starting reading the manual with
this node, and 2) this is true for the implementation of '\chapter' in
standard classes, but there may be some classes/packages out-there in
which '\chapter' does something else than calling '\cleardoublepage'.
For instance, I am not sure that if you load the fncychap package,
then \chapter redefinition also does this …

Furthermore, if I do a \show\chapter with book class, I see that it
begins as follows:

\if at openright \cleardoublepage \else \clearpage \fi

so when \if at openright is false, the chapter page wont't be completely blank.

Assuming \if at openright is true, and we want *ONLY* to affect \chapter,
we should rather do this (not tested …, needs to be refined to handle
\chapter optional argument properly) where the grouping ensures that
\cleardoublepage is affected only for \chapter :

\let\origchapter\chapter
\def\chapter#1{{\let\cleardoublepage\clearemptydoublepage\origchapter{#1}}}

or we could do that :

\let\origchapter\chapter
\def\chapter#1{%
  \let\cleardoublepage\clearemptydoublepage
  \origchapter{#1}%
  \let\cleardoublepage\origcleardoublepage
}

Or we could completely redefine \chapter as follows (I just took the
standard book definition and replaced \thispagestyle{plain} by
\hispagestyle{empty}:

\makeatletter
\long\def\chapter{\if at openright \cleardoublepage \else \clearpage \fi
\thispagestyle {empty}\global \@topnum \z@ \@afterindentfalse \secdef
\@chapter \@schapter}
\makeatother

Indeed, I think that the best way forward would be to propose the
fncychap maintainer to add some user command \ChPageStyle to set the
page style, so one would just do something like:

\usepackage{fncychap}
\ChPageStyle{empty}

to get empty pages for chapters.

  V.

PS : looking at the code of fncychap, I think that it could be greatly
improved (DocTeX-ing it, putting styles into separate files, prefixing
by smthing like \FNCH@ all internal macros, etc …), so I am not sure
whether this is the best package out-there for chapter customization.

Le ven. 2 sept. 2022 à 23:10, Karl Berry <karl at freefriends.org> a écrit :
>
>     Subject: [latexrefman] If you want @LaTeX{}'s standard @code{\chapter}
>             command to do this
>
> Seems correct as written to me.
>
> The "do this" refers to having \chapter do the \clearemptydoublepage
> command just described/defined in the example. -k



More information about the latexrefman mailing list.