From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/clrdblpg/clrdblpg.dtx | 152 +++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 macros/latex/contrib/clrdblpg/clrdblpg.dtx (limited to 'macros/latex/contrib/clrdblpg/clrdblpg.dtx') diff --git a/macros/latex/contrib/clrdblpg/clrdblpg.dtx b/macros/latex/contrib/clrdblpg/clrdblpg.dtx new file mode 100644 index 0000000000..0bdc44edae --- /dev/null +++ b/macros/latex/contrib/clrdblpg/clrdblpg.dtx @@ -0,0 +1,152 @@ +% \iffalse +% +AMDG This document was begun on 19 April 1202, the +% feast of St. Anselm, and it is humbly dedicated to him +% and to the Immaculate Heart of Mary for +% their prayers, and to the Sacred Heart of Jesus for His +% mercy. +% +% This document is copyright 2018 by Donald P. Goodman, and is +% released publicly under the LaTeX Project Public License. The +% distribution and modification of this work is constrained by the +% conditions of that license. See +% http://www.latex-project.org/lppl.txt +% for the text of the license. This document is released +% under version 1.3 of that license, and this work may be distributed +% or modified under the terms of that license or, at your option, any +% later version. +% +% This work has the LPPL maintenance status 'maintained'. +% +% The Current Maintainer of this work is Donald P. Goodman +% (dgoodmaniii@gmail.com). +% +% This work consists of clrdblpg.dtx, clrdblpg.ins, and +% derived files clrdblpg.sty and clrdblpg.pdf. +% \fi + +% \iffalse +%\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%\ProvidesPackage{clrdblpg}[2018/04/21 v1.0 Control page style of blank pages] +%<*driver> +\documentclass{ltxdoc} + +\usepackage{doc} +\usepackage{xurl} +\usepackage{luatex85} +\usepackage{lmodern} +\usepackage[]{clrdblpg} +\usepackage[colorlinks]{hyperref} + +\begin{document} +\DocInput{clrdblpg.dtx} +\end{document} +% \fi +% +% \title{The |clrdblpg| Package, v1.0} +% \author{Donald P.\ Goodman III} +% \date{\today} +% +% \maketitle +% +% \begin{abstract} +% \noindent +% This tiny package allows easy manipulation of the headers +% and footers on pages left blank by |\cleardoublepage|. By +% default, \LaTeX\ has no easy facilities for this. This +% package uses more or less the algorithm listed in the +% |fancyhdr| package documentation, with some added +% flexibility thrown in. +% \end{abstract} +% +% \tableofcontents +% +% \section{Introduction} +% +% \LaTeX\ clears double pages when using certain classes +% because certain divisions, such as chapters, must normally +% start on recto (odd) pages. This sometimes results in a +% page which is blank. However, \LaTeX\ puts the normal +% page dressings on these blank pages. This might be the +% right decision in certain cases; but in other cases, it's +% certainly wrong. Yet there is no easy way to change this +% behavior. +% +% \section{Usage} +% +% So here's |clrdblpg|. This tiny package takes an +% algorithm redefining the normal \LaTeX\ command +% |\cleardoublepage| from the |fancyhdr| documentation (by +% Piet van Oostrum and George Gr{\"a}tzer), but indents it +% better and adds the ability to control which page style +% will be applied to the blank pages. +% +% To see the original algorithm, and the excellent +% |fancyhdr| package which you should almost certainly +% already be using, see \url{http://ctan.org/pkg/fancyhdr}. +% +% To use the package, simply load the package |clrdblpg| +% with the |style| option expressing what page style you +% want. The default is to set the blank pages as having +% page style |empty|, so if that's what you want, you do not +% need to list an option. +% +% \begin{center} +% \begin{tabular}{lp{0.4\textwidth}} +% |\usepackage{clrdblpg}| & Leaves cleared verso pages +% empty, with neither header nor footer \\ +% |\usepackage[style=empty]{clrdblpg}| & Leaves cleared verso pages +% empty, with neither header nor footer \\ +% |\usepackage[style=plain]{clrdblpg}| & Leaves cleared verso pages +% with the |plain| style, meaning no header and a +% centered page number for a footer \\ +% \end{tabular} +% \end{center} +% +% Obviously, any page style (defined by \LaTeX, some class +% or package, or you) can be used instead. +% +% And that's it for this little package. +% +% \section{Implementation} +% +% Start with a reasonable default. I don't personally think +% the \LaTeX\ default here is reasonable, so I've not done +% it. I think |empty| makes sense; hence, the default. +% \begin{macrocode} +\def\clrdblpg@pagestyle{empty}% +% \end{macrocode} +% Require |xkeyval|, and set our package option. +% \begin{macrocode} +\RequirePackage{xkeyval} +\DeclareOptionX{style}{\def\clrdblpg@pagestyle{#1}} +\ProcessOptionsX +% \end{macrocode} +% Now define the command. This is taken directly from the +% documentation of the |fancyhdr| package +% (\url{http://ctan.org/pkg/fancyhdr}), +% but with better +% indentation and the ability to select a pagestyle for the +% blank page. +% \begin{macrocode} +\def\cleardoublepage{% + \clearpage% + \if@twoside% + \ifodd% + \c@page% + \else% + \hbox{}% + \vspace*{\fill}% + \thispagestyle{\clrdblpg@pagestyle}% + \newpage% + \if@twocolumn% + \hbox{}% + \newpage% + \fi% + \fi% + \fi% +}% +% \end{macrocode} +% And there's the |clrdblpg| package. I hope it proves +% useful to someone besides myself. Happy \TeX{}ing! +% +% \PrintIndex -- cgit v1.2.3