Debian Codegraph @

texmf-dist/source/latex/clrdblpg/clrdblpg.dtx

raw
1 % \iffalse
2 % +AMDG This document was begun on 19 April 1202, the
3 % feast of St. Anselm, and it is humbly dedicated to him
4 % and to the Immaculate Heart of Mary for
5 % their prayers, and to the Sacred Heart of Jesus for His
6 % mercy.
7 %
8 % This document is copyright 2018 by Donald P. Goodman, and is
9 % released publicly under the LaTeX Project Public License. The
10 % distribution and modification of this work is constrained by the
11 % conditions of that license. See
12 % http://www.latex-project.org/lppl.txt
13 % for the text of the license. This document is released
14 % under version 1.3 of that license, and this work may be distributed
15 % or modified under the terms of that license or, at your option, any
16 % later version.
17 %
18 % This work has the LPPL maintenance status 'maintained'.
19 %
20 % The Current Maintainer of this work is Donald P. Goodman
21 % ([email protected]).
22 %
23 % This work consists of clrdblpg.dtx, clrdblpg.ins, and
24 % derived files clrdblpg.sty and clrdblpg.pdf.
25 % \fi
26
27 % \iffalse
28 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
29 %<package>\ProvidesPackage{clrdblpg}[2018/04/21 v1.0 Control page style of blank pages]
30 %<*driver>
31 \documentclass{ltxdoc}
32
33 \usepackage{doc}
34 \usepackage{xurl}
35 \usepackage{luatex85}
36 \usepackage{lmodern}
37 \usepackage[]{clrdblpg}
38 \usepackage[colorlinks]{hyperref}
39
40 \begin{document}
41 \DocInput{clrdblpg.dtx}
42 \end{document}
43 %</driver> \fi
44 %
45 % \title{The |clrdblpg| Package, v1.0}
46 % \author{Donald P.\ Goodman III}
47 % \date{\today}
48 %
49 % \maketitle
50 %
51 % \begin{abstract}
52 % \noindent
53 % This tiny package allows easy manipulation of the headers
54 % and footers on pages left blank by |\cleardoublepage|. By
55 % default, \LaTeX\ has no easy facilities for this. This
56 % package uses more or less the algorithm listed in the
57 % |fancyhdr| package documentation, with some added
58 % flexibility thrown in.
59 % \end{abstract}
60 %
61 % \tableofcontents
62 %
63 % \section{Introduction}
64 %
65 % \LaTeX\ clears double pages when using certain classes
66 % because certain divisions, such as chapters, must normally
67 % start on recto (odd) pages. This sometimes results in a
68 % page which is blank. However, \LaTeX\ puts the normal
69 % page dressings on these blank pages. This might be the
70 % right decision in certain cases; but in other cases, it's
71 % certainly wrong. Yet there is no easy way to change this
72 % behavior.
73 %
74 % \section{Usage}
75 %
76 % So here's |clrdblpg|. This tiny package takes an
77 % algorithm redefining the normal \LaTeX\ command
78 % |\cleardoublepage| from the |fancyhdr| documentation (by
79 % Piet van Oostrum and George Gr{\"a}tzer), but indents it
80 % better and adds the ability to control which page style
81 % will be applied to the blank pages.
82 %
83 % To see the original algorithm, and the excellent
84 % |fancyhdr| package which you should almost certainly
85 % already be using, see \url{http://ctan.org/pkg/fancyhdr}.
86 %
87 % To use the package, simply load the package |clrdblpg|
88 % with the |style| option expressing what page style you
89 % want. The default is to set the blank pages as having
90 % page style |empty|, so if that's what you want, you do not
91 % need to list an option.
92 %
93 % \begin{center}
94 % \begin{tabular}{lp{0.4\textwidth}}
95 % |\usepackage{clrdblpg}| & Leaves cleared verso pages
96 % empty, with neither header nor footer \\
97 % |\usepackage[style=empty]{clrdblpg}| & Leaves cleared verso pages
98 % empty, with neither header nor footer \\
99 % |\usepackage[style=plain]{clrdblpg}| & Leaves cleared verso pages
100 % with the |plain| style, meaning no header and a
101 % centered page number for a footer \\
102 % \end{tabular}
103 % \end{center}
104 %
105 % Obviously, any page style (defined by \LaTeX, some class
106 % or package, or you) can be used instead.
107 %
108 % And that's it for this little package.
109 %
110 % \section{Implementation}
111 %
112 % Start with a reasonable default. I don't personally think
113 % the \LaTeX\ default here is reasonable, so I've not done
114 % it. I think |empty| makes sense; hence, the default.
115 % \begin{macrocode}
116 \def\clrdblpg@pagestyle{empty}%
117 % \end{macrocode}
118 % Require |xkeyval|, and set our package option.
119 % \begin{macrocode}
120 \RequirePackage{xkeyval}
121 \DeclareOptionX{style}{\def\clrdblpg@pagestyle{#1}}
122 \ProcessOptionsX
123 % \end{macrocode}
124 % Now define the command. This is taken directly from the
125 % documentation of the |fancyhdr| package
126 % (\url{http://ctan.org/pkg/fancyhdr}),
127 % but with better
128 % indentation and the ability to select a pagestyle for the
129 % blank page.
130 % \begin{macrocode}
131 \def\cleardoublepage{%
132 \clearpage%
133 \if@twoside%
134 \ifodd%
135 \c@page%
136 \else%
137 \hbox{}%
138 \vspace*{\fill}%
139 \thispagestyle{\clrdblpg@pagestyle}%
140 \newpage%
141 \if@twocolumn%
142 \hbox{}%
143 \newpage%
144 \fi%
145 \fi%
146 \fi%
147 }%
148 % \end{macrocode}
149 % And there's the |clrdblpg| package. I hope it proves
150 % useful to someone besides myself. Happy \TeX{}ing!
151 %
152 % \PrintIndex