Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % notespages.dtx
4 % Copyright 2016 Mike Kaufmann
5 % [email protected]
6 %
7 % This work may be distributed and/or modified under the
8 % conditions of the LaTeX Project Public License, either version 1.3
9 % of this license or (at your option) any later version.
10 % The latest version of this license is in
11 % http://www.latex-project.org/lppl.txt
12 % and version 1.3 or later is part of all distributions of LaTeX
13 % version 2005/12/01 or later.
14 %
15 % This work has the LPPL maintenance status `maintained'.
16 %
17 % The Current Maintainer of this work is Mike Kaufmann.
18 %
19 % This work consists of the files notespages.dtx and notespages.ins
20 % and the derived files notespages.sty and np-test.tex.
21 % \fi
22 %% \CharacterTable
23 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
24 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
25 %% Digits \0\1\2\3\4\5\6\7\8\9
26 %% Exclamation \! Double quote \" Hash (number) \#
27 %% Dollar \$ Percent \% Ampersand \&
28 %% Acute accent \' Left paren \( Right paren \)
29 %% Asterisk \* Plus \+ Comma \,
30 %% Minus \- Point \. Solidus \/
31 %% Colon \: Semicolon \; Less than \<
32 %% Equals \= Greater than \> Question mark \?
33 %% Commercial at \@ Left bracket \[ Backslash \\
34 %% Right bracket \] Circumflex \^ Underscore \_
35 %% Grave accent \` Left brace \{ Vertical bar \|
36 %% Right brace \} Tilde \~}
37 %%
38 % \CheckSum{1360}
39 %
40 % \iffalse meta-comment
41 %
42 %<*package>
43 %%
44 \def\fileversion{0.8.1}
45 \def\filedate{2016/08/21}
46
47 %</package>
48 %
49 %<*driver>
50 \documentclass{ltxdoc}
51 \usepackage{hypdoc}
52 \usepackage{graphicx}
53 \hypersetup{colorlinks,linkcolor=blue}
54 \usepackage[all]{hypcap}
55 \setcounter{IndexColumns}{2}
56 \EnableCrossrefs
57 \CodelineIndex
58 \RecordChanges
59 %\OnlyDescription
60 \makeatletter
61 % new, like ...Env... commands from doc.sty)
62 \let\PrintDescribeOpt\PrintDescribeEnv
63 \let\PrintOptName\PrintEnvName
64 \def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters
65 \Describe@Opt}
66 \def\Describe@Opt#1{\endgroup
67 \marginpar{\raggedleft\PrintDescribeOpt{#1}}%
68 \SpecialOptIndex{#1}\@esphack\ignorespaces}
69 \def\SpecialOptIndex#1{\@bsphack
70 \index{#1\actualchar{\protect\ttfamily#1}
71 (option)\encapchar usage}%
72 \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar
73 usage}\@esphack}
74 % new (like \SpecialEnvIndex from hypdoc.sty)
75 \let\HDorg@SpecialOptIndex\SpecialOptIndex
76 \renewcommand*\SpecialOptIndex[1]{%
77 \@bsphack
78 \begingroup
79 \HD@target
80 \let\HDorg@encapchar\encapchar
81 \edef\encapchar usage{%
82 \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
83 }%
84 \HDorg@SpecialOptIndex{#1}%
85 \endgroup
86 \@esphack
87 }
88 % redefinition (from doc.sty)
89 \def\macro{\begingroup
90 \catcode`\\12
91 \MakePrivateLetters \m@cro@ \z@}
92 \def\environment{\begingroup
93 \catcode`\\12
94 \MakePrivateLetters \m@cro@ \@ne}
95 % new, environment 'option', like 'environment', but index entries with
96 % '(option)'
97 \def\option{\begingroup
98 \catcode`\\12
99 \MakePrivateLetters \m@cro@ \tw@}
100 % redefinition (from doc.sty)
101 \long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist
102 \edef\saved@macroname{\string#2}%
103 \def\makelabel##1{\llap{##1}}%
104 \if@inlabel
105 \let\@tempa\@empty \count@\macro@cnt
106 \loop \ifnum\count@>\z@
107 \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
108 \edef\makelabel##1{\llap{\vtop to\baselineskip
109 {\@tempa\hbox{##1}\vss}}}%
110 \advance \macro@cnt \@ne
111 \else \macro@cnt\@ne \fi
112 \edef\@tempa{\noexpand\item[%
113 \ifcase #1%
114 \noexpand\PrintMacroName
115 \or
116 \noexpand\PrintEnvName
117 \or
118 \noexpand\PrintOptName
119 \fi
120 {\string#2}]}%
121 \@tempa
122 \global\advance\c@CodelineNo\@ne
123 \ifcase #1%
124 \SpecialMainIndex{#2}\nobreak
125 \DoNotIndex{#2}%
126 \or
127 \SpecialMainEnvIndex{#2}\nobreak
128 \or
129 \SpecialMainOptIndex{#2}\nobreak
130 \fi
131 \global\advance\c@CodelineNo\m@ne
132 \ignorespaces}
133 % new
134 \let\endoption\endmacro
135 \def\SpecialMainOptIndex#1{\@bsphack\special@index{%
136 #1\actualchar
137 {\string\ttfamily\space#1}
138 (option)%
139 \encapchar main}%
140 \special@index{options:\levelchar#1\actualchar{%
141 \string\ttfamily\space#1}\encapchar
142 main}\@esphack}
143 \makeatother
144 \begin{document}
145 \DocInput{notespages.dtx}
146 \end{document}
147 %</driver>
148 %
149 %<*package>
150 % \fi
151 %
152 % \DoNotIndex{\',\@auxout,\@gobble}
153 % \DoNotIndex{\@ifclassloaded,\@ifpackageloaded,\@ifpackagewith,\@ifundefined}
154 % \DoNotIndex{\@ne,\@temptokena,\@themark,\@writefile}
155 % \DoNotIndex{\addto,\advance}
156 % \DoNotIndex{\AtBeginDocument,\AtEndDocument}
157 % \DoNotIndex{\begin,\begingroup}
158 % \DoNotIndex{\c@page,\centering,\chapter}
159 % \DoNotIndex{\clearpage,\color,\csname}
160 % \DoNotIndex{\def,\definecolor,\divide}
161 % \DoNotIndex{\define@boolkey,\define@choicekey,\define@cmdkey,\define@key}
162 % \DoNotIndex{\edef,\else,\end,\endgroup,\endcsname}
163 % \DoNotIndex{\expandafter}
164 % \DoNotIndex{\fi,\filedate,\fileversion}
165 % \DoNotIndex{\gdef,\global,\glossary}
166 % \DoNotIndex{\hbox,\hrule,\@height}
167 % \DoNotIndex{\if@filesw,\if@nobreak}
168 % \DoNotIndex{\if,\ifcase,\ifcat,\ifdim,\ifnum,\ifvmode,\ifx}
169 % \DoNotIndex{\immediate,\index,\InputIfFileExists}
170 % \DoNotIndex{\jobname}
171 % \DoNotIndex{\key@ifundefined}
172 % \DoNotIndex{\label,\let,\line,\lineskip,\long,\loop}
173 % \DoNotIndex{\MakeUppercase,\MessageBreak,\m@ne,\mark,\markboth,\markright}
174 % \DoNotIndex{\maxdimen,\minisec,\multiply,\multiput}
175 % \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcount,\newdimen,\newif,\newtoks}
176 % \DoNotIndex{\newpage,\newwrite,\nobreak,\noindent,\number}
177 % \DoNotIndex{\openout}
178 % \DoNotIndex{\PackageError,\PackageWarning,\PackageWarningNoLine}
179 % \DoNotIndex{\PackageInfo,\ProvidesPackage,\ProcessOptionsX}
180 % \DoNotIndex{\p@,\pagegoal,\pagetotal,\par,\parfillskip,\phantom,\protect}
181 % \DoNotIndex{\protected@write,\providecolor}
182 % \DoNotIndex{\raggedleft,\raggedright,\relax,\repeat,\rule,\RequirePackage}
183 % \DoNotIndex{\setkeys,\space,\string,\section,\subsection,\subsubsection}
184 % \DoNotIndex{\textfraction,\textheight,\textwidth,\the,\thispagestyle,\tw@}
185 % \DoNotIndex{\unitlength,\unrestored@protected@xdef,\vfill,\vspace}
186 % \DoNotIndex{\xdef,\z@}
187 %
188 % \newcommand{\NP}{\textsf{NotesPages}}
189 % \newcommand{\pkg}[1]{\textsf{#1}}
190 % \newcommand{\opt}[1]{\textsf{#1}}
191 % \newcommand{\choice}[1]{\textsf{\textsl{#1}}}
192 % \newcommand{\bs}{\textbackslash}
193 % \newcommand{\since}[2][changed]{\marginpar{\hfill\textsf{\textit{\textcolor[rgb]{0,0.3,0}{#1 #2}}}}}
194 %
195 % \changes{0.8}{2016/08/10}{initial release}
196 %
197 % \title{The \NP\ Package\\[1ex]
198 % Filling documents, so the total number of pages is a multiple of a given number.}
199 % \author{Mike Kaufmann\\\href{mailto:[email protected]}{\texttt{[email protected]}}}
200 % \date{\filedate\ (v\fileversion)}
201 % ^^A--------------------------------------------------------------------------
202 % \maketitle
203 % \begin{abstract}
204 % The \NP\ package provides one macro to insert a single notes page and another
205 % to fill the document with multiple notes pages, until the total number of pages
206 % (so far) is a multiple of a given number. A third command can be used to fill
207 % half empty pages with a notes area.
208 % \end{abstract}
209 %
210 % \tableofcontents
211 %
212 % ^^A--------------------------------------------------------------------------
213 % \section{Introduction}
214 % \subsection{Why this Package}
215 % Well, sometimes I have to write short manuals, which are then printed as a booklet.
216 % Therefore their number of pages has to be dividable by 4. And since it's tiresome
217 % to check the number of pages after every change and add or remove notes pages
218 % manually, I automated this work. In this, I had to take into account that there
219 % are a number of fixed pages at the end of the booklet.
220 %
221 % In order to make it useful for others, options for formating a notes page were
222 % added.
223 %
224 % ^^A---------------------------------------------
225 % \subsection{Feeback and Testing}
226 % The \NP\ package was tested with the example file provided with this package.
227 % There may be documents, where the algorithm for calculating the number of pages
228 % needed to fill a document may not work properly. Or there may be other issues.
229 % If you have such a document, please send me an example, which shows the problem,
230 % so I can try to fix it.
231 %
232 % ^^A---------------------------------------------
233 % \subsection{Dependencies}
234 % \subsubsection{Necessary Packages}
235 % The \NP\ package needs the \pkg{xkeyval} package for processing the options.
236 %
237 % ^^A-------------------------
238 % \subsubsection{Babel}
239 % The package makes use of \pkg{babel}, if it is loaded, but it doesn't depend
240 % on it. The order, in which the package is loaded in regard to the \NP\ package,
241 % is of no consequence. More on supporting languages can be found in
242 % \autoref{sec:babel}.
243 %
244 % ^^A-------------------------
245 % \subsubsection{Color}
246 % The package also makes use of the package \pkg{color} or \pkg{xcolor}, if loaded,
247 % without depending either one. Again, the order, in which the package is loaded
248 % in regard to the \NP\ package, is of no consequence. More on supporting color
249 % can be found in \autoref{sec:color}.
250 %
251 % ^^A---------------------------------------------
252 % \subsection{Legal Stuff}
253 % This program is provided under the terms of the
254 % \LaTeX\ Project Public License distributed from CTAN
255 % \href{http://www.ctan.org/license/lppl1.3}{http://www.ctan.org/license/lppl1.3}
256 %
257 % ^^A--------------------------------------------------------------------------
258 % \section{Using the Packages}
259 % \subsection{Loading}
260 % The package is loaded as usual.
261 %
262 % \vspace{1ex}
263 % |\usepackage|\oarg{options}|{notepages}|
264 %
265 % \vspace{1ex}
266 % \noindent
267 % The options are described in \autoref{sec:options}.
268 %
269 % ^^A---------------------------------------------
270 % \subsection{The basic commands}
271 % \label{sec:cmd}
272 % \DescribeMacro\setnotespages
273 % With |\setnotespages|\marg{options} all the settings possible with the options
274 % described in \autoref{sec:options} can be changed globaly. This will overwrite
275 % the settings made with the options provided on loading the package or the
276 % defaults.
277 %
278 % \DescribeMacro\notespage
279 % With |\notespage|\oarg{options} a single notes page will be inserted into the
280 % document. For this, a new page will be started at the place of its occurrence.
281 % The command has one optional parameter, which can contain all the options
282 % described in \autoref{sec:options}. But the options of \autoref{sec:optmultiple}
283 % and \autoref{sec:optfill} are ignored, because they are of no use for |\notespage|.
284 %
285 % The options are local to the command, i.e.\ they will not change the settings
286 % done with |\setnotespages|, made at loading the package, or the defaults. Thus,
287 % if the next notes page should have the same appearance, the same options must
288 % be given.
289 %
290 % \DescribeMacro\notespages
291 % With |\notespages|\oarg{options} the document can be filled with notes pages, so the
292 % total number of pages so far is a multiple of a given number. Depending on the
293 % settings done with the options described in \autoref{sec:optmultiple}, this
294 % may result in anything from 0 to 199 notes pages.
295 %
296 % All options described in \autoref{sec:options} can be used in the optional
297 % parameter. But the options in \autoref{sec:optfill} are ignored, because they
298 % are of no use for |\notespages|.
299 %
300 % The command first sets up everything according to the given options. It then
301 % calculates the amount of pages needed and inserts them.
302 %
303 % For |\notespages| the options are also local to the command.
304 %
305 % \DescribeMacro\notesfill
306 % With |\notesfill|\oarg{options} a page can be filled with a notes area preceeded by
307 % the notes tile. It is formated similar to a notes page, but no new page is
308 % started, the pagestyle can not be changed and so can't the text in the header .
309 %
310 % All options described in \autoref{sec:options} can be used in the optional
311 % parameter. But the options of \autoref{sec:optmultiple} are useless to
312 % |\notesfill| and therefore ignored. Also the options \opt{startnotes},
313 % \opt{pagestyle}, \opt{mark}, \opt{marktext}, and \opt{markuppercase} from
314 % \autoref{sec:optsingle} are ignored.
315 %
316 % With the options described in \autoref{sec:optfill} it is possible to set a
317 % minimum height for |\notesfill|, i.e. no notes title plus notes area will
318 % be generated, if the remaining space on the page is less then the minimum.
319 % Also a maximum height for the notes title plus the notes area can be defined.
320 % If there is more space left on the page, the notes title plus notes area
321 % will be moved to the bottom of the page by default.
322 %
323 % And again, the options given to |\notesfill| are local to the command.
324 %
325 % There is an restriction to |\notesfill| regarding bottom floats and footnotes:
326 % they will appear below it.
327 %
328 % ^^A---------------------------------------------
329 % \subsection{Layout}
330 % \autoref{fig:layoutpage} shows the layout of a notes page and \autoref{fig:layoutfill}
331 % the layout of a notes fill, together with some of the layout options described in
332 % \autoref{sec:options}. The dimension |\remainingtextheight| is described in
333 % \autoref{sec:advanced}.
334 %
335 % \begin{figure}[htb]
336 % \setlength{\unitlength}{1mm}
337 % \begin{minipage}{0.49\textwidth}
338 % \centering
339 % \begin{picture}(60,90)
340 % \thicklines
341 % \put( 0,85){\framebox(60, 5){header\quad\textsf{marktext/mark/pagestyle}}}
342 % \put( 0, 0){\framebox(60, 5){footer\qquad\textsf{pagestyle}}}
343 % \put( 0,78){\framebox(60, 5){notes title\qquad\textsf{titletext/titlestyle}}}
344 % \put( 0, 7){\framebox(60,66){\parbox{60mm}{\centering notes area\\\textsf{notesstyle}\\\textsf{hparts/vparts}}}}
345 % \thinlines
346 % \put( 5,15){\vector(0, 1){58}}
347 % \put( 5,15){\vector(0,-1){8}}
348 % \put( 6,10){\makebox(0,5)[l]{\texttt{\bs remainingtextheight}}}
349 % \put( 5,75){\vector(0, 1){3}}
350 % \put( 5,75){\vector(0,-1){2}}
351 % \put( 6,73){\makebox(0,5)[l]{\textsf{titleskip}}}
352 % \put(25,73){\makebox(0,0){\textbullet}}
353 % \put(26,73){\makebox(0,5)[l]{\textsf{titlenotesfill}}}
354 % \end{picture}
355 % \caption{Layout notes page}\label{fig:layoutpage}
356 % \end{minipage}
357 % \hspace{\fill}
358 % \begin{minipage}{0.49\textwidth}
359 % \centering
360 % \capstart
361 % \begin{picture}(60,90)
362 % \thicklines
363 % \put( 0,85){\framebox(60,5){header}}
364 % \put( 0, 0){\framebox(60,5){footer}}
365 % \put( 0,56){\makebox(60,27){text}}
366 % \put( 0,83){\line(1,0){60}}
367 % \put( 0,53){\line(0,1){30}}
368 % \put( 0,53){\line(1,0){40}}
369 % \put(40,53){\line(0,1){3}}
370 % \put(40,56){\line(1,0){20}}
371 % \put(60,56){\line(0,1){27}}
372 % \put( 0,43){\framebox(60, 5){notes title\qquad\textsf{titletext/titlestyle}}}
373 % \put( 0, 7){\framebox(60,31){\parbox{60mm}{\centering notes area\\\textsf{notesstyle}\\\textsf{hparts/vparts}\\~\\~}}}
374 % \thinlines
375 % \put( 5,15){\vector(0, 1){23}}
376 % \put( 5,15){\vector(0,-1){8}}
377 % \put( 6,10){\makebox(0,5)[l]{\texttt{\bs remainingtextheight}}}
378 % \put( 5,40){\vector(0, 1){3}}
379 % \put( 5,40){\vector(0,-1){2}}
380 % \put( 6,38){\makebox(0,5)[l]{\textsf{titleskip}}}
381 % \put( 5,50){\vector(0, 1){3}}
382 % \put( 5,50){\vector(0,-1){2}}
383 % \put( 6,48){\makebox(0,5)[l]{\textsf{filltopskip}}}
384 % \put(25,48){\makebox(0,0){\textbullet}}
385 % \put(26,48){\makebox(0,5)[l]{\textsf{filltopfill}}}
386 % \put(25,38){\makebox(0,0){\textbullet}}
387 % \put(26,38){\makebox(0,5)[l]{\textsf{titlenotesfill}}}
388 % \end{picture}
389 % \caption{Layout notes fill}\label{fig:layoutfill}
390 % \end{minipage}
391 % \end{figure}
392 %
393 % ^^A---------------------------------------------
394 % \subsection{Package and Command Options}
395 % \label{sec:options}
396 % \subsubsection{Setting Options}
397 % If options are used without a value, they will be set to their defaults. The
398 % exception are the boolean options \opt{allowfloats}, \opt{usenotesareaheight},
399 % \opt{titlenotesfill}, \opt{markuppercase}, and \opt{filltopfill}, which are
400 % set to \choice{true}.
401 %
402 % ^^A-------------------------
403 % \subsubsection{Options for \texttt{\bs notespage}}
404 % \label{sec:optsingle}
405 % The following options affect the style and layout of a single notes page.
406 % They are all used by |\notespage| and |\notespages|. And most of them are
407 % also used by |\notesfill| (the exceptions are \opt{startnotes},
408 % \opt{pagestyle}, \opt{mark}, \opt{marktext}, and \opt{markuppercase}).
409 %
410 % \DescribeOpt{startnotes}
411 % The option \opt{startnotes} defines, how the new page for |\notespage| is
412 % started. The choices are \choice{newpage} and \choice{clearpage}. The default
413 % is \choice{clearpage}.
414 %
415 % With \choice{newpage} the command |\newpage| is used and therefore remaining floats
416 % are not given out by default, which can be changed with the option \opt{allowfloats}.
417 % With \choice{clearpage} |\clearpage| is used and remaining floats are given out
418 % before the notes page.
419 %
420 % \DescribeOpt{allowfloats}
421 % If the boolean \opt{allowfloats} is set to \choice{true} floats are allowed to
422 % be placed on a notes page, if \choice{newpage} is used for the option
423 % \opt{startnotes}. Caution: the header will be changed on such pages. The default
424 % is \choice{false}.
425 %
426 % \DescribeOpt{pagestyle}
427 % With \opt{pagestyle} the pagestyle for a notes page can be defined. All possible
428 % pagestyles (\choice{empty}, \choice{plain}, \choice{headings}, \choice{myheadings},
429 % and what ever is defined for the document) can be use as value. Additionally,
430 % \choice{current} can be used to denote to not change the pagestyle. This is the
431 % default. Internally |\thispagestyle| is used, but not for the value \choice{current}.
432 %
433 % A pagestyle must have been defined, before it can be chosen. If a nonexisting
434 % pagestyle is chosen, a warning will be given and the value will be set to the
435 % default. Therefore, |\setnotespages| must appear after defining a page style
436 % to be used for notes pages in the preamble.
437 %
438 % \DescribeOpt{notesstyle}
439 % With \opt{notesstyle} the way the notes area is filled can be chosen. Possible
440 % are \choice{plain}, \choice{lines}, \choice{vlines}, \choice{grid}, and \choice{text}.
441 % The default is \choice{grid}.
442 %
443 % With \choice{plain} the notes area is left empty, \choice{lines} will fill the
444 % notes area with horizonal lines, \choice{vlines} with vertical lines, \choice{grid}
445 % will fill it with a grid, and \choice{text} will give out a short text.
446 %
447 % It is possible to add your own \opt{notesstyle}. This is described in
448 % \autoref{sec:advanced}.
449 %
450 % \DescribeOpt{hparts}
451 % The option \opt{hparts} divides the notes area into the given number $n_x$
452 % horizontal parts, which will be seperated by vertical lines. There will always
453 % be $n_x + 1$ lines. The default value is 25.
454 %
455 % The option applies to the \opt{notesstyle}s \choice{vlines} and \choice{grid}.
456 % The value may be in the range from 1 to 200. If the given number is smaller or
457 % larger, a warning is given out and it's set to either 1 or 200 respectively.
458 %
459 % \DescribeOpt{vparts}
460 % The option \opt{vparts} divides the |\textheight| into the given number $n_y$
461 % vertical parts. The calculation is based on |\textheight| by default (see
462 % below, option \opt{usenotesareaheight}), in order to achieve same height
463 % vertical parts, independent of the actual height of the notes area. The
464 % option applies to the \opt{notesstyle}s \choice{lines} and \choice{grid}.
465 %
466 % The value may be in the range from 0 to 300. If the given number is smaller or
467 % larger, a warning is given out and it's set to either 0 or 300 respectively.
468 %
469 % The values 0 and 1 have special meaning. With 0 for the \opt{notesstyle}
470 % \choice{grid} the length of a vertical part will be the same as for a horizontal
471 % part, thus resulting in a square grid. For the \opt{notesstyle} \choice{lines}
472 % a warning will be given and the notes area is left empty. A value of 1 will lead
473 % to one line at the bottom and one at the top of the notes area, regardless of
474 % its height, thus making it possible to put a rectangle around the notes area.
475 %
476 % For values of 2 or greater only lines for full vertical parts are drawn. For
477 % example, if the height of a notes area is 20.5 times the length of a vertical
478 % part, for \choice{lines} 20 lines are drawn and 21 for \choice{grid}. For small
479 % values there may be no lines in the notes area of a |\notesfill|.
480 %
481 % The default value is 0, so for the \opt{notesstyle} \choice{lines} it has
482 % to be changed.
483 %
484 % \DescribeOpt{usenotesareaheight}
485 % With the option \opt{usenotesareaheight} the calculation of the height of a
486 % vertical part (see above, option \opt{vparts}) is based on the height of the
487 % notes area instead of |\textheight|. This enables the user to vertically divide
488 % the notes area into the exact number given to \opt{vparts}. Of course with this,
489 % for a |\notesfill| the height of a vertical part can differ each time. The default
490 % is \choice{false}.
491 %
492 % \DescribeOpt{titlestyle}
493 % With the option \opt{titlestyle} a layout for the notes title can be chosen.
494 % Possible are \choice{none}, \choice{text}, \choice{section}, \choice{subsection},
495 % \choice{subsubsection}, and, if available, \choice{minisec}. The default is
496 % \choice{section}.
497 %
498 % With \choice{none} no title is set. And \choice{text} formats it as simple text.
499 % With \choice{section}, \choice{subsection}, or \choice{subsubsection} one of
500 % the commands |\section*|, |\subsection*|, or |\subsubsection*| is used. The
501 % choice \choice{minisec} is only available, if |\minisec| is defined (before
502 % loading the \NP\ package). Then, if chosen, |\minisec| is used to format the
503 % title.
504 %
505 % It is possible to add your own \opt{titlestyle}. This is described in
506 % \autoref{sec:advanced}.
507 %
508 % \DescribeOpt{titletext}
509 % With \opt{titletext} an arbitrary text can be chosen as new a notes title. If
510 % the new text contains more then one word, it is recommended to put the text in
511 % braces, e.g.\ |titletext={My new notes title}|. If the text contains a comma (``,'')
512 % or an equality sign (``=''), it must be given in braces! The default is |\npnotesname|,
513 % which is ``Notes'' without \pkg{babel} or language dependend with \pkg{babel}
514 % (see \autoref{sec:babel} for details).
515 %
516 % The option \opt{titletext} will automatically also set \opt{marktext} to
517 % its value, if \opt{marktext} is not given, but not otherwise, regardless
518 % which option comes first. So if a long text is set with \opt{titletext},
519 % it is recommended to also use \opt{marktext} to set a shorter text suitable
520 % for the headers. Of course, if \opt{mark} is set to \choice{keep}, this is
521 % not necessary.
522 %
523 % \DescribeOpt{titleskip}
524 % With \opt{titleskip} the distance between the notes title and the notes area
525 % can be set. The value can be everything accepted as a length by \TeX. The default
526 % is 0pt. For the default title style this is ok, because |\section*| adds some
527 % space after the title. But for the title style \choice{text} it is recommended
528 % to set a \opt{titleskip} greater then 0pt.
529 %
530 % \DescribeOpt{titlenotesfill}
531 % If the boolean \opt{titlenotesfill} is set to \choice{true}, a |\vfill| will be
532 % inserted between notes title and notes area, moving the latter to the bottom
533 % of the page. The default is \choice{false}.
534 %
535 % Most of the provided notes styles always use the whole remaining space of a page,
536 % so the option is of no use for them. The exception is the notes style \choice{text},
537 % which has the height of the text. But this option would move the text to the end
538 % of the page. It may be useful for a custom notes style, which doesn't use all
539 % the available space, and the notes area should be moved down to the end
540 % of the page.
541 %
542 % \DescribeOpt{notestext}
543 % With \opt{notestext} an arbitrary text can be chosen as a new text for the
544 % notes style \choice{text}. If the text contains more then one word, it is
545 % recommended to put the text in braces, e.g.\ |notestext={This page is empty.}|.
546 % If the text contains a comma (``,'') or an equality sign (``=''), it must be
547 % given in braces! The default is |\npnotestext|, which is ``This page is
548 % intentionally left blank.'' without \pkg{babel} or language dependend with
549 % \pkg{babel} (see \autoref{sec:babel} for details).
550 %
551 % \DescribeOpt{notestextalign}
552 % With \opt{notestextalign} the horizontal alignement for the text of the notes
553 % style \opt{text} can be choosen. Possible are \choice{right}, \choice{left},
554 % \choice{center}, and \choice{none}. The default is \choice{center}.
555 %
556 % For \choice{none} no alignement is set. Thus the text is aligned the same as
557 % normal text in the document.
558 %
559 % Vertical alignment can be done using the option \opt{titleskip}. For the notes
560 % style \choice{text} is is also inserted, if the title style is \choice{none}.
561 %
562 % \DescribeOpt{mark}
563 % With \opt{mark} the way the notes title is put into the header can be chosen.
564 % Possible are \choice{both}, \choice{right}, \choice{left}, and \choice{keep}.
565 % The default is \choice{both}.
566 %
567 % For \choice{both}, \choice{right}, and \choice{left} the command |\markboth|
568 % is used, but for \choice{right} and \choice{left} the original mark is set for
569 % the other side. With the choice \choice{keep} the headers are not changed.
570 %
571 % Note, in order to get the header marks right, it is necessary to run
572 % \LaTeX\ twice.
573 %
574 % \DescribeOpt{marktext}
575 % The option \opt{marktext} can be used the set an arbitrary text for the
576 % headers, which differs from the notes title. The latter is the default.
577 % Here too, the text should be given in braces if it contains more then one word
578 % and it must be given in braces, if it contains a comma (``,'') or an equality
579 % sign (``='').
580 %
581 % Note, if \opt{notestitle} is given locally, it will also set \opt{marktext}
582 % locally. Therefore, if both texts should be different, both options must be
583 % used.
584 %
585 % \DescribeOpt{markuppercase}
586 % If the option \opt{markuppercase} is used, the text for the header marks set by
587 % a notes page is converted to upper case letters. The default depends on the
588 % class used. For the standard classes and \pkg{memoir} the option is set to
589 % \choice{true}, for others to \choice{false}.
590 %
591 % ^^A-------------------------
592 % \subsubsection{Options for \texttt{\bs notespages}}
593 % \label{sec:optmultiple}
594 % The following options are only used by |\notespages| to determie the number of
595 % notes pages to be inserted.
596 %
597 % \DescribeOpt{multiple}
598 % With \opt{multiple} the number of pages, the total number of pages of a
599 % document (so far) should be a multiple of, can be defined. For example, with
600 % |multiple=4|, |\notepages| will insert enough pages to make the total number of
601 % pages (so far) 4, 8, 12, 16, 20 and so on. The value can be in the range from
602 % 1 to 100. If the given number is below or above that, a warning will be given
603 % and the value will be set to either the minimum or maximum respectively. The
604 % default is 4.
605 %
606 % \DescribeOpt{minpages}
607 % With \opt{minpages} the minimum number of notes pages to be inserted can be
608 % defined. For example, with |multiple=4|, |minpages=1| and |\notespages| appearing
609 % on (the not empty) page 20, one page will be added to fulfill the minimum and
610 % an additional 3 to make the number of pages a multiple of 4 again, leading to
611 % a total of 24 pages. The value can be in the range from 0 to 100. If the given
612 % number is below or above that, a warning will be given and the value will be
613 % set to either the minimum or maximum respectively. The default is 0.
614 %
615 % \DescribeOpt{endpages}
616 % With \opt{endpages} the number of pages at the end of a document, which are
617 % not notes pages, can be defined. For example, the last page of a booklet has to
618 % contain contact information and therefore shouldn't be a notes page. By setting
619 % |endpages=1| this is taken into account and |\notespages| will fill the document
620 % only up to, for example, page 19 instead of 20, thus leaving page 20 free for
621 % the desired content. The value can be in the range from 0 to 100. If the given
622 % number is below or above that, a warning will be given and the value will be
623 % set to either the minimum or maximum respectively. The default is 0.
624 %
625 % ^^A-------------------------
626 % \subsubsection{Options for \texttt{\bs notesfill}}
627 % \label{sec:optfill}
628 % The following options are only used by |\notesfill|.
629 %
630 % \DescribeOpt{fillminspace}
631 % With \opt{fillminspace} the minimum height for a notes fill can be defined,
632 % i.e. if the remaining space on a page is less than the given length, no notes
633 % fill will appear. The value can be anything accepted as a length by \TeX. The
634 % default is |0.25\textheight|.
635 %
636 % The value given to the option \opt{filltopskip} is taken into account for the
637 % calculation of the remaining space, meaning, it is subtracted from the space
638 % left, before the decision is made to insert a notes fill or not.
639 %
640 % \DescribeOpt{fillmaxspace}
641 % With \opt{fillmaxspace} the maximum height for a notes fill can be defined,
642 % i.e. if the remaining space on a page is greater than the given length, the
643 % height of a notes fill is limited to this length. The value can be anything
644 % accepted as a length by \TeX. The default is |\textheight|.
645 %
646 % \DescribeOpt{filltopskip}
647 % With \opt{filltopskip} the distance between the text and the notes title can
648 % be defined. The value can be anything accepted as a length by \TeX. The default
649 % is 0pt. For the default value of \opt{titlestyle} 0pt is ok, since |\section*|
650 % inserts some space before the notes title. But for |titlestyle=text| it is
651 % recommended to set a \opt{filltopskip} greater then 0pt.
652 %
653 % \DescribeOpt{filltopfill}
654 % If the boolean \opt{filltopfill} is set to \choice{true}, a |\vfill| will be
655 % inserted between the text and the notes title, moving the notes fill to the
656 % bottom of the page. The default is \choice{true}. This is useful, if the notes fill
657 % is not as high as the remaining space on the page, because it was limited by
658 % \opt{fillmaxspace}.
659 %
660 % ^^A-------------------------
661 % \subsubsection{Meta Option}
662 % \label{sec:optmeta}
663 % Basically meta options are option, which set some or all the options described
664 % so far. There are three of them.
665 %
666 % \DescribeOpt{empty}
667 % The option \opt{empty} sets |pagestyle=empty,notesstyle=plain,titlestyle=| |none|,
668 % which will lead to totally empty pages.
669 %
670 % \DescribeOpt{vacant}
671 % The option \opt{vacant} sets |pagestyle=empty,notesstyle=text,titlestyle=|
672 % |none,titleskip=0.3\textheight|, which will lead to pages with only the text
673 % ``This page is intentionally left blank.'' on it at about 1/3 of the height
674 % from the top.
675 %
676 % \DescribeOpt{default}
677 % With \opt{default} all options are set back to their default values. This is
678 % useful in |\setnotespages| and all |\notes...| commands to get a defined
679 % starting point.
680 %
681 % It is possible to define your own meta option (see \autoref{sec:advanced} for
682 % details).
683 %
684 % ^^A-------------------------
685 % \subsubsection{Order of Options}
686 % The order of options is important, if one options is given more then once. In
687 % this case the last occurence wins. For example, writing
688 %
689 % \vspace{1ex}
690 % \noindent
691 % |\notespage[hparts=30,vparts=30,hparts=20]|
692 %
693 % \vspace{1ex}
694 % \noindent
695 % will be the same as writing
696 %
697 % \vspace{1ex}
698 % \noindent
699 % |\notespage[vparts=30,hparts=20]|,
700 %
701 % \vspace{1ex}
702 % \noindent
703 % because \opt{hparts} appeared twice and |hparts=20| overwrote |hparts=30|.
704 %
705 % This is especially important when using meta options, because they set other
706 % option, which would overwrite options given before.
707 %
708 % ^^A---------------------------------------------
709 % \subsection{Advanced commands}
710 % \label{sec:advanced}
711 % \DescribeMacro\definenotesoption
712 % With |\definenotesoption|\marg{newopt}\marg{options} it is possible to define a new meta
713 % option \meta{newopt}, which can then be used as an option for the commands described
714 % in \autoref{sec:cmd}. For \meta{newopt} only a single word can be used. In \meta{options}
715 % all options described so far can be used. For example, with
716 %
717 % \vspace{1ex}
718 % \noindent
719 % |\definenotesoption{box}{titlestyle=none,vparts=1,hparts=1}|\\
720 % |\notespages[box]|
721 %
722 % \vspace{1ex}
723 % \noindent
724 % notes pages with only a box on them could be produced. The command is especially
725 % useful, if you want to switch between different layouts occasionally throughout
726 % the document.
727 %
728 % \DescribeMacro\definenotesstyle
729 % \DescribeMacro\remainingtextheight
730 % \DescribeMacro\notesareatext
731 % With |\definenotesstyle|\marg{newnotesstyle}\marg{commands} a new notes style can be
732 % defined. After that, \meta{newnotesstyle} can be used as a new choice for the
733 % \opt{notesstyle} option and \meta{commands} is used to produce the notes area.
734 % For \meta{newnotesstyle} only a single word can be used. For \meta{commands} the length
735 % |\remainingtextheight| is available, containing the height remaining on the page
736 % usable for the notes area (see \autoref{fig:layoutpage} and \autoref{fig:layoutfill}).
737 % And if the notes style should contain the text given to the option \opt{notestext},
738 % the macro |\notesareatext| has to be used.
739 %
740 % For example, after
741 %
742 % \vspace{1ex}
743 % \noindent
744 % |\definenotesstyle{yellow}{\color{LightYellow}%|\\
745 % | \rule{\textwidth}{\remainingtextheight}}|
746 %
747 % \vspace{1ex}
748 % \noindent
749 % it is possible to get notes pages with a yellow box, covering the whole notes
750 % area, by typing
751 %
752 % \vspace{1ex}
753 % \noindent
754 % |\notespages[notesstyle=yellow]|
755 %
756 % \vspace{1ex}
757 % \DescribeMacro\definetitlestyle
758 % \DescribeMacro\notestitletext
759 % With |\definetitlestyle|\marg{newtitlestyle}\marg{commands} a new style for the notes
760 % title can be defined. After that, \meta{newnotesstyle} can be used as a new choice
761 % for the \opt{titlestyle} option and \meta{commands} is used to produce the notes
762 % title. For \meta{newnotesstyle} only single word can be used. For \meta{commands} the
763 % command |\notestitletext| has to be used to get the title text set with the
764 % option \opt{titletext}. The commands should start with |\noindent|, in order
765 % to prevent the indentation done for a first line of a paragraph. And it must
766 % end with |\par| to start a new paragraph for the notes area, unless the used
767 % commands already contain it somehow (like, e.g.\ |\section*|). For example,
768 % after
769 %
770 % \vspace{1ex}
771 % \noindent
772 % |\definetitlestyle{boldred}{\noindent\textcolor{red}%|\\
773 % | {\textbf{\notestitletext}}\par}|
774 %
775 % \vspace{1ex}
776 % \noindent
777 % it is possible to get a boldface red notes title, by typing
778 %
779 % \vspace{1ex}
780 % \noindent
781 % |\notespages[titlestyle=boldred]|
782 %
783 % \vspace{1ex}
784 % Please note, the styles or options defined with the commands described here,
785 % must have been defined before they can be used. It is recommended to use these
786 % commands only in the preamble.
787 %
788 % \DescribeMacro\nppatchchapter
789 % With |\nppatchchapter|\marg{options} the command |\chapter| is patched, so it
790 % works as if one writes |\notespages[|\meta{options}|]| followed by |\chapter|.
791 % By this, the occasional empty page before a new chapter is converted into a
792 % notes page.
793 %
794 % It is recommended to add at least |multiple=2|. Otherwise there may be
795 % up to three notes pages before a new chapter (with the default value). If other
796 % notes pages in the document should be formated differently, one can start with
797 % the option \opt{default}. If the argument is left empty, the notes page will
798 % be formated with the current settings (the defaults, the package options, or
799 % the last options set with |\setnotespages|).
800 %
801 % \changes{0.8.1}{2016/08/21}{corrected manual section for \texttt{\bs nppatchchapter}}%
802 % This macro should not be used, if the class uses the option \opt{openany},
803 % because it will suppress the effect of this class option. Any\since{0.8.1}
804 % redefinition of |\chapter|, either by loading a package or manually, must be
805 % done before the \NP\ package is loaded, otherwise the redefinition and/or the
806 % patching may not be effective.
807 %
808 % The command can be used anywhere in the document and it can be used multiple
809 % time. This way, the apperance of a notes page before a new chapter can be
810 % changed where ever wanted.
811 %
812 % The |\chapter| command is only patched, if it exists, so no errors will occur
813 % for a class without it.
814 %
815 % \DescribeMacro\npunpatchchapter
816 % \changes{0.8.1}{2016/08/21}{added \texttt{\bs npunpatchchapter}}%
817 % With\since[added]{0.8.1} |\npunpatchchapter| the command |\chapter| is restored
818 % to its original meaning, thus there will be no more notes pages before a new
819 % chapter after issuing this command.
820 %
821 % ^^A---------------------------------------------
822 % \subsection{Supporting Babel}
823 % \label{sec:babel}
824 % \DescribeMacro\npnotesname
825 % The \NP\ package defines the macro |\npnotesname| to contain the default title
826 % ``Notes''. If \pkg{babel} is used, commands will be added to redefine |\npnotesname|
827 % to the appropriate translation for the chosen language (if available).
828 %
829 % \DescribeMacro\npnotestext
830 % Also, \NP\ defines the macro |\npnotestext| to contain the default text
831 % ``This page is intentionally left blank.'', which will be redefined to the
832 % appropriate translation, if \pkg{babel} is used.
833 %
834 % Currently, only the languages English (english, USenglish, american, UKeng\-lish,
835 % british, canadian, australian, newzealand), French (french, francais, canadien,
836 % acadian), and German (austrian, german, germanb, ngerman, naustrian) are supported.
837 % Additional languages will be supported as users provide a translation for the
838 % word ``Notes'' (plural of note, as in ``make a note'', German: ``Notizen'') and
839 % the sentence ``This page is intentionally left blank.'' (German: ``Diese Seite
840 % wurde absichtlich leer gelassen.''; French: ``Cette page est laiss\'{e}e
841 % intentionnellement vide.'').
842 %
843 % Until then, you can put
844 %
845 % \vspace{1ex}
846 % \noindent
847 % |\addto{\extras|\meta{yourlang}|}{\def\npnotesname|\marg{``Notes'' translated}|%|\\
848 % | \def\npnotestext|\marg{``This page ...'' translated}|}|
849 %
850 % \vspace{1ex}
851 % \noindent
852 % in the preamble of a multilingual document. For documents in one language one
853 % could simply put
854 %
855 % \vspace{1ex}
856 % \noindent
857 % |\setnotespages{titletext=|\marg{``Notes'' translated}|,notestext=|\\
858 % | |\marg{``This page ...'' translated}|}|
859 %
860 % \vspace{1ex}
861 % \noindent
862 % in the preamble. But this would be overwritten, if the option \opt{default} is
863 % used. To circumvent this, one can redefine the macros |\npnotesname|
864 % and |\npnotestext| instead:
865 %
866 % \vspace{1ex}
867 % \noindent
868 % |\renewcommand{\npnotesname}|\marg{``Notes'' translated}\\
869 % |\renewcommand{\npnotestext}|\marg{``This page ...'' translated}
870 %
871 % ^^A---------------------------------------------
872 % \subsection{Supporting Color}
873 % \label{sec:color}
874 % The \NP\ package uses the colors \textsf{NotesHColor}, \textsf{NotesVColor},
875 % and \textsf{NotesTextColor} for horizontal and vertical lines and the text
876 % in the notes area of notes style \choice{text}. They are defined in the
877 % |\AtBeginDocument| hook, but only, if the package \pkg{color} or \pkg{xcolor}
878 % is loaded and the colors where not defined yet. This way, it is possible to
879 % define them with your own settings in the preamble. The default for all colors
880 % is |{gray}{0.7}|.
881 %
882 % ^^A---------------------------------------------
883 % \subsection{Warnings and Errors}
884 % There are 7 package warnings for the options. In most cases wrong values will
885 % be set to a resonable value, so compiling the document will work. But of course
886 % the result won't be as expected.
887 %
888 % If one of the keys is already defined, an error message will be given out.
889 % There are two possible reasons for this: a) another package uses the same key
890 % or b) \NP\ was loaded twice.
891 %
892 % If for a number or a length something illegal is given, there will be the usual
893 % error messages from \TeX.
894 %
895 % If for a choice key an undefined value is given, there will be an error message
896 % from the \pkg{xkeyval} package.
897 %
898 % Another Warning will be given out, if \LaTeX\ should be run again in order to
899 % get saving and restoring header marks correct.
900 %
901 % ^^A--------------------------------------------------------------------------
902 % \section{Example File}
903 % \label{sec:example}
904 % Since examples for the \NP\ package would fill this document with a lot of
905 % pages, they are outsourced to an example file \texttt{np-test.tex} provided with
906 % this package. But beware, the resulting file will be very long. The file also
907 % contains some examples for defining own title styles and notes styles.
908 %
909 % ^^A--------------------------------------------------------------------------
910 % \section{Restrictions}
911 % \label{sec:restrictions}
912 % The only known restriction applies to |\notesfill|s. If there are bottom floats
913 % or footnotes on the page, they will appear below it. This is shown in the example
914 % file. Fixing this, will be at least difficult, as it may require rewriting or
915 % patching the output routine. And there are many reasons not doing this.
916 %
917 % Of course, there may be other restrictions or incompatibility with some packages,
918 % but none were noticed with the packages used for the example file.
919 %
920 % ^^A--------------------------------------------------------------------------
921 % \section{Testing}
922 % The example file (see \autoref{sec:example}) was also used for testing. It was
923 % compiled several times with different lines commented out. Please refer to the
924 % comments in the example for further information.
925 %
926 % ^^A--------------------------------------------------------------------------
927 % \section{ToDo}
928 % There is just two items on the todo list:
929 % \begin{itemize}
930 % \item add support for other languages, as translations drop in, and
931 % \item find a way to circumvent the restriction described in \autoref{sec:restrictions}
932 % (if feasible).
933 % \end{itemize}
934 % If there are good ideas for additional features from users, I may add them
935 % to the todo list. And of course, reported bugs will be added.
936 %
937 % ^^A--------------------------------------------------------------------------
938 % \StopEventually{\newpage\PrintIndex\PrintChanges}
939 %
940 % ^^A--------------------------------------------------------------------------
941 % \newpage
942 % \section{The Code}
943 % \subsection{The Usual}
944 % First the usual things.
945 % \begin{macrocode}
946 \NeedsTeXFormat{LaTeX2e}
947 \ProvidesPackage{notespages}[\filedate\space
948 v\fileversion\space filling documents, so the total number of pages
949 is a multiple of a given number]
950 % \end{macrocode}
951 %
952 % ^^A---------------------------------------------
953 % \subsection{Loading required packages}
954 % The only package required by \NP\ is \pkg{xkeyval} to process the options of
955 % the package and the commands.
956 % \begin{macrocode}
957 \RequirePackage{xkeyval}
958 % \end{macrocode}
959 %
960 % ^^A---------------------------------------------
961 % \subsection{``Variables''}
962 % \subsubsection{``Variables'' useful for the user}
963 % \begin{macro}{\npnotesname}
964 % First, |\npnotesname| is set to its default.
965 % \begin{macrocode}
966 \newcommand*{\npnotesname}{Notes}
967 % \end{macrocode}
968 % \end{macro}
969 %
970 % \begin{macro}{\npnotestext}
971 % And then the default for |\npnotestext| is set.
972 % \begin{macrocode}
973 \newcommand*{\npnotestext}{This page is intentionally left blank.}
974 % \end{macrocode}
975 % \end{macro}
976 %
977 % \begin{macro}{\remainingtextheight}
978 % This dimen will hold the height remaining on a page for the notes area.
979 % But first, it is checked, if the name is already defined.
980 % \begin{macrocode}
981 \newcommand*{\remainingtextheight}{}
982 \newdimen\remainingtextheight
983 % \end{macrocode}
984 % \end{macro}
985 %
986 % \begin{macro}{\notestitletext}
987 % This macro will hold the value given to the option \opt{titletext}. It should
988 % be used for defining a custom title style with |\definetitlestyle|, in order
989 % to get the title given with the \opt{titletext} option.
990 % \begin{macrocode}
991 \newcommand*{\notestitletext}{}
992 % \end{macrocode}
993 % \end{macro}
994 %
995 % \begin{macro}{\notesareatext}
996 % This macro will hold the value given to the option \opt{notestext}. It can be
997 % used for own notes styles, if they should contain the text.
998 % \begin{macrocode}
999 \newcommand*{\notesareatext}{}
1000 % \end{macrocode}
1001 % \end{macro}
1002 %
1003 % ^^A-------------------------
1004 % \subsubsection{``Variables'' for \texttt{\bs notespage}}
1005 % \begin{macro}{\np@startnotes}
1006 % This macro will hold the value given to the option \opt{startnotes}.
1007 % \begin{macrocode}
1008 \newcommand*{\np@startnotes}{}
1009 % \end{macrocode}
1010 % \end{macro}
1011 %
1012 % \begin{macro}{\np@pagestyle}
1013 % This macro will hold the value given to the option \opt{pagestyle}.
1014 % \begin{macrocode}
1015 \newcommand*{\np@pagestyle}{}
1016 % \end{macrocode}
1017 % \end{macro}
1018 %
1019 % \begin{macro}{\np@notesstyle}
1020 % This macro will hold the value given to the option \opt{notesstyle}.
1021 % \begin{macrocode}
1022 \newcommand*{\np@notesstyle}{}
1023 % \end{macrocode}
1024 % \end{macro}
1025 %
1026 % \begin{macro}{\np@titlestyle}
1027 % This macro will hold the value given to the option \opt{titlestyle}.
1028 % \begin{macrocode}
1029 \newcommand*{\np@titlestyle}{}
1030 % \end{macrocode}
1031 % \end{macro}
1032 %
1033 % \begin{macro}{\np@titleskip}
1034 % This dimen will be set to the length given to the option \opt{titleskip}.
1035 % \begin{macrocode}
1036 \newcommand*{\np@titleskip}{}
1037 \newdimen\np@titleskip
1038 % \end{macrocode}
1039 % \end{macro}
1040 %
1041 % \begin{macro}{\np@notesalign}
1042 % This macro will hold the value given to the option \opt{notestextalign}.
1043 % \begin{macrocode}
1044 \newcommand*{\np@notesalign}{}
1045 % \end{macrocode}
1046 % \end{macro}
1047 %
1048 % \begin{macro}{\np@mark}
1049 % This macro will hold the value given to the option \opt{mark}.
1050 % \begin{macrocode}
1051 \newcommand*{\np@mark}{}
1052 % \end{macrocode}
1053 % \end{macro}
1054 %
1055 % \begin{macro}{\np@marktext}
1056 % This macro will hold the value given to the option \opt{marktext}.
1057 % \begin{macrocode}
1058 \newcommand*{\np@marktext}{}
1059 % \end{macrocode}
1060 % \end{macro}
1061 %
1062 % \begin{macro}{\np@hparts}
1063 % This counter will be set to the number given to the option \opt{hparts}.
1064 % \begin{macrocode}
1065 \newcommand*{\np@hparts}{}
1066 \newcount\np@hparts
1067 % \end{macrocode}
1068 % \end{macro}
1069 %
1070 % \begin{macro}{\np@vparts}
1071 % This counter will be set to the number given to the option \opt{vparts}.
1072 % \begin{macrocode}
1073 \newcommand*{\np@vparts}{}
1074 \newcount\np@vparts
1075 % \end{macrocode}
1076 % \end{macro}
1077 %
1078 % \begin{macro}{\np@height}
1079 % In the commands for the notes styles \choice{lines} and \choice{grid} this dimen
1080 % will be set to the distance between two horizontal lines.
1081 % \begin{macrocode}
1082 \newcommand*{\np@height}{}
1083 \newdimen\np@height
1084 % \end{macrocode}
1085 % \end{macro}
1086 %
1087 % \begin{macro}{\np@width}
1088 % In the commands for the notes styles \choice{vlines} and \choice{grid} this dimen
1089 % will be set to the distance between two vertical lines.
1090 % \begin{macrocode}
1091 \newcommand*{\np@width}{}
1092 \newdimen\np@width
1093 % \end{macrocode}
1094 % \end{macro}
1095 %
1096 % \begin{macro}{\np@save@marks@tokens}
1097 % This token register is used to save the original marks for the header, so they
1098 % can be changed and later restored.
1099 % \begin{macrocode}
1100 \newcommand*{\np@save@marks@tokens}{}
1101 \newtoks\np@save@marks@tokens
1102 % \end{macrocode}
1103 % \end{macro}
1104 %
1105 % \begin{macro}{\ifnp@marktext@set}
1106 % \begin{macro}{\np@marktext@setfalse}
1107 % \begin{macro}{\np@marktext@settrue}
1108 % This boolean is used to prevent the option \opt{titletext} from also setting
1109 % \opt{marktext} in case the latter option was already given in the current key
1110 % list. It is initialised to false.
1111 % \begin{macrocode}
1112 \newcommand*{\ifnp@marktext@set}{}
1113 \newif\ifnp@marktext@set\np@marktext@setfalse
1114 % \end{macrocode}
1115 % \end{macro}
1116 % \end{macro}
1117 % \end{macro}
1118 %
1119 % \begin{macro}{\ifnp@mark@new}
1120 % \begin{macro}{\np@mark@newfalse}
1121 % \begin{macro}{\np@mark@newtrue}
1122 % This boolean is used to generate a warning, if new notes pages were inserted
1123 % and therefore \LaTeX\ should be run again. It is initialised to false.
1124 % \begin{macrocode}
1125 \newcommand*{\ifnp@mark@new}{}
1126 \newif\ifnp@mark@new\np@mark@newfalse
1127 % \end{macrocode}
1128 % \end{macro}
1129 % \end{macro}
1130 % \end{macro}
1131 %
1132 % \begin{macro}{\ifnp@std@class}
1133 % \begin{macro}{\np@std@classfalse}
1134 % \begin{macro}{\np@std@classtrue}
1135 % This boolean is set to true, if a standard class or \pkg{memoir} was loaded.
1136 % It is initialised depending on the used class. Currently this boolean is only
1137 % used to set the default for the option \opt{markuppercase}.
1138 % \begin{macrocode}
1139 \newcommand*{\ifnp@std@class}{}
1140 \newif\ifnp@std@class\np@std@classfalse
1141 \@ifclassloaded{article}{\np@std@classtrue}{}
1142 \@ifclassloaded{report}{\np@std@classtrue}{}
1143 \@ifclassloaded{book}{\np@std@classtrue}{}
1144 \@ifclassloaded{memoir}{\np@std@classtrue}{}
1145 % \end{macrocode}
1146 % \end{macro}
1147 % \end{macro}
1148 % \end{macro}
1149 %
1150 % ^^A-------------------------
1151 % \subsubsection{``Variables'' for \texttt{\bs notespages}}
1152 % \begin{macro}{\np@minpages}
1153 % This counter will be set to the number given to the option \opt{minpages}.
1154 % \begin{macrocode}
1155 \newcommand*{\np@minpages}{}
1156 \newcount\np@minpages
1157 % \end{macrocode}
1158 % \end{macro}
1159 %
1160 % \begin{macro}{\np@endpages}
1161 % This counter will be set to the number given to the option \opt{endpages}.
1162 % \begin{macrocode}
1163 \newcommand*{\np@endpages}{}
1164 \newcount\np@endpages
1165 % \end{macrocode}
1166 % \end{macro}
1167 %
1168 % \begin{macro}{\np@multiple}
1169 % This counter will be set to the number given to the option \opt{multiple}.
1170 % \begin{macrocode}
1171 \newcommand*{\np@multiple}{}
1172 \newcount\np@multiple
1173 % \end{macrocode}
1174 % \end{macro}
1175 %
1176 % \begin{macro}{\np@notepages}
1177 % This counter will hold the number of notes pages, which have to be inserted by
1178 % |\notespages|. It is decremented after every page.
1179 % \begin{macrocode}
1180 \newcommand*{\np@notepages}{}
1181 \newcount\np@notepages
1182 % \end{macrocode}
1183 % \end{macro}
1184 %
1185 % \begin{macro}{\ifnp@started@on@new@page}
1186 % \begin{macro}{\np@started@on@new@pagefalse}
1187 % \begin{macro}{\np@started@on@new@pagetrue}
1188 % In |\notespages| this boolean is set to true, if the command started on a new
1189 % page. It is needed to calculate the number of pages to be inserted.
1190 % \begin{macrocode}
1191 \newcommand*{\ifnp@started@on@new@page}{}
1192 \newif\ifnp@started@on@new@page
1193 % \end{macrocode}
1194 % \end{macro}
1195 % \end{macro}
1196 % \end{macro}
1197 %
1198 % \begin{macro}{\ifnp@started@on@full@page}
1199 % \changes{0.8.1}{2016/08/21}{added for calculating the number of notes pages}%
1200 % \begin{macro}{\np@started@on@full@pagefalse}
1201 % \begin{macro}{\np@started@on@full@pagetrue}
1202 % In |\notespages| this boolean is set to true, if the current page is already
1203 % full. It is needed to calculate the number of pages to be inserted.
1204 % \since[~\\~\\\null\hfill added]{0.8.1}
1205 % \begin{macrocode}
1206 \newcommand*{\ifnp@started@on@full@page}{}
1207 \newif\ifnp@started@on@full@page
1208 % \end{macrocode}
1209 % \end{macro}
1210 % \end{macro}
1211 % \end{macro}
1212 %
1213 % ^^A-------------------------
1214 % \subsubsection{``Variables'' for \texttt{\bs notesfill}}
1215 % \begin{macro}{\np@fill@minspace}
1216 % This dimen is set to the length given to the option \opt{fillminspace}.
1217 % \begin{macrocode}
1218 \newcommand*{\np@fill@minspace}{}
1219 \newdimen\np@fill@minspace
1220 % \end{macrocode}
1221 % \end{macro}
1222 %
1223 % \begin{macro}{\np@fill@maxspace}
1224 % This dimen is set to the length given to the option \opt{fillmaxspace}.
1225 % \begin{macrocode}
1226 \newcommand*{\np@fill@maxspace}{}
1227 \newdimen\np@fill@maxspace
1228 % \end{macrocode}
1229 % \end{macro}
1230 %
1231 % \begin{macro}{\np@fill@topskip}
1232 % This dimen is set to the length given to the option \opt{filltopskip}.
1233 % \begin{macrocode}
1234 \newcommand*{\np@fill@topskip}{}
1235 \newdimen\np@fill@topskip
1236 % \end{macrocode}
1237 % \end{macro}
1238 %
1239 % ^^A-------------------------
1240 % \subsubsection{Temporary ``Variables''}
1241 % \begin{macro}{\np@tempcnta}
1242 % \begin{macro}{\np@tempcntb}
1243 % \begin{macro}{\np@tempdima}
1244 % \begin{macro}{\np@tempa}
1245 % These three registers and the macro are used as temporary variables in some
1246 % commands.
1247 % \begin{macrocode}
1248 \newcommand*{\np@tempcnta}{}
1249 \newcount\np@tempcnta
1250 \newcommand*{\np@tempcntb}{}
1251 \newcount\np@tempcntb
1252 \newcommand*{\np@tempdima}{}
1253 \newdimen\np@tempdima
1254 \newcommand*{\np@tempa}{}
1255 % \end{macrocode}
1256 % \end{macro}
1257 % \end{macro}
1258 % \end{macro}
1259 % \end{macro}
1260 %
1261 % ^^A---------------------------------------------
1262 % \subsection{Options}
1263 % \subsubsection{Checking numbers}
1264 % \begin{macro}{\np@check@num@range}
1265 % This command checks the range of a number given to some options. If the number
1266 % is too small or too large, a warning is given out and the number is set to either
1267 % the minimum or maximum respectively. The parameters are |#1| the name of option,
1268 % |#2| the counter containing the number to check, |#3| the minimum, and |#4| the
1269 % maximum.
1270 % \begin{macrocode}
1271 \newcommand*{\np@check@num@range}[4]{\relax
1272 \ifnum#2<#3\relax
1273 \PackageWarning{notespages}{%
1274 Value for #1 to small, set to #3\MessageBreak}#2=#3\relax
1275 \else\ifnum#2>#4\relax
1276 \PackageWarning{notespages}{%
1277 Value for #1 to large, set to #4\MessageBreak}#2=#4\relax
1278 \fi\fi}
1279 % \end{macrocode}
1280 % \end{macro}
1281 %
1282 % ^^A-------------------------
1283 % \subsubsection{Error message for already defined option}
1284 % \begin{macro}{\np@err@defined}
1285 % This command gives out an error for already defined keys. This is checked before
1286 % defining keys. There are two possible reasons for this: a) another package uses
1287 % the same family and the same key or b) \NP\ was loaded twice.
1288 % \begin{macrocode}
1289 \newcommand*{\np@err@defined}[1]{%
1290 \PackageError{notespages}%
1291 {Key #1 is already defined.\MessageBreak}%
1292 {The key #1 may have been defined by some other package\MessageBreak
1293 or the NotesPages package was loaded twice.}}
1294 % \end{macrocode}
1295 % \end{macro}
1296 %
1297 % ^^A-------------------------
1298 % \subsubsection{Options for \texttt{\bs notespage}}
1299 % \label{sec:optnotespage}
1300 % \begin{option}{startnotes}
1301 % The key is used to define, if a notes page should be started with |\newpage| or
1302 % |\clearpage|. It stored the value in |\np@startnotes|. Before defining the key
1303 % it is checked, if the key already exists. If so, an error is given out.
1304 % \begin{macrocode}
1305 \key@ifundefined{np}{startnotes}{}{\np@err@defined{startnotes}}
1306 \define@choicekey{np}{startnotes}[\np@startnotes]%
1307 {clearpage,newpage}[clearpage]{}
1308 % \end{macrocode}
1309 % \end{option}
1310 %
1311 % \begin{option}{allowfloats}
1312 % The boolean key is used decide if floats may appear on a notes page started with
1313 % |startnotes=newpage|. The default is set to \choice{true} here so it's possible
1314 % to just give the option without a value. It will later be set to it's real default
1315 % \choice{false} by initialising the keys.
1316 % \begin{macrocode}
1317 \key@ifundefined{np}{allowfloats}{}{\np@err@defined{allowfloats}}
1318 \define@boolkey{np}{allowfloats}[true]{}
1319 % \end{macrocode}
1320 % \end{option}
1321 %
1322 % \begin{option}{pagestyle}
1323 % The key is used to define the page style for a notes page. The value given is
1324 % stored in |\np@pagestyle|. After that, it is tested, if the given pagestyle is
1325 % defined. If not, a warning is given out and the default is set.
1326 % \begin{macrocode}
1327 \key@ifundefined{np}{pagestyle}{}{\np@err@defined{pagestyle}}
1328 \define@cmdkey{np}[np@]{pagestyle}[current]{%
1329 \def\np@tempa{current}\ifx\np@tempa\np@pagestyle\else
1330 \@ifundefined{ps@#1}{%
1331 \PackageWarning{notespages}{%
1332 `#1' is not a valid pagestyle, set to default\MessageBreak}%
1333 \def\np@pagestyle{current}}{}\fi}
1334 % \end{macrocode}
1335 % \end{option}
1336 %
1337 % \begin{option}{notesstyle}
1338 % The key is used to define the style for the notes area. The value given is
1339 % stored in |\np@notesstyle|.
1340 % \begin{macrocode}
1341 \key@ifundefined{np}{notesstyle}{}{\np@err@defined{notesstyle}}
1342 \define@choicekey{np}{notesstyle}[\np@notesstyle]%
1343 {plain,lines,vlines,grid,text}[grid]{}
1344 % \end{macrocode}
1345 % \end{option}
1346 % \begin{macro}{\np@notesstyle@nominations}
1347 % In order to make the choices expandable, the list is stored here.
1348 % \begin{macrocode}
1349 \newcommand*{\np@notesstyle@nominations}{plain,lines,vlines,grid,text}
1350 % \end{macrocode}
1351 % \end{macro}
1352 % \begin{macro}{\np@def@notesstyle@key}
1353 % And with this command the option \opt{notesstyle} can be redifined with a new
1354 % list of choices. The command is first defined with |\newcommand| to ensure it is
1355 % not defined yet. The command is later used in |\definenotesstyle| (see
1356 % \autoref{sec:newnotesstyle}).
1357 % \begin{macrocode}
1358 \newcommand*{\np@def@notesstyle@key}{}
1359 \def\np@def@notesstyle@key#1\np@end{%
1360 \define@choicekey{np}{notesstyle}[\np@notesstyle]{#1}[grid]{}}
1361 % \end{macrocode}
1362 % \end{macro}
1363 %
1364 % \begin{option}{titlestyle}
1365 % The key is used to define the style for the notes title. The value given is
1366 % stored in |\np@titlestyle|. But first the command |\minisec| is checked, so the
1367 % choice \choice{minisec} is only added, if the command exists.
1368 % \begin{macro}{\np@titlestyle@nominations}
1369 % Also, in order to make the choices expandable, the list is stored here.
1370 % \begin{macrocode}
1371 \key@ifundefined{np}{titlestyle}{}{\np@err@defined{titlestyle}}
1372 \@ifundefined{minisec}{%
1373 \define@choicekey{np}{titlestyle}[\np@titlestyle]%
1374 {none,text,section,subsection,subsubsection}[section]{}%
1375 \newcommand*{\np@titlestyle@nominations}%
1376 {none,text,section,subsection,subsubsection}}{%
1377 \define@choicekey{np}{titlestyle}[\np@titlestyle]%
1378 {none,text,section,subsection,subsubsection,minisec}[section]{}%
1379 \newcommand*{\np@titlestyle@nominations}%
1380 {none,text,section,subsection,subsubsection,minisec}}
1381 % \end{macrocode}
1382 % \end{macro}
1383 % \end{option}
1384 % \begin{macro}{\np@def@titlestyle@key}
1385 % And with this command the option \opt{titlestyle} can be redifined with a new
1386 % list of choices. The command is first defined with |\newcommand| to ensure it is
1387 % not defined yet. The command is later used in |\definetitlestyle| (see
1388 % \autoref{sec:newtitlestyle}).
1389 % \begin{macrocode}
1390 \newcommand*{\np@def@titlestyle@key}{}
1391 \def\np@def@titlestyle@key#1\np@end{%
1392 \define@choicekey{np}{titlestyle}[\np@titlestyle]{#1}[section]{}}
1393 % \end{macrocode}
1394 % \end{macro}
1395 %
1396 % \begin{option}{titletext}
1397 % The key is used to define a new text for the notes title. The value given is
1398 % stored in |\notestitletext|. The callback also sets |\np@marktext| to the same
1399 % value, if \opt{marktext} wasn't used so far.
1400 % \begin{macrocode}
1401 \key@ifundefined{np}{titletext}{}{\np@err@defined{titletext}}
1402 \define@key{np}{titletext}[\npnotesname]%
1403 {\ifnp@marktext@set\else\def\np@marktext{#1}\fi
1404 \def\notestitletext{#1}}
1405 % \end{macrocode}
1406 % \end{option}
1407 %
1408 % \begin{option}{titleskip}
1409 % The key is used to define the distance between the notes title and the notes
1410 % area. The length given is stored in |\np@titleskip|.
1411 % \begin{macrocode}
1412 \key@ifundefined{np}{titleskip}{}{\np@err@defined{titleskip}}
1413 \define@key{np}{titleskip}[0pt]{\np@titleskip=#1}
1414 % \end{macrocode}
1415 % \end{option}
1416 %
1417 % \begin{option}{titlenotesfill}
1418 % This key is used to decide, if a |\vfill| should be added between notes title
1419 % and notes area. Again, \choice{true} is set as the default here to make it
1420 % possible to use the option without a value. The real default is set during
1421 % initialisation.
1422 % \begin{macrocode}
1423 \key@ifundefined{np}{titlenotesfill}{}{\np@err@defined{titlenotesfill}}
1424 \define@boolkey{np}{titlenotesfill}[true]{}
1425 % \end{macrocode}
1426 % \end{option}
1427 %
1428 % \begin{option}{notestext}
1429 % The key is used to define a new text for the notes style \choice{text}. The value
1430 % given is stored in |\notesareatext|.
1431 % \begin{macrocode}
1432 \key@ifundefined{np}{notestext}{}{\np@err@defined{notestext}}
1433 \define@key{np}{notestext}[\npnotestext]{\def\notesareatext{#1}}
1434 % \end{macrocode}
1435 % \end{option}
1436 %
1437 % \begin{option}{notestextalign}
1438 % The key is used to set the alignment for the text of the notes style \choice{text}.
1439 % The value given is stored in |\np@notesalign|.
1440 % \begin{macrocode}
1441 \key@ifundefined{np}{notestextalign}{}{\np@err@defined{notestextalign}}
1442 \define@choicekey{np}{notestextalign}[\np@notesalign]%
1443 {left,right,center,none}[center]{}
1444 % \end{macrocode}
1445 % \end{option}
1446 %
1447 % \begin{option}{mark}
1448 % The key is used to select were the notes title should be put in the header. The
1449 % value given is stored in |\np@mark|.
1450 % \begin{macrocode}
1451 \key@ifundefined{np}{mark}{}{\np@err@defined{mark}}
1452 \define@choicekey{np}{mark}[\np@mark]{both,right,left,keep}[both]{}
1453 % \end{macrocode}
1454 % \end{option}
1455 %
1456 % \begin{option}{marktext}
1457 % With this key an alternative text for the header can be set. The new text is
1458 % stored in |\np@marktext|. The callback sets |\np@marktext@settrue|, in order
1459 % to prevent a later occurence of \opt{titletext} to overwrite \opt{marktext}.
1460 % \begin{macrocode}
1461 \key@ifundefined{np}{marktext}{}{\np@err@defined{marktext}}
1462 \define@cmdkey{np}[np@]{marktext}[\npnotesname]{\np@marktext@settrue}
1463 % \end{macrocode}
1464 % \end{option}
1465 %
1466 % \begin{option}{markuppercase}
1467 % This key is used to convert the text for the header marks of a notes pages to
1468 % upper case letters. The real default is set during initialisation, depending
1469 % on the class used.
1470 % \begin{macrocode}
1471 \key@ifundefined{np}{markuppercase}{}{\np@err@defined{markuppercase}}
1472 \define@boolkey{np}{markuppercase}[true]{}
1473 % \end{macrocode}
1474 % \end{option}
1475 %
1476 % \begin{macro}{\np@init@markuppercase}
1477 % The macro sets the option \opt{markuppercase} according to the class loaded.
1478 % \begin{macrocode}
1479 \newcommand*{\np@init@markuppercase}{%
1480 \ifnp@std@class
1481 \setkeys{np}{markuppercase=true}%
1482 \else
1483 \setkeys{np}{markuppercase=false}%
1484 \fi}
1485 % \end{macrocode}
1486 % \end{macro}
1487 %
1488 % \begin{option}{hparts}
1489 % With this key the number of horizontal parts is defined. The number is stored in
1490 % |\np@hparts| and then the range is checked.
1491 % \begin{macrocode}
1492 \key@ifundefined{np}{hparts}{}{\np@err@defined{hparts}}
1493 \define@key{np}{hparts}[25]%
1494 {\np@hparts=#1\np@check@num@range{hparts}{\np@hparts}{1}{200}}
1495 % \end{macrocode}
1496 % \end{option}
1497 %
1498 % \begin{option}{vparts}
1499 % With this key the number of vertical parts is defined. The number is stored in
1500 % |\np@vparts| and then the range is checked.
1501 % \begin{macrocode}
1502 \key@ifundefined{np}{vparts}{}{\np@err@defined{vparts}}
1503 \define@key{np}{vparts}[0]%
1504 {\np@vparts=#1\np@check@num@range{vparts}{\np@vparts}{0}{300}}
1505 % \end{macrocode}
1506 % \end{option}
1507 %
1508 % \begin{option}{usenotesareaheight}
1509 % With this key the height of a vertical part can be based on the height of the
1510 % notes area (|\remainingtextheight|) instead of |\textheight|. Here too, true
1511 % is set as the default to make it possible to use the option without a value.
1512 % The real default is set during initialisation.
1513 % \begin{macrocode}
1514 \key@ifundefined{np}{usenotesareaheight}{}%
1515 {\np@err@defined{usenotesareaheight}}
1516 \define@boolkey{np}{usenotesareaheight}[true]{}
1517 % \end{macrocode}
1518 % \end{option}
1519 %
1520 % ^^A-------------------------
1521 % \subsubsection{Options for \texttt{\bs notespages}}
1522 % \begin{option}{multiple}
1523 % With this key the number, the total number of pages of a document (so far) should
1524 % be dividable by, is defined. The number is stored in |\np@multiple| and then the
1525 % range is checked.
1526 % \begin{macrocode}
1527 \key@ifundefined{np}{multiple}{}{\np@err@defined{multiple}}
1528 \define@key{np}{multiple}[4]%
1529 {\np@multiple=#1\np@check@num@range{multiple}{\np@multiple}{1}{100}}
1530 % \end{macrocode}
1531 % \end{option}
1532 %
1533 % \begin{option}{minpages}
1534 % With this key the minimum number of notes pages to be given out is defined. The
1535 % number is stored in |\np@minpages| and then the range is checked.
1536 % \begin{macrocode}
1537 \key@ifundefined{np}{minpages}{}{\np@err@defined{minpages}}
1538 \define@key{np}{minpages}[0]%
1539 {\np@minpages=#1\np@check@num@range{minpages}{\np@minpages}{0}{100}}
1540 % \end{macrocode}
1541 % \end{option}
1542 %
1543 % \begin{option}{endpages}
1544 % With this key the number of pages, which will appear after the notes pages,
1545 % is defined. The number is stored in |\np@endpages| and then the range is
1546 % checked.
1547 % \begin{macrocode}
1548 \key@ifundefined{np}{endpages}{}{\np@err@defined{endpages}}
1549 \define@key{np}{endpages}[0]%
1550 {\np@endpages=#1\np@check@num@range{endpages}{\np@endpages}{0}{100}}
1551 % \end{macrocode}
1552 % \end{option}
1553 %
1554 % ^^A-------------------------
1555 % \subsubsection{Options for \texttt{\bs notesfill}}
1556 % \begin{option}{fillminspace}
1557 % With this key the the minimum space is defined, which has to be left on a page
1558 % to insert a notes fill. The length is stored in |\np@fill@minspace|.
1559 % \begin{macrocode}
1560 \key@ifundefined{np}{fillminspace}{}{\np@err@defined{fillminspace}}
1561 \define@key{np}{fillminspace}[0.25\textheight]{\np@fill@minspace=#1}
1562 % \end{macrocode}
1563 % \end{option}
1564 %
1565 % \begin{option}{fillmaxspace}
1566 % With this key the maximum height of a notes fill is defined. The length is
1567 % stored in |\np@fill@maxspace|.
1568 % \begin{macrocode}
1569 \key@ifundefined{np}{fillmaxspace}{}{\np@err@defined{fillmaxspace}}
1570 \define@key{np}{fillmaxspace}[\textheight]{\np@fill@maxspace=#1}
1571 % \end{macrocode}
1572 % \end{option}
1573 %
1574 % \begin{option}{filltopskip}
1575 % With this key the distance between the text and the notes fill is defined. The
1576 % length is stored in |\np@fill@topskip|.
1577 % \begin{macrocode}
1578 \key@ifundefined{np}{filltopskip}{}{\np@err@defined{filltopskip}}
1579 \define@key{np}{filltopskip}[0pt]{\np@fill@topskip=#1}
1580 % \end{macrocode}
1581 % \end{option}
1582 %
1583 % \begin{option}{filltopfill}
1584 % This key is used to decide, if a |\vfill| should be added between the text and
1585 % notes title of a notes fill.
1586 % \begin{macrocode}
1587 \key@ifundefined{np}{filltopfill}{}{\np@err@defined{filltopfill}}
1588 \define@boolkey{np}{filltopfill}[true]{}
1589 % \end{macrocode}
1590 % \end{option}
1591 %
1592 % ^^A-------------------------
1593 % \subsubsection{Meta option}
1594 % \begin{option}{empty}
1595 % This option sets all necessary keys to the values needed to produce completely
1596 % empty notes pages.
1597 % \begin{macrocode}
1598 \key@ifundefined{np}{empty}{}{\np@err@defined{empty}}
1599 \define@key{np}{empty}[]{\setkeys{np}{%
1600 pagestyle=empty,notesstyle=plain,titlestyle=none}}
1601 % \end{macrocode}
1602 % \end{option}
1603 %
1604 % \begin{option}{vacant}
1605 % This option sets all necessary keys to the values needed to produce notes pages
1606 % with only the text given to the option \opt{notetext}.
1607 % \begin{macrocode}
1608 \key@ifundefined{np}{vacant}{}{\np@err@defined{vacant}}
1609 \define@key{np}{vacant}[]{\setkeys{np}{pagestyle=empty,
1610 notesstyle=text,titlestyle=none,titleskip=0.3\textheight}}
1611 % \end{macrocode}
1612 % \end{option}
1613 %
1614 % \begin{option}{default}
1615 % This option sets all keys back to their default values. Since \pkg{xkeyval} sets
1616 % the default value, if no value in given, most options don't have values here.
1617 % Just some boolean options are set to \choice{false}. The option \opt{markuppercase}
1618 % is set with |\np@init@markuppercase|, thus depending on the class loaded.
1619 % \begin{macrocode}
1620 \key@ifundefined{np}{default}{}{\np@err@defined{default}}
1621 \define@key{np}{default}[]{\setkeys{np}{%
1622 startnotes,allowfloats=false,pagestyle,notesstyle,
1623 titlestyle,titletext,titleskip,titlenotesfill=false,
1624 notestext,notestextalign,
1625 mark,marktext,
1626 hparts=25,vparts=0,usenotesareaheight=false,
1627 minpages,endpages,multiple=4,
1628 fillminspace,fillmaxspace,filltopskip,filltopfill}%
1629 \np@init@markuppercase}
1630 % \end{macrocode}
1631 % \end{option}
1632 %
1633 % ^^A-------------------------
1634 % \subsubsection{Initialisation}
1635 % The keys are now initialised, i.e.\ set to thier defaults. After that, the
1636 % options passed on loading are processed.
1637 % \begin{macrocode}
1638 \setkeys{np}{default}
1639 \ProcessOptionsX<np>
1640 % \end{macrocode}
1641 %
1642 % ^^A---------------------------------------------
1643 % \subsection{Commands}
1644 % \subsubsection{Header marks}
1645 % Changing and restoring the header marks works as follows: first the original
1646 % marks are saved with |\np@savemark|. Then the header marks for the notes page
1647 % are set with |\np@setmark|. And finally, the original header makrs are restored
1648 % with |\np@restoremark|.
1649 %
1650 % But there are several conditions to that:
1651 % \begin{enumerate}
1652 % \item The original header marks can only be saved on the first notes page of
1653 % a group of successive notes pages, regardless if they where generated
1654 % with one |\notespages| command or several |\notespage| or |\notespages|
1655 % commands. If done on following pages, this would overwrite the already
1656 % saved original header marks.
1657 % \item Saving, setting, and restoring the header marks should only be done
1658 % if necessary, i.e. if \opt{mark} is not \choice{keep}.
1659 % \item Setting the header marks can be done on every notes page, but of course
1660 % only according to the value given to \opt{mark}.
1661 % \item When setting only the left or the right mark, for the other the original
1662 % mark must be set, so in case the value for \opt{mark} is changed on
1663 % successive notes pages, the marks don't mixed up.
1664 % \item Restoring the original header marks can only be done on the last of a
1665 % group of successive notes pages. Otherwise, this would mix up the header
1666 % marks.
1667 % \item All |\mark...| commands always set both marks, |\markright| just sets
1668 % the current other mark again (stored in \LaTeX{}s |\@themark|).
1669 % \item The left mark must not be restored on the notes page, because |\botmark|
1670 % is used for this. This would result in the restored left mark on the last
1671 % notes page.
1672 % \item The right mark must be restored before the page after the last notes page,
1673 % because here |\firstmark| is used. Otherwise, a new section after the notes
1674 % page would not reflect in the header.
1675 % \end{enumerate}
1676 %
1677 % The first condition could easily be met with a simple flag, but for condition 5
1678 % it is necessary to look ahead. Therefore, some information is written to the
1679 % |.aux| file for every notes page, where \opt{mark} is not \choice{keep}. When
1680 % the file is reread at the end of the document, these informations will be written
1681 % to a file |\jobname.npm|. The latter is then read in |\AtBeginDocument| during
1682 % the second \LaTeX\ run, defining special macros for each notes page. These macros
1683 % are then used to look back and ahead to meet conditions 1 and 5.
1684 %
1685 % The last three conditions result is a conflict. Due to condition 6, regarding
1686 % condition 7 would violate condition 8 and vice versa. This problem is solved
1687 % by setting a mark in the form |\ifnum| \meta{page number after notes page} $=$
1688 % \meta{current page number} \meta{original left mark} |\else| \meta{left mark
1689 % for notes page} |\fi| on the last notes page.
1690 %
1691 % \begin{macro}{\npnpinfo}
1692 % The macro |\npnpinfo| is written to the file |\jobname.npm| via the |.aux| file.
1693 % The argument is the page number of the notes page. It will define a macro
1694 % |\np@np@info.|\meta{page number}, which will later just be checked
1695 % for existence to determine, if the previous or next page is a notes page.
1696 % \begin{macrocode}
1697 \newcommand*{\npnpinfo}[1]{%
1698 \expandafter\def\csname np@np@info.#1\endcsname{}}
1699 % \end{macrocode}
1700 % \end{macro}
1701 %
1702 % The file |\jobname.npm| must be opened in |\AtEndDocument|, so \LaTeX\ can
1703 % write it while rereading the |.aux| file. The |\nofiles| switch is observed.
1704 % Here also the warning to rerun \LaTeX\ is given out, if new notes pages were
1705 % added.
1706 % \begin{macrocode}
1707 \AtEndDocument{\if@filesw\newwrite\tf@npm
1708 \immediate\openout\tf@npm\jobname.npm\fi
1709 \ifnp@mark@new
1710 \PackageWarningNoLine{notespage}{%
1711 New notes pages were added.
1712 Please rerun LaTeX to get header marks right.}%
1713 \fi}
1714 % \end{macrocode}
1715 %
1716 % \begin{macro}{\tracingnpmarks}
1717 % For saving, setting, and restoring the header marks, some tracing can be done.
1718 % By setting the counter |\tracingnpmarks| to a value greater then 0, informations
1719 % about the reasons for doing or not doing things are stored to the log file. It
1720 % is switched off by default.
1721 % \begin{macrocode}
1722 \newcommand*{\tracingnpmarks}{}
1723 \newcount\tracingnpmarks
1724 \tracingnpmarks\z@
1725 % \end{macrocode}
1726 % \end{macro}
1727 %
1728 % \begin{macro}{\np@tracing@marks}
1729 % This macro is used for adding the tracing information to the log file if
1730 % tracing is enabled.
1731 % \begin{macrocode}
1732 \newcommand{\np@tracing@marks}[3]{%
1733 \ifnum\tracingnpmarks>\z@
1734 \PackageInfo{notespages}{#1 header marks: #2 done\MessageBreak
1735 #3\MessageBreak}%
1736 \fi}
1737 % \end{macrocode}
1738 % \end{macro}
1739 %
1740 % \begin{macro}{\ifnp@page@has@np}
1741 % \begin{macro}{\np@page@has@nptrue}
1742 % \begin{macro}{\np@page@has@npfalse}
1743 % \begin{macro}{\np@page@has@np}
1744 % This boolean and the macro are used to determine, if a page is a notes page. The
1745 % page number is given as argument to |\np@page@has@np|.
1746 % \begin{macrocode}
1747 \newcommand*{\ifnp@page@has@np}{}
1748 \newif\ifnp@page@has@np
1749 \newcommand*{\np@page@has@np}[1]{%
1750 \@ifundefined{np@np@info.#1}%
1751 {\np@page@has@npfalse}{\np@page@has@nptrue}}
1752 % \end{macrocode}
1753 % \end{macro}
1754 % \end{macro}
1755 % \end{macro}
1756 % \end{macro}
1757 %
1758 % \begin{macro}{\np@mark@keep}
1759 % This macro simply checks, if |mark=keep| was given.
1760 % \begin{macrocode}
1761 \newcommand*{\np@mark@keep}{TT\fi
1762 \def\np@tempa{keep}\ifx\np@tempa\np@mark}
1763 % \end{macrocode}
1764 % \end{macro}
1765 %
1766 % \begin{macro}{\np@savemark}
1767 % This command saves the current header marks in the token register\linebreak
1768 % |\np@save@marks@tokens|. But this is only done, if \opt{mark} is not \choice{keep}
1769 % and the previous page is not a notes page. The messages for tracing are numbered,
1770 % so it's easier to find the corresponding parts in the code.
1771 % \begin{macrocode}
1772 \newcommand*{\np@savemark}{%
1773 \if\np@mark@keep
1774 \np@tracing@marks{save}{not}{mark=keep (1)}%
1775 \else
1776 \np@tempcnta\c@page\advance\np@tempcnta\m@ne
1777 \np@page@has@np{\the\np@tempcnta}\ifnp@page@has@np
1778 \np@tracing@marks{save}{not}{np on previous page (2)}%
1779 \else
1780 \np@tracing@marks{save}{}{mark not keep (3)}%
1781 \global\np@save@marks@tokens\expandafter{\@themark}%
1782 \fi
1783 \fi}
1784 % \end{macrocode}
1785 % \end{macro}
1786 %
1787 % Setting the header marks is not as easy as it seems at first. In order to make
1788 % it possible to switch between the possible choices on consecutive pages, both
1789 % header marks must always be set. For \choice{both} this is easily done with
1790 % |\markboth|. For \choice{left} and \choice{right} it is necessary to set the
1791 % other mark to the original, because they may have been changed on the page
1792 % before.
1793 %
1794 % \begin{macro}{\np@@markleft}
1795 % \begin{macro}{\np@@markright}
1796 % These commands take three arguments, |#1|: the original left header mark, |#2|:
1797 % the original right header mark, and |#3|: the header mark for the notes page.
1798 % The latter is used for the appropriate side and for the other the original is
1799 % used.
1800 % \begin{macrocode}
1801 \newcommand*{\np@@markleft}[3]{\markboth{#3}{#2}}
1802 \newcommand*{\np@@markright}[3]{\markboth{#1}{#3}}
1803 % \end{macrocode}
1804 % \end{macro}
1805 % \end{macro}
1806 %
1807 % \begin{macro}{\np@markleft}
1808 % \begin{macro}{\np@@markright}
1809 % These commands take the header mark for the notes page as their argument and
1810 % pass it to |\np@@markleft| or |\np@@markright| together with the original
1811 % header marks.
1812 % \begin{macrocode}
1813 \newcommand*{\np@markleft}[1]{%
1814 \expandafter\np@@markleft\the\np@save@marks@tokens{#1}}
1815 \newcommand*{\np@markright}[1]{%
1816 \expandafter\np@@markright\the\np@save@marks@tokens{#1}}
1817 % \end{macrocode}
1818 % \end{macro}
1819 % \end{macro}
1820 %
1821 % \begin{macro}{\np@setmark}
1822 % This command sets the header marks for a notes page depending on the value given
1823 % to the option \opt{mark}. For the choice \choice{keep} nothing is done, leading
1824 % to unchanged headers. Additionally, |\np@mark@newtrue| is set, if the notes page
1825 % is new in this \LaTeX\ run.
1826 % \begin{macrocode}
1827 \newcommand*{\np@setmark}{
1828 \if\np@mark@keep
1829 \np@tracing@marks{set}{not}{mark=keep (4)}%
1830 \else
1831 \np@page@has@np{\the\c@page}\ifnp@page@has@np\else
1832 \global\np@mark@newtrue
1833 \fi
1834 \def\np@tempa{both}\ifx\np@tempa\np@mark
1835 \np@tracing@marks{set}{}{mark=both (5)}%
1836 \ifKV@np@markuppercase
1837 \markboth{\MakeUppercase{\np@marktext}}%
1838 {\MakeUppercase{\np@marktext}}%
1839 \else
1840 \markboth{\np@marktext}{\np@marktext}%
1841 \fi
1842 \else
1843 \def\np@tempa{right}\ifx\np@tempa\np@mark
1844 \np@tracing@marks{set}{}{mark=right (6)}%
1845 \ifKV@np@markuppercase
1846 \np@markright{\MakeUppercase{\np@marktext}}%
1847 \else
1848 \np@markright{\np@marktext}%
1849 \fi
1850 \else
1851 \def\np@tempa{left}\ifx\np@tempa\np@mark
1852 \np@tracing@marks{set}{}{mark=left (7)}%
1853 \ifKV@np@markuppercase
1854 \np@markleft{\MakeUppercase{\np@marktext}}%
1855 \else
1856 \np@markleft{\np@marktext}%
1857 \fi
1858 \fi
1859 \fi
1860 \fi
1861 \fi}
1862 % \end{macrocode}
1863 % \end{macro}
1864 %
1865 % \begin{macro}{\np@restore@@mark}
1866 % This macro restores the header marks. It basically works like |\markboth|, but
1867 % with four arguments. Here |#1| and |#2| are the left and right marks for the notes
1868 % page and |#3| and |#4| are the original left and right marks. Argument |#2| is
1869 % not needed, but it can't be avoided. Additionally the counter |\np@tempcnta|
1870 % has to contain the number of the next page, which is calculated in |\np@restoremark|.
1871 %
1872 % \LaTeX{}s |\@themark| is set twice. The first time the left mark is set as an
1873 % |\if| construct. Then, after |\mark|, |\@themark| is set again, but this time
1874 % with only the original marks. Without this the |\if| construct would be nested
1875 % in another one in case a notes page would be followed by normal pages and then
1876 % a notes page again, without anything setting the left mark, e.g.\ a new chapter.
1877 % \begin{macrocode}
1878 \newcommand*{\np@restore@@mark}[4]{%
1879 \begingroup
1880 \let\label\relax \let\index\relax \let\glossary\relax
1881 \@temptokena {#4}%
1882 \unrestored@protected@xdef\@themark{%
1883 {\protect\ifnum\the\np@tempcnta=\c@page
1884 #3\protect\else #1\protect\fi}%
1885 {\the\@temptokena}}%
1886 \@temptokena \expandafter{\@themark}%
1887 \mark{\the\@temptokena}%
1888 \@temptokena {#4}%
1889 \unrestored@protected@xdef\@themark{{#3}{\the\@temptokena}}%
1890 \endgroup
1891 \if@nobreak\ifvmode\nobreak\fi\fi}
1892 % \end{macrocode}
1893 % \end{macro}
1894 %
1895 % \begin{macro}{\np@restore@mark}
1896 % This macro is only used to get the correct arguments for |\np@restore@@mark|.
1897 % \begin{macrocode}
1898 \newcommand*{\np@restore@mark}[2]{%
1899 \expandafter\np@restore@@mark\@themark{#1}{#2}}
1900 % \end{macrocode}
1901 % \end{macro}
1902 %
1903 % \begin{macro}{\np@restoremark}
1904 % This command is used to restore the header makrs from before a notes page.
1905 % It only does this, if \opt{mark} is not \choice{keep} and the next page
1906 % isn't a notes page.
1907 % \begin{macrocode}
1908 \newcommand*{\np@restoremark}{%
1909 \if\np@mark@keep
1910 \np@tracing@marks{restore}{not}{mark=keep (8)}%
1911 \else
1912 \np@tempcnta\c@page\advance\np@tempcnta\@ne
1913 \np@page@has@np{\the\np@tempcnta}\ifnp@page@has@np
1914 \np@tracing@marks{restore}{not}{np on next page (9)}%
1915 \else
1916 \np@tracing@marks{restore}{}{(10)}%
1917 \expandafter\np@restore@mark\the\np@save@marks@tokens
1918 \fi
1919 \fi}
1920 % \end{macrocode}
1921 % \end{macro}
1922 %
1923 % ^^A-------------------------
1924 % \subsubsection{Page stuff}
1925 % \begin{macro}{\np@startnotespage}
1926 % This macro starts a new page for a notes page by just calling the values given
1927 % to the option \opt{startnotes} as a command.
1928 % \begin{macrocode}
1929 \newcommand*{\np@startnotespage}{%
1930 \expandafter\csname \np@startnotes\endcsname}
1931 % \end{macrocode}
1932 % \end{macro}
1933 % \begin{macro}{\np@setpagestyle}
1934 % This macro sets the page style for a notes page by using the value given to the
1935 % option \opt{pagestyle} as a parameter for |\thispagestyle|, if it is not
1936 % \choice{current}.
1937 % \begin{macrocode}
1938 \newcommand*{\np@setpagestyle}{%
1939 \def\np@tempa{current}\ifx\np@tempa\np@pagestyle\else
1940 \thispagestyle{\np@pagestyle}\fi}
1941 % \end{macrocode}
1942 % \end{macro}
1943 %
1944 % ^^A-------------------------
1945 % \subsubsection{Notes title}
1946 % \begin{macro}{\np@ts@section}
1947 % \begin{macro}{\np@ts@subsection}
1948 % \begin{macro}{\np@ts@subsubsection}
1949 % \begin{macro}{\np@ts@minisec}
1950 % \begin{macro}{\np@ts@text}
1951 % \begin{macro}{\np@ts@none}
1952 % The following macros just provide the commands for the choices of the option
1953 % \opt{titlestyle}. For \choice{text} the |\par| at the end is necessary to
1954 % start a new paragraph for the notes area.
1955 % \begin{macrocode}
1956 \newcommand*{\np@ts@section}{\section*{\notestitletext}}
1957 \newcommand*{\np@ts@subsection}{\subsection*{\notestitletext}}
1958 \newcommand*{\np@ts@subsubsection}{\subsubsection*{\notestitletext}}
1959 \newcommand*{\np@ts@minisec}{\minisec{\notestitletext}}
1960 \newcommand*{\np@ts@text}{\noindent\notestitletext\par}
1961 \newcommand*{\np@ts@none}{}
1962 % \end{macrocode}
1963 % \end{macro}
1964 % \end{macro}
1965 % \end{macro}
1966 % \end{macro}
1967 % \end{macro}
1968 % \end{macro}
1969 %
1970 % \begin{macro}{\np@maketitle}
1971 % This macro calls the macro for the selected notes title style.
1972 % \begin{macrocode}
1973 \newcommand*{\np@maketitle}{\csname np@ts@\np@titlestyle\endcsname}
1974 % \end{macrocode}
1975 % \end{macro}
1976 %
1977 % ^^A-------------------------
1978 % \subsubsection{Remaining height}
1979 % \begin{macro}{\np@calcheight}
1980 % This macro calculates the height remaining on the page and stores the result in
1981 % |\remainingtextheight|. If a page was just started, |\pagegoal| is |\maxdimen|
1982 % and |\pagetotal| 0pt. If there is already something on the page, like the notes
1983 % title or the text on a page with a notes fill, it is necessary, to subtract
1984 % |\lineskip| to get the right height.
1985 % \begin{macrocode}
1986 \newcommand*{\np@calcheight}{%
1987 \ifdim\pagegoal=\maxdimen
1988 \remainingtextheight\textheight
1989 \else
1990 \remainingtextheight\pagegoal
1991 \advance\remainingtextheight by -\pagetotal
1992 \advance\remainingtextheight by -\lineskip
1993 \fi}
1994 % \end{macrocode}
1995 % \end{macro}
1996 %
1997 % ^^A-------------------------
1998 % \subsubsection{Dividing dimen by dimen}
1999 % The following macros are use to divide a dimen register by another dimen
2000 % register, resulting in a real number as a string in |\np@result|.
2001 % \begin{macro}{\np@Tc}
2002 % This is used as a temporary counter.
2003 % \begin{macrocode}
2004 \newcommand*{\np@Tc}{}
2005 \newcount\np@Tc
2006 % \end{macrocode}
2007 % \end{macro}
2008 % \begin{macro}{\np@Zc}
2009 % This counter is used for the numerator in sp (scaled points) at first and later
2010 % for computing decimal places.
2011 % \begin{macrocode}
2012 \newcommand*{\np@Zc}{}
2013 \newcount\np@Zc
2014 % \end{macrocode}
2015 % \end{macro}
2016 % \begin{macro}{\np@Nc}
2017 % This counter is used for the denominator in sp. It is set to its absolute value
2018 % and not changed afterwards.
2019 % \begin{macrocode}
2020 \newcommand*{\np@Nc}{}
2021 \newcount\np@Nc
2022 % \end{macrocode}
2023 % \end{macro}
2024 % \begin{macro}{\np@Z}
2025 % This dimen will hold the numerator in pt. It is set but not changed.
2026 % \begin{macrocode}
2027 \newcommand*{\np@Z}{}
2028 \newdimen\np@Z
2029 % \end{macrocode}
2030 % \end{macro}
2031 % \begin{macro}{\np@N}
2032 % This dimen will hold the denominator in pt. It is set but not changed.
2033 % \begin{macrocode}
2034 \newcommand*{\np@N}{}
2035 \newdimen\np@N
2036 % \end{macrocode}
2037 % \end{macro}
2038 % \begin{macro}{\np@result}
2039 % In this macro the result is build as a string without a unit.
2040 % \begin{macrocode}
2041 \newcommand*{\np@result}{}
2042 % \end{macrocode}
2043 % \end{macro}
2044 % \begin{macro}{\np@calcnextdigit}
2045 % This macro computes one decimal place of the result. It expects |\np@Tc| to hold
2046 % the result of the last division and |\np@Zc| the remainder of the nominator
2047 % multiplied with $10^d$ ($d$: number of decimal places computed so far). Both
2048 % counters are left prepared for computing the next decimal place.
2049 % \begin{macrocode}
2050 \newcommand*{\np@calcnextdigit}{%
2051 \multiply\np@Tc\np@Nc
2052 \advance\np@Zc-\np@Tc
2053 \multiply\np@Zc10\relax
2054 \np@Tc\np@Zc
2055 \divide\np@Tc\np@Nc
2056 \xdef\np@result{\np@result\number\np@Tc}}
2057 % \end{macrocode}
2058 % \end{macro}
2059 % \begin{macro}{\np@divide}
2060 % This macro does the divison. First, |\np@result|, |\np@Zc|, and |\np@Nc| are
2061 % initialised. Then the counters are set to their absolute values and, if necessary,
2062 % a minus sign is added to the result. Because\TeX\ interprets ``$--$'' as ``$+$'',
2063 % it can be done for both, numerator and denominator. Then the first division is
2064 % done, leading to an integer result representing the digits before the decimal
2065 % point. This number is appended to |\np@result|. After this, 6 decimal places are
2066 % computed.
2067 % \begin{macrocode}
2068 \newcommand*{\np@divide}{%
2069 \gdef\np@result{}%
2070 \global\np@Zc\np@Z\global\np@Nc\np@N
2071 \ifnum\np@Zc<\z@\np@Zc-\np@Zc\gdef\np@result{-}\fi
2072 \ifnum\np@Nc<\z@\np@Nc-\np@Nc\xdef\np@result{\np@result-}\fi
2073 \np@Tc\np@Zc
2074 \divide\np@Tc\np@Nc
2075 \xdef\np@result{\np@result\number\np@Tc.}%
2076 \np@calcnextdigit\np@calcnextdigit\np@calcnextdigit
2077 \np@calcnextdigit\np@calcnextdigit\np@calcnextdigit}
2078 % \end{macrocode}
2079 % \end{macro}
2080 % \begin{macro}{\np@dddivide}
2081 % This macro is used by the package to divide two dimens. It just sets |\np@Z|
2082 % and |\np@N| and calls |\np@divide|. The macro can be adapted to work with
2083 % real numbers provided as strings, by just adding |\p@| after |#1| and/or |#2|.
2084 % \begin{macrocode}
2085 \newcommand*{\np@dddivide}[2]{\global\np@Z#1\global\np@N#2\np@divide}
2086 % \end{macrocode}
2087 % \end{macro}
2088 %
2089 % ^^A-------------------------
2090 % \subsubsection{Truncating a dimen}
2091 % \begin{macro}{\np@truncate}
2092 % This macro simply cuts of everything after the decimal point. Since |\the| always
2093 % produces a decimal point for dimen registers, no special treatment for whole
2094 % numbers is required.
2095 % \begin{macrocode}
2096 \newcommand*{\np@truncate}{}
2097 \def\np@truncate#1.#2\np@end{#1}
2098 % \end{macrocode}
2099 % \end{macro}
2100 %
2101 % ^^A---------------------------------------------
2102 % \subsection{Notes styles}
2103 % \subsubsection{Plain}
2104 % \begin{macro}{\np@ns@plain}
2105 % The macro for the \opt{notesstyle} \choice{plain} simply produces an invisible
2106 % box the size of the notes area.
2107 % \begin{macrocode}
2108 \newcommand{\np@ns@plain}{%
2109 \phantom{\rule{\textwidth}{\remainingtextheight}}}
2110 % \end{macrocode}
2111 % \end{macro}
2112 %
2113 % ^^A-------------------------
2114 % \subsubsection{Lines}
2115 % \begin{macro}{\np@calc@vheight}
2116 % This macro calculates the height of a vertical part in |\np@height|. Depending
2117 % on the value for \opt{usenotesareaheight} it is based on |\textheight| or
2118 % |\remainingtextheight|. The number of times |\np@height| fits into the notes
2119 % area as a whole is also calculated and stored in |\np@tempcntb|.
2120 % \begin{macrocode}
2121 \newcommand{\np@calc@vheight}{%
2122 \ifKV@np@usenotesareaheight
2123 \np@height\remainingtextheight\divide\np@height\np@vparts
2124 \np@tempcntb\np@vparts
2125 \else
2126 \np@height\textheight\divide\np@height\np@vparts
2127 % \end{macrocode}
2128 % Here the number of lines, which fit in the notes area, is calculated as a real
2129 % number and stored in |\np@tempdima|.
2130 % \begin{macrocode}
2131 \np@dddivide\remainingtextheight\np@height
2132 \expandafter\np@tempdima\np@result\p@
2133 % \end{macrocode}
2134 % In order to get rid of rounding errors (a result of 3 may be something like 2.99998)
2135 % a small length is added to |\np@tempdima|, before it is truncated and the result
2136 % stored in |\np@tempcntb|. This is the number of times |\np@height| fits into the
2137 % notes area as a whole.
2138 % \begin{macrocode}
2139 \advance\[email protected]\p@
2140 \edef\np@tempa{\expandafter\np@truncate\the\np@tempdima\np@end}%
2141 \np@tempcntb\np@tempa\relax
2142 \fi}
2143 % \end{macrocode}
2144 % \end{macro}
2145 %
2146 % \begin{macro}{\np@ns@lines}
2147 % This macro is used to produce the notes area for the \opt{notesstyle} \choice{lines}.
2148 % First the special cases are handled. For |vparts=0| a warning is given and
2149 % \choice{plain} is used as \opt{notesstyle}.
2150 % \begin{macrocode}
2151 \newcommand{\np@ns@lines}{%
2152 \ifnum\np@vparts=\z@\relax
2153 \PackageWarning{notespages}{vparts is 0, there are no lines
2154 \MessageBreak}%
2155 \np@ns@plain
2156 % \end{macrocode}
2157 % For |vparts=1| a line on the top and the bottom of the notes area is
2158 % drawn. Here the trick of setting |\unitlength| to |\relax| is used to make the
2159 % \textsf{picture} environment use dimens. For this to work, the optional second
2160 % coordinates must be given too. There is no harm in not restoring |\unitlength|,
2161 % because |\np@ns@lines| is executed within a group, keeping the change local.
2162 % \begin{macrocode}
2163 \else\ifnum\np@vparts=\@ne\relax
2164 \let\unitlength\relax
2165 \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
2166 \color{NotesHColor}%
2167 \multiput(\z@,\z@)(\z@,\remainingtextheight){2}%
2168 {\line(1,0){\textwidth}}%
2169 \end{picture}%
2170 \else
2171 % \end{macrocode}
2172 % For all other values of \opt{vparts}, the distance between two horizontal lines
2173 % (in |\np@height|) and the number of lines (in |\np@tempcntb|) are calculated.
2174 % \begin{macrocode}
2175 \np@calc@vheight
2176 % \end{macrocode}
2177 % And finally, the lines are drawn, using the same trick for the \textsf{picture}
2178 % environment as above, to make it take lengths.
2179 % \begin{macrocode}
2180 \let\unitlength\relax
2181 \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
2182 \color{NotesHColor}%
2183 \multiput(\z@,\z@)(\z@,\np@height){\np@tempcntb}%
2184 {\line(1,0){\textwidth}}%
2185 \end{picture}%
2186 \fi\fi}
2187 % \end{macrocode}
2188 % \end{macro}
2189 %
2190 % ^^A-------------------------
2191 % \subsubsection{Vlines}
2192 % \begin{macro}{\np@ns@vlines}
2193 % This macro is used to produce the notes area for the \opt{notesstyle} \choice{vlines}.
2194 % First the distance between two vertical lines is calculated and stored in |\np@width|.
2195 % Then |\np@tempcnta| is set to |\np@hparts| $+$ 1, to always draw the line on the
2196 % right side of the notes area. And finally, the lines are drawn, using the trick
2197 % from |\np@ns@lines| again.
2198 % \begin{macrocode}
2199 \newcommand{\np@ns@vlines}{%
2200 \np@width\textwidth\divide\np@width\np@hparts
2201 \np@tempcnta\np@hparts\advance\np@tempcnta\@ne\relax
2202 \let\unitlength\relax
2203 \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
2204 \color{NotesVColor}%
2205 \multiput(\z@,\z@)(\np@width,\z@){\np@tempcnta}%
2206 {\line(0,1){\remainingtextheight}}%
2207 \end{picture}}
2208 % \end{macrocode}
2209 % \end{macro}
2210 %
2211 % ^^A-------------------------
2212 % \subsubsection{Grid}
2213 % \begin{macro}{\np@ns@grid}
2214 % This macro is used to produce the notes area for the \opt{notesstyle} \choice{grid}.
2215 % First the distance between two vertical lines (in |\np@width|) and their number
2216 % (in |\np@tempcnta|) are calculated.
2217 % \begin{macrocode}
2218 \newcommand{\np@ns@grid}{%
2219 \np@width\textwidth\divide\np@width\np@hparts
2220 \np@tempcnta\np@hparts\advance\np@tempcnta\@ne\relax
2221 % \end{macrocode}
2222 % Then the distance between two horizontal lines (in |\np@height|) and their number
2223 % (in |\np@tempcntb|) are calculated. Again, special cases must be handled. For
2224 % |vparts=0| the grid should be made from squares. Therefore |\np@height|
2225 % is set to |\np@width|. The following calculation of the number of whole \opt{hparts}
2226 % is calculated similar to |\np@ns@lines|. The number of lines is stored in
2227 % |\np@tempcntb|.
2228 % \begin{macrocode}
2229 \ifnum\np@vparts=\z@\relax
2230 \np@height\np@width
2231 \np@dddivide\remainingtextheight\np@height
2232 \expandafter\np@tempdima\np@result\p@
2233 \advance\[email protected]\p@
2234 \edef\np@tempa{\expandafter\np@truncate\the\np@tempdima\np@end}%
2235 \np@tempcntb\np@tempa\relax
2236 % \end{macrocode}
2237 % The height needed for vertical lines is calculated and stored in |\np@tempdima|.
2238 % And the number of horizontal lines is incremented, in order to also draw the
2239 % top most line.
2240 % \begin{macrocode}
2241 \np@tempdima\np@height\multiply\np@tempdima\np@tempcntb
2242 \advance\np@tempcntb\@ne\relax
2243 % \end{macrocode}
2244 % For |vparts=1| a line on the top and the bottom should be drawn. The
2245 % values |\np@height|, |\np@tempcntb|, and |\np@tempdima| are set accordingly.
2246 % \begin{macrocode}
2247 \else\ifnum\np@vparts=\@ne\relax
2248 \np@height\remainingtextheight
2249 \np@tempcntb\tw@\relax
2250 \np@tempdima\np@height
2251 \else
2252 % \end{macrocode}
2253 % For other values of \opt{vparts} the necessary values are calculated the same
2254 % way as for |\np@ns@lines|.
2255 % \begin{macrocode}
2256 \np@calc@vheight
2257 % \end{macrocode}
2258 % And then, the height needed for vertical lines (|\np@tempdima|) is calculated
2259 % and the number of horizontal lines (|\np@tempcntb|) is incremented.
2260 % \begin{macrocode}
2261 \np@tempdima\np@height\multiply\np@tempdima\np@tempcntb
2262 \advance\np@tempcntb\@ne
2263 \fi\fi
2264 % \end{macrocode}
2265 % Finally, all lines are drawn, using the trick from |\np@ns@lines| again.
2266 % \begin{macrocode}
2267 \let\unitlength\relax
2268 \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
2269 \color{NotesVColor}%
2270 \multiput(\z@,\z@)(\np@width,\z@){\np@tempcnta}%
2271 {\line(0,1){\np@tempdima}}%
2272 \color{NotesHColor}%
2273 \multiput(\z@,\z@)(\z@,\np@height){\np@tempcntb}%
2274 {\line(1,0){\textwidth}}%
2275 \end{picture}}
2276 % \end{macrocode}
2277 % \end{macro}
2278 %
2279 % ^^A-------------------------
2280 % \subsubsection{Text}
2281 % \label{sec:ns-text}
2282 % \begin{macro}{\np@ns@text}
2283 % This macro is used to produce the notes area for the \opt{notesstyle} \choice{text}.
2284 % Since |\np@titleskip| is not inserted for |titlestyle=none|, it is inserted here to
2285 % enable shifting the text vertically. For some unknown reason this doesn't work
2286 % without the invisible |\hrule|. After that, the alignement is set. For
2287 % |notestextalign=none| nothing is done, thus using the alignement active before
2288 % the notes page. For the text color |\color| is used so the user can easily set an
2289 % own color by using |notestext=\textcolor{mycolor}{my notes text}|.
2290 % \begin{macrocode}
2291 \newcommand{\np@ns@text}{%
2292 \def\np@tempa{none}\ifx\np@tempa\np@titlestyle
2293 \hrule\@height\z@
2294 \vspace*{\np@titleskip}%
2295 \fi
2296 \def\np@tempa{left}\ifx\np@tempa\np@notesalign
2297 %% \typeout{notespages debug: notestextalign=left}%
2298 \raggedright
2299 \else
2300 \def\np@tempa{right}\ifx\np@tempa\np@notesalign
2301 %% \typeout{notespages debug: notestextalign=right}%
2302 \raggedleft
2303 \else
2304 \def\np@tempa{center}\ifx\np@tempa\np@notesalign
2305 %% \typeout{notespages debug: notestextalign=center}%
2306 \centering
2307 \fi
2308 \fi
2309 \fi
2310 % \end{macrocode}
2311 % \changes{0.8.1}{2016/08/21}{added \texttt{\bs par} to make alignement work again}%
2312 % The\since{0.8.1} |\par| had to be added, to make the alignement set with
2313 % \opt{notesalign} work again after the group was added in |\np@inner@notespage|
2314 % (see \autoref{sec:use-ns}).
2315 % \begin{macrocode}
2316 \color{NotesTextColor}\notesareatext\par}
2317 % \end{macrocode}
2318 % \end{macro}
2319 %
2320 % ^^A-------------------------
2321 % \subsubsection{Using notes styles}
2322 % \label{sec:use-ns}
2323 % \begin{macro}{\np@inner@notespage}
2324 % This macro calls the command for the \opt{notesstyle} seclected. Before that,
2325 % |\parfillskip| is set to avoid an |overfull hbox| error, in case some class
2326 % or package set it to a different value (example: \pkg{KOMA-Script} classes with
2327 % the option \opt{parskip}).
2328 %
2329 % \changes{0.8.1}{2016/08/21}{bug fixed regarding \texttt{\bs unitlength} and \pkg{eso-pic}}%
2330 % The\since{0.8.1} group around |\csname ...\endcsname| had to be added, because
2331 % otherwise packages like \pkg{eso-pic} (which uses a \textsf{picture} environment
2332 % to put something into the background of a page) will fail. The reason for the
2333 % latter is the |\newpage| at the end of |\np@notespage| (see \autoref{sec:build-np})
2334 % and the fact, that |\unitlength| would still be disabled at this point without
2335 % the group.
2336 % \begin{macrocode}
2337 \newcommand{\np@inner@notespage}{\parfillskip\z@ plus 1fil%
2338 \begingroup
2339 \csname np@ns@\np@notesstyle\endcsname
2340 \endgroup}
2341 % \end{macrocode}
2342 % \end{macro}
2343 %
2344 % ^^A---------------------------------------------
2345 % \subsection{User commands}
2346 % \subsubsection{Building a notes page}
2347 % \label{sec:build-np}
2348 % \begin{macro}{\np@notespage}
2349 % This macro builds a single notes page. If \opt{allowfloats} is \choice{false}
2350 % and \opt{startnotes} is \choice{newpage}, |\textfraction| is temporarily set to
2351 % 1 in order to prevent floats from being placed on the notes page.
2352 % \begin{macrocode}
2353 \newcommand*{\np@notespage}{%
2354 \ifKV@np@allowfloats\else
2355 \def\np@tempa{newpage}\ifx\np@tempa\np@startnotes
2356 \edef\np@orig@textfraction{\textfraction}%
2357 \gdef\textfraction{1}%
2358 \fi
2359 \fi
2360 \np@startnotespage
2361 \np@savemark
2362 \np@setmark
2363 % \end{macrocode}
2364 % Here the information about the notes pages needed for saving and restoring the
2365 % header marks is written to the |.aux| file. Note pages with |mark=keep|
2366 % are excluded here, because otherwise they would mix up the header marks if used
2367 % within a couple of notes pages with different values for \opt{mark}.
2368 % \begin{macrocode}
2369 \if\np@mark@keep\else
2370 \protected@write\@auxout{}%
2371 {\string\@writefile{npm}{\string\npnpinfo{\the\c@page}}}%
2372 \fi
2373 \np@setpagestyle
2374 \np@maketitle
2375 % \end{macrocode}
2376 % If there is no notes title, |\np@titleskip| is not used. Without this, the notes
2377 % area wouldn't have the correct height.
2378 % \begin{macrocode}
2379 \def\np@tempa{none}\ifx\np@tempa\np@titlestyle\else
2380 \vspace*{\np@titleskip}%
2381 \fi
2382 \noindent\np@calcheight
2383 \ifKV@np@titlenotesfill\vfill\noindent\fi
2384 \np@inner@notespage
2385 \np@restoremark
2386 % \end{macrocode}
2387 % At the end, |\textfraction| is restored and a new page is started. The latter
2388 % is necessary to prevent occasional problems with page breaks.
2389 % \begin{macrocode}
2390 \ifKV@np@allowfloats\else
2391 \def\np@tempa{newpage}\ifx\np@tempa\np@startnotes
2392 \xdef\textfraction{\np@orig@textfraction}%
2393 \fi
2394 \fi
2395 \newpage}
2396 % \end{macrocode}
2397 % \end{macro}
2398 %
2399 % ^^A-------------------------
2400 % \subsubsection{Single notes page}
2401 % \begin{macro}{\notespage}
2402 % In |\notespage| everything is done within a group, in order to keep settings done
2403 % with the keys in the optional argument local to the macro. Before the keys are
2404 % set, the boolean |\ifnp@marktext@set| is set to false, so the option \opt{titletext}
2405 % will also set \opt{marktext}.
2406 % \begin{macrocode}
2407 \newcommand*{\notespage}[1][]{%
2408 \begingroup
2409 \np@marktext@setfalse\setkeys{np}{#1}%
2410 \np@notespage
2411 \endgroup}
2412 % \end{macrocode}
2413 % \end{macro}
2414 %
2415 % ^^A-------------------------
2416 % \subsubsection{Multiple notes pages}
2417 % \begin{macro}{\notespages}
2418 % Also, in |\notespages| everything is done in a group to keep it local. After
2419 % setting the keys, the number of pages needed is calculated as follows ($p$:
2420 % page, $d$: \opt{multiple}, $m$: \opt{minpages}, $e$: \opt{endpages}, $n$: notes
2421 % pages).
2422 % \begin{macrocode}
2423 \newcommand*{\notespages}[1][]{%
2424 \begingroup
2425 \np@marktext@setfalse\setkeys{np}{#1}%
2426 % \end{macrocode}
2427 % If started on a new page, set the boolean |\ifnp@started@on@new@page| to true,
2428 % else to false.
2429 % \begin{macrocode}
2430 %% \typeout{notespages debug:\space\the\pagetotal\space\the\pagegoal}%
2431 \ifdim\pagetotal=\z@
2432 \np@started@on@new@pagetrue\else\np@started@on@new@pagefalse\fi
2433 % \end{macrocode}
2434 % \changes{0.8.1}{2016/08/21}{bug fixed for calculating the number of notes pages}%
2435 % If\since[added]{0.8.1} the |\pagetotal| is already greater or equal than |\pagegoal|,
2436 % the notes page will be shifted to a new page, but the calculation would be done
2437 % based on the current page number. For this, |\ifnp@started@on@full@page| is set.
2438 % \begin{macrocode}
2439 \ifdim\pagetotal<\pagegoal
2440 \np@started@on@full@pagefalse\else\np@started@on@full@pagetrue\fi
2441 % \end{macrocode}
2442 % $n = p$, if(started on new page) $n = n - 1$
2443 % \begin{macrocode}
2444 \np@notepages\c@page
2445 \ifnp@started@on@new@page\advance\np@notepages\m@ne\fi
2446 % \end{macrocode}
2447 % This\since[added]{0.8.1} correction is needed in case |\notespages| started on
2448 % an already full page.
2449 % \begin{macrocode}
2450 \ifnp@started@on@full@page\advance\np@notepages\@ne\fi
2451 % \end{macrocode}
2452 % This is basically $n = d - (n \bmod d)$, but with a correction, if started on
2453 % a new page or an already full page.\since[added]{0.8.1} This will lead to
2454 % $n = d$ in case $n \bmod d = 0$, which is corrected by not adding $d$ at the
2455 % end.
2456 % \begin{macrocode}
2457 \divide\np@notepages\np@multiple
2458 \multiply\np@notepages\np@multiple
2459 \advance\np@notepages-\c@page
2460 \ifnp@started@on@new@page\advance\np@notepages\@ne\fi
2461 \ifnp@started@on@full@page\advance\np@notepages\m@ne\fi
2462 \ifnum\np@notepages<\z@
2463 \advance\np@notepages\np@multiple\fi
2464 % \end{macrocode}
2465 % The next step is $n = n - (e \bmod d)$, because the amount of \opt{endpages}
2466 % fully dividable by $d$ is of no significance for calculating $n$.
2467 % \begin{macrocode}
2468 \np@tempcnta\np@endpages
2469 \np@tempcntb\np@endpages
2470 \divide\np@tempcnta\np@multiple
2471 \multiply\np@tempcnta\np@multiple
2472 \advance\np@tempcntb-\np@tempcnta
2473 \advance\np@notepages-\np@tempcntb
2474 % \end{macrocode}
2475 % And finally, $m$ is taken into account by $n = n + (m \div d) \cdot d$, if($n < m$)
2476 % $n = n + d$, leading to the value for $n$.
2477 % \begin{macrocode}
2478 \np@tempcnta\np@minpages
2479 \divide\np@tempcnta\np@multiple
2480 \multiply\np@tempcnta\np@multiple
2481 \advance\np@notepages\np@tempcnta
2482 \ifnum\np@notepages<\np@minpages
2483 \advance\np@notepages\np@multiple\relax\fi
2484 % \end{macrocode}
2485 % If there are notes pages to be given out, this is done in a loop.
2486 % \begin{macrocode}
2487 \ifnum\np@notepages>\z@\relax
2488 \loop\ifnum\np@notepages>\z@\relax
2489 \np@notespage\advance\np@notepages\m@ne\relax
2490 \repeat
2491 \fi
2492 \endgroup}
2493 % \end{macrocode}
2494 % \end{macro}
2495 %
2496 % ^^A-------------------------
2497 % \subsubsection{Notes fill}
2498 % \begin{macro}{\notesfill}
2499 % And again, things in |\notesfill| are done in a group to keep stuff local. Since
2500 % the option \opt{marktext} is ignored here, it is not necessary to set
2501 % |\np@marktext@setfalse|, before setting the keys.
2502 % \begin{macrocode}
2503 \newcommand*{\notesfill}[1][]{%
2504 \begingroup
2505 \setkeys{np}{#1}%
2506 % \end{macrocode}
2507 % Next, the remaining height is calculated and \opt{filltopskip} is subtracted,
2508 % so it's not taken into account. Only if the remaining height now is at least
2509 % \opt{fillminspace}, the notes fill is generated.
2510 % \begin{macrocode}
2511 \np@calcheight
2512 \advance\remainingtextheight-\np@fill@topskip
2513 \ifdim\remainingtextheight<\np@fill@minspace\else
2514 % \end{macrocode}
2515 % If the remaining height is greater than \opt{fillmaxspace}, the space to be left
2516 % empty is calculated and stored in |\np@tempdima|.
2517 % \begin{macrocode}
2518 \ifdim\remainingtextheight>\np@fill@maxspace
2519 \np@tempdima\remainingtextheight
2520 \advance\np@tempdima-\np@fill@maxspace
2521 \else
2522 \np@tempdima=\z@
2523 \fi
2524 % \end{macrocode}
2525 % Now the title is generated together with the spaces before and after it.
2526 % \begin{macrocode}
2527 \vspace*{\np@fill@topskip}
2528 \ifKV@np@filltopfill\vfill\fi
2529 \np@maketitle
2530 \def\np@tempa{none}\ifx\np@tempa\np@titlestyle\else
2531 \vspace*{\np@titleskip}%
2532 \fi
2533 % \end{macrocode}
2534 % And finally, the remaining height for the notes area is calculated and reduced
2535 % by the space to be left empty, before the notes area is generated.
2536 % \begin{macrocode}
2537 \noindent\np@calcheight
2538 \advance\remainingtextheight-\np@tempdima
2539 \ifKV@np@titlenotesfill\vfill\noindent\fi
2540 \np@inner@notespage\newpage
2541 \fi
2542 \endgroup}
2543 % \end{macrocode}
2544 % \end{macro}
2545 %
2546 % ^^A---------------------------------------------
2547 % \subsection{Advanced commands}
2548 % \subsubsection{Setting options}
2549 % \begin{macro}{\setnotespages}
2550 % This macro takes a key value list and sets them with |\setkeys|.
2551 % \begin{macrocode}
2552 \newcommand*{\setnotespages}[1]{%
2553 \np@marktext@setfalse\setkeys{np}{#1}}
2554 % \end{macrocode}
2555 % \end{macro}
2556 %
2557 % ^^A-------------------------
2558 % \subsubsection{New meta option}
2559 % \begin{macro}{\definenotesoption}
2560 % This macro defines a new key given as the first parameter, which will set the
2561 % keys to the values provided in the key value list given as the second parameter.
2562 % \begin{macrocode}
2563 \newcommand*{\definenotesoption}[2]{%
2564 \key@ifundefined{np}{#1}{\define@key{np}{#1}[]{\setkeys{np}{#2}}}%
2565 {\PackageError{notespages}%
2566 {Key #1 is already defined.\MessageBreak}%
2567 {The key #1 may have been defined by some package\MessageBreak
2568 or you tried to redefine this key.}}}
2569 % \end{macrocode}
2570 % \end{macro}
2571 %
2572 % ^^A-------------------------
2573 % \subsubsection{New notes style}
2574 % \label{sec:newnotesstyle}
2575 % \begin{macro}{\definenotesstyle}
2576 % This macro defines a new notes style. The name is given in |#1| and the commands
2577 % for the new style in |#2|. First, the list of choices in |\np@notesstyle@nominations|
2578 % (see \autoref{sec:optnotespage}) is extended and then the key \opt{notesstyle} is
2579 % redefined with |\np@def@notesstyle@key|. Finally the command for the notes style
2580 % itself is defined.
2581 % \begin{macrocode}
2582 \newcommand{\definenotesstyle}[2]{%
2583 \edef\np@notesstyle@nominations{\np@notesstyle@nominations,#1}%
2584 \expandafter\np@def@notesstyle@key\np@notesstyle@nominations\np@end
2585 \long\expandafter\def\csname np@ns@#1\endcsname{#2}}
2586 % \end{macrocode}
2587 % \end{macro}
2588 %
2589 % ^^A-------------------------
2590 % \subsubsection{New title style}
2591 % \label{sec:newtitlestyle}
2592 % \begin{macro}{\definetitlestyle}
2593 % This macros defines a new title style. It works similar to the command
2594 % |\definenotesstyle|.
2595 % \begin{macrocode}
2596 \newcommand{\definetitlestyle}[2]{%
2597 \edef\np@titlestyle@nominations{\np@titlestyle@nominations,#1}%
2598 \expandafter\np@def@titlestyle@key\np@titlestyle@nominations\np@end
2599 \long\expandafter\def\csname np@ts@#1\endcsname{#2}}
2600 % \end{macrocode}
2601 % \end{macro}
2602 %
2603 % ^^A-------------------------
2604 % \subsubsection{Patching \texttt{\bs chapter}}
2605 % \begin{macro}{\nppatchchapter}
2606 % This macros patches |\chapter| by adding |\notespages| in front off it. The
2607 % argument is used as the optional argument for the latter. Patching will only
2608 % be done, if |\chapter| exists.
2609 % \begin{macrocode}
2610 \let\np@orig@chapter\chapter
2611 \newcommand{\nppatchchapter}[1]{%
2612 \@ifundefined{chapter}{}{%
2613 \def\chapter{\notespages[#1]\np@orig@chapter}}}
2614 % \end{macrocode}
2615 % \end{macro}
2616 %
2617 % \begin{macro}{\npunpatchchapter}
2618 % \changes{0.8.1}{2016/08/21}{added command}%
2619 % This macros restores the original meaning of |\chapter|, which is only done,
2620 % if it exists.\since[added]{0.8.1}
2621 % \begin{macrocode}
2622 \newcommand{\npunpatchchapter}{%
2623 \@ifundefined{chapter}{}{\let\chapter\np@orig@chapter}}
2624 % \end{macrocode}
2625 % \end{macro}
2626 %
2627 % ^^A---------------------------------------------
2628 % \subsection{Support for other packages}
2629 % \subsubsection{Babel}
2630 % The method of supporting \pkg{babel} was taken from Heiko Oberdieks package
2631 % \pkg{hyperref}.
2632 %
2633 % \begin{macro}{\np@lang@german}
2634 % This macro defines |\npnotesname| and |\npnotestext| for variations of the German
2635 % language.
2636 % \begin{macrocode}
2637 \newcommand*{\np@lang@german}{\def\npnotesname{Notizen}%
2638 \def\npnotestext{Diese Seite wurde absichtlich leer gelassen.}}
2639 % \end{macrocode}
2640 % \end{macro}
2641 % \begin{macro}{\np@lang@english}
2642 % This macro defines |\npnotesname| and |\npnotestext| for variations of the English
2643 % language.
2644 % \begin{macrocode}
2645 \newcommand*{\np@lang@english}{\def\npnotesname{Notes}%
2646 \def\npnotestext{This page is intentionally left blank.}}
2647 % \end{macrocode}
2648 % \end{macro}
2649 % \begin{macro}{\np@lang@french}
2650 % This macro defines |\npnotesname| and |\npnotestext| for variations of the French
2651 % language.
2652 % \begin{macrocode}
2653 \newcommand*{\np@lang@french}{\def\npnotesname{Notes}%
2654 \def\npnotestext{Cette page est laiss\'{e}e intentionnellement vide.}}
2655 % \end{macrocode}
2656 % \end{macro}
2657 %
2658 % \begin{macro}{\np@declarelang}
2659 % This macro adds one of the macros defining |\npnotesname| and |\npnotestext| (|#2|)
2660 % to a language supported by \pkg{babel} (|#1|), if the language loaded.
2661 % \begin{macrocode}
2662 \newcommand*{\np@declarelang}[2]{%
2663 \@ifpackagewith{babel}{#1}{%
2664 \expandafter\addto
2665 \csname extras#1\expandafter\endcsname
2666 \csname np@lang@#2\endcsname}{}}
2667 % \end{macrocode}
2668 % \end{macro}
2669 %
2670 % \begin{macro}{\np@supportbabel}
2671 % This macro adds one of the macros defining |\npnotesname| and |\npnotestext| to all
2672 % languages supported by \NP\ so far.
2673 % \begin{macrocode}
2674 \newcommand*{\np@supportbabel}{%
2675 \@ifpackageloaded{babel}{%
2676 \np@declarelang{english}{english}%
2677 \np@declarelang{USenglish}{english}%
2678 \np@declarelang{american}{english}%
2679 \np@declarelang{UKenglish}{english}%
2680 \np@declarelang{british}{english}%
2681 \np@declarelang{canadian}{english}%
2682 \np@declarelang{australian}{english}%
2683 \np@declarelang{newzealand}{english}%
2684 \np@declarelang{austrian}{german}%
2685 \np@declarelang{german}{german}%
2686 \np@declarelang{germanb}{german}%
2687 \np@declarelang{ngerman}{german}%
2688 \np@declarelang{naustrian}{german}%
2689 \np@declarelang{french}{french}%
2690 \np@declarelang{francais}{french}%
2691 \np@declarelang{canadien}{french}%
2692 \np@declarelang{acadian}{french}}{}}
2693 % \end{macrocode}
2694 % \end{macro}
2695 %
2696 % The macro is used in the |\AtBeginDocument| hook, but it also has to be called
2697 % here, in case \pkg{babel} was loaded before \NP.
2698 % \begin{macrocode}
2699 \np@supportbabel
2700 % \end{macrocode}
2701 %
2702 % ^^A-------------------------
2703 % \subsubsection{(X)Color}
2704 % \begin{macro}{\np@setcolors}
2705 % This macro defines the colors used by \NP\ for the package \pkg{color}. It first
2706 % checks, if the colors are already defined, in order to make it possible for the
2707 % user to define the colors in the preamble.
2708 % \begin{macrocode}
2709 \newcommand*{\np@setcolors}{%
2710 \@ifundefined{\string\color @NotesHColor}%
2711 {\definecolor{NotesHColor}{gray}{0.7}}{}%
2712 \@ifundefined{\string\color @NotesVColor}%
2713 {\definecolor{NotesVColor}{gray}{0.7}}{}%
2714 \@ifundefined{\string\color @NotesTextColor}%
2715 {\definecolor{NotesTextColor}{gray}{0.7}}{}}
2716 % \end{macrocode}
2717 % \end{macro}
2718
2719 % \begin{macro}{\np@setxcolors}
2720 % This macro defines the colors used by \NP\ for the package \pkg{xcolor}. For this,
2721 % |\providecolor| is used, which defines a color only, if it is not defined yet.
2722 % \begin{macrocode}
2723 \newcommand*{\np@setxcolors}{%
2724 \providecolor{NotesHColor}{gray}{0.7}%
2725 \providecolor{NotesVColor}{gray}{0.7}%
2726 \providecolor{NotesTextColor}{gray}{0.7}}
2727 % \end{macrocode}
2728 % \end{macro}
2729
2730 % \begin{macro}{\np@supportcolor}
2731 % This macro checks, if one of the packages \pkg{color} or \pkg{xcolor} is loaded,
2732 % and calls either |\np@setcolors| or |\np@setxcolors| respectively. In case none
2733 % is loaded, the macro |\color| is set to |\@gobble|, so it can be used by
2734 % \NP\ without harm. |\np@supportcolor| is used in the |\AtBeginDocument| hook.
2735 % \begin{macrocode}
2736 \newcommand*{\np@supportcolor}{%
2737 \@ifpackageloaded{xcolor}{\np@setxcolors}{%
2738 \@ifpackageloaded{color}{\np@setcolors}{\let\color\@gobble}}}
2739 % \end{macrocode}
2740 % \end{macro}
2741 %
2742 % ^^A-------------------------
2743 % \subsubsection{Initialisation}
2744 % Finally, the file |\jobname.npm| is loaded and the macros |\np@supportbabel| and
2745 % |\np@supportcolor| are called in the |\AtBeginDocument| hook, so the order of
2746 % loading packages is without consequences.
2747 % \begin{macrocode}
2748 \AtBeginDocument{\InputIfFileExists{\jobname.npm}{}{}%
2749 \np@supportbabel\np@supportcolor}
2750 % \end{macrocode}
2751 %
2752 % \newpage
2753 % \Finale\endinput
2754 %</package>
2755 % ^^A--------------------------------------------------------------------------
2756 % ^^A Now the source of the example
2757 %<*example>
2758 %% this document is intended to be compiled with the class scrbook, other classes
2759 %% will not produce a logically correct result (some notes fills are missing,
2760 %% pages are different, a lot of overful hboxes, and so on), they where just
2761 %% used for testing
2762 %%\documentclass[11pt,a4paper]{article}
2763 %%\documentclass[11pt,a4paper]{report}
2764 %%\documentclass[11pt,a4paper]{book}
2765 \documentclass[11pt,a4paper]{scrbook}
2766 %%\documentclass[11pt,a4paper]{scrartcl}
2767 %%\documentclass[11pt,a4paper]{scrreprt}
2768 %%\documentclass[11pt,a4paper,article]{memoir}
2769 %%\documentclass[11pt,a4paper]{memoir}
2770 \usepackage{lmodern}
2771 \usepackage[T1]{fontenc}
2772 \usepackage[utf8]{inputenc}
2773 \usepackage{microtype}
2774 \usepackage[italian,ngerman,french,english]{babel}
2775 \usepackage[colorlinks,linkcolor=blue]{hyperref}
2776 \usepackage{lipsum}
2777 \usepackage[svgnames]{xcolor}
2778 \usepackage{tikz}
2779 \usepackage{afterpage}
2780 \usepackage{eso-pic}
2781 \usepackage{notespages}
2782
2783 %% CAUTION: do not use this with the class memoir
2784 %% it will not work, because memoir has its
2785 %% own methods to set the header and footer
2786 %% this is meant to be used with KOMA-Script classes
2787 \usepackage{scrpage2}
2788 \lehead[]{\leftmark}
2789 \cehead[]{}
2790 \rehead[]{\rightmark}
2791 \lohead[]{\leftmark}
2792 \cohead[]{}
2793 \rohead[]{\rightmark}
2794 \lefoot[\pagemark]{\pagemark}
2795 \cefoot[]{}
2796 \refoot[]{\textsf{NotesPages}}
2797 \lofoot[]{\textsf{NotesPages}}
2798 \cofoot[]{}
2799 \rofoot[\pagemark]{\pagemark}
2800 \pagestyle{scrheadings}
2801 %% this is meant to be used with all other classes
2802 %%\pagestyle{headings}
2803
2804 %% only use this for classes book, scrbook and memoir without option article
2805 \nppatchchapter{default,vacant,multiple=2,
2806 notestext={An empty page before a new chapter.}}
2807
2808 %% this has to be used with classes article and scrartcl
2809 %%\let\secleveli{\section}
2810 %%\let\seclevelii\subsection
2811 %% this has to be used with all other classes
2812 \def\secleveli{\chapter}
2813 \let\seclevelii\section
2814
2815 %%\tracingnpmarks1
2816
2817 \newcommand{\fillit}[1][]{\minisec{Fill it}\lipsum[#1]}
2818
2819 \begin{document}
2820 \thispagestyle{empty}
2821 \begin{center}
2822 \vspace*{\fill}
2823 \textsf{\Huge The \textbf{NotesPages} Package}\\[5ex]
2824 \textsf{\textbf{\Large Example File}}\\[5ex]
2825 Mike Kaufmann\\[2ex]
2826 \href{mailto:[email protected]}{\texttt{[email protected]}}\\[2ex]
2827 2016/08/21 (v0.8.1)\\[10ex]
2828 \textsf{\textbf{\LARGE Warning: do not print!}}\\[2ex]
2829 You would waste over a hundred pages!
2830 \vspace*{\fill}
2831 \vspace*{\fill}
2832 \end{center}
2833
2834 \tableofcontents
2835
2836 \secleveli{Layout variations}
2837 \seclevelii{Default settings}
2838 First let's start with the default settings. The next three and a half pages are
2839 filled with \verb|\notesfill|, \verb|\notespage|, and \verb|\notespages|. The
2840 latter will produce two pages, in order to fill up the document to a multiple
2841 of 4 pages.
2842
2843 Btw.: In the lower left corner of this page and the next three is a bit of text,
2844 put there with \textsf{eso-pic}, to check, if the bug from version 0.8 is gone.
2845 It's in yellow, so barely visible.
2846
2847 The commands are:
2848
2849 \begin{verbatim}
2850 \notesfill
2851 \notespage
2852 \notespages
2853 \end{verbatim}
2854
2855 %% testing eso-pic
2856 \AddToShipoutPictureBG{\AtPageLowerLeft{\makebox(0,0)[bl]{\textcolor{yellow}{eos-pic test}}}}
2857
2858 \notesfill
2859 \notespage
2860 \notespages
2861
2862 %% testing eso-pic
2863 \ClearShipoutPictureBG
2864
2865 \seclevelii{The options \textsf{startnotes} and \textsf{allowfloats}}
2866 To show the effect of these options, some text and a float, which doesn't fit on
2867 this page, is needed. For the float the positioning \verb|[htb]| was used. After
2868 the float \verb|\notespage| was used once.
2869
2870 Test for referencing: \autoref{fig:rect} on \autopageref{fig:rect}.
2871
2872 \fillit[1-3]
2873
2874 \begin{figure}[htb]
2875 \centering
2876 \textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
2877 \caption{Just a rectangle}\label{fig:rect}
2878 \end{figure}
2879
2880 \notespage
2881
2882 Now let's do this again, but this time using \verb|\notespage[startnotes=newpage]|.
2883
2884 Test for referencing: \autoref{fig:rect2} on \autopageref{fig:rect2}.
2885
2886 \fillit[1-3]
2887
2888 \begin{figure}[htb]
2889 \centering
2890 \textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
2891 \caption{Another rectangle}\label{fig:rect2}
2892 \end{figure}
2893
2894 \notespage[startnotes=newpage]
2895
2896 Ok, now lets add the option \textsf{allowfloats} and see what happens. This time
2897 \verb|\notespages| \verb|[startnotes=newpage,allowfloats]| is used, filling the document
2898 up to page 16. Note: the header is already changed on the next page.
2899
2900 Test for referencing: \autoref{fig:rect3} on \autopageref{fig:rect3}.
2901
2902 \begin{figure}[htb]
2903 \centering
2904 \textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
2905 \caption{A third rectangle}\label{fig:rect3}
2906 \end{figure}
2907
2908 \notespages[startnotes=newpage,allowfloats]
2909
2910 \seclevelii{The option \textsf{pagestyle}}
2911 The next 3 pages show notes pages with different page styles. The commands are:
2912
2913 \begin{verbatim}
2914 \notespage[pagestyle=empty]
2915 \notespage[pagestyle=plain]
2916 \notespage[pagestyle=useheadings]
2917 \end{verbatim}
2918
2919 Btw.: The pagestyle for this document was defined deliberately this way to see
2920 both header marks as often as possible. For this, the package \textsf{scrpage2}
2921 from \textsf{KOMA-Script} was used.
2922
2923 \notespage[pagestyle=empty]
2924 \notespage[pagestyle=plain]
2925 \notespage[pagestyle=useheadings]
2926
2927 \seclevelii{The option \textsf{notesstyle}}
2928 Up until now, the default \textsf{notesstyle} (\textsf{\textit{grid}}) was used.
2929 The next example shows the other four. The commands are:
2930
2931 \begin{verbatim}
2932 \notespage[notesstyle=plain]
2933 \notespage[vparts=35,notesstyle=lines]
2934 \notespage[notesstyle=vlines]
2935 \notespage[notesstyle=text]
2936 \notespage[vacant]
2937 \end{verbatim}
2938
2939 For the second page \texttt{vparts=35} was used, because the default is 0 and
2940 therefore the notes area would be empty. The fourth page doesn't realy make sense,
2941 because the notes style \textsf{text} was meant to be used for otherwise empty
2942 pages. For this the meta option \textsf{vacant} was introduced. Its effect can be
2943 seen on the fifth page.
2944
2945 \notespage[notesstyle=plain]
2946 \notespage[vparts=35,notesstyle=lines]
2947 \notespage[notesstyle=vlines]
2948 \notespage[notesstyle=text]
2949 \notespage[vacant]
2950
2951 \seclevelii{The options \textsf{hparts}, \textsf{vparts}, and \textsf{usenotesareaheight}}
2952 Now let's play around a little with the options \textsf{hparts} and \textsf{vparts}.
2953 As mentioned in the manual, a value of 1 will always draw two lines. Let's take a
2954 look. The commands are:
2955
2956 \begin{verbatim}
2957 \notesfill[vparts=1,notesstyle=lines]
2958 \notespage[hparts=1,notesstyle=vlines]
2959 \notespage[hparts=1,vparts=1]
2960 \end{verbatim}
2961
2962 \notesfill[vparts=1,notesstyle=lines]
2963 \notespage[hparts=1,notesstyle=vlines]
2964 \notespage[hparts=1,vparts=1]
2965
2966 With the same values for both, one gets rectangles with the same aspect ratio
2967 as the text body. The command:
2968
2969 \begin{verbatim}
2970 \notesfill[hparts=30,vparts=30]
2971 \end{verbatim}
2972
2973 \notesfill[hparts=30,vparts=30]
2974
2975 With the option \textsf{usenotesareaheight} the height of a vertical part will
2976 be calculated based on the height of the notes area instead of \verb|\textheight|.
2977 Thus, there will be the exact number of parts given to \textsf{vparts}.
2978
2979 But first, lets see it without \textsf{usenotesareaheight}. The command:
2980
2981 \begin{verbatim}
2982 \notesfill[hparts=2,vparts=2]
2983 \end{verbatim}
2984
2985 \notesfill[hparts=2,vparts=2]
2986
2987 And now, the same command, but this time with the option \textsf{usenotesareaheight}.
2988 The command is:
2989
2990 \begin{verbatim}
2991 \notesfill[hparts=2,vparts=2,usenotesareaheight]
2992 \end{verbatim}
2993
2994 \notesfill[hparts=2,vparts=2,usenotesareaheight]
2995
2996 But with the same command the height of a vertical part can be different each
2997 time, as can be seen below.
2998
2999 \fillit[1-2]
3000
3001 \notesfill[hparts=2,vparts=2,usenotesareaheight]
3002
3003 \seclevelii{The option \textsf{titlestyle}}
3004 The following pages show the possible \textsf{titlestyle}s. Since the top most
3005 rectangles for the default appearance of the notes area will only be shown, if they
3006 fit completely into the notes area, the latter was change to be just a rectangle.
3007 Without this, the real distance between notes title and notes area couldn't be seen.
3008 The choice \textsf{minisec} wasn't used here, so this file can be compiled with
3009 classes, which don't support the command \verb|\minisec|. The commands are:
3010
3011 \begin{verbatim}
3012 \notesfill[hparts=1,vparts=1]
3013 \notespage[hparts=1,vparts=1,titlestyle=subsection]
3014 \notespage[hparts=1,vparts=1,titlestyle=subsubsection]
3015 \notespage[hparts=1,vparts=1,titlestyle=text]
3016 \notespage[hparts=1,vparts=1,titlestyle=none]
3017 \end{verbatim}
3018
3019 \notesfill[hparts=1,vparts=1]
3020 \notespage[hparts=1,vparts=1,titlestyle=subsection]
3021 \notespage[hparts=1,vparts=1,titlestyle=subsubsection]
3022 \notespage[hparts=1,vparts=1,titlestyle=text]
3023 \notespage[hparts=1,vparts=1,titlestyle=none]
3024
3025 \seclevelii{The option \textsf{titletext}}
3026 With the option \textsf{titletext} a new text for the notes title can be given.
3027 If the new text is not just a single word, it should be given in braces. And if
3028 it contains a comma or an equality sign it must be given in braces.
3029
3030 The new text is also used as the text for the header mark, if the option
3031 \textsf{marktext} is not used. The commands are:
3032
3033 \begin{verbatim}
3034 \notesfill[hparts=1,vparts=1,titletext={Please, make some notes here}]
3035 \notespage[hparts=1,vparts=1,titletext={Scribble page}]
3036 \end{verbatim}
3037
3038 \notesfill[hparts=1,vparts=1,titletext={Please, make some notes here}]
3039 \notespage[hparts=1,vparts=1,titletext={Scribble page}]
3040
3041 \seclevelii{The option \textsf{titleskip}}
3042 Especially if \texttt{titlestyle=text} is given, the option \textsf{titleskip}
3043 is useful. With it, some space can be put between the notes title and the notes
3044 area. This is shown here. Compare it to page 37. The command is:
3045
3046 \begin{verbatim}
3047 \notesfill[hparts=1,vparts=1,titlestyle=text,titleskip=2ex]
3048 \end{verbatim}
3049
3050 \notesfill[hparts=1,vparts=1,titlestyle=text,titleskip=2ex]
3051
3052 \seclevelii{The option \textsf{titlenotesfill}}
3053 The option \textsf{titlenotesfill} will move the notes area down to the end of
3054 the page. This can only be shown with the \textsf{notesstyle} \textsf{\textit{text}},
3055 for whitch it doesn't realy make sense. But if someone defines a custom notes style,
3056 which doesn't use the whole notes area, the option can be used to move it down.
3057 The command is:
3058
3059 \begin{verbatim}
3060 \notesfill[notesstyle=text,filltopfill=false,titlenotesfill]
3061 \end{verbatim}
3062
3063 \notesfill[notesstyle=text,filltopfill=false,titlenotesfill]
3064
3065 \seclevelii{The option \textsf{mark}}
3066 Up unitl now, \textsf{mark} was set to \textsf{both}. The next pages will show
3067 the other choices. The commands are:
3068
3069 \begin{verbatim}
3070 \notespage[mark=keep,titletext={Notes (keep)}]
3071 \notespage[mark=right,titletext={Notes (right)}]
3072 \notespage[mark=left,titletext={Notes (left)}]
3073 \notespage[mark=right,titletext={Notes (right)}]
3074 \notespage[titletext={Notes (both)}]
3075 \notespage[mark=left,titletext={Notes (left)}]
3076 \notespage[mark=right,titletext={Notes (right)}]
3077 \notespage[mark=left,titletext={Notes (left)}]
3078 \notespage[titletext={Notes (both)}]
3079 \notespage[mark=right,titletext={Notes (right)}]
3080 \notespage[mark=left,titletext={Notes (left)}]
3081 \end{verbatim}
3082
3083 The additional pages were put in to test, if switching between the choices of
3084 \textsf{mark} works.
3085
3086 \notespage[mark=keep,titletext={Notes (keep)}]
3087 \notespage[mark=right,titletext={Notes (right)}]
3088 \notespage[mark=left,titletext={Notes (left)}]
3089 \notespage[mark=right,titletext={Notes (right)}]
3090 \notespage[titletext={Notes (both)}]
3091 \notespage[mark=left,titletext={Notes (left)}]
3092 \notespage[mark=right,titletext={Notes (right)}]
3093 \notespage[mark=left,titletext={Notes (left)}]
3094 \notespage[titletext={Notes (both)}]
3095 \notespage[mark=right,titletext={Notes (right)}]
3096 \notespage[mark=left,titletext={Notes (left)}]
3097
3098 \seclevelii{The options \textsf{marktext} and \textsf{markuppercase}}
3099 The option \textsf{marktext} is used the set a text for the header mark. This is
3100 useful, if the title text is to long for the header. Again, if the text contains
3101 more then one word it should be given in braces, and if it contains a comma or an
3102 equality sign it must be given in braces.
3103
3104 Some classes set the header marks in uppercase letters. To do this for the header
3105 marks of a notes page, the option \textsf{markuppercase} exists. It is set
3106 automatically for the standard classes, the \textsf{KOMA-Script} classes and
3107 \textsf{memoir}. For other classes, the default is \textsf{\textit{false}}.
3108 The setting can be changed with this option, as shown in the next example.
3109
3110 The command is:
3111
3112 \begin{verbatim}
3113 \notespage[marktext=Scribbel,markuppercase,titlestyle=text,
3114 titletext={This is a very long text for a scribble page. And it
3115 doesn't just end after one sentence, so it is realy too long for
3116 the header.}]
3117 \end{verbatim}
3118
3119 \notespage[marktext=Scribbel,markuppercase,titlestyle=text,
3120 titletext={This is a very long text for a scribble page. And it
3121 doesn't just end after one sentence, so it is realy too long for
3122 the header.}]
3123
3124 \secleveli{Controlling the number of notes pages}
3125 \seclevelii{The options \textsf{multiple}, \textsf{minpages}, and \textsf{endpages}}
3126 The way to set these options is to think as follows: the number of pages must be
3127 a multiple of $d$, at least $m$ notes pages are needed, and at the end $e$ pages
3128 are needed for other purposes. Then just set \textsf{multiple} $=d$, \textsf{minpages}
3129 $=m$, and \textsf{endpages} $=e$.
3130
3131 As an example, lets assume the number of pages should be a multiple of 4, at least
3132 one notes page should appear and one page is needed after the notes pages. The
3133 options for this are \verb|multiple=4,minpages=1,endpages=1| (\textsf{multiple}
3134 could be omitted, because 4 is the default value).
3135
3136 Now this is page 57, therefore three pages are needed to fill the document to a
3137 multiple of 4. But there should be one page at the end for other stuff. So only
3138 two pages will be inserted to fulfill \verb|endpages=1|. Since there are already
3139 two notes pages, \verb|minpages=1| is fullfilled.
3140
3141 If this would have been page 55, there would be 4 notes pages. Page 56 would be a
3142 notes page to fulfill \verb|minpages=1|, which would also fulfill \verb|multiple=4|
3143 but violate \verb|endpages=1|. Because of that, three additional notes pages would
3144 be inserted, so all three conditions are met.
3145
3146 \notespages[multiple=4,minpages=1,endpages=1]
3147
3148 Here we are on page 60, the page for other purposes (like for example contact
3149 information on the back of a manual).
3150
3151 With \verb|minpages=0| nothing would change here. And with \verb|endpages=0|
3152 this page would be a notes page too.
3153
3154 Besides the maximum and minimum values for the options, there are no limits on
3155 the values and there are no dependencies between them. For example, \textsf{endpages}
3156 may be greater than \textsf{multiple}.
3157
3158 \seclevelii{Other examples}
3159 Since this is page 60 and it's a multiple of 4, a \verb|\notespages| here with
3160 the default setting (\verb|multiple=4,minpages=0,endpages=0|) will do nothing.
3161 Let's try it:
3162
3163 \notespages
3164
3165 Look into the source of this file, there is a \verb|\notespages| command between
3166 this paragraph and the former one.
3167
3168 Inserting an exact number $n$ of notes pages can be done with
3169 \verb|multiple=1,minpages=|$n$. Here any value for \textsf{endpages} would have
3170 no effect.
3171
3172 \secleveli{Controlling notes fills}
3173 \seclevelii{The option \textsf{fillminspace} and \textsf{fillmaxspace}}
3174 The length given to \textsf{fillminspace} is only used to decide, if a notes fill
3175 should appear on a page, while \textsf{fillmaxspace} only limits its height. They
3176 are indepentent from each other. so it's possible to set \textsf{fillminspace} to
3177 a value greater than \textsf{fillmaxspace}. For example,
3178
3179 \begin{verbatim}
3180 \notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
3181 \end{verbatim}
3182
3183 \noindent
3184 will insert a notes fill on this page, but not on the next one. But
3185
3186 \begin{verbatim}
3187 \notesfill[fillmaxspace=0.4\textheight,fillminspace=0.2\textheight]
3188 \end{verbatim}
3189
3190 \noindent
3191 will insert a notes fill on the page after that, allthough it has the same amount
3192 of text.
3193
3194 \notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
3195
3196 \fillit[1-3]
3197
3198 \notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
3199
3200 \newpage
3201 \fillit[1-3]
3202
3203 \notesfill[fillmaxspace=0.4\textheight,fillminspace=0.2\textheight]
3204
3205 \seclevelii{The options \textsf{filltopskip}}
3206 The option \textsf{filltopskip} is used to get a minimum distance between the text
3207 and the notes fill. In order to show its effect the \textsf{titlestyle} is changed
3208 \textsf{\textit{text}}. The commands are
3209
3210 \begin{verbatim}
3211 \notesfill[titlestyle=text]
3212 \notesfill[titlestyle=text,filltopskip=2ex]
3213 \end{verbatim}
3214
3215 Just compare this page to the next one.
3216
3217 \fillit[3]
3218
3219 \notesfill[titlestyle=text]
3220
3221 The different space between the notes title and the nots area here is due to
3222 the fact, that only full vertical parts are drawn.
3223
3224 \fillit[3]
3225
3226 \notesfill[titlestyle=text,filltopskip=2ex]
3227
3228 \seclevelii{The option \textsf{filltopfill}}
3229 As can be seen on page 61, the notes fill is moved to the bottom of the page.
3230 This is due to the fact, that by default \textsf{filltopfill} is set to
3231 \textsf{\textit{true}}. With the command
3232
3233 \begin{verbatim}
3234 \notesfill[fillmaxspace=0.4\textheight,filltopfill=false]
3235 \end{verbatim}
3236
3237 \noindent
3238 the notes fill is not moved down, as can be seen here.
3239
3240 \notesfill[fillmaxspace=0.4\textheight,filltopfill=false]
3241
3242 \seclevelii{The restriction regarding \textsf{notesfill}}
3243 As mentioned in the manual, footnotes and bottom floats will appear below the
3244 notes fill, as shown here.\footnote{Unfortunately, this is not easy to fix.}
3245 But at least, it has the right height.
3246
3247 \begin{figure}[b]
3248 \centering
3249 \textcolor{lightgray}{\rule{0.8\textwidth}{0.2\textheight}}
3250 \caption{Again, a rectangle}\label{fig:rect4}
3251 \end{figure}
3252
3253 \notesfill
3254
3255 \secleveli{Advanced commands}
3256 \seclevelii{The command \texttt{\textbackslash setnotespages}}
3257 This command is used to change the settings globally. It takes a key value list,
3258 where all options can be used. It is possible to use the command everywhere in the
3259 document, changing the settings from the point of its appearance on. For example,
3260 instead of writing
3261
3262 \begin{verbatim}
3263 \notesfill[hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
3264 titletext=\textsf{\textbf{Scribble}},titleskip=1ex]
3265 \notespage[hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
3266 titletext=\textsf{\textbf{Scribble}},titleskip=1ex]
3267 \end{verbatim}
3268
3269 \noindent
3270 it is easier to write
3271
3272 \begin{verbatim}
3273 \setnotespages{hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
3274 titletext=\textsf{\textbf{Scribble}},titleskip=1ex}
3275 \notesfill
3276 \notespage
3277 \setnotespages{default}
3278 \end{verbatim}
3279
3280 \noindent
3281 Note, that on the next page the formatting for the \textsf{titletext} is used
3282 for the header too. This can be circumvented by a) also setting \textsf{marktext}
3283 or b) defining your own title style (see \autoref{sec:deftitlestyle}).
3284
3285 At the end, the package defaults are restored, so following examles start from
3286 there.
3287
3288 \setnotespages{hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
3289 titletext=\textsf{\textbf{Scribble}},titleskip=1ex}
3290 \notesfill
3291 \notespage
3292 \setnotespages{default}
3293
3294 \seclevelii{The command \texttt{\textbackslash definenotesoption}}
3295 This command is used to define a new meta option. It is similar to \verb|\setnotespages|,
3296 but instead of changing the settings, the settings are assigned to a name, which
3297 can then be used as an option for the commands of this package. With this, the
3298 last example can be realised with
3299
3300 \begin{verbatim}
3301 \definenotesoption{scribblepage}{default,hparts=1,vparts=1,
3302 titlestyle=text,filltopskip=2ex,titletext=\textsf{\textbf{Scribble}},
3303 titleskip=1ex,marktext=Scribble}
3304 \notesfill[scribblepage]
3305 \notespage[scribblepage]
3306 \end{verbatim}
3307
3308 \noindent
3309 Here the option \textsf{default} was used, in order to always keep the same
3310 appearance, even if the settings were changed with \verb|\setnotespages|. And
3311 the problem with the header marks in the previous example was solved using
3312 \textsf{marktext}.
3313
3314 After its definition, the new option \textsf{scribblepage} can also be used in
3315 \verb|\setnotespages| or another \verb|\definenotesoption|.
3316
3317 \definenotesoption{scribblepage}{default,hparts=1,vparts=1,
3318 titlestyle=text,filltopskip=2ex,titletext=\textsf{\textbf{Scribble}},
3319 titleskip=1ex,marktext=Scribble}
3320 \notesfill[scribblepage]
3321 \notespage[scribblepage]
3322
3323 \seclevelii{The command \texttt{\textbackslash definetitlestyle}}
3324 \label{sec:deftitlestyle}
3325 With this command a new title style can be defined. The first argument is the
3326 name for the new style, which can be used as a new choice for the option
3327 \textsf{titlestyle} after the definition. The second argument contains the macros
3328 to format the title.
3329
3330 In order to get the text set with the option \textsf{titletext} the command
3331 \verb|\notestitletext| must be used where the title should appear. But of course,
3332 it is possible to put in some text. If the indentation by \verb|\parindent| is
3333 unwanted, the definition should start with \verb|\noindent|. And finally, there
3334 has to be a \verb|\par| at the end. That said, if a predefined command is used,
3335 which somehow uses \verb|\noindent| and \verb|\par|, they are no longer necessary.
3336 For example, the title styles \textsf{\textit{section}} and \textsf{\textit{text}}
3337 could have been defined with
3338 \begin{verbatim}
3339 \definetitlestyle{section}{\section*{\notestitletext}}
3340 \definetitlestyle{text}{\noindent\notestitletext\par}
3341 \end{verbatim}
3342 Btw.: existing title styles should not be redifined, as this may cause problems.
3343
3344 Now lets define a new title style. Here is the example from the manual:
3345
3346 \begin{verbatim}
3347 \definetitlestyle{boldred}{\noindent\textcolor{red}%
3348 {\textbf{\notestitletext}}\par}
3349 \notesfill[scribblepage,titletext={Bold Red Note},
3350 titlestyle=boldred,fillminspace=0.1\textheight]
3351 \end{verbatim}
3352
3353 Here the option \textsf{scribblepage} from the last example was used. And then
3354 \textsf{titletext} and \textsf{titlestyle} were added, overwriting some of the
3355 settings done with \textsf{scribblepage}. This shows the importance of the order
3356 of options. Putting \textsf{scribblepage} at the end would have overwritten the
3357 other options.
3358
3359 Now, it is possible to put some text directly into the definition. But keep in
3360 mind, this text will not appear in the headers. Here an example:
3361
3362 \begin{verbatim}
3363 \definetitlestyle{prefix}{\noindent Note on:
3364 \textcolor{blue}{\notestitletext}\par}
3365 \notespage[hparts=1,vparts=1,titleskip=1ex,titletext={Title Styles},
3366 titlestyle=prefix]
3367 \end{verbatim}
3368
3369 \definetitlestyle{boldred}{\noindent\textcolor{red}%
3370 {\textbf{\notestitletext}}\par}
3371 \notesfill[scribblepage,titletext={Bold Red Note},
3372 titlestyle=boldred,fillminspace=0.1\textheight]
3373
3374 \definetitlestyle{prefix}{\noindent Note on:
3375 \textcolor{blue}{\notestitletext}\par}
3376 \notespage[hparts=1,vparts=1,titleskip=1ex,titletext={Title Styles},
3377 titlestyle=prefix]
3378
3379 \seclevelii{The command \texttt{\textbackslash definenotestyle}}
3380 \label{sec:defnotesstyle}
3381 The notes style provided with \textsf{NotesPages} are just basic ones. With this
3382 command it is possible to define your own styles, which can be quite fancy. But
3383 lets start with the simple example from the manual:
3384
3385 \begin{verbatim}
3386 \definenotesstyle{yellow}{\color{LightYellow}%
3387 \rule{\textwidth}{\remainingtextheight}}
3388 \notesfill[notesstyle=yellow]
3389 \end{verbatim}
3390
3391 Again, the first argument is the name of the new style, which can then be used as
3392 a new choice for the option \textsf{notesstyle}. And the second argument contains
3393 the macros to create the notes area. Here \verb|\remainingtextheight| has to be
3394 used to get the height of the notes area.
3395
3396 \definenotesstyle{yellow}{\color{LightYellow}%
3397 \rule{\textwidth}{\remainingtextheight}}
3398 \notesfill[notesstyle=yellow]
3399
3400 For the next example lets create a double frame around the notes area, using the
3401 \LaTeX\ \textsf{picture} environment:
3402
3403 \begin{verbatim}
3404 \newdimen\innerwidth
3405 \newdimen\innerheight
3406 \definenotesstyle{dframe}{%
3407 \innerwidth\textwidth\advance\innerwidth-10mm\relax
3408 \innerheight\remainingtextheight\advance\innerheight-10mm\relax
3409 \let\unitlength\relax
3410 \begin{picture}(\textwidth,\remainingtextheight)(0pt,0pt)
3411 \color{lightgray}
3412 \put(0pt,0pt){\framebox(\textwidth,\remainingtextheight){}}
3413 \put(5mm,5mm){\framebox(\innerwidth,\innerheight){}}
3414 \end{picture}}
3415 \notesfill[notesstyle=dframe]
3416 \end{verbatim}
3417
3418 Here first two dimens are needed to calculate the height and width of the inner
3419 frame. These length are calculated first. Then a trick is used to make the
3420 \textsf{picture} environment work with lengths: \verb|\unitlength| is set to
3421 \verb|\relax|, thus disabling it. Caution: this requires to give the optional
3422 argument for an offset as \verb|(0pt,0pt)|, otherwise an error will occur.
3423 Additionally, a color for the frames is set. Since the new notes style is used
3424 within a group, disabling \verb|\unitlength| and setting a color without resetting
3425 them has no repercussions outside the \verb|\notesfill|.
3426
3427 \newdimen\innerwidth
3428 \newdimen\innerheight
3429 \definenotesstyle{dframe}{%
3430 \innerwidth\textwidth\advance\innerwidth-10mm\relax
3431 \innerheight\remainingtextheight\advance\innerheight-10mm\relax
3432 \let\unitlength\relax
3433 \begin{picture}(\textwidth,\remainingtextheight)(0pt,0pt)
3434 \color{lightgray}
3435 \put(0pt,0pt){\framebox(\textwidth,\remainingtextheight){}}
3436 \put(5mm,5mm){\framebox(\innerwidth,\innerheight){}}
3437 \end{picture}}
3438 \notesfill[notesstyle=dframe]
3439
3440 It is also possible to use \textsf{TikZ} to define notes styles. Here the bounding
3441 box is used to keep the size of the picture to the exact size of the notes area.
3442 For the text \verb|\notesareatext| is used, thus using the text passed to the option
3443 \textsf{notestext}.
3444
3445 \begin{verbatim}
3446 \definenotesstyle{slash}{%
3447 \begin{tikzpicture}[color=gray!25]
3448 \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
3449 \clip (0,0) rectangle (\textwidth,\remainingtextheight);
3450 \draw[line width=2cm]
3451 (0,0) to node[color=black,sloped]{\textsf{\notesareatext}}
3452 (\textwidth,\remainingtextheight);
3453 \end{tikzpicture}}
3454 \notesfill[notesstyle=slash]
3455 \end{verbatim}
3456
3457 \definenotesstyle{slash}{%
3458 \begin{tikzpicture}[color=gray!25]
3459 \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
3460 \clip (0,0) rectangle (\textwidth,\remainingtextheight);
3461 \draw[line width=2cm]
3462 (0,0) to node[color=black,sloped]{\textsf{\notesareatext}}
3463 (\textwidth,\remainingtextheight);
3464 \end{tikzpicture}}
3465 \notesfill[notesstyle=slash]
3466
3467 Here is another example using \textsf{TikZ}. It defines a mm graph paper, which
3468 always has a whole number of cm in both direction and is centered in the notes
3469 area.
3470
3471 \begin{verbatim}
3472 \newdimen\xoffset
3473 \newdimen\yoffset
3474 \definenotesstyle{mmgp}{%
3475 \begin{tikzpicture}[color=gray!25]
3476 \pgfmathsetlength{\xoffset}{
3477 (\textwidth-(floor(\textwidth/1cm+0.01)*1cm))/2}
3478 \pgfmathsetlength{\yoffset}{
3479 (\remainingtextheight-(floor(\remainingtextheight/1cm+0.01)*1cm))/2}
3480 \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
3481 \draw[xshift=\xoffset,yshift=\yoffset,very thin]
3482 (0,0) grid [step=1mm]
3483 (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
3484 \draw[xshift=\xoffset,yshift=\yoffset,line width=0.5pt]
3485 (0,0) grid [step=5mm]
3486 (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
3487 \draw[xshift=\xoffset,yshift=\yoffset,thick]
3488 (0,0) grid [step=1cm]
3489 (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
3490 \end{tikzpicture}}
3491 \notesfill[notesstyle=mmgp]
3492 \end{verbatim}
3493
3494 \newdimen\xoffset
3495 \newdimen\yoffset
3496 \definenotesstyle{mmgp}{%
3497 \begin{tikzpicture}[color=gray!25]
3498 \pgfmathsetlength{\xoffset}{
3499 (\textwidth-(floor(\textwidth/1cm+0.01)*1cm))/2}
3500 \pgfmathsetlength{\yoffset}{
3501 (\remainingtextheight-(floor(\remainingtextheight/1cm+0.01)*1cm))/2}
3502 \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
3503 \draw[xshift=\xoffset,yshift=\yoffset,very thin]
3504 (0,0) grid [step=1mm]
3505 (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
3506 \draw[xshift=\xoffset,yshift=\yoffset,line width=0.5pt]
3507 (0,0) grid [step=5mm]
3508 (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
3509 \draw[xshift=\xoffset,yshift=\yoffset,thick]
3510 (0,0) grid [step=1cm]
3511 (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
3512 \end{tikzpicture}}
3513 \notesfill[notesstyle=mmgp]
3514
3515 The next example is just for showing the effect of the option \textsf{titlenotesfill}.
3516 It is not realy useful (unless you want to torture your readers for scribbling in
3517 your painfully worded masterpiece by making them write in circles). Here the
3518 bounding box is set to a square.
3519
3520 Caution: since the height is fixed, this notes style is not realy suitable for a
3521 notes fill. If it doesn't fit on the page, it will be moved to the next.
3522
3523 \begin{verbatim}
3524 \definenotesstyle{spiral}{%
3525 \begin{tikzpicture}[color=gray!25]
3526 \useasboundingbox (-0.5\textwidth,-0.5\textwidth) rectangle
3527 (0.5\textwidth,0.5\textwidth);
3528 \draw[domain=0:22*3.14159,smooth,variable=\t,samples=1000] plot
3529 ({-0.1*\t*sin(\t r)},{0.1*\t*cos(\t r)});
3530 \end{tikzpicture}}
3531 \notespage[notesstyle=spiral,titletext={Write in Circles}]
3532 \notespage[notesstyle=spiral,titletext={Write in Circles},
3533 titlenotesfill]
3534 \end{verbatim}
3535
3536 \definenotesstyle{spiral}{%
3537 \begin{tikzpicture}[color=gray!25]
3538 \useasboundingbox (-0.5\textwidth,-0.5\textwidth) rectangle
3539 (0.5\textwidth,0.5\textwidth);
3540 \draw[domain=0:22*3.14159,smooth,variable=\t,samples=1000] plot
3541 ({-0.1*\t*sin(\t r)},{0.1*\t*cos(\t r)});
3542 \end{tikzpicture}}
3543 \notespage[notesstyle=spiral,titletext={Write in Circles}]
3544 \notespage[notesstyle=spiral,titletext={Write in Circles},
3545 titlenotesfill]
3546
3547 \seclevelii{The command \texttt{\textbackslash nppatchchapter}}
3548 Page 68 (among others) would be empty here, if a book class is used. This is,
3549 because a new chapter normally starts on a right hand page and so a left hand page
3550 may be left empty. To put a notes page there, one could manually add a line like
3551 \begin{verbatim}
3552 \notespages[vacant,multiple=2,
3553 notestext={An empty page before a new chapter.}]
3554 \end{verbatim}
3555 before every new chapter. But with \verb|\nppatchchapter| this can be automated.
3556 It changes \verb|\chapter| so it behaves like
3557 \begin{verbatim}
3558 \notespages[...]
3559 \chapter
3560 \end{verbatim}
3561 The optional argument for \verb|\notespages| is the argument passed to
3562 \verb|\nppatchchapter|. And the new \verb|\chapter| can just be used like the
3563 original one.
3564
3565 In the preamble of this document the lines
3566 \begin{verbatim}
3567 \nppatchchapter{default,vacant,multiple=2,
3568 notestext={An empty page before a new chapter.}}
3569 \end{verbatim}
3570 were added to make the empty pages before a new chapter into a notes pages. The
3571 option \textsf{default} asures, that no changes of the settings (this includes
3572 packages options and settings done with \verb|\setnotespages|) will change their
3573 apperance. And with \verb|multiple=2| there will be no more then one notes
3574 page before a new chapter instead of up to three with the default value of 4.
3575
3576 The command \verb|\nppatchchapter| can be used multiple times in a document,
3577 enabling the user to change the apperance of a notes page before a new chapter.
3578 The command is:
3579
3580 \begin{verbatim}
3581 \nppatchchapter{default,vacant,multiple=2,
3582 notestext={Another notes page\\
3583 automatically inserted\\
3584 before a new chapter.}}
3585 \end{verbatim}
3586
3587 \nppatchchapter{default,vacant,multiple=2,
3588 notestext={Another notes page\\
3589 automatically inserted\\
3590 before a new chapter.}}
3591
3592 \fillit[1-3]
3593
3594 \secleveli{Colors and Languages}
3595 \seclevelii{Colors}
3596 The \textsf{NotesPages} package uses three colors.
3597 \begin{itemize}
3598 \item \textsf{NotesHColor} for horizontal lines in the notes styles
3599 \textsf{\textit{lines}} and \textsf{\textit{grid}},
3600 \item \textsf{NotesVColor} for vertical lines in the notes styles
3601 \textsf{\textit{vlines}} and \textsf{\textit{grid}}, and
3602 \item \textsf{NotesTextColor} for the text in the notes style
3603 \textsf{\textit{text}}.
3604 \end{itemize}
3605 Colors can be redefined, so it's possible to change them at any time. To make the
3606 changes local, they are put in a group here.
3607
3608 \begin{verbatim}
3609 {\definecolor{NotesHColor}{rgb}{0,0,1}
3610 \definecolor{NotesVColor}{rgb}{0,1,0}
3611 \definecolor{NotesTextColor}{rgb}{1,0,0}
3612 \notesfill
3613 \notespage[notestyle=text]}
3614 \end{verbatim}
3615
3616 {\definecolor{NotesHColor}{rgb}{0,0,1}
3617 \definecolor{NotesVColor}{rgb}{0,1,0}
3618 \definecolor{NotesTextColor}{rgb}{1,0,0}
3619 \notesfill
3620 \notespage[notesstyle=text]}
3621
3622 \seclevelii{Languages}
3623 So far, only English, French, and German are supported. Up unitl now English was
3624 used in this document. Here are examples for the other ones.
3625
3626 \begin{verbatim}
3627 \selectlanguage{french}
3628 \notespage[notesstyle=text]
3629 \selectlanguage{ngerman}
3630 \notespage[notesstyle=text]
3631 \selectlanguage{english}
3632 \end{verbatim}
3633
3634 New languages will be supported, as users provide the translations. But naturally,
3635 this will take some time. So if your language is not supported yet and you can't
3636 wait, you can add the following to the preamble of your document (of course with
3637 the correct translations):
3638
3639 \begin{verbatim}
3640 \setnotespages{titletext={No Clue},
3641 notestext={No clue what this is in your language.}}
3642 \end{verbatim}
3643
3644 This is sufficient for documents in one language. But caution, using the option
3645 \textsf{default} will reset these texts. That can be solved by redefining
3646 \verb|\npnotesname| and \verb|\npnotestext| instead. For multilingual documents
3647 you can add for example
3648 \begin{verbatim}
3649 \addto{\extrasitalian}{\def\npnotesname{No Clue}%
3650 \def\npnotestext{No clue what this is in Italian.}}
3651 \end{verbatim}
3652 to the preamble (again, for your language and with the correct translations).
3653 After that you can use
3654 \begin{verbatim}
3655 \selectlanguage{italian}
3656 \notespage[notesstyle=text]
3657 \end{verbatim}
3658 to get a notes page in the new language.
3659
3660 \selectlanguage{french}
3661 \notespage[notesstyle=text]
3662 \selectlanguage{ngerman}
3663 \notespage[notesstyle=text]
3664 \addto{\extrasitalian}{\def\npnotesname{No Clue}%
3665 \def\npnotestext{No clue what this is in Italian.}}
3666 \selectlanguage{italian}
3667 \notespage[notesstyle=text]
3668 \selectlanguage{english}
3669
3670 \secleveli{Other Stuff}
3671 \seclevelii{The Package \textsf{afterpage}}
3672 \textsf{NotesPages} can be used with the package \textsf{afterpage}. This makes
3673 it possible to put a notes page on the next page without leaving the page it was
3674 invoked half empty. So here the line
3675 \begin{verbatim}
3676 \afterpage{\notespage[titletext={Notes on \textsl{afterpage}},
3677 marktext=Notes]}
3678 \end{verbatim}
3679 is inserted to get a notes page on the next page, without wasting the remaining
3680 space on this one (look into the source, here it comes):
3681
3682 \afterpage{\notespage[titletext={Notes on \textsl{afterpage}},
3683 marktext=Notes]}
3684
3685 Ok, lets fill this page, so the effect of the example can be seen. You could also
3686 start a new section here.
3687
3688 \fillit[1-4]
3689
3690 \seclevelii{The command \texttt{\textbackslash npunpatchchapter}}
3691 With \verb|\npunpatchchapter| the original meaning of \verb|\chapter| can be
3692 restored. After that, there may be the usual empty before a new chapter, as can
3693 be seen on the next page. The command:
3694
3695 \begin{verbatim}
3696 \npunpatchchapter
3697 \end{verbatim}
3698
3699 \npunpatchchapter
3700
3701 \secleveli{The End}
3702 Now this is the end of this example file. But I just can't resist to add one more
3703 example:
3704 \begin{verbatim}
3705 \notespages[multiple=100,minpages=100,endpages=1]
3706 \end{verbatim}
3707 See you on page 200.
3708
3709 \notespages[multiple=100,minpages=100,endpages=1]
3710
3711 \noindent
3712 \vspace*{\fill}
3713 \begin{center}
3714 \sffamily\bfseries
3715 Welcome on page 200.\\~\\
3716 You just scrolled through over a hundred notes pages.\\~\\
3717 Hey, come on, I had to test this.
3718 \end{center}
3719 \vspace*{\fill}
3720 \vspace*{\fill}
3721 \end{document}
3722 %</example>