texlive[41839] Master: notespages (11aug16)

commits+karl at tug.org commits+karl at tug.org
Thu Aug 11 23:44:36 CEST 2016


Revision: 41839
          http://tug.org/svn/texlive?view=revision&revision=41839
Author:   karl
Date:     2016-08-11 23:44:36 +0200 (Thu, 11 Aug 2016)
Log Message:
-----------
notespages (11aug16)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/libexec/ctan2tds
    trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/notespages/
    trunk/Master/texmf-dist/doc/latex/notespages/README
    trunk/Master/texmf-dist/doc/latex/notespages/notespages.pdf
    trunk/Master/texmf-dist/doc/latex/notespages/np-test.pdf
    trunk/Master/texmf-dist/doc/latex/notespages/np-test.tex
    trunk/Master/texmf-dist/source/latex/notespages/
    trunk/Master/texmf-dist/source/latex/notespages/notespages.dtx
    trunk/Master/texmf-dist/source/latex/notespages/notespages.ins
    trunk/Master/texmf-dist/tex/latex/notespages/
    trunk/Master/texmf-dist/tex/latex/notespages/notespages.sty
    trunk/Master/tlpkg/tlpsrc/notespages.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/notespages/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/notespages/README	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/notespages/README	2016-08-11 21:44:36 UTC (rev 41839)
@@ -0,0 +1,58 @@
+Copyright 2016 Mike Kaufmann
+               m.km at gmx.de
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3
+of this license or (at your option) any later version.
+The latest version of this license is in
+  http://www.latex-project.org/lppl.txt
+and version 1.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This work has the LPPL maintenance status `maintained'.
+ 
+The Current Maintainer of this work is Mike Kaufmann.
+
+This work consists of the files notespages.dtx and notespages.ins
+and the derived files notespages.sty and np-test.tex.
+
+
+1. What is it
+The NotesPages package provides one macros to insert a single notes page and
+another to fill the document with multiple notes pages, until the total number
+of pages (so far) is a multiple of a given number. A third command can be used
+to fill half empty pages with a notes area.
+
+This package is in a nearly finished state of development (it's version 0.8).
+It is useful, but there are some restrictions. And although it's not planned,
+the user interface may change in the future.
+
+
+2. Generating notespages.sty
+Simply run:    tex notespages.ins
+
+The file notepages.dtx also contains an example. You will be asked,
+if you want to generate it.
+
+
+3. Making the Documentation
+To get contents, cross references and index right, run TeX and makeindex
+as follows:
+
+pdflatex notespages.dtx
+pdflatex notespages.dtx
+makeindex -s gind.ist notespages.idx
+pdflatex notespages.dtx
+
+
+4. Making the Example File
+To get it right, run LaTeX twice. It requires KOMA-Script and TikZ.
+Oh, and it takes quite some time to compile.
+
+
+5. Files
+README                  this file
+notespages.dtx          the package
+notespages.ins          the generator
+notespages.pdf          the manual
+np-test.pdf             the example file


Property changes on: trunk/Master/texmf-dist/doc/latex/notespages/README
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/notespages/notespages.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/notespages/notespages.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/notespages/notespages.pdf	2016-08-11 21:43:18 UTC (rev 41838)
+++ trunk/Master/texmf-dist/doc/latex/notespages/notespages.pdf	2016-08-11 21:44:36 UTC (rev 41839)

Property changes on: trunk/Master/texmf-dist/doc/latex/notespages/notespages.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/notespages/np-test.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/notespages/np-test.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/notespages/np-test.pdf	2016-08-11 21:43:18 UTC (rev 41838)
+++ trunk/Master/texmf-dist/doc/latex/notespages/np-test.pdf	2016-08-11 21:44:36 UTC (rev 41839)

Property changes on: trunk/Master/texmf-dist/doc/latex/notespages/np-test.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/notespages/np-test.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/notespages/np-test.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/notespages/np-test.tex	2016-08-11 21:44:36 UTC (rev 41839)
@@ -0,0 +1,970 @@
+%%
+%% This is file `np-test.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% notespages.dtx  (with options: `example')
+%% 
+%% Copyright 2016 Mike Kaufmann
+%%                m.km at gmx.de
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%% 
+%% This work has the LPPL maintenance status `maintained'.
+%% 
+%% The Current Maintainer of this work is Mike Kaufmann.
+%% 
+%% This work consists of the files notespages.dtx and notespages.ins
+%% and the derived files notespages.sty and np-test.tex.
+%% 
+%% \CharacterTable
+%%  {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
+%%   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
+%%   Digits        \0\1\2\3\4\5\6\7\8\9
+%%   Exclamation   \!     Double quote  \"     Hash (number) \#
+%%   Dollar        \$     Percent       \%     Ampersand     \&
+%%   Acute accent  \'     Left paren    \(     Right paren   \)
+%%   Asterisk      \*     Plus          \+     Comma         \,
+%%   Minus         \-     Point         \.     Solidus       \/
+%%   Colon         \:     Semicolon     \;     Less than     \<
+%%   Equals        \=     Greater than  \>     Question mark \?
+%%   Commercial at \@     Left bracket  \[     Backslash     \\
+%%   Right bracket \]     Circumflex    \^     Underscore    \_
+%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
+%%   Right brace   \}     Tilde         \~}
+%%
+%% this document is intended to be compiled with the class scrbook, other classes
+%% will not produce a logically correct result (some notes fills are missing,
+%% pages are different, a lot of overful hboxes, and so on), they where just
+%% used for testing
+%%\documentclass[11pt,a4paper]{article}
+%%\documentclass[11pt,a4paper]{report}
+%%\documentclass[11pt,a4paper]{book}
+\documentclass[11pt,a4paper]{scrbook}
+%%\documentclass[11pt,a4paper]{scrartcl}
+%%\documentclass[11pt,a4paper]{scrreprt}
+%%\documentclass[11pt,a4paper,article]{memoir}
+%%\documentclass[11pt,a4paper]{memoir}
+\usepackage{lmodern}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{microtype}
+\usepackage[italian,ngerman,french,english]{babel}
+\usepackage[colorlinks,linkcolor=blue]{hyperref}
+\usepackage{lipsum}
+\usepackage[svgnames]{xcolor}
+\usepackage{tikz}
+\usepackage{afterpage}
+\usepackage{notespages}
+
+%% CAUTION: do not use this with the class memoir
+%%          it will not work, because memoir has its
+%%          own methods to set the header and footer
+%% this is meant to be used with KOMA-Script classes
+\usepackage{scrpage2}
+\lehead[]{\leftmark}
+\cehead[]{}
+\rehead[]{\rightmark}
+\lohead[]{\leftmark}
+\cohead[]{}
+\rohead[]{\rightmark}
+\lefoot[\pagemark]{\pagemark}
+\cefoot[]{}
+\refoot[]{\textsf{NotesPages}}
+\lofoot[]{\textsf{NotesPages}}
+\cofoot[]{}
+\rofoot[\pagemark]{\pagemark}
+\pagestyle{scrheadings}
+%% this is meant to be used with all other classes
+%%\pagestyle{headings}
+
+%% only use this for classes book, scrbook and memoir without option article
+\nppatchchapter{default,vacant,multiple=2,
+  notestext={An empty page before a new chapter.}}
+
+%% this trick will only work after \nppatchchapter
+%% this has to be used with classes article and scrartcl
+%%\let\secleveli\section
+%%\let\seclevelii\subsection
+%% this has to be used with all other classes
+\let\secleveli\chapter
+\let\seclevelii\section
+
+%%\tracingnpmarks1
+
+\newcommand{\fillit}[1][]{\minisec{Fill it}\lipsum[#1]}
+
+\begin{document}
+\thispagestyle{empty}
+\begin{center}
+\vspace*{\fill}
+\textsf{\Huge The \textbf{NotesPages} Package}\\[5ex]
+\textsf{\textbf{\Large Example File}}\\[5ex]
+Mike Kaufmann\\[2ex]
+\href{mailto:m.km at gmx.de}{\texttt{m.km at gmx.de}}\\[2ex]
+2016/08/10 (v0.8)\\[10ex]
+\textsf{\textbf{\LARGE Warning: do not print!}}\\[2ex]
+You would waste over a hundred pages!
+\vspace*{\fill}
+\vspace*{\fill}
+\end{center}
+
+\tableofcontents
+
+\secleveli{Layout variations}
+\seclevelii{Default settings}
+First let's start with the default settings. The next three and a half pages are
+filled with \verb|\notesfill|, \verb|\notespage|, and \verb|\notespages|. The
+latter will produce two pages, in order to fill up the document to a multiple
+of 4 pages.
+
+The commands are:
+
+\begin{verbatim}
+\notesfill
+\notespage
+\notespages
+\end{verbatim}
+
+\notesfill
+\notespage
+\notespages
+
+\seclevelii{The options \textsf{startnotes} and \textsf{allowfloats}}
+To show the effect of these options, some text and a float, which doesn't fit on
+this page, is needed. For the float the positioning \verb|[htb]| was used. After
+the float \verb|\notespage| was used once.
+
+Test for referencing: \autoref{fig:rect} on \autopageref{fig:rect}.
+
+\fillit[1-3]
+
+\begin{figure}[htb]
+\centering
+\textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
+\caption{Just a rectangle}\label{fig:rect}
+\end{figure}
+
+\notespage
+
+Now let's do this again, but this time using \verb|\notespage[startnotes=newpage]|.
+
+Test for referencing: \autoref{fig:rect2} on \autopageref{fig:rect2}.
+
+\fillit[1-3]
+
+\begin{figure}[htb]
+\centering
+\textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
+\caption{Another rectangle}\label{fig:rect2}
+\end{figure}
+
+\notespage[startnotes=newpage]
+
+Ok, now lets add the option \textsf{allowfloats} and see what happens. This time
+\verb|\notespages| \verb|[startnotes=newpage,allowfloats]| is used, filling the document
+up to page 16. Note: the header is already changed on the next page.
+
+Test for referencing: \autoref{fig:rect3} on \autopageref{fig:rect3}.
+
+\begin{figure}[htb]
+\centering
+\textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
+\caption{A third rectangle}\label{fig:rect3}
+\end{figure}
+
+\notespages[startnotes=newpage,allowfloats]
+
+\seclevelii{The option \textsf{pagestyle}}
+The next 3 pages show notes pages with different page styles. The commands are:
+
+\begin{verbatim}
+\notespage[pagestyle=empty]
+\notespage[pagestyle=plain]
+\notespage[pagestyle=useheadings]
+\end{verbatim}
+
+Btw.: The pagestyle for this document was defined deliberately this way to see
+both header marks as often as possible. For this, the package \textsf{scrpage2}
+from \textsf{KOMA-Script} was used.
+
+\notespage[pagestyle=empty]
+\notespage[pagestyle=plain]
+\notespage[pagestyle=useheadings]
+
+\seclevelii{The option \textsf{notesstyle}}
+Up until now, the default \textsf{notesstyle} (\textsf{\textit{grid}}) was used.
+The next example shows the other four. The commands are:
+
+\begin{verbatim}
+\notespage[notesstyle=plain]
+\notespage[vparts=35,notesstyle=lines]
+\notespage[notesstyle=vlines]
+\notespage[notesstyle=text]
+\notespage[vacant]
+\end{verbatim}
+
+For the second page \texttt{vparts=35} was used, because the default is 0 and
+therefore the notes area would be empty. The fourth page doesn't realy make sense,
+because the notes style \textsf{text} was meant to be used for otherwise empty
+pages. For this the meta option \textsf{vacant} was introduced. Its effect can be
+seen on the fifth page.
+
+\notespage[notesstyle=plain]
+\notespage[vparts=35,notesstyle=lines]
+\notespage[notesstyle=vlines]
+\notespage[notesstyle=text]
+\notespage[vacant]
+
+\seclevelii{The options \textsf{hparts}, \textsf{vparts}, and \textsf{usenotesareaheight}}
+Now let's play around a little with the options \textsf{hparts} and \textsf{vparts}.
+As mentioned in the manual, a value of 1 will always draw two lines. Let's take a
+look. The commands are:
+
+\begin{verbatim}
+\notesfill[vparts=1,notesstyle=lines]
+\notespage[hparts=1,notesstyle=vlines]
+\notespage[hparts=1,vparts=1]
+\end{verbatim}
+
+\notesfill[vparts=1,notesstyle=lines]
+\notespage[hparts=1,notesstyle=vlines]
+\notespage[hparts=1,vparts=1]
+
+With the same values for both, one gets rectangles with the same aspect ratio
+as the text body. The command:
+
+\begin{verbatim}
+\notesfill[hparts=30,vparts=30]
+\end{verbatim}
+
+\notesfill[hparts=30,vparts=30]
+
+With the option \textsf{usenotesareaheight} the height of a vertical part will
+be calculated based on the height of the notes area instead of \verb|\textheight|.
+Thus, there will be the exact number of parts given to \textsf{vparts}.
+
+But first, lets see it without \textsf{usenotesareaheight}. The command:
+
+\begin{verbatim}
+\notesfill[hparts=2,vparts=2]
+\end{verbatim}
+
+\notesfill[hparts=2,vparts=2]
+
+And now, the same command, but this time with the option \textsf{usenotesareaheight}.
+The command is:
+
+\begin{verbatim}
+\notesfill[hparts=2,vparts=2,usenotesareaheight]
+\end{verbatim}
+
+\notesfill[hparts=2,vparts=2,usenotesareaheight]
+
+But with the same command the height of a vertical part can be different each
+time, as can be seen below.
+
+\fillit[1-2]
+
+\notesfill[hparts=2,vparts=2,usenotesareaheight]
+
+\seclevelii{The option \textsf{titlestyle}}
+The following pages show the possible \textsf{titlestyle}s. Since the top most
+rectangles for the default appearance of the notes area will only be shown, if they
+fit completely into the notes area, the latter was change to be just a rectangle.
+Without this, the real distance between notes title and notes area couldn't be seen.
+The choice \textsf{minisec} wasn't used here, so this file can be compiled with
+classes, which don't support the command \verb|\minisec|. The commands are:
+
+\begin{verbatim}
+\notesfill[hparts=1,vparts=1]
+\notespage[hparts=1,vparts=1,titlestyle=subsection]
+\notespage[hparts=1,vparts=1,titlestyle=subsubsection]
+\notespage[hparts=1,vparts=1,titlestyle=text]
+\notespage[hparts=1,vparts=1,titlestyle=none]
+\end{verbatim}
+
+\notesfill[hparts=1,vparts=1]
+\notespage[hparts=1,vparts=1,titlestyle=subsection]
+\notespage[hparts=1,vparts=1,titlestyle=subsubsection]
+\notespage[hparts=1,vparts=1,titlestyle=text]
+\notespage[hparts=1,vparts=1,titlestyle=none]
+
+\seclevelii{The option \textsf{titletext}}
+With the option \textsf{titletext} a new text for the notes title can be given.
+If the new text is not just a single word, it should be given in braces. And if
+it contains a comma or an equality sign it must be given in braces.
+
+The new text is also used as the text for the header mark, if the option
+\textsf{marktext} is not used. The commands are:
+
+\begin{verbatim}
+\notesfill[hparts=1,vparts=1,titletext={Please, make some notes here}]
+\notespage[hparts=1,vparts=1,titletext={Scribble page}]
+\end{verbatim}
+
+\notesfill[hparts=1,vparts=1,titletext={Please, make some notes here}]
+\notespage[hparts=1,vparts=1,titletext={Scribble page}]
+
+\seclevelii{The option \textsf{titleskip}}
+Especially if \texttt{titlestyle=text} is given, the option \textsf{titleskip}
+is useful. With it, some space can be put between the notes title and the notes
+area. This is shown here. Compare it to page 37. The command is:
+
+\begin{verbatim}
+\notesfill[hparts=1,vparts=1,titlestyle=text,titleskip=2ex]
+\end{verbatim}
+
+\notesfill[hparts=1,vparts=1,titlestyle=text,titleskip=2ex]
+
+\seclevelii{The option \textsf{titlenotesfill}}
+The option \textsf{titlenotesfill} will move the notes area down to the end of
+the page. This can only be shown with the \textsf{notesstyle} \textsf{\textit{text}},
+for whitch it doesn't realy make sense. But if someone defines a custom notes style,
+which doesn't use the whole notes area, the option can be used to move it down.
+The command is:
+
+\begin{verbatim}
+\notesfill[notesstyle=text,filltopfill=false,titlenotesfill]
+\end{verbatim}
+
+\notesfill[notesstyle=text,filltopfill=false,titlenotesfill]
+
+\seclevelii{The option \textsf{mark}}
+Up unitl now, \textsf{mark} was set to \textsf{both}. The next pages will show
+the other choices. The commands are:
+
+\begin{verbatim}
+\notespage[mark=keep,titletext={Notes (keep)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[titletext={Notes (both)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[titletext={Notes (both)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\end{verbatim}
+
+The additional pages were put in to test, if switching between the choices of
+\textsf{mark} works.
+
+\notespage[mark=keep,titletext={Notes (keep)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[titletext={Notes (both)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[titletext={Notes (both)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+
+\seclevelii{The options \textsf{marktext} and \textsf{markuppercase}}
+The option \textsf{marktext} is used the set a text for the header mark. This is
+useful, if the title text is to long for the header. Again, if the text contains
+more then one word it should be given in braces, and if it contains a comma or an
+equality sign it must be given in braces.
+
+Some classes set the header marks in uppercase letters. To do this for the header
+marks of a notes page, the option \textsf{markuppercase} exists. It is set
+automatically for the standard classes, the \textsf{KOMA-Script} classes and
+\textsf{memoir}. For other classes, the default is \textsf{\textit{false}}.
+The setting can be changed with this option, as shown in the next example.
+
+The command is:
+
+\begin{verbatim}
+\notespage[marktext=Scribbel,markuppercase,titlestyle=text,
+    titletext={This is a very long text for a scribble page. And it
+    doesn't just end after one sentence, so it is realy too long for
+    the header.}]
+\end{verbatim}
+
+\notespage[marktext=Scribbel,markuppercase,titlestyle=text,
+    titletext={This is a very long text for a scribble page. And it
+    doesn't just end after one sentence, so it is realy too long for
+    the header.}]
+
+\secleveli{Controlling the number of notes pages}
+\seclevelii{The options \textsf{multiple}, \textsf{minpages}, and \textsf{endpages}}
+The way to set these options is to think as follows: the number of pages must be
+a multiple of $d$, at least $m$ notes pages are needed, and at the end $e$ pages
+are needed for other purposes. Then just set \textsf{multiple} $=d$, \textsf{minpages}
+$=m$, and \textsf{endpages} $=e$.
+
+As an example, lets assume the number of pages should be a multiple of 4, at least
+one notes page should appear and one page is needed after the notes pages. The
+options for this are \verb|multiple=4,minpages=1,endpages=1| (\textsf{multiple}
+could be omitted, because 4 is the default value).
+
+Now this is page 57, therefore three pages are needed to fill the document to a
+multiple of 4. But there should be one page at the end for other stuff. So only
+two pages will be inserted to fulfill \verb|endpages=1|. Since there are already
+two notes pages, \verb|minpages=1| is fullfilled.
+
+If this would have been page 55, there would be 4 notes pages. Page 56 would be a
+notes page to fulfill \verb|minpages=1|, which would also fulfill \verb|multiple=4|
+but violate \verb|endpages=1|. Because of that, three additional notes pages would
+be inserted, so all three conditions are met.
+
+\notespages[multiple=4,minpages=1,endpages=1]
+
+Here we are on page 60, the page for other purposes (like for example contact
+information on the back of a manual).
+
+With \verb|minpages=0| nothing would change here. And with \verb|endpages=0|
+this page would be a notes page too.
+
+Besides the maximum and minimum values for the options, there are no limits on
+the values and there are no dependencies between them. For example, \textsf{endpages}
+may be greater than \textsf{multiple}.
+
+\seclevelii{Other examples}
+Since this is page 60 and it's a multiple of 4, a \verb|\notespages| here with
+the default setting (\verb|multiple=4,minpages=0,endpages=0|) will do nothing.
+Let's try it:
+
+\notespages
+
+Look into the source of this file, there is a \verb|\notespages| command between
+this paragraph and the former one.
+
+Inserting an exact number $n$ of notes pages can be done with
+\verb|multiple=1,minpages=|$n$. Here any value for \textsf{endpages} would have
+no effect.
+
+\secleveli{Controlling notes fills}
+\seclevelii{The option \textsf{fillminspace} and \textsf{fillmaxspace}}
+The length given to \textsf{fillminspace} is only used to decide, if a notes fill
+should appear on a page, while \textsf{fillmaxspace} only limits its height. They
+are indepentent from each other. so it's possible to set \textsf{fillminspace} to
+a value greater than \textsf{fillmaxspace}. For example,
+
+\begin{verbatim}
+\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
+\end{verbatim}
+
+\noindent
+will insert a notes fill on this page, but not on the next one. But
+
+\begin{verbatim}
+\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.2\textheight]
+\end{verbatim}
+
+\noindent
+will insert a notes fill on the page after that, allthough it has the same amount
+of text.
+
+\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
+
+\fillit[1-3]
+
+\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
+
+\newpage
+\fillit[1-3]
+
+\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.2\textheight]
+
+\seclevelii{The options \textsf{filltopskip}}
+The option \textsf{filltopskip} is used to get a minimum distance between the text
+and the notes fill. In order to show its effect the \textsf{titlestyle} is changed
+\textsf{\textit{text}}. The commands are
+
+\begin{verbatim}
+\notesfill[titlestyle=text]
+\notesfill[titlestyle=text,filltopskip=2ex]
+\end{verbatim}
+
+Just compare this page to the next one.
+
+\fillit[3]
+
+\notesfill[titlestyle=text]
+
+The different space between the notes title and the nots area here is due to
+the fact, that only full vertical parts are drawn.
+
+\fillit[3]
+
+\notesfill[titlestyle=text,filltopskip=2ex]
+
+\seclevelii{The option \textsf{filltopfill}}
+As can be seen on page 61, the notes fill is moved to the bottom of the page.
+This is due to the fact, that by default \textsf{filltopfill} is set to
+\textsf{\textit{true}}. With the command
+
+\begin{verbatim}
+\notesfill[fillmaxspace=0.4\textheight,filltopfill=false]
+\end{verbatim}
+
+\noindent
+the notes fill is not moved down, as can be seen here.
+
+\notesfill[fillmaxspace=0.4\textheight,filltopfill=false]
+
+\seclevelii{The restriction regarding \textsf{notesfill}}
+As mentioned in the manual, footnotes and bottom floats will appear below the
+notes fill, as shown here.\footnote{Unfortunately, this is not easy to fix.}
+But at least, it has the right height.
+
+\begin{figure}[b]
+\centering
+\textcolor{lightgray}{\rule{0.8\textwidth}{0.2\textheight}}
+\caption{Again, a rectangle}\label{fig:rect4}
+\end{figure}
+
+\notesfill
+
+\secleveli{Advanced commands}
+\seclevelii{The command \texttt{\textbackslash setnotespages}}
+This command is used to change the settings globally. It takes a key value list,
+where all options can be used. It is possible to use the command everywhere in the
+document, changing the settings from the point of its appearance on. For example,
+instead of writing
+
+\begin{verbatim}
+\notesfill[hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
+    titletext=\textsf{\textbf{Scribble}},titleskip=1ex]
+\notespage[hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
+    titletext=\textsf{\textbf{Scribble}},titleskip=1ex]
+\end{verbatim}
+
+\noindent
+it is easier to write
+
+\begin{verbatim}
+\setnotespages{hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
+    titletext=\textsf{\textbf{Scribble}},titleskip=1ex}
+\notesfill
+\notespage
+\setnotespages{default}
+\end{verbatim}
+
+\noindent
+Note, that on the next page the formatting for the \textsf{titletext} is used
+for the header too. This can be circumvented by a) also setting \textsf{marktext}
+or b) defining your own title style (see \autoref{sec:deftitlestyle}).
+
+At the end, the package defaults are restored, so following examles start from
+there.
+
+\setnotespages{hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
+    titletext=\textsf{\textbf{Scribble}},titleskip=1ex}
+\notesfill
+\notespage
+\setnotespages{default}
+
+\seclevelii{The command \texttt{\textbackslash definenotesoption}}
+This command is used to define a new meta option. It is similar to \verb|\setnotespages|,
+but instead of changing the settings, the settings are assigned to a name, which
+can then be used as an option for the commands of this package. With this, the
+last example can be realised with
+
+\begin{verbatim}
+\definenotesoption{scribblepage}{default,hparts=1,vparts=1,
+    titlestyle=text,filltopskip=2ex,titletext=\textsf{\textbf{Scribble}},
+    titleskip=1ex,marktext=Scribble}
+\notesfill[scribblepage]
+\notespage[scribblepage]
+\end{verbatim}
+
+\noindent
+Here the option \textsf{default} was used, in order to always keep the same
+appearance, even if the settings were changed with \verb|\setnotespages|. And
+the problem with the header marks in the previous example was solved using
+\textsf{marktext}.
+
+After its definition, the new option \textsf{scribblepage} can also be used in
+\verb|\setnotespages| or another \verb|\definenotesoption|.
+
+\definenotesoption{scribblepage}{default,hparts=1,vparts=1,
+    titlestyle=text,filltopskip=2ex,titletext=\textsf{\textbf{Scribble}},
+    titleskip=1ex,marktext=Scribble}
+\notesfill[scribblepage]
+\notespage[scribblepage]
+
+\seclevelii{The command \texttt{\textbackslash definetitlestyle}}
+\label{sec:deftitlestyle}
+With this command a new title style can be defined. The first argument is the
+name for the new style, which can be used as a new choice for the option
+\textsf{titlestyle} after the definition. The second argument contains the macros
+to format the title.
+
+In order to get the text set with the option \textsf{titletext} the command
+\verb|\notestitletext| must be used where the title should appear. But of course,
+it is possible to put in some text. If the indentation by \verb|\parindent| is
+unwanted, the definition should start with \verb|\noindent|. And finally, there
+has to be a \verb|\par| at the end. That said, if a predefined command is used,
+which somehow uses \verb|\noindent| and \verb|\par|, they are no longer necessary.
+For example, the title styles \textsf{\textit{section}} and \textsf{\textit{text}}
+could have been defined with
+\begin{verbatim}
+\definetitlestyle{section}{\section*{\notestitletext}}
+\definetitlestyle{text}{\noindent\notestitletext\par}
+\end{verbatim}
+Btw.: existing title styles should not be redifined, as this may cause problems.
+
+Now lets define a new title style. Here is the example from the manual:
+
+\begin{verbatim}
+\definetitlestyle{boldred}{\noindent\textcolor{red}%
+    {\textbf{\notestitletext}}\par}
+\notesfill[scribblepage,titletext={Bold Red Note},
+    titlestyle=boldred,fillminspace=0.1\textheight]
+\end{verbatim}
+
+Here the option \textsf{scribblepage} from the last example was used. And then
+\textsf{titletext} and \textsf{titlestyle} were added, overwriting some of the
+settings done with \textsf{scribblepage}. This shows the importance of the order
+of options. Putting \textsf{scribblepage} at the end would have overwritten the
+other options.
+
+Now, it is possible to put some text directly into the definition. But keep in
+mind, this text will not appear in the headers. Here an example:
+
+\begin{verbatim}
+\definetitlestyle{prefix}{\noindent Note on:
+    \textcolor{blue}{\notestitletext}\par}
+\notespage[hparts=1,vparts=1,titleskip=1ex,titletext={Title Styles},
+    titlestyle=prefix]
+\end{verbatim}
+
+\definetitlestyle{boldred}{\noindent\textcolor{red}%
+    {\textbf{\notestitletext}}\par}
+\notesfill[scribblepage,titletext={Bold Red Note},
+    titlestyle=boldred,fillminspace=0.1\textheight]
+
+\definetitlestyle{prefix}{\noindent Note on:
+    \textcolor{blue}{\notestitletext}\par}
+\notespage[hparts=1,vparts=1,titleskip=1ex,titletext={Title Styles},
+    titlestyle=prefix]
+
+\seclevelii{The command \texttt{\textbackslash definenotestyle}}
+\label{sec:defnotesstyle}
+The notes style provided with \textsf{NotesPages} are just basic ones. With this
+command it is possible to define your own styles, which can be quite fancy. But
+lets start with the simple example from the manual:
+
+\begin{verbatim}
+\definenotesstyle{yellow}{\color{LightYellow}%
+    \rule{\textwidth}{\remainingtextheight}}
+\notesfill[notesstyle=yellow]
+\end{verbatim}
+
+Again, the first argument is the name of the new style, which can then be used as
+a new choice for the option \textsf{notesstyle}. And the second argument contains
+the macros to create the notes area. Here \verb|\remainingtextheight| has to be
+used to get the height of the notes area.
+
+\definenotesstyle{yellow}{\color{LightYellow}%
+    \rule{\textwidth}{\remainingtextheight}}
+\notesfill[notesstyle=yellow]
+
+For the next example lets create a double frame around the notes area, using the
+\LaTeX\ \textsf{picture} environment:
+
+\begin{verbatim}
+\newdimen\innerwidth
+\newdimen\innerheight
+\definenotesstyle{dframe}{%
+    \innerwidth\textwidth\advance\innerwidth-10mm\relax
+    \innerheight\remainingtextheight\advance\innerheight-10mm\relax
+    \let\unitlength\relax
+    \begin{picture}(\textwidth,\remainingtextheight)(0pt,0pt)
+    \color{lightgray}
+    \put(0pt,0pt){\framebox(\textwidth,\remainingtextheight){}}
+    \put(5mm,5mm){\framebox(\innerwidth,\innerheight){}}
+    \end{picture}}
+\notesfill[notesstyle=dframe]
+\end{verbatim}
+
+Here first two dimens are needed to calculate the height and width of the inner
+frame. These length are calculated first. Then a trick is used to make the
+\textsf{picture} environment work with lengths: \verb|\unitlength| is set to
+\verb|\relax|, thus disabling it. Caution: this requires to give the optional
+argument for an offset as \verb|(0pt,0pt)|, otherwise an error will occur.
+Additionally, a color for the frames is set. Since the new notes style is used
+within a group, disabling \verb|\unitlength| and setting a color without resetting
+them has no repercussions outside the \verb|\notesfill|.
+
+\newdimen\innerwidth
+\newdimen\innerheight
+\definenotesstyle{dframe}{%
+    \innerwidth\textwidth\advance\innerwidth-10mm\relax
+    \innerheight\remainingtextheight\advance\innerheight-10mm\relax
+    \let\unitlength\relax
+    \begin{picture}(\textwidth,\remainingtextheight)(0pt,0pt)
+    \color{lightgray}
+    \put(0pt,0pt){\framebox(\textwidth,\remainingtextheight){}}
+    \put(5mm,5mm){\framebox(\innerwidth,\innerheight){}}
+    \end{picture}}
+\notesfill[notesstyle=dframe]
+
+It is also possible to use \textsf{TikZ} to define notes styles.  Here the bounding
+box is used to keep the size of the picture to the exact size of the notes area.
+For the text \verb|\notesareatext| is used, thus using the text passed to the option
+\textsf{notestext}.
+
+\begin{verbatim}
+\definenotesstyle{slash}{%
+  \begin{tikzpicture}[color=gray!25]
+  \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
+  \clip (0,0) rectangle (\textwidth,\remainingtextheight);
+  \draw[line width=2cm]
+    (0,0) to node[color=black,sloped]{\textsf{\notesareatext}}
+    (\textwidth,\remainingtextheight);
+  \end{tikzpicture}}
+\notesfill[notesstyle=slash]
+\end{verbatim}
+
+\definenotesstyle{slash}{%
+  \begin{tikzpicture}[color=gray!25]
+  \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
+  \clip (0,0) rectangle (\textwidth,\remainingtextheight);
+  \draw[line width=2cm]
+    (0,0) to node[color=black,sloped]{\textsf{\notesareatext}}
+    (\textwidth,\remainingtextheight);
+  \end{tikzpicture}}
+\notesfill[notesstyle=slash]
+
+Here is another example using \textsf{TikZ}. It defines a mm graph paper, which
+always has a whole number of cm in both direction and is centered in the notes
+area.
+
+\begin{verbatim}
+\newdimen\xoffset
+\newdimen\yoffset
+\definenotesstyle{mmgp}{%
+  \begin{tikzpicture}[color=gray!25]
+  \pgfmathsetlength{\xoffset}{
+    (\textwidth-(floor(\textwidth/1cm+0.01)*1cm))/2}
+  \pgfmathsetlength{\yoffset}{
+    (\remainingtextheight-(floor(\remainingtextheight/1cm+0.01)*1cm))/2}
+  \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
+  \draw[xshift=\xoffset,yshift=\yoffset,very thin]
+    (0,0) grid [step=1mm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \draw[xshift=\xoffset,yshift=\yoffset,line width=0.5pt]
+    (0,0) grid [step=5mm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \draw[xshift=\xoffset,yshift=\yoffset,thick]
+    (0,0) grid [step=1cm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \end{tikzpicture}}
+\notesfill[notesstyle=mmgp]
+\end{verbatim}
+
+\newdimen\xoffset
+\newdimen\yoffset
+\definenotesstyle{mmgp}{%
+  \begin{tikzpicture}[color=gray!25]
+  \pgfmathsetlength{\xoffset}{
+    (\textwidth-(floor(\textwidth/1cm+0.01)*1cm))/2}
+  \pgfmathsetlength{\yoffset}{
+    (\remainingtextheight-(floor(\remainingtextheight/1cm+0.01)*1cm))/2}
+  \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
+  \draw[xshift=\xoffset,yshift=\yoffset,very thin]
+    (0,0) grid [step=1mm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \draw[xshift=\xoffset,yshift=\yoffset,line width=0.5pt]
+    (0,0) grid [step=5mm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \draw[xshift=\xoffset,yshift=\yoffset,thick]
+    (0,0) grid [step=1cm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \end{tikzpicture}}
+\notesfill[notesstyle=mmgp]
+
+The next example is just for showing the effect of the option \textsf{titlenotesfill}.
+It is not realy useful (unless you want to torture your readers for scribbling in
+your painfully worded masterpiece by making them write in circles). Here the
+bounding box is set to a square.
+
+Caution: since the height is fixed, this notes style is not realy suitable for a
+notes fill. If it doesn't fit on the page, it will be moved to the next.
+
+\begin{verbatim}
+\definenotesstyle{spiral}{%
+  \begin{tikzpicture}[color=gray!25]
+  \useasboundingbox (-0.5\textwidth,-0.5\textwidth) rectangle
+    (0.5\textwidth,0.5\textwidth);
+  \draw[domain=0:22*3.14159,smooth,variable=\t,samples=1000] plot
+    ({-0.1*\t*sin(\t r)},{0.1*\t*cos(\t r)});
+  \end{tikzpicture}}
+\notespage[notesstyle=spiral,titletext={Write in Circles}]
+\notespage[notesstyle=spiral,titletext={Write in Circles},
+           titlenotesfill]
+\end{verbatim}
+
+\definenotesstyle{spiral}{%
+  \begin{tikzpicture}[color=gray!25]
+  \useasboundingbox (-0.5\textwidth,-0.5\textwidth) rectangle
+    (0.5\textwidth,0.5\textwidth);
+  \draw[domain=0:22*3.14159,smooth,variable=\t,samples=1000] plot
+    ({-0.1*\t*sin(\t r)},{0.1*\t*cos(\t r)});
+  \end{tikzpicture}}
+\notespage[notesstyle=spiral,titletext={Write in Circles}]
+\notespage[notesstyle=spiral,titletext={Write in Circles},
+           titlenotesfill]
+
+\seclevelii{The command \texttt{\textbackslash nppatchchapter}}
+Page 68 (among others) would be empty here, if a book class is used. This is,
+because a new chapter normally starts on a right hand page and so a left hand page
+may be left empty. To put a notes page there, one could manually add a line like
+\begin{verbatim}
+\notespages[vacant,multiple=2,
+  notestext={An empty page before a new chapter.}]
+\end{verbatim}
+before every new chapter. But with \verb|\nppatchchapter| this can be automated.
+It changes \verb|\chapter| so it behaves like
+\begin{verbatim}
+\notespages[...]
+\chapter
+\end{verbatim}
+The optional argument for \verb|\notespages| is the argument passed to
+\verb|\nppatchchapter|. And the new \verb|\chapter| can just be used like the
+original one.
+
+In the preamble of this document the lines
+\begin{verbatim}
+\nppatchchapter{default,vacant,multiple=2,
+  notestext={An empty page before a new chapter.}}
+\end{verbatim}
+were added to make the empty pages before a new chapter into a notes pages. The
+option \textsf{default} asures, that no changes of the settings (this includes
+packages options and settings done with \verb|\setnotespages|) will change their
+apperance. And with \verb|multiple=2| there will be no more then one notes
+page before a new chapter instead of up to three with the default value of 4.
+
+\secleveli{Colors and Languages}
+\seclevelii{Colors}
+The \textsf{NotesPages} package uses three colors.
+\begin{itemize}
+\item \textsf{NotesHColor} for horizontal lines in the notes styles
+      \textsf{\textit{lines}} and \textsf{\textit{grid}},
+\item \textsf{NotesVColor} for vertical lines in the notes styles
+      \textsf{\textit{vlines}} and \textsf{\textit{grid}}, and
+\item \textsf{NotesTextColor} for the text in the notes style
+      \textsf{\textit{text}}.
+\end{itemize}
+Colors can be redefined, so it's possible to change them at any time. To make the
+changes local, they are put in a group here.
+
+\begin{verbatim}
+{\definecolor{NotesHColor}{rgb}{0,0,1}
+ \definecolor{NotesVColor}{rgb}{0,1,0}
+ \definecolor{NotesTextColor}{rgb}{1,0,0}
+ \notesfill
+ \notespage[notestyle=text]}
+\end{verbatim}
+
+{\definecolor{NotesHColor}{rgb}{0,0,1}
+ \definecolor{NotesVColor}{rgb}{0,1,0}
+ \definecolor{NotesTextColor}{rgb}{1,0,0}
+ \notesfill
+ \notespage[notesstyle=text]}
+
+\seclevelii{Languages}
+So far, only English, French, and German are supported. Up unitl now English was
+used in this document. Here are examples for the other ones.
+
+\begin{verbatim}
+\selectlanguage{french}
+\notespage[notesstyle=text]
+\selectlanguage{ngerman}
+\notespage[notesstyle=text]
+\selectlanguage{english}
+\end{verbatim}
+
+New languages will be supported, as users provide the translations. But naturally,
+this will take some time. So if your language is not supported yet and you can't
+wait, you can add the following to the preamble of your document (of course with
+the correct translations):
+
+\begin{verbatim}
+\setnotespages{titletext={No Clue},
+  notestext={No clue what this is in your language.}}
+\end{verbatim}
+
+This is sufficient for documents in one language. But caution, using the option
+\textsf{default} will reset these texts. That can be solved by redefining
+\verb|\npnotesname| and \verb|\npnotestext| instead. For multilingual documents
+you can add for example
+\begin{verbatim}
+\addto{\extrasitalian}{\def\npnotesname{No Clue}%
+  \def\npnotestext{No clue what this is in Italian.}}
+\end{verbatim}
+to the preamble (again, for your language and with the correct translations).
+After that you can use
+\begin{verbatim}
+\selectlanguage{italian}
+\notespage[notesstyle=text]
+\end{verbatim}
+to get a notes page in the new language.
+
+\selectlanguage{french}
+\notespage[notesstyle=text]
+\selectlanguage{ngerman}
+\notespage[notesstyle=text]
+\addto{\extrasitalian}{\def\npnotesname{No Clue}%
+  \def\npnotestext{No clue what this is in Italian.}}
+\selectlanguage{italian}
+\notespage[notesstyle=text]
+\selectlanguage{english}
+
+\secleveli{Other Stuff}
+\seclevelii{The Package \textsf{afterpage}}
+\textsf{NotesPages} can be used with the package \textsf{afterpage}. This makes
+it possible to put a notes page on the next page without leaving the page it was
+invoked half empty. So here the line
+\begin{verbatim}
+\afterpage{\notespage[titletext={Notes on \textsl{afterpage}},
+    marktext=Notes]}
+\end{verbatim}
+is inserted to get a notes page on the next page, without wasting the remaining
+space on this one (look into the source, here it comes):
+
+\afterpage{\notespage[titletext={Notes on \textsl{afterpage}},
+    marktext=Notes]}
+
+Ok, lets fill this page, so the effect of the example can be seen. You could also
+start a new section here.
+
+\fillit[1-4]
+
+\seclevelii{The End}
+Now this is the end of this example file. But I just can't resist to add one more
+example:
+\begin{verbatim}
+\notespages[multiple=100,minpages=100,endpages=1]
+\end{verbatim}
+See you on page 200.
+
+\notespages[multiple=100,minpages=100,endpages=1]
+
+\noindent
+\vspace*{\fill}
+\begin{center}
+\sffamily\bfseries
+Welcome on page 200.\\~\\
+You just scrolled through over a hundred notes pages.\\~\\
+Hey, come on, I had to test this.
+\end{center}
+\vspace*{\fill}
+\vspace*{\fill}
+\end{document}
+\endinput
+%%
+%% End of file `np-test.tex'.


Property changes on: trunk/Master/texmf-dist/doc/latex/notespages/np-test.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/notespages/notespages.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/notespages/notespages.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/notespages/notespages.dtx	2016-08-11 21:44:36 UTC (rev 41839)
@@ -0,0 +1,3608 @@
+% \iffalse meta-comment
+%
+% notespages.dtx
+% Copyright 2016 Mike Kaufmann
+%                m.km at gmx.de
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+%   http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+% 
+% The Current Maintainer of this work is Mike Kaufmann.
+%
+% This work consists of the files notespages.dtx and notespages.ins
+% and the derived files notespages.sty and np-test.tex.
+% \fi
+%% \CharacterTable
+%%  {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
+%%   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
+%%   Digits        \0\1\2\3\4\5\6\7\8\9
+%%   Exclamation   \!     Double quote  \"     Hash (number) \#
+%%   Dollar        \$     Percent       \%     Ampersand     \&
+%%   Acute accent  \'     Left paren    \(     Right paren   \)
+%%   Asterisk      \*     Plus          \+     Comma         \,
+%%   Minus         \-     Point         \.     Solidus       \/
+%%   Colon         \:     Semicolon     \;     Less than     \<
+%%   Equals        \=     Greater than  \>     Question mark \?
+%%   Commercial at \@     Left bracket  \[     Backslash     \\
+%%   Right bracket \]     Circumflex    \^     Underscore    \_
+%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
+%%   Right brace   \}     Tilde         \~}
+%%
+% \CheckSum{1320}
+%
+% \iffalse meta-comment
+%
+%<*package>
+%% 
+\def\fileversion{0.8}
+\def\filedate{2016/08/10}
+
+%</package>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{hypdoc}
+\usepackage{graphicx}
+\hypersetup{pdfborder=0,colorlinks,linkcolor=blue}
+\usepackage[all]{hypcap}
+\setcounter{IndexColumns}{2}
+\EnableCrossrefs
+\CodelineIndex
+%\RecordChanges
+%\OnlyDescription
+\makeatletter
+% new, like ...Env... commands from doc.sty)
+\let\PrintDescribeOpt\PrintDescribeEnv
+\let\PrintOptName\PrintEnvName
+\def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters
+    \Describe at Opt}
+\def\Describe at Opt#1{\endgroup
+    \marginpar{\raggedleft\PrintDescribeOpt{#1}}%
+    \SpecialOptIndex{#1}\@esphack\ignorespaces}
+\def\SpecialOptIndex#1{\@bsphack
+    \index{#1\actualchar{\protect\ttfamily#1}
+           (option)\encapchar usage}%
+    \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar
+           usage}\@esphack}
+% new (like \SpecialEnvIndex from hypdoc.sty)
+\let\HDorg at SpecialOptIndex\SpecialOptIndex
+\renewcommand*\SpecialOptIndex[1]{%
+  \@bsphack
+  \begingroup
+    \HD at target
+    \let\HDorg at encapchar\encapchar
+    \edef\encapchar usage{%
+      \HDorg at encapchar hdclindex{\the\c at HD@hypercount}{usage}%
+    }%
+    \HDorg at SpecialOptIndex{#1}%
+  \endgroup
+  \@esphack
+}
+% redefinition (from doc.sty)
+\def\macro{\begingroup
+   \catcode`\\12
+   \MakePrivateLetters \m at cro@ \z@}
+\def\environment{\begingroup
+   \catcode`\\12
+   \MakePrivateLetters \m at cro@ \@ne}
+% new, environment 'option', like 'environment', but index entries with
+% '(option)'
+\def\option{\begingroup
+   \catcode`\\12
+   \MakePrivateLetters \m at cro@ \tw@}
+% redefinition (from doc.sty)
+\long\def\m at cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist
+   \edef\saved at macroname{\string#2}%
+  \def\makelabel##1{\llap{##1}}%
+  \if at inlabel
+    \let\@tempa\@empty \count@\macro at cnt
+    \loop \ifnum\count@>\z@
+      \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m at ne \repeat
+    \edef\makelabel##1{\llap{\vtop to\baselineskip
+                               {\@tempa\hbox{##1}\vss}}}%
+    \advance \macro at cnt \@ne
+  \else  \macro at cnt\@ne  \fi
+  \edef\@tempa{\noexpand\item[%
+     \ifcase #1%
+       \noexpand\PrintMacroName
+     \or
+       \noexpand\PrintEnvName
+     \or
+       \noexpand\PrintOptName
+     \fi
+     {\string#2}]}%
+ \@tempa
+  \global\advance\c at CodelineNo\@ne
+   \ifcase #1%
+      \SpecialMainIndex{#2}\nobreak
+      \DoNotIndex{#2}%
+   \or
+      \SpecialMainEnvIndex{#2}\nobreak
+   \or
+      \SpecialMainOptIndex{#2}\nobreak
+   \fi
+  \global\advance\c at CodelineNo\m at ne
+  \ignorespaces}
+% new
+\let\endoption\endmacro
+\def\SpecialMainOptIndex#1{\@bsphack\special at index{%
+                                      #1\actualchar
+                                      {\string\ttfamily\space#1}
+                                         (option)%
+                                      \encapchar main}%
+    \special at index{options:\levelchar#1\actualchar{%
+                   \string\ttfamily\space#1}\encapchar
+           main}\@esphack}
+\makeatother
+\begin{document}
+\DocInput{notespages.dtx}
+\end{document}
+%</driver>
+%
+%<*package>
+% \fi
+%
+% \DoNotIndex{\',\@auxout,\@gobble}
+% \DoNotIndex{\@ifclassloaded,\@ifpackageloaded,\@ifpackagewith,\@ifundefined}
+% \DoNotIndex{\@ne,\@temptokena,\@themark,\@writefile}
+% \DoNotIndex{\addto,\advance}
+% \DoNotIndex{\AtBeginDocument,\AtEndDocument}
+% \DoNotIndex{\begin,\begingroup}
+% \DoNotIndex{\c at page,\centering,\chapter}
+% \DoNotIndex{\clearpage,\color,\csname}
+% \DoNotIndex{\def,\definecolor,\divide}
+% \DoNotIndex{\define at boolkey,\define at choicekey,\define at cmdkey,\define at key}
+% \DoNotIndex{\edef,\else,\end,\endgroup,\endcsname}
+% \DoNotIndex{\expandafter}
+% \DoNotIndex{\fi,\filedate,\fileversion}
+% \DoNotIndex{\gdef,\global,\glossary}
+% \DoNotIndex{\hbox,\hrule,\@height}
+% \DoNotIndex{\if at filesw,\if at nobreak}
+% \DoNotIndex{\if,\ifcase,\ifcat,\ifdim,\ifnum,\ifvmode,\ifx}
+% \DoNotIndex{\immediate,\index,\InputIfFileExists}
+% \DoNotIndex{\jobname}
+% \DoNotIndex{\key at ifundefined}
+% \DoNotIndex{\label,\let,\line,\lineskip,\long,\loop}
+% \DoNotIndex{\MakeUppercase,\MessageBreak,\m at ne,\mark,\markboth,\markright}
+% \DoNotIndex{\maxdimen,\minisec,\multiply,\multiput}
+% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcount,\newdimen,\newif,\newtoks}
+% \DoNotIndex{\newpage,\newwrite,\nobreak,\noindent,\number}
+% \DoNotIndex{\openout}
+% \DoNotIndex{\PackageError,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\PackageInfo,\ProvidesPackage,\ProcessOptionsX}
+% \DoNotIndex{\p@,\pagegoal,\pagetotal,\par,\parfillskip,\phantom,\protect}
+% \DoNotIndex{\protected at write,\providecolor}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\repeat,\rule,\RequirePackage}
+% \DoNotIndex{\setkeys,\space,\string,\section,\subsection,\subsubsection}
+% \DoNotIndex{\textfraction,\textheight,\textwidth,\the,\thispagestyle,\tw@}
+% \DoNotIndex{\unitlength,\unrestored at protected@xdef,\vfill,\vspace}
+% \DoNotIndex{\xdef,\z@}
+%
+% \changes{0.8}{2016/08/07}{initial release}
+%
+% \newcommand{\NP}{\textsf{NotesPages}}
+% \newcommand{\pkg}[1]{\textsf{#1}}
+% \newcommand{\opt}[1]{\textsf{#1}}
+% \newcommand{\choice}[1]{\textsf{\textsl{#1}}}
+% \newcommand{\bs}{\textbackslash}
+%
+% \title{The \NP\ Package\\[1ex]
+%     Filling documents, so the total number of pages is a multiple of a given number.}
+% \author{Mike Kaufmann\\\href{mailto:m.km at gmx.de}{\texttt{m.km at gmx.de}}}
+% \date{\filedate\ (v\fileversion)}
+% ^^A--------------------------------------------------------------------------
+% \maketitle
+% \begin{abstract}
+% The \NP\ package provides one macro to insert a single notes page and another
+% to fill the document with multiple notes pages, until the total number of pages
+% (so far) is a multiple of a given number. A third command can be used to fill
+% half empty pages with a notes area.
+% \end{abstract}
+%
+% \tableofcontents
+%
+% ^^A--------------------------------------------------------------------------
+% \section{Introduction}
+% \subsection{Why this Package}
+% Well, sometimes I have to write short manuals, which are then printed as a booklet.
+% Therefore their number of pages has to be dividable by 4. And since it's tiresome
+% to check the number of pages after every change and add or remove notes pages
+% manually, I automated this work. In this, I had to take into account that there
+% are a number of fixed pages at the end of the booklet.
+%
+% In order to make it useful for others, options for formating a notes page were
+% added.
+%
+% ^^A---------------------------------------------
+% \subsection{Feeback and Testing}
+% The \NP\ package was tested with the example file provided with this package.
+% There may be documents, where the algorithm for calculating the number of pages
+% needed to fill a document may not work properly. Or there may be other issues.
+% If you have such a document, please send me an example, which shows the problem,
+% so I can try to fix it.
+%
+% ^^A---------------------------------------------
+% \subsection{Dependencies}
+% \subsubsection{Necessary Packages}
+% The \NP\ package needs the \pkg{xkeyval} package for processing the options.
+%
+% ^^A-------------------------
+% \subsubsection{Babel}
+% The package makes use of \pkg{babel}, if it is loaded, but it doesn't depend
+% on it. The order, in which the package is loaded in regard to the \NP\ package,
+% is of no consequence. More on supporting languages can be found in
+% \autoref{sec:babel}.
+%
+% ^^A-------------------------
+% \subsubsection{Color}
+% The package also makes use of the package \pkg{color} or \pkg{xcolor}, if loaded,
+% without depending either one. Again, the order, in which the package is loaded
+% in regard to the \NP\ package, is of no consequence. More on supporting color
+% can be found in \autoref{sec:color}.
+%
+% ^^A---------------------------------------------
+% \subsection{Legal Stuff}
+% This program is provided under the terms of the
+% \LaTeX\ Project Public License distributed from CTAN
+% \href{http://www.ctan.org/license/lppl1.3}{http://www.ctan.org/license/lppl1.3}
+% 
+% ^^A--------------------------------------------------------------------------
+% \section{Using the Packages}
+% \subsection{Loading}
+% The package is loaded as usual.
+%
+% \vspace{1ex}
+% |\usepackage|\oarg{options}|{notepages}|
+%
+% \vspace{1ex}
+% \noindent
+% The options are described in \autoref{sec:options}.
+%
+% ^^A---------------------------------------------
+% \subsection{The basic commands}
+% \label{sec:cmd}
+% \DescribeMacro\setnotespages
+% With |\setnotespages|\marg{options} all the settings possible with the options
+% described in \autoref{sec:options} can be changed globaly. This will overwrite
+% the settings made with the options provided on loading the package or the
+% defaults.
+%
+% \DescribeMacro\notespage
+% With |\notespage|\oarg{options} a single notes page will be inserted into the
+% document. For this, a new page will be started at the place of its occurrence.
+% The command has one optional parameter, which can contain all the options
+% described in \autoref{sec:options}. But the options of \autoref{sec:optmultiple}
+% and \autoref{sec:optfill} are ignored, because they are of no use for |\notespage|.
+%
+% The options are local to the command, i.e.\ they will not change the settings
+% done with |\setnotespages|, made at loading the package, or the defaults. Thus,
+% if the next notes page should have the same appearance, the same options must
+% be given.
+%
+% \DescribeMacro\notespages
+% With |\notespages|\oarg{options} the document can be filled with notes pages, so the
+% total number of pages so far is a multiple of a given number. Depending on the
+% settings done with the options described in \autoref{sec:optmultiple}, this
+% may result in anything from 0 to 199 notes pages.
+%
+% All options described in \autoref{sec:options} can be used in the optional
+% parameter. But the options in \autoref{sec:optfill} are ignored, because they
+% are of no use for |\notespages|.
+%
+% The command first sets up everything according to the given options. It then
+% calculates the amount of pages needed and inserts them.
+%
+% For |\notespages| the options are also local to the command. 
+%
+% \DescribeMacro\notesfill
+% With |\notesfill|\oarg{options} a page can be filled with a notes area preceeded by
+% the notes tile. It is formated similar to a notes page, but no new page is
+% started, the pagestyle can not be changed and so can't the text in the header .
+%
+% All options described in \autoref{sec:options} can be used in the optional
+% parameter. But the options of \autoref{sec:optmultiple} are useless to
+% |\notesfill| and therefore ignored. Also the options \opt{startnotes},
+% \opt{pagestyle}, \opt{mark}, \opt{marktext}, and \opt{markuppercase} from
+% \autoref{sec:optsingle} are ignored.
+%
+% With the options described in \autoref{sec:optfill} it is possible to set a
+% minimum height for |\notesfill|, i.e. no notes title plus notes area will
+% be generated, if the remaining space on the page is less then the minimum.
+% Also a maximum height for the notes title plus the notes area can be defined.
+% If there is more space left on the page, the notes title plus notes area
+% will be moved to the bottom of the page by default.
+%
+% And again, the options given to |\notesfill| are local to the command.
+%
+% There is an restriction to |\notesfill| regarding bottom floats and footnotes:
+% they will appear below it.
+%
+% ^^A---------------------------------------------
+% \subsection{Layout}
+% \autoref{fig:layoutpage} shows the layout of a notes page and \autoref{fig:layoutfill}
+% the layout of a notes fill, together with some of the layout options described in
+% \autoref{sec:options}. The dimension |\remainingtextheight| is described in
+% \autoref{sec:advanced}.
+%
+% \begin{figure}[htb]
+% \setlength{\unitlength}{1mm}
+% \begin{minipage}{0.49\textwidth}
+% \centering
+% \begin{picture}(60,90)
+% \thicklines
+% \put( 0,85){\framebox(60, 5){header\quad\textsf{marktext/mark/pagestyle}}}
+% \put( 0, 0){\framebox(60, 5){footer\qquad\textsf{pagestyle}}}
+% \put( 0,78){\framebox(60, 5){notes title\qquad\textsf{titletext/titlestyle}}}
+% \put( 0, 7){\framebox(60,66){\parbox{60mm}{\centering notes area\\\textsf{notesstyle}\\\textsf{hparts/vparts}}}}
+% \thinlines
+% \put( 5,15){\vector(0, 1){58}}
+% \put( 5,15){\vector(0,-1){8}}
+% \put( 6,10){\makebox(0,5)[l]{\texttt{\bs remainingtextheight}}}
+% \put( 5,75){\vector(0, 1){3}}
+% \put( 5,75){\vector(0,-1){2}}
+% \put( 6,73){\makebox(0,5)[l]{\textsf{titleskip}}}
+% \put(25,73){\makebox(0,0){\textbullet}}
+% \put(26,73){\makebox(0,5)[l]{\textsf{titlenotesfill}}}
+% \end{picture}
+% \caption{Layout notes page}\label{fig:layoutpage}
+% \end{minipage}
+% \hspace{\fill}
+% \begin{minipage}{0.49\textwidth}
+% \centering
+% \capstart
+% \begin{picture}(60,90)
+% \thicklines
+% \put( 0,85){\framebox(60,5){header}}
+% \put( 0, 0){\framebox(60,5){footer}}
+% \put( 0,56){\makebox(60,27){text}}
+% \put( 0,83){\line(1,0){60}}
+% \put( 0,53){\line(0,1){30}}
+% \put( 0,53){\line(1,0){40}}
+% \put(40,53){\line(0,1){3}}
+% \put(40,56){\line(1,0){20}}
+% \put(60,56){\line(0,1){27}}
+% \put( 0,43){\framebox(60, 5){notes title\qquad\textsf{titletext/titlestyle}}}
+% \put( 0, 7){\framebox(60,31){\parbox{60mm}{\centering notes area\\\textsf{notesstyle}\\\textsf{hparts/vparts}\\~\\~}}}
+% \thinlines
+% \put( 5,15){\vector(0, 1){23}}
+% \put( 5,15){\vector(0,-1){8}}
+% \put( 6,10){\makebox(0,5)[l]{\texttt{\bs remainingtextheight}}}
+% \put( 5,40){\vector(0, 1){3}}
+% \put( 5,40){\vector(0,-1){2}}
+% \put( 6,38){\makebox(0,5)[l]{\textsf{titleskip}}}
+% \put( 5,50){\vector(0, 1){3}}
+% \put( 5,50){\vector(0,-1){2}}
+% \put( 6,48){\makebox(0,5)[l]{\textsf{filltopskip}}}
+% \put(25,48){\makebox(0,0){\textbullet}}
+% \put(26,48){\makebox(0,5)[l]{\textsf{filltopfill}}}
+% \put(25,38){\makebox(0,0){\textbullet}}
+% \put(26,38){\makebox(0,5)[l]{\textsf{titlenotesfill}}}
+% \end{picture}
+% \caption{Layout notes fill}\label{fig:layoutfill}
+% \end{minipage}
+% \end{figure}
+%
+% ^^A---------------------------------------------
+% \subsection{Package and Command Options}
+% \label{sec:options}
+% \subsubsection{Setting Options}
+% If options are used without a value, they will be set to their defaults. The
+% exception are the boolean options \opt{allowfloats}, \opt{usenotesareaheight},
+% \opt{titlenotesfill}, \opt{markuppercase}, and \opt{filltopfill}, which are
+% set to \choice{true}.
+%
+% ^^A-------------------------
+% \subsubsection{Options for \texttt{\bs notespage}}
+% \label{sec:optsingle}
+% The following options affect the style and layout of a single notes page.
+% They are all used by |\notespage| and |\notespages|. And most of them are
+% also used by |\notesfill| (the exceptions are \opt{startnotes},
+% \opt{pagestyle}, \opt{mark}, \opt{marktext}, and \opt{markuppercase}).
+% 
+% \DescribeOpt{startnotes}
+% The option \opt{startnotes} defines, how the new page for |\notespage| is
+% started. The choices are \choice{newpage} and \choice{clearpage}. The default
+% is \choice{clearpage}.
+%
+% With \choice{newpage} the command |\newpage| is used and therefore remaining floats
+% are not given out by default, which can be changed with the option \opt{allowfloats}.
+% With \choice{clearpage} |\clearpage| is used and remaining floats are given out
+% before the notes page.
+%
+% \DescribeOpt{allowfloats}
+% If the boolean \opt{allowfloats} is set to \choice{true} floats are allowed to
+% be placed on a notes page, if \choice{newpage} is used for the option
+% \opt{startnotes}. Caution: the header will be changed on such pages. The default
+% is \choice{false}.
+%
+% \DescribeOpt{pagestyle}
+% With \opt{pagestyle} the pagestyle for a notes page can be defined. All possible
+% pagestyles (\choice{empty}, \choice{plain}, \choice{headings}, \choice{myheadings},
+% and what ever is defined for the document) can be use as value. Additionally,
+% \choice{current} can be used to denote to not change the pagestyle. This is the
+% default. Internally |\thispagestyle| is used, but not for the value \choice{current}.
+%
+% A pagestyle must have been defined, before it can be chosen. If a nonexisting
+% pagestyle is chosen, a warning will be given and the value will be set to the
+% default. Therefore, |\setnotespages| must appear after defining a page style
+% to be used for notes pages in the preamble.
+%
+% \DescribeOpt{notesstyle}
+% With \opt{notesstyle} the way the notes area is filled can be chosen. Possible
+% are \choice{plain}, \choice{lines}, \choice{vlines}, \choice{grid}, and \choice{text}.
+% The default is \choice{grid}.
+%
+% With \choice{plain} the notes area is left empty, \choice{lines} will fill the
+% notes area with horizonal lines, \choice{vlines} with vertical lines, \choice{grid}
+% will fill it with a grid, and \choice{text} will give out a short text.
+%
+% It is possible to add your own \opt{notesstyle}. This is described in
+% \autoref{sec:advanced}.
+%
+% \DescribeOpt{hparts}
+% The option \opt{hparts} divides the notes area into the given number $n_x$
+% horizontal parts, which will be seperated by vertical lines. There will always
+% be $n_x + 1$ lines. The default value is 25.
+%
+% The option applies to the \opt{notesstyle}s \choice{vlines} and \choice{grid}.
+% The value may be in the range from 1 to 200. If the given number is smaller or
+% larger, a warning is given out and it's set to either 1 or 200 respectively.
+%
+% \DescribeOpt{vparts}
+% The option \opt{vparts} divides the |\textheight| into the given number $n_y$
+% vertical parts. The calculation is based on |\textheight| by default (see
+% below, option \opt{usenotesareaheight}), in order to achieve same height
+% vertical parts, independent of the actual height of the notes area. The
+% option applies to the \opt{notesstyle}s \choice{lines} and \choice{grid}.
+%
+% The value may be in the range from 0 to 300. If the given number is smaller or
+% larger, a warning is given out and it's set to either 0 or 300 respectively.
+%
+% The values 0 and 1 have special meaning. With 0 for the \opt{notesstyle}
+% \choice{grid} the length of a vertical part will be the same as for a horizontal
+% part, thus resulting in a square grid. For the \opt{notesstyle} \choice{lines}
+% a warning will be given and the notes area is left empty. A value of 1 will lead
+% to one line at the bottom and one at the top of the notes area, regardless of
+% its height, thus making it possible to put a rectangle around the notes area.
+%
+% For values of 2 or greater only lines for full vertical parts are drawn. For
+% example, if the height of a notes area is 20.5 times the length of a vertical
+% part, for \choice{lines} 20 lines are drawn and 21 for \choice{grid}. For small
+% values there may be no lines in the notes area of a |\notesfill|.
+%
+% The default value is 0, so for the \opt{notesstyle} \choice{lines} it has
+% to be changed.
+%
+% \DescribeOpt{usenotesareaheight}
+% With the option \opt{usenotesareaheight} the calculation of the height of a
+% vertical part (see above, option \opt{vparts}) is based on the height of the
+% notes area instead of |\textheight|. This enables the user to vertically divide
+% the notes area into the exact number given to \opt{vparts}. Of course with this,
+% for a |\notesfill| the height of a vertical part can differ each time. The default
+% is \choice{false}.
+%
+% \DescribeOpt{titlestyle}
+% With the option \opt{titlestyle} a layout for the notes title can be chosen.
+% Possible are \choice{none}, \choice{text}, \choice{section}, \choice{subsection},
+% \choice{subsubsection}, and, if available, \choice{minisec}. The default is
+% \choice{section}.
+%
+% With \choice{none} no title is set. And \choice{text} formats it as simple text.
+% With \choice{section}, \choice{subsection}, or \choice{subsubsection} one of
+% the commands |\section*|, |\subsection*|, or |\subsubsection*| is used. The
+% choice \choice{minisec} is only available, if |\minisec| is defined (before
+% loading the \NP\ package). Then, if chosen, |\minisec| is used to format the
+% title.
+%
+% It is possible to add your own \opt{titlestyle}. This is described in
+% \autoref{sec:advanced}.
+%
+% \DescribeOpt{titletext}
+% With \opt{titletext} an arbitrary text can be chosen as new a notes title. If
+% the new text contains more then one word, it is recommended to put the text in
+% braces, e.g.\ |titletext={My new notes title}|. If the text contains a comma (``,'')
+% or an equality sign (``=''), it must be given in braces! The default is |\npnotesname|,
+% which is ``Notes'' without \pkg{babel} or language dependend with \pkg{babel}
+% (see \autoref{sec:babel} for details).
+%
+% The option \opt{titletext} will automatically also set \opt{marktext} to
+% its value, if \opt{marktext} is not given, but not otherwise, regardless
+% which option comes first. So if a long text is set with \opt{titletext},
+% it is recommended to also use \opt{marktext} to set a shorter text suitable
+% for the headers. Of course, if \opt{mark} is set to \choice{keep}, this is
+% not necessary.
+%
+% \DescribeOpt{titleskip}
+% With \opt{titleskip} the distance between the notes title and the notes area
+% can be set. The value can be everything accepted as a length by \TeX. The default
+% is 0pt. For the default title style this is ok, because |\section*| adds some
+% space after the title. But for the title style \choice{text} it is recommended
+% to set a \opt{titleskip} greater then 0pt.
+%
+% \DescribeOpt{titlenotesfill}
+% If the boolean \opt{titlenotesfill} is set to \choice{true}, a |\vfill| will be
+% inserted between notes title and notes area, moving the latter to the bottom
+% of the page. The default is \choice{false}.
+%
+% Most of the provided notes styles always use the whole remaining space of a page,
+% so the option is of no use for them. The exception is the notes style \choice{text},
+% which has the height of the text. But this option would move the text to the end
+% of the page. It may be useful for a custom notes style, which doesn't use all
+% the available space, and the notes area should be moved down to the end
+% of the page.
+%
+% \DescribeOpt{notestext}
+% With \opt{notestext} an arbitrary text can be chosen as a new text for the
+% notes style \choice{text}. If the text contains more then one word, it is
+% recommended to put the text in braces, e.g.\ |notestext={This page is empty.}|.
+% If the text contains a comma (``,'') or an equality sign (``=''), it must be
+% given in braces! The default is |\npnotestext|, which is ``This page is
+% intentionally left blank.'' without \pkg{babel} or language dependend with
+% \pkg{babel} (see \autoref{sec:babel} for details).
+%
+% \DescribeOpt{notestextalign}
+% With \opt{notestextalign} the horizontal alignement for the text of the notes
+% style \opt{text} can be choosen. Possible are \choice{right}, \choice{left},
+% \choice{center}, and \choice{none}. The default is \choice{center}.
+%
+% For \choice{none} no alignement is set. Thus the text is aligned the same as
+% normal text in the document.
+%
+% Vertical alignment can be done using the option \opt{titleskip}. For the notes
+% style \choice{text} is is also inserted, if the title style is \choice{none}.
+%
+% \DescribeOpt{mark}
+% With \opt{mark} the way the notes title is put into the header can be chosen.
+% Possible are \choice{both}, \choice{right}, \choice{left}, and \choice{keep}.
+% The default is \choice{both}.
+%
+% For \choice{both}, \choice{right}, and \choice{left} the command |\markboth|
+% is used, but for \choice{right} and \choice{left} the original mark is set for
+% the other side. With the choice \choice{keep} the headers are not changed.
+%
+% Note, in order to get the header marks right, it is necessary to run
+% \LaTeX\ twice.
+%
+% \DescribeOpt{marktext}
+% The option \opt{marktext} can be used the set an arbitrary text for the
+% headers, which differs from the notes title. The latter is the default.
+% Here too, the text should be given in braces if it contains more then one word
+% and it must be given in braces, if it contains a comma (``,'') or an equality
+% sign (``='').
+%
+% Note, if \opt{notestitle} is given locally, it will also set \opt{marktext}
+% locally. Therefore, if both texts should be different, both options must be
+% used.
+%
+% \DescribeOpt{markuppercase}
+% If the option \opt{markuppercase} is used, the text for the header marks set by
+% a notes page is converted to upper case letters. The default depends on the
+% class used. For the standard classes and \pkg{memoir} the option is set to
+% \choice{true}, for others to \choice{false}.
+%
+% ^^A-------------------------
+% \subsubsection{Options for \texttt{\bs notespages}}
+% \label{sec:optmultiple}
+% The following options are only used by |\notespages| to determie the number of
+% notes pages to be inserted.
+%
+% \DescribeOpt{multiple}
+% With \opt{multiple} the number of pages, the total number of pages of a
+% document (so far) should be a multiple of, can be defined. For example, with
+% |multiple=4|, |\notepages| will insert enough pages to make the total number of
+% pages (so far) 4, 8, 12, 16, 20 and so on. The value can be in the range from
+% 1 to 100. If the given number is below or above that, a warning will be given
+% and the value will be set to either the minimum or maximum respectively. The
+% default is 4.
+%
+% \DescribeOpt{minpages}
+% With \opt{minpages} the minimum number of notes pages to be inserted can be
+% defined. For example, with |multiple=4|, |minpages=1| and |\notespages| appearing
+% on (the not empty) page 20, one page will be added to fulfill the minimum and
+% an additional 3 to make the number of pages a multiple of 4 again, leading to
+% a total of 24 pages. The value can be in the range from 0 to 100. If the given
+% number is below or above that, a warning will be given and the value will be
+% set to either the minimum or maximum respectively. The default is 0.
+%
+% \DescribeOpt{endpages}
+% With \opt{endpages} the number of pages at the end of a document, which are
+% not notes pages, can be defined. For example, the last page of a booklet has to
+% contain contact information and therefore shouldn't be a notes page. By setting
+% |endpages=1| this is taken into account and |\notespages| will fill the document
+% only up to, for example, page 19 instead of 20, thus leaving page 20 free for
+% the desired content. The value can be in the range from 0 to 100. If the given
+% number is below or above that, a warning will be given and the value will be
+% set to either the minimum or maximum respectively. The default is 0.
+%
+% ^^A-------------------------
+% \subsubsection{Options for \texttt{\bs notesfill}}
+% \label{sec:optfill}
+% The following options are only used by |\notesfill|.
+%
+% \DescribeOpt{fillminspace}
+% With \opt{fillminspace} the minimum height for a notes fill can be defined,
+% i.e. if the remaining space on a page is less than the given length, no notes
+% fill will appear. The value can be anything accepted as a length by \TeX. The
+% default is |0.25\textheight|.
+%
+% The value given to the option \opt{filltopskip} is taken into account for the
+% calculation of the remaining space, meaning, it is subtracted from the space
+% left, before the decision is made to insert a notes fill or not.
+%
+% \DescribeOpt{fillmaxspace}
+% With \opt{fillmaxspace} the maximum height for a notes fill can be defined,
+% i.e. if the remaining space on a page is greater than the given length, the
+% height of a notes fill is limited to this length. The value can be anything
+% accepted as a length by \TeX. The default is |\textheight|.
+%
+% \DescribeOpt{filltopskip}
+% With \opt{filltopskip} the distance between the text and the notes title can
+% be defined. The value can be anything accepted as a length by \TeX. The default
+% is 0pt. For the default value of \opt{titlestyle} 0pt is ok, since |\section*|
+% inserts some space before the notes title. But for |titlestyle=text| it is
+% recommended to set a \opt{filltopskip} greater then 0pt.
+%
+% \DescribeOpt{filltopfill}
+% If the boolean \opt{filltopfill} is set to \choice{true}, a |\vfill| will be
+% inserted between the text and the notes title, moving the notes fill to the
+% bottom of the page. The default is \choice{true}. This is useful, if the notes fill
+% is not as high as the remaining space on the page, because it was limited by
+% \opt{fillmaxspace}.
+%
+% ^^A-------------------------
+% \subsubsection{Meta Option}
+% \label{sec:optmeta}
+% Basically meta options are option, which set some or all the options described
+% so far. There are three of them.
+%
+% \DescribeOpt{empty}
+% The option \opt{empty} sets |pagestyle=empty,notesstyle=plain,titlestyle=| |none|,
+% which will lead to totally empty pages.
+%
+% \DescribeOpt{vacant}
+% The option \opt{vacant} sets |pagestyle=empty,notesstyle=text,titlestyle=|
+% |none,titleskip=0.3\textheight|, which will lead to pages with only the text
+% ``This page is intentionally left blank.'' on it at about 1/3 of the height
+% from the top.
+%
+% \DescribeOpt{default}
+% With \opt{default} all options are set back to their default values. This is
+% useful in |\setnotespages| and all |\notes...| commands to get a defined
+% starting point.
+%
+% It is possible to define your own meta option (see \autoref{sec:advanced} for
+% details).
+%
+% ^^A-------------------------
+% \subsubsection{Order of Options}
+% The order of options is important, if one options is given more then once. In
+% this case the last occurence wins. For example, writing
+%
+% \vspace{1ex}
+% \noindent
+% |\notespage[hparts=30,vparts=30,hparts=20]|
+%
+% \vspace{1ex}
+% \noindent
+% will be the same as writing
+%
+% \vspace{1ex}
+% \noindent
+% |\notespage[vparts=30,hparts=20]|,
+%
+% \vspace{1ex}
+% \noindent
+% because \opt{hparts} appeared twice and |hparts=20| overwrote |hparts=30|.
+%
+% This is especially important when using meta options, because they set other
+% option, which would overwrite options given before.
+%
+% ^^A---------------------------------------------
+% \subsection{Advanced commands}
+% \label{sec:advanced}
+% \DescribeMacro\definenotesoption
+% With |\definenotesoption|\marg{newopt}\marg{options} it is possible to define a new meta
+% option \meta{newopt}, which can then be used as an option for the commands described
+% in \autoref{sec:cmd}. For \meta{newopt} only a single word can be used. In \meta{options}
+% all options described so far can be used. For example, with
+%
+% \vspace{1ex}
+% \noindent
+% |\definenotesoption{box}{titlestyle=none,vparts=1,hparts=1}|\\
+% |\notespages[box]|
+%
+% \vspace{1ex}
+% \noindent
+% notes pages with only a box on them could be produced. The command is especially
+% useful, if you want to switch between different layouts occasionally throughout
+% the document.
+%
+% \DescribeMacro\definenotesstyle
+% \DescribeMacro\remainingtextheight
+% \DescribeMacro\notesareatext
+% With |\definenotesstyle|\marg{newnotesstyle}\marg{commands} a new notes style can be
+% defined. After that, \meta{newnotesstyle} can be used as a new choice for the
+% \opt{notesstyle} option and \meta{commands} is used to produce the notes area.
+% For \meta{newnotesstyle} only a single word can be used. For \meta{commands} the length
+% |\remainingtextheight| is available, containing the height remaining on the page
+% usable for the notes area (see \autoref{fig:layoutpage} and \autoref{fig:layoutfill}).
+% And if the notes style should contain the text given to the option \opt{notestext},
+% the macro |\notesareatext| has to be used.
+%
+% For example, after
+%
+% \vspace{1ex}
+% \noindent
+% |\definenotesstyle{yellow}{\color{LightYellow}%|\\
+% |    \rule{\textwidth}{\remainingtextheight}}|
+%
+% \vspace{1ex}
+% \noindent
+% it is possible to get notes pages with a yellow box, covering the whole notes
+% area, by typing
+%
+% \vspace{1ex}
+% \noindent
+% |\notespages[notesstyle=yellow]|
+%
+% \vspace{1ex}
+% \DescribeMacro\definetitlestyle
+% \DescribeMacro\notestitletext
+% With |\definetitlestyle|\marg{newtitlestyle}\marg{commands} a new style for the notes
+% title can be defined. After that, \meta{newnotesstyle} can be used as a new choice
+% for the \opt{titlestyle} option and \meta{commands} is used to produce the notes
+% title. For \meta{newnotesstyle} only single word can be used. For \meta{commands} the
+% command |\notestitletext| has to be used to get the title text set with the
+% option \opt{titletext}. The commands should start with |\noindent|, in order
+% to prevent the indentation done for a first line of a paragraph. And it must
+% end with |\par| to start a new paragraph for the notes area, unless the used
+% commands already contain it somehow (like, e.g.\ |\section*|). For example,
+% after
+%
+% \vspace{1ex}
+% \noindent
+% |\definetitlestyle{boldred}{\noindent\textcolor{red}%|\\
+% |    {\textbf{\notestitletext}}\par}|
+%
+% \vspace{1ex}
+% \noindent
+% it is possible to get a boldface red notes title, by typing
+%
+% \vspace{1ex}
+% \noindent
+% |\notespages[titlestyle=boldred]|
+%
+% \vspace{1ex}
+% Please note, the styles or options defined with the commands described here,
+% must have been defined before they can be used. It is recommended to use these
+% commands only in the preamble.
+%
+% \DescribeMacro\nppatchchapter
+% With |\nppatchchapter|\marg{options} the command |\chapter| is patched, so it
+% works as if one writes |\notespages[|\meta{options}|]| followed by |\chapter|.
+% By this, the occasional empty page before a new chapter is converted into a
+% notes page.
+%
+% It is recommended to add at least |multiple=2|. Otherwise there may be
+% up to three notes pages before a new chapter (with the default value). If other
+% notes pages in the document should be formated differently, one can start with
+% the option \opt{default}. If the argument is left empty, the notes page will
+% be formated with the current settings (the defaults, the package options, or
+% the last options set with |\setnotespages|).
+%
+% This macro should not be used, if the class uses the option \opt{openany},
+% because it will suppress the effect of this class option. Packages redefining
+% |\chapter| must be loaded before |\nppatchchapter| is used, otherwise it may
+% not be effective.
+%
+% The |\chapter| command is only patched, if it exists, so no errors will occur
+% for a class without it.
+%
+% ^^A---------------------------------------------
+% \subsection{Supporting Babel}
+% \label{sec:babel}
+% \DescribeMacro\npnotesname
+% The \NP\ package defines the macro |\npnotesname| to contain the default title
+% ``Notes''. If \pkg{babel} is used, commands will be added to redefine |\npnotesname|
+% to the appropriate translation for the chosen language (if available).
+%
+% \DescribeMacro\npnotestext
+% Also, \NP\ defines the macro |\npnotestext| to contain the default text
+% ``This page is intentionally left blank.'', which will be redefined to the
+% appropriate translation, if \pkg{babel} is used.
+%
+% Currently, only the languages English (english, USenglish, american, UKeng\-lish,
+% british, canadian, australian, newzealand), French (french, francais, canadien,
+% acadian), and German (austrian, german, germanb, ngerman, naustrian) are supported.
+% Additional languages will be supported as users provide a translation for the
+% word ``Notes'' (plural of note, as in ``make a note'', German: ``Notizen'') and
+% the sentence ``This page is intentionally left blank.'' (German: ``Diese Seite
+% wurde absichtlich leer gelassen.''; French: ``Cette page est laiss\'{e}e
+% intentionnellement vide.'').
+%
+% Until then, you can put
+%
+% \vspace{1ex}
+% \noindent
+% |\addto{\extras|\meta{yourlang}|}{\def\npnotesname|\marg{``Notes'' translated}|%|\\
+% |  \def\npnotestext|\marg{``This page ...'' translated}|}|
+%
+% \vspace{1ex}
+% \noindent
+% in the preamble of a multilingual document. For documents in one language one
+% could simply put
+%
+% \vspace{1ex}
+% \noindent
+% |\setnotespages{titletext=|\marg{``Notes'' translated}|,notestext=|\\
+% |  |\marg{``This page ...'' translated}|}|
+%
+% \vspace{1ex}
+% \noindent
+% in the preamble. But this would be overwritten, if the option \opt{default} is
+% used. To circumvent this, one can redefine the macros |\npnotesname|
+% and |\npnotestext| instead:
+%
+% \vspace{1ex}
+% \noindent
+% |\renewcommand{\npnotesname}|\marg{``Notes'' translated}\\
+% |\renewcommand{\npnotestext}|\marg{``This page ...'' translated}
+%
+% ^^A---------------------------------------------
+% \subsection{Supporting Color}
+% \label{sec:color}
+% The \NP\ package uses the colors \textsf{NotesHColor}, \textsf{NotesVColor},
+% and \textsf{NotesTextColor} for horizontal and vertical lines and the text
+% in the notes area of notes style \choice{text}. They are defined in the
+% |\AtBeginDocument| hook, but only, if the package \pkg{color} or \pkg{xcolor}
+% is loaded and the colors where not defined yet. This way, it is possible to
+% define them with your own settings in the preamble. The default for all colors
+% is |{gray}{0.7}|.
+% 
+% ^^A---------------------------------------------
+% \subsection{Warnings and Errors}
+% There are 7 package warnings for the options. In most cases wrong values will
+% be set to a resonable value, so compiling the document will work. But of course
+% the result won't be as expected.
+%
+% If one of the keys is already defined, an error message will be given out.
+% There are two possible reasons for this: a) another package uses the same key
+% or b) \NP\ was loaded twice.
+%
+% If for a number or a length something illegal is given, there will be the usual
+% error messages from \TeX.
+%
+% If for a choice key an undefined value is given, there will be an error message
+% from the \pkg{xkeyval} package.
+%
+% Another Warning will be given out, if \LaTeX\ should be run again in order to
+% get saving and restoring header marks correct.
+%
+% ^^A--------------------------------------------------------------------------
+% \section{Example File}
+% \label{sec:example}
+% Since examples for the \NP\ package would fill this document with a lot of
+% pages, they are outsourced to an example file \texttt{np-test.tex} provided with
+% this package. But beware, the resulting file will be very long. The file also
+% contains some examples for defining own title styles and notes styles.
+%
+% ^^A--------------------------------------------------------------------------
+% \section{Restrictions}
+% \label{sec:restrictions}
+% The only known restriction applies to |\notesfill|s. If there are bottom floats
+% or footnotes on the page, they will appear below it. This is shown in the example
+% file. Fixing this, will be at least difficult, as it may require rewriting or
+% patching the output routine. And there are many reasons not doing this.
+%
+% Of course, there may be other restrictions or incompatibility with some packages,
+% but none were noticed with the packages used for the example file.
+% 
+% ^^A--------------------------------------------------------------------------
+% \section{Testing}
+% The example file (see \autoref{sec:example}) was also used for testing. It was
+% compiled several times with different lines commented out. Please refer to the
+% comments in the example for further information.
+%
+% ^^A--------------------------------------------------------------------------
+% \section{ToDo}
+% There is just two items on the todo list:
+% \begin{itemize}
+% \item add support for other languages, as translations drop in, and
+% \item find a way to circumvent the restriction described in \autoref{sec:restrictions}
+%     (if feasible).
+% \end{itemize}
+% If there are good ideas for additional features from users, I may add them
+% to the todo list. And of course, reported bugs will be added.
+%
+% ^^A--------------------------------------------------------------------------
+% \StopEventually{\newpage\PrintIndex}
+% ^^A \PrintChanges}
+%
+% ^^A--------------------------------------------------------------------------
+% \newpage
+% \section{The Code}
+% \subsection{The Usual}
+% First the usual things.
+%    \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{notespages}[\filedate\space
+    v\fileversion\space filling documents, so the total number of pages
+    is a multiple of a given number]
+%    \end{macrocode}
+%
+% ^^A---------------------------------------------
+% \subsection{Loading required packages}
+% The only package required by \NP\ is \pkg{xkeyval} to process the options of
+% the package and the commands.
+%    \begin{macrocode}
+\RequirePackage{xkeyval}
+%    \end{macrocode}
+%
+% ^^A---------------------------------------------
+% \subsection{``Variables''}
+% \subsubsection{``Variables'' useful for the user}
+% \begin{macro}{\npnotesname}
+% First, |\npnotesname| is set to its default.
+%    \begin{macrocode}
+\newcommand*{\npnotesname}{Notes}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\npnotestext}
+% And then the default for |\npnotestext| is set.
+%    \begin{macrocode}
+\newcommand*{\npnotestext}{This page is intentionally left blank.}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\remainingtextheight}
+% This dimen will hold the height remaining on a page for the notes area.
+% But first, it is checked, if the name is already defined.
+%    \begin{macrocode}
+\newcommand*{\remainingtextheight}{}
+\newdimen\remainingtextheight
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\notestitletext}
+% This macro will hold the value given to the option \opt{titletext}. It should
+% be used for defining a custom title style with |\definetitlestyle|, in order
+% to get the title given with the \opt{titletext} option.
+%    \begin{macrocode}
+\newcommand*{\notestitletext}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\notesareatext}
+% This macro will hold the value given to the option \opt{notestext}. It can be
+% used for own notes styles, if they should contain the text.
+%    \begin{macrocode}
+\newcommand*{\notesareatext}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{``Variables'' for \texttt{\bs notespage}}
+% \begin{macro}{\np at startnotes}
+% This macro will hold the value given to the option \opt{startnotes}.
+%    \begin{macrocode}
+\newcommand*{\np at startnotes}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at pagestyle}
+% This macro will hold the value given to the option \opt{pagestyle}.
+%    \begin{macrocode}
+\newcommand*{\np at pagestyle}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at notesstyle}
+% This macro will hold the value given to the option \opt{notesstyle}.
+%    \begin{macrocode}
+\newcommand*{\np at notesstyle}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at titlestyle}
+% This macro will hold the value given to the option \opt{titlestyle}.
+%    \begin{macrocode}
+\newcommand*{\np at titlestyle}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at titleskip}
+% This dimen will be set to the length given to the option \opt{titleskip}.
+%    \begin{macrocode}
+\newcommand*{\np at titleskip}{}
+\newdimen\np at titleskip
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at notesalign}
+% This macro will hold the value given to the option \opt{notestextalign}.
+%    \begin{macrocode}
+\newcommand*{\np at notesalign}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at mark}
+% This macro will hold the value given to the option \opt{mark}.
+%    \begin{macrocode}
+\newcommand*{\np at mark}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at marktext}
+% This macro will hold the value given to the option \opt{marktext}.
+%    \begin{macrocode}
+\newcommand*{\np at marktext}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at hparts}
+% This counter will be set to the number given to the option \opt{hparts}.
+%    \begin{macrocode}
+\newcommand*{\np at hparts}{}
+\newcount\np at hparts
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at vparts}
+% This counter will be set to the number given to the option \opt{vparts}.
+%    \begin{macrocode}
+\newcommand*{\np at vparts}{}
+\newcount\np at vparts
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at height}
+% In the commands for the notes styles \choice{lines} and \choice{grid} this dimen
+% will be set to the distance between two horizontal lines.
+%    \begin{macrocode}
+\newcommand*{\np at height}{}
+\newdimen\np at height
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at width}
+% In the commands for the notes styles \choice{vlines} and \choice{grid} this dimen
+% will be set to the distance between two vertical lines.
+%    \begin{macrocode}
+\newcommand*{\np at width}{}
+\newdimen\np at width
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at save@marks at tokens}
+% This token register is used to save the original marks for the header, so they
+% can be changed and later restored.
+%    \begin{macrocode}
+\newcommand*{\np at save@marks at tokens}{}
+\newtoks\np at save@marks at tokens
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifnp at marktext@set}
+% \begin{macro}{\np at marktext@setfalse}
+% \begin{macro}{\np at marktext@settrue}
+% This boolean is used to prevent the option \opt{titletext} from also setting
+% \opt{marktext} in case the latter option was already given in the current key
+% list. It is initialised to false.
+%    \begin{macrocode}
+\newcommand*{\ifnp at marktext@set}{}
+\newif\ifnp at marktext@set\np at marktext@setfalse
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ifnp at mark@new}
+% \begin{macro}{\np at mark@newfalse}
+% \begin{macro}{\np at mark@newtrue}
+% This boolean is used to generate a warning, if new notes pages were inserted
+% and therefore \LaTeX\ should be run again. It is initialised to false.
+%    \begin{macrocode}
+\newcommand*{\ifnp at mark@new}{}
+\newif\ifnp at mark@new\np at mark@newfalse
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ifnp at std@class}
+% \begin{macro}{\np at std@classfalse}
+% \begin{macro}{\np at std@classtrue}
+% This boolean is set to true, if a standard class or \pkg{memoir} was loaded.
+% It is initialised depending on the used class. Currently this boolean is only
+% used to set the default for the option \opt{markuppercase}.
+%    \begin{macrocode}
+\newcommand*{\ifnp at std@class}{}
+\newif\ifnp at std@class\np at std@classfalse
+\@ifclassloaded{article}{\np at std@classtrue}{}
+\@ifclassloaded{report}{\np at std@classtrue}{}
+\@ifclassloaded{book}{\np at std@classtrue}{}
+\@ifclassloaded{memoir}{\np at std@classtrue}{}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{``Variables'' for \texttt{\bs notespages}}
+% \begin{macro}{\np at minpages}
+% This counter will be set to the number given to the option \opt{minpages}.
+%    \begin{macrocode}
+\newcommand*{\np at minpages}{}
+\newcount\np at minpages
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at endpages}
+% This counter will be set to the number given to the option \opt{endpages}.
+%    \begin{macrocode}
+\newcommand*{\np at endpages}{}
+\newcount\np at endpages
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at multiple}
+% This counter will be set to the number given to the option \opt{multiple}.
+%    \begin{macrocode}
+\newcommand*{\np at multiple}{}
+\newcount\np at multiple
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at notepages}
+% This counter will hold the number of notes pages, which have to be inserted by
+% |\notespages|. It is decremented after every page.
+%    \begin{macrocode}
+\newcommand*{\np at notepages}{}
+\newcount\np at notepages
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifnp at started@on at new@page}
+% \begin{macro}{\np at started@on at new@pagefalse}
+% \begin{macro}{\np at started@on at new@pagetrue}
+% In |\notespages| this boolean is set to true, if the command started on a new
+% page. It is needed to calculate the number of pages to be inserted.
+%    \begin{macrocode}
+\newcommand*{\ifnp at started@on at new@page}{}
+\newif\ifnp at started@on at new@page
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{``Variables'' for \texttt{\bs notesfill}}
+% \begin{macro}{\np at fill@minspace}
+% This dimen is set to the length given to the option \opt{fillminspace}.
+%    \begin{macrocode}
+\newcommand*{\np at fill@minspace}{}
+\newdimen\np at fill@minspace
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at fill@maxspace}
+% This dimen is set to the length given to the option \opt{fillmaxspace}.
+%    \begin{macrocode}
+\newcommand*{\np at fill@maxspace}{}
+\newdimen\np at fill@maxspace
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at fill@topskip}
+% This dimen is set to the length given to the option \opt{filltopskip}.
+%    \begin{macrocode}
+\newcommand*{\np at fill@topskip}{}
+\newdimen\np at fill@topskip
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Temporary ``Variables''}
+% \begin{macro}{\np at tempcnta}
+% \begin{macro}{\np at tempcntb}
+% \begin{macro}{\np at tempdima}
+% \begin{macro}{\np at tempa}
+% These three registers and the macro are used as temporary variables in some
+% commands.
+%    \begin{macrocode}
+\newcommand*{\np at tempcnta}{}
+\newcount\np at tempcnta
+\newcommand*{\np at tempcntb}{}
+\newcount\np at tempcntb
+\newcommand*{\np at tempdima}{}
+\newdimen\np at tempdima
+\newcommand*{\np at tempa}{}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{Options}
+% \subsubsection{Checking numbers}
+% \begin{macro}{\np at check@num at range}
+% This command checks the range of a number given to some options. If the number
+% is too small or too large, a warning is given out and the number is set to either
+% the minimum or maximum respectively. The parameters are |#1| the name of option,
+% |#2| the counter containing the number to check, |#3| the minimum, and |#4| the
+% maximum.
+%    \begin{macrocode}
+\newcommand*{\np at check@num at range}[4]{\relax
+  \ifnum#2<#3\relax
+    \PackageWarning{notespages}{%
+      Value for #1 to small, set to #3\MessageBreak}#2=#3\relax
+  \else\ifnum#2>#4\relax
+    \PackageWarning{notespages}{%
+      Value for #1 to large, set to #4\MessageBreak}#2=#4\relax
+  \fi\fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Error message for already defined option}
+% \begin{macro}{\np at err@defined}
+% This command gives out an error for already defined keys. This is checked before
+% defining keys. There are two possible reasons for this: a) another package uses
+% the same family and the same key or b) \NP\ was loaded twice.
+%    \begin{macrocode}
+\newcommand*{\np at err@defined}[1]{%
+  \PackageError{notespages}%
+    {Key #1 is already defined.\MessageBreak}%
+    {The key #1 may have been defined by some other package\MessageBreak
+     or the NotesPages package was loaded twice.}}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Options for \texttt{\bs notespage}}
+% \label{sec:optnotespage}
+% \begin{option}{startnotes}
+% The key is used to define, if a notes page should be started with |\newpage| or
+% |\clearpage|. It stored the value in |\np at startnotes|. Before defining the key
+% it is checked, if the key already exists. If so, an error is given out.
+%    \begin{macrocode}
+\key at ifundefined{np}{startnotes}{}{\np at err@defined{startnotes}}
+\define at choicekey{np}{startnotes}[\np at startnotes]%
+  {clearpage,newpage}[clearpage]{}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{allowfloats}
+% The boolean key is used decide if floats may appear on a notes page started with
+% |startnotes=newpage|. The default is set to \choice{true} here so it's possible
+% to just give the option without a value. It will later be set to it's real default
+% \choice{false} by initialising the keys.
+%    \begin{macrocode}
+\key at ifundefined{np}{allowfloats}{}{\np at err@defined{allowfloats}}
+\define at boolkey{np}{allowfloats}[true]{}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{pagestyle}
+% The key is used to define the page style for a notes page. The value given is
+% stored in |\np at pagestyle|. After that, it is tested, if the given pagestyle is
+% defined. If not, a warning is given out and the default is set.
+%    \begin{macrocode}
+\key at ifundefined{np}{pagestyle}{}{\np at err@defined{pagestyle}}
+\define at cmdkey{np}[np@]{pagestyle}[current]{%
+  \def\np at tempa{current}\ifx\np at tempa\np at pagestyle\else
+    \@ifundefined{ps@#1}{%
+      \PackageWarning{notespages}{%
+        `#1' is not a valid pagestyle, set to default\MessageBreak}%
+      \def\np at pagestyle{current}}{}\fi}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{notesstyle}
+% The key is used to define the style for the notes area. The value given is
+% stored in |\np at notesstyle|.
+%    \begin{macrocode}
+\key at ifundefined{np}{notesstyle}{}{\np at err@defined{notesstyle}}
+\define at choicekey{np}{notesstyle}[\np at notesstyle]%
+  {plain,lines,vlines,grid,text}[grid]{}
+%    \end{macrocode}
+% \end{option}
+% \begin{macro}{\np at notesstyle@nominations}
+% In order to make the choices expandable, the list is stored here.
+%    \begin{macrocode}
+\newcommand*{\np at notesstyle@nominations}{plain,lines,vlines,grid,text}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at def@notesstyle at key}
+% And with this command the option \opt{notesstyle} can be redifined with a new
+% list of choices. The command is first defined with |\newcommand| to ensure it is
+% not defined yet. The command is later used in |\definenotesstyle| (see
+% \autoref{sec:newnotesstyle}).
+%    \begin{macrocode}
+\newcommand*{\np at def@notesstyle at key}{}
+\def\np at def@notesstyle at key#1\np at end{%
+  \define at choicekey{np}{notesstyle}[\np at notesstyle]{#1}[grid]{}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{option}{titlestyle}
+% The key is used to define the style for the notes title. The value given is
+% stored in |\np at titlestyle|. But first the command |\minisec| is checked, so the
+% choice \choice{minisec} is only added, if the command exists.
+% \begin{macro}{\np at titlestyle@nominations}
+% Also, in order to make the choices expandable, the list is stored here.
+%    \begin{macrocode}
+\key at ifundefined{np}{titlestyle}{}{\np at err@defined{titlestyle}}
+\@ifundefined{minisec}{%
+  \define at choicekey{np}{titlestyle}[\np at titlestyle]%
+    {none,text,section,subsection,subsubsection}[section]{}%
+  \newcommand*{\np at titlestyle@nominations}%
+    {none,text,section,subsection,subsubsection}}{%
+  \define at choicekey{np}{titlestyle}[\np at titlestyle]%
+    {none,text,section,subsection,subsubsection,minisec}[section]{}%
+  \newcommand*{\np at titlestyle@nominations}%
+    {none,text,section,subsection,subsubsection,minisec}}
+%    \end{macrocode}
+% \end{macro}
+% \end{option}
+% \begin{macro}{\np at def@titlestyle at key}
+% And with this command the option \opt{titlestyle} can be redifined with a new
+% list of choices. The command is first defined with |\newcommand| to ensure it is
+% not defined yet. The command is later used in |\definetitlestyle| (see
+% \autoref{sec:newtitlestyle}).
+%    \begin{macrocode}
+\newcommand*{\np at def@titlestyle at key}{}
+\def\np at def@titlestyle at key#1\np at end{%
+  \define at choicekey{np}{titlestyle}[\np at titlestyle]{#1}[section]{}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{option}{titletext}
+% The key is used to define a new text for the notes title. The value given is
+% stored in |\notestitletext|. The callback also sets |\np at marktext| to the same
+% value, if \opt{marktext} wasn't used so far.
+%    \begin{macrocode}
+\key at ifundefined{np}{titletext}{}{\np at err@defined{titletext}}
+\define at key{np}{titletext}[\npnotesname]%
+  {\ifnp at marktext@set\else\def\np at marktext{#1}\fi
+    \def\notestitletext{#1}}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{titleskip}
+% The key is used to define the distance between the notes title and the notes
+% area. The length given is stored in |\np at titleskip|.
+%    \begin{macrocode}
+\key at ifundefined{np}{titleskip}{}{\np at err@defined{titleskip}}
+\define at key{np}{titleskip}[0pt]{\np at titleskip=#1}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{titlenotesfill}
+% This key is used to decide, if a |\vfill| should be added between notes title
+% and notes area. Again, \choice{true} is set as the default here to make it
+% possible to use the option without a value. The real default is set during
+% initialisation.
+%    \begin{macrocode}
+\key at ifundefined{np}{titlenotesfill}{}{\np at err@defined{titlenotesfill}}
+\define at boolkey{np}{titlenotesfill}[true]{}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{notestext}
+% The key is used to define a new text for the notes style \choice{text}. The value
+% given is stored in |\notesareatext|.
+%    \begin{macrocode}
+\key at ifundefined{np}{notestext}{}{\np at err@defined{notestext}}
+\define at key{np}{notestext}[\npnotestext]{\def\notesareatext{#1}}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{notestextalign}
+% The key is used to set the alignment for the text of the notes style \choice{text}.
+% The value given is stored in |\np at notesalign|.
+%    \begin{macrocode}
+\key at ifundefined{np}{notestextalign}{}{\np at err@defined{notestextalign}}
+\define at choicekey{np}{notestextalign}[\np at notesalign]%
+  {left,right,center,none}[center]{}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{mark}
+% The key is used to select were the notes title should be put in the header. The
+% value given is stored in |\np at mark|.
+%    \begin{macrocode}
+\key at ifundefined{np}{mark}{}{\np at err@defined{mark}}
+\define at choicekey{np}{mark}[\np at mark]{both,right,left,keep}[both]{}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{marktext}
+% With this key an alternative text for the header can be set. The new text is
+% stored in |\np at marktext|. The callback sets |\np at marktext@settrue|, in order
+% to prevent a later occurence of \opt{titletext} to overwrite \opt{marktext}.
+%    \begin{macrocode}
+\key at ifundefined{np}{marktext}{}{\np at err@defined{marktext}}
+\define at cmdkey{np}[np@]{marktext}[\npnotesname]{\np at marktext@settrue}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{markuppercase}
+% This key is used to convert the text for the header marks of a notes pages to
+% upper case letters. The real default is set during initialisation, depending
+% on the class used.
+%    \begin{macrocode}
+\key at ifundefined{np}{markuppercase}{}{\np at err@defined{markuppercase}}
+\define at boolkey{np}{markuppercase}[true]{}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{macro}{\np at init@markuppercase}
+% The macro sets the option \opt{markuppercase} according to the class loaded.
+%    \begin{macrocode}
+\newcommand*{\np at init@markuppercase}{%
+  \ifnp at std@class
+    \setkeys{np}{markuppercase=true}%
+  \else
+    \setkeys{np}{markuppercase=false}%
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{option}{hparts}
+% With this key the number of horizontal parts is defined. The number is stored in
+% |\np at hparts| and then the range is checked.
+%    \begin{macrocode}
+\key at ifundefined{np}{hparts}{}{\np at err@defined{hparts}}
+\define at key{np}{hparts}[25]%
+  {\np at hparts=#1\np at check@num at range{hparts}{\np at hparts}{1}{200}}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{vparts}
+% With this key the number of vertical parts is defined. The number is stored in
+% |\np at vparts| and then the range is checked.
+%    \begin{macrocode}
+\key at ifundefined{np}{vparts}{}{\np at err@defined{vparts}}
+\define at key{np}{vparts}[0]%
+  {\np at vparts=#1\np at check@num at range{vparts}{\np at vparts}{0}{300}}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{usenotesareaheight}
+% With this key the height of a vertical part can be based on the height of the
+% notes area (|\remainingtextheight|) instead of |\textheight|. Here too, true
+% is set as the default to make it possible to use the option without a value.
+% The real default is set during initialisation.
+%    \begin{macrocode}
+\key at ifundefined{np}{usenotesareaheight}{}%
+  {\np at err@defined{usenotesareaheight}}
+\define at boolkey{np}{usenotesareaheight}[true]{}
+%    \end{macrocode}
+% \end{option}
+%
+% ^^A-------------------------
+% \subsubsection{Options for \texttt{\bs notespages}}
+% \begin{option}{multiple}
+% With this key the number, the total number of pages of a document (so far) should
+% be dividable by, is defined. The number is stored in |\np at multiple| and then the
+% range is checked.
+%    \begin{macrocode}
+\key at ifundefined{np}{multiple}{}{\np at err@defined{multiple}}
+\define at key{np}{multiple}[4]%
+  {\np at multiple=#1\np at check@num at range{multiple}{\np at multiple}{1}{100}}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{minpages}
+% With this key the minimum number of notes pages to be given out is defined. The
+% number is stored in |\np at minpages| and then the range is checked.
+%    \begin{macrocode}
+\key at ifundefined{np}{minpages}{}{\np at err@defined{minpages}}
+\define at key{np}{minpages}[0]%
+  {\np at minpages=#1\np at check@num at range{minpages}{\np at minpages}{0}{100}}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{endpages}
+% With this key the number of pages, which will appear after the notes pages,
+% is defined. The number is stored in |\np at endpages| and then the range is
+% checked.
+%    \begin{macrocode}
+\key at ifundefined{np}{endpages}{}{\np at err@defined{endpages}}
+\define at key{np}{endpages}[0]%
+  {\np at endpages=#1\np at check@num at range{endpages}{\np at endpages}{0}{100}}
+%    \end{macrocode}
+% \end{option}
+%
+% ^^A-------------------------
+% \subsubsection{Options for \texttt{\bs notesfill}}
+% \begin{option}{fillminspace}
+% With this key the the minimum space is defined, which has to be left on a page
+% to insert a notes fill. The length is stored in |\np at fill@minspace|.
+%    \begin{macrocode}
+\key at ifundefined{np}{fillminspace}{}{\np at err@defined{fillminspace}}
+\define at key{np}{fillminspace}[0.25\textheight]{\np at fill@minspace=#1}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{fillmaxspace}
+% With this key the maximum height of a notes fill is defined. The length is
+% stored in |\np at fill@maxspace|.
+%    \begin{macrocode}
+\key at ifundefined{np}{fillmaxspace}{}{\np at err@defined{fillmaxspace}}
+\define at key{np}{fillmaxspace}[\textheight]{\np at fill@maxspace=#1}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{filltopskip}
+% With this key the distance between the text and the notes fill is defined. The
+% length is stored in |\np at fill@topskip|.
+%    \begin{macrocode}
+\key at ifundefined{np}{filltopskip}{}{\np at err@defined{filltopskip}}
+\define at key{np}{filltopskip}[0pt]{\np at fill@topskip=#1}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{filltopfill}
+% This key is used to decide, if a |\vfill| should be added between the text and
+% notes title of a notes fill.
+%    \begin{macrocode}
+\key at ifundefined{np}{filltopfill}{}{\np at err@defined{filltopfill}}
+\define at boolkey{np}{filltopfill}[true]{}
+%    \end{macrocode}
+% \end{option}
+%
+% ^^A-------------------------
+% \subsubsection{Meta option}
+% \begin{option}{empty}
+% This option sets all necessary keys to the values needed to produce completely
+% empty notes pages.
+%    \begin{macrocode}
+\key at ifundefined{np}{empty}{}{\np at err@defined{empty}}
+\define at key{np}{empty}[]{\setkeys{np}{%
+  pagestyle=empty,notesstyle=plain,titlestyle=none}}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{vacant}
+% This option sets all necessary keys to the values needed to produce notes pages
+% with only the text given to the option \opt{notetext}.
+%    \begin{macrocode}
+\key at ifundefined{np}{vacant}{}{\np at err@defined{vacant}}
+\define at key{np}{vacant}[]{\setkeys{np}{pagestyle=empty,
+  notesstyle=text,titlestyle=none,titleskip=0.3\textheight}}
+%    \end{macrocode}
+% \end{option}
+%
+% \begin{option}{default}
+% This option sets all keys back to their default values. Since \pkg{xkeyval} sets
+% the default value, if no value in given, most options don't have values here.
+% Just some boolean options are set to \choice{false}. The option \opt{markuppercase}
+% is set with |\np at init@markuppercase|, thus depending on the class loaded. 
+%    \begin{macrocode}
+\key at ifundefined{np}{default}{}{\np at err@defined{default}}
+\define at key{np}{default}[]{\setkeys{np}{%
+  startnotes,allowfloats=false,pagestyle,notesstyle,
+  titlestyle,titletext,titleskip,titlenotesfill=false,
+  notestext,notestextalign,
+  mark,marktext,
+  hparts=25,vparts=0,usenotesareaheight=false,
+  minpages,endpages,multiple=4,
+  fillminspace,fillmaxspace,filltopskip,filltopfill}%
+  \np at init@markuppercase}
+%    \end{macrocode}
+% \end{option}
+%
+% ^^A-------------------------
+% \subsubsection{Initialisation}
+% The keys are now initialised, i.e.\ set to thier defaults. After that, the
+% options passed on loading are processed.
+%    \begin{macrocode}
+\setkeys{np}{default}
+\ProcessOptionsX<np>
+%    \end{macrocode}
+%
+% ^^A---------------------------------------------
+% \subsection{Commands}
+% \subsubsection{Header marks}
+% Changing and restoring the header marks works as follows: first the original
+% marks are saved with |\np at savemark|. Then the header marks for the notes page
+% are set with |\np at setmark|. And finally, the original header makrs are restored
+% with |\np at restoremark|.
+%
+% But there are several conditions to that:
+% \begin{enumerate}
+% \item The original header marks can only be saved on the first notes page of
+%       a group of successive notes pages, regardless if they where generated
+%       with one |\notespages| command or several |\notespage| or |\notespages|
+%       commands. If done on following pages, this would overwrite the already
+%       saved original header marks.
+% \item Saving, setting, and restoring the header marks should only be done
+%       if necessary, i.e. if \opt{mark} is not \choice{keep}.
+% \item Setting the header marks can be done on every notes page, but of course
+%       only according to the value given to \opt{mark}.
+% \item When setting only the left or the right mark, for the other the original
+%       mark must be set, so in case the value for \opt{mark} is changed on
+%       successive notes pages, the marks don't mixed up. 
+% \item Restoring the original header marks can only be done on the last of a
+%       group of successive notes pages. Otherwise, this would mix up the header
+%       marks.
+% \item All |\mark...| commands always set both marks, |\markright| just sets
+%       the current other mark again (stored in \LaTeX{}s |\@themark|).
+% \item The left mark must not be restored on the notes page, because |\botmark|
+%       is used for this. This would result in the restored left mark on the last
+%       notes page.
+% \item The right mark must be restored before the page after the last notes page,
+%       because here |\firstmark| is used. Otherwise, a new section after the notes
+%       page would not reflect in the header.
+% \end{enumerate}
+%
+% The first condition could easily be met with a simple flag, but for condition 5
+% it is necessary to look ahead. Therefore, some information is written to the
+% |.aux| file for every notes page, where \opt{mark} is not \choice{keep}. When
+% the file is reread at the end of the document, these informations will be written
+% to a file |\jobname.npm|. The latter is then read in |\AtBeginDocument| during
+% the second \LaTeX\ run, defining special macros for each notes page. These macros
+% are then used to look back and ahead to meet conditions 1 and 5.
+%
+% The last three conditions result is a conflict. Due to condition 6, regarding
+% condition 7 would violate condition 8 and vice versa. This problem is solved
+% by setting a mark in the form |\ifnum| \meta{page number after notes page} $=$
+% \meta{current page number} \meta{original left mark} |\else| \meta{left mark
+% for notes page} |\fi| on the last notes page.
+%
+% \begin{macro}{\npnpinfo}
+% The macro |\npnpinfo| is written to the file |\jobname.npm| via the |.aux| file.
+% The argument is the page number of the notes page. It will define a macro
+% |\np at np@info.|\meta{page number}, which will later just be checked
+% for existence to determine, if the previous or next page is a notes page.
+%    \begin{macrocode}
+\newcommand*{\npnpinfo}[1]{%
+  \expandafter\def\csname np at np@info.#1\endcsname{}}
+%    \end{macrocode}
+% \end{macro}
+%
+% The file |\jobname.npm| must be opened in |\AtEndDocument|, so \LaTeX\ can
+% write it while rereading the |.aux| file. The |\nofiles| switch is observed.
+% Here also the warning to rerun \LaTeX\ is given out, if new notes pages were
+% added.
+%    \begin{macrocode}
+\AtEndDocument{\if at filesw\newwrite\tf at npm
+  \immediate\openout\tf at npm\jobname.npm\fi
+  \ifnp at mark@new
+    \PackageWarningNoLine{notespage}{%
+      New notes pages were added.
+      Please rerun LaTeX to get header marks right.}%
+  \fi}
+%    \end{macrocode}
+%
+% \begin{macro}{\tracingnpmarks}
+% For saving, setting, and restoring the header marks, some tracing can be done.
+% By setting the counter |\tracingnpmarks| to a value greater then 0, informations
+% about the reasons for doing or not doing things are stored to the log file. It
+% is switched off by default.
+%    \begin{macrocode}
+\newcommand*{\tracingnpmarks}{}
+\newcount\tracingnpmarks
+\tracingnpmarks\z@
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at tracing@marks}
+% This macro is used for adding the tracing information to the log file if
+% tracing is enabled.
+%    \begin{macrocode}
+\newcommand{\np at tracing@marks}[3]{%
+  \ifnum\tracingnpmarks>\z@
+    \PackageInfo{notespages}{#1 header marks: #2 done\MessageBreak
+      #3\MessageBreak}%
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifnp at page@has at np}
+% \begin{macro}{\np at page@has at nptrue}
+% \begin{macro}{\np at page@has at npfalse}
+% \begin{macro}{\np at page@has at np}
+% This boolean and the macro are used to determine, if a page is a notes page. The
+% page number is given as argument to |\np at page@has at np|.
+%    \begin{macrocode}
+\newcommand*{\ifnp at page@has at np}{}
+\newif\ifnp at page@has at np
+\newcommand*{\np at page@has at np}[1]{%
+  \@ifundefined{np at np@info.#1}%
+    {\np at page@has at npfalse}{\np at page@has at nptrue}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\np at mark@keep}
+% This macro simply checks, if |mark=keep| was given.
+%    \begin{macrocode}
+\newcommand*{\np at mark@keep}{TT\fi
+  \def\np at tempa{keep}\ifx\np at tempa\np at mark}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at savemark}
+% This command saves the current header marks in the token register\linebreak
+% |\np at save@marks at tokens|. But this is only done, if \opt{mark} is not \choice{keep}
+% and the previous page is not a notes page. The messages for tracing are numbered,
+% so it's easier to find the corresponding parts in the code.
+%    \begin{macrocode}
+\newcommand*{\np at savemark}{%
+  \if\np at mark@keep
+    \np at tracing@marks{save}{not}{mark=keep (1)}%
+  \else
+    \np at tempcnta\c at page\advance\np at tempcnta\m at ne
+    \np at page@has at np{\the\np at tempcnta}\ifnp at page@has at np
+      \np at tracing@marks{save}{not}{np on previous page (2)}%
+    \else
+      \np at tracing@marks{save}{}{mark not keep (3)}%
+      \global\np at save@marks at tokens\expandafter{\@themark}%
+    \fi
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% Setting the header marks is not as easy as it seems at first. In order to make
+% it possible to switch between the possible choices on consecutive pages, both
+% header marks must always be set. For \choice{both} this is easily done with
+% |\markboth|. For \choice{left} and \choice{right} it is necessary to set the
+% other mark to the original, because they may have been changed on the page
+% before.
+%
+% \begin{macro}{\np@@markleft}
+% \begin{macro}{\np@@markright}
+% These commands take three arguments, |#1|: the original left header mark, |#2|:
+% the original right header mark, and |#3|: the header mark for the notes page.
+% The latter is used for the appropriate side and for the other the original is
+% used.
+%    \begin{macrocode}
+\newcommand*{\np@@markleft}[3]{\markboth{#3}{#2}}
+\newcommand*{\np@@markright}[3]{\markboth{#1}{#3}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\np at markleft}
+% \begin{macro}{\np@@markright}
+% These commands take the header mark for the notes page as their argument and
+% pass it to |\np@@markleft| or |\np@@markright| together with the original
+% header marks.
+%    \begin{macrocode}
+\newcommand*{\np at markleft}[1]{%
+  \expandafter\np@@markleft\the\np at save@marks at tokens{#1}}
+\newcommand*{\np at markright}[1]{%
+  \expandafter\np@@markright\the\np at save@marks at tokens{#1}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\np at setmark}
+% This command sets the header marks for a notes page depending on the value given
+% to the option \opt{mark}. For the choice \choice{keep} nothing is done, leading
+% to unchanged headers. Additionally, |\np at mark@newtrue| is set, if the notes page
+% is new in this \LaTeX\ run.
+%    \begin{macrocode}
+\newcommand*{\np at setmark}{
+  \if\np at mark@keep
+    \np at tracing@marks{set}{not}{mark=keep (4)}%
+  \else
+    \np at page@has at np{\the\c at page}\ifnp at page@has at np\else
+      \global\np at mark@newtrue
+    \fi
+    \def\np at tempa{both}\ifx\np at tempa\np at mark
+      \np at tracing@marks{set}{}{mark=both (5)}%
+      \ifKV at np@markuppercase
+        \markboth{\MakeUppercase{\np at marktext}}%
+          {\MakeUppercase{\np at marktext}}%
+      \else
+        \markboth{\np at marktext}{\np at marktext}%
+      \fi
+    \else
+      \def\np at tempa{right}\ifx\np at tempa\np at mark
+        \np at tracing@marks{set}{}{mark=right (6)}%
+        \ifKV at np@markuppercase
+          \np at markright{\MakeUppercase{\np at marktext}}%
+        \else
+          \np at markright{\np at marktext}%
+        \fi
+      \else
+        \def\np at tempa{left}\ifx\np at tempa\np at mark
+          \np at tracing@marks{set}{}{mark=left (7)}%
+          \ifKV at np@markuppercase
+            \np at markleft{\MakeUppercase{\np at marktext}}%
+          \else
+            \np at markleft{\np at marktext}%
+          \fi
+        \fi
+      \fi
+    \fi
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at restore@@mark}
+% This macro restores the header marks. It basically works like |\markboth|, but
+% with four arguments. Here |#1| and |#2| are the left and right marks for the notes
+% page and |#3| and |#4| are the original left and right marks. Argument |#2| is
+% not needed, but it can't be avoided. Additionally the counter |\np at tempcnta|
+% has to contain the number of the next page, which is calculated in |\np at restoremark|.
+%
+% \LaTeX{}s |\@themark| is set twice. The first time the left mark is set as an
+% |\if| construct. Then, after |\mark|, |\@themark| is set again, but this time
+% with only the original marks. Without this the |\if| construct would be nested
+% in another one in case a notes page would be followed by normal pages and then
+% a notes page again, without anything setting the left mark, e.g.\ a new chapter.
+%    \begin{macrocode}
+\newcommand*{\np at restore@@mark}[4]{%
+  \begingroup
+    \let\label\relax \let\index\relax \let\glossary\relax
+    \@temptokena {#4}%
+    \unrestored at protected@xdef\@themark{%
+      {\protect\ifnum\the\np at tempcnta=\c at page
+        #3\protect\else #1\protect\fi}%
+      {\the\@temptokena}}%
+    \@temptokena \expandafter{\@themark}%
+    \mark{\the\@temptokena}%
+    \@temptokena {#4}%
+    \unrestored at protected@xdef\@themark{{#3}{\the\@temptokena}}%
+  \endgroup
+  \if at nobreak\ifvmode\nobreak\fi\fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at restore@mark}
+% This macro is only used to get the correct arguments for |\np at restore@@mark|.
+%    \begin{macrocode}
+\newcommand*{\np at restore@mark}[2]{%
+  \expandafter\np at restore@@mark\@themark{#1}{#2}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at restoremark}
+% This command is used to restore the header makrs from before a notes page.
+% It only does this, if \opt{mark} is not \choice{keep} and the next page
+% isn't a notes page.
+%    \begin{macrocode}
+\newcommand*{\np at restoremark}{%
+  \if\np at mark@keep
+    \np at tracing@marks{restore}{not}{mark=keep (8)}%
+  \else
+    \np at tempcnta\c at page\advance\np at tempcnta\@ne
+    \np at page@has at np{\the\np at tempcnta}\ifnp at page@has at np
+      \np at tracing@marks{restore}{not}{np on next page (9)}%
+    \else
+      \np at tracing@marks{restore}{}{(10)}%
+      \expandafter\np at restore@mark\the\np at save@marks at tokens
+    \fi
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Page stuff}
+% \begin{macro}{\np at startnotespage}
+% This macro starts a new page for a notes page by just calling the values given
+% to the option \opt{startnotes} as a command.
+%    \begin{macrocode}
+\newcommand*{\np at startnotespage}{%
+  \expandafter\csname \np at startnotes\endcsname}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at setpagestyle}
+% This macro sets the page style for a notes page by using the value given to the
+% option \opt{pagestyle} as a parameter for |\thispagestyle|, if it is not
+% \choice{current}.
+%    \begin{macrocode}
+\newcommand*{\np at setpagestyle}{%
+  \def\np at tempa{current}\ifx\np at tempa\np at pagestyle\else
+    \thispagestyle{\np at pagestyle}\fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Notes title}
+% \begin{macro}{\np at ts@section}
+% \begin{macro}{\np at ts@subsection}
+% \begin{macro}{\np at ts@subsubsection}
+% \begin{macro}{\np at ts@minisec}
+% \begin{macro}{\np at ts@text}
+% \begin{macro}{\np at ts@none}
+% The following macros just provide the commands for the choices of the option
+% \opt{titlestyle}. For \choice{text} the |\par| at the end is necessary to
+% start a new paragraph for the notes area.
+%    \begin{macrocode}
+\newcommand*{\np at ts@section}{\section*{\notestitletext}}
+\newcommand*{\np at ts@subsection}{\subsection*{\notestitletext}}
+\newcommand*{\np at ts@subsubsection}{\subsubsection*{\notestitletext}}
+\newcommand*{\np at ts@minisec}{\minisec{\notestitletext}}
+\newcommand*{\np at ts@text}{\noindent\notestitletext\par}
+\newcommand*{\np at ts@none}{}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\np at maketitle}
+% This macro calls the macro for the selected notes title style.
+%    \begin{macrocode}
+\newcommand*{\np at maketitle}{\csname np at ts@\np at titlestyle\endcsname}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Remaining height}
+% \begin{macro}{\np at calcheight}
+% This macro calculates the height remaining on the page and stores the result in
+% |\remainingtextheight|. If a page was just started, |\pagegoal| is |\maxdimen|
+% and |\pagetotal| 0pt. If there is already something on the page, like the notes
+% title or the text on a page with a notes fill, it is necessary, to subtract
+% |\lineskip| to get the right height.
+%    \begin{macrocode}
+\newcommand*{\np at calcheight}{%
+  \ifdim\pagegoal=\maxdimen
+    \remainingtextheight\textheight
+  \else
+    \remainingtextheight\pagegoal
+    \advance\remainingtextheight by -\pagetotal
+    \advance\remainingtextheight by -\lineskip
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Dividing dimen by dimen}
+% The following macros are use to divide a dimen register by another dimen
+% register, resulting in a real number as a string in |\np at result|.
+% \begin{macro}{\np at Tc}
+% This is used as a temporary counter.
+%    \begin{macrocode}
+\newcommand*{\np at Tc}{}
+\newcount\np at Tc
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at Zc}
+% This counter is used for the numerator in sp (scaled points) at first and later
+% for computing decimal places. 
+%    \begin{macrocode}
+\newcommand*{\np at Zc}{}
+\newcount\np at Zc
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at Nc}
+% This counter is used for the denominator in sp. It is set to its absolute value
+% and not changed afterwards.
+%    \begin{macrocode}
+\newcommand*{\np at Nc}{}
+\newcount\np at Nc
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at Z}
+% This dimen will hold the numerator in pt. It is set but not changed.
+%    \begin{macrocode}
+\newcommand*{\np at Z}{}
+\newdimen\np at Z
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at N}
+% This dimen will hold the denominator in pt. It is set but not changed.
+%    \begin{macrocode}
+\newcommand*{\np at N}{}
+\newdimen\np at N
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at result}
+% In this macro the result is build as a string without a unit.
+%    \begin{macrocode}
+\newcommand*{\np at result}{}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at calcnextdigit}
+% This macro computes one decimal place of the result. It expects |\np at Tc| to hold
+% the result of the last division and |\np at Zc| the remainder of the nominator
+% multiplied with $10^d$ ($d$: number of decimal places computed so far). Both
+% counters are left prepared for computing the next decimal place.
+%    \begin{macrocode}
+\newcommand*{\np at calcnextdigit}{%
+  \multiply\np at Tc\np at Nc
+  \advance\np at Zc-\np at Tc
+  \multiply\np at Zc10\relax
+  \np at Tc\np at Zc
+  \divide\np at Tc\np at Nc
+  \xdef\np at result{\np at result\number\np at Tc}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at divide}
+% This macro does the divison. First, |\np at result|, |\np at Zc|, and |\np at Nc| are
+% initialised. Then the counters are set to their absolute values and, if necessary,
+% a minus sign is added to the result. Because\TeX\ interprets ``$--$'' as ``$+$'',
+% it can be done for both, numerator and denominator. Then the first division is
+% done, leading to an integer result representing the digits before the decimal
+% point. This number is appended to |\np at result|. After this, 6 decimal places are
+% computed.
+%    \begin{macrocode}
+\newcommand*{\np at divide}{%
+  \gdef\np at result{}%
+  \global\np at Zc\np at Z\global\np at Nc\np at N
+  \ifnum\np at Zc<\z@\np at Zc-\np at Zc\gdef\np at result{-}\fi
+  \ifnum\np at Nc<\z@\np at Nc-\np at Nc\xdef\np at result{\np at result-}\fi
+  \np at Tc\np at Zc
+  \divide\np at Tc\np at Nc
+  \xdef\np at result{\np at result\number\np at Tc.}%
+  \np at calcnextdigit\np at calcnextdigit\np at calcnextdigit
+  \np at calcnextdigit\np at calcnextdigit\np at calcnextdigit}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at dddivide}
+% This macro is used by the package to divide two dimens. It just sets |\np at Z|
+% and |\np at N| and calls |\np at divide|. The macro can be adapted to work with
+% real numbers provided as strings, by just adding |\p@| after |#1| and/or |#2|.
+%    \begin{macrocode}
+\newcommand*{\np at dddivide}[2]{\global\np at Z#1\global\np at N#2\np at divide}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Truncating a dimen}
+% \begin{macro}{\np at truncate}
+% This macro simply cuts of everything after the decimal point. Since |\the| always
+% produces a decimal point for dimen registers, no special treatment for whole
+% numbers is required.
+%    \begin{macrocode}
+\newcommand*{\np at truncate}{}
+\def\np at truncate#1.#2\np at end{#1}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{Notes styles}
+% \subsubsection{Plain}
+% \begin{macro}{\np at ns@plain}
+% The macro for the \opt{notesstyle} \choice{plain} simply produces an invisible
+% box the size of the notes area.
+%    \begin{macrocode}
+\newcommand{\np at ns@plain}{%
+  \phantom{\rule{\textwidth}{\remainingtextheight}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Lines}
+% \begin{macro}{\np at calc@vheight}
+% This macro calculates the height of a vertical part in |\np at height|. Depending
+% on the value for \opt{usenotesareaheight} it is based on |\textheight| or
+% |\remainingtextheight|. The number of times |\np at height| fits into the notes
+% area as a whole is also calculated and stored in |\np at tempcntb|.
+%    \begin{macrocode}
+\newcommand{\np at calc@vheight}{%
+  \ifKV at np@usenotesareaheight
+    \np at height\remainingtextheight\divide\np at height\np at vparts
+    \np at tempcntb\np at vparts
+  \else
+    \np at height\textheight\divide\np at height\np at vparts
+%    \end{macrocode}
+% Here the number of lines, which fit in the notes area, is calculated as a real
+% number and stored in |\np at tempdima|.
+%    \begin{macrocode}
+    \np at dddivide\remainingtextheight\np at height
+    \expandafter\np at tempdima\np at result\p@
+%    \end{macrocode}
+% In order to get rid of rounding errors (a result of 3 may be something like 2.99998)
+% a small length is added to |\np at tempdima|, before it is truncated and the result
+% stored in |\np at tempcntb|. This is the number of times |\np at height| fits into the
+% notes area as a whole.
+%    \begin{macrocode}
+    \advance\np at tempdima0.01\p@
+    \edef\np at tempa{\expandafter\np at truncate\the\np at tempdima\np at end}%
+    \np at tempcntb\np at tempa\relax
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at ns@lines}
+% This macro is used to produce the notes area for the \opt{notesstyle} \choice{lines}.
+% First the special cases are handled. For |vparts=0| a warning is given and
+% \choice{plain} is used as \opt{notesstyle}.
+%    \begin{macrocode}
+\newcommand{\np at ns@lines}{%
+  \ifnum\np at vparts=\z@\relax
+    \PackageWarning{notespages}{vparts is 0, there are no lines
+      \MessageBreak}%
+    \np at ns@plain
+%    \end{macrocode}
+% For |vparts=1| a line on the top and the bottom of the notes area is
+% drawn. Here the trick of setting |\unitlength| to |\relax| is used to make the
+% \textsf{picture} environment use dimens. For this to work, the optional second
+% coordinates must be given too. There is no harm in not restoring |\unitlength|,
+% because |\np at ns@lines| is executed within a group, keeping the change local.
+%    \begin{macrocode}
+  \else\ifnum\np at vparts=\@ne\relax
+    \let\unitlength\relax
+    \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
+    \color{NotesHColor}%
+    \multiput(\z@,\z@)(\z@,\remainingtextheight){2}%
+      {\line(1,0){\textwidth}}%
+    \end{picture}%
+  \else
+%    \end{macrocode}
+% For all other values of \opt{vparts}, the distance between two horizontal lines
+% (in |\np at height|) and the number of lines (in |\np at tempcntb|) are calculated.
+%    \begin{macrocode}
+    \np at calc@vheight
+%    \end{macrocode}
+% And finally, the lines are drawn, using the same trick for the \textsf{picture}
+% environment as above, to make it take lengths.
+%    \begin{macrocode}
+    \let\unitlength\relax
+    \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
+    \color{NotesHColor}%
+    \multiput(\z@,\z@)(\z@,\np at height){\np at tempcntb}%
+      {\line(1,0){\textwidth}}%
+    \end{picture}%
+  \fi\fi}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Vlines}
+% \begin{macro}{\np at ns@vlines}
+% This macro is used to produce the notes area for the \opt{notesstyle} \choice{vlines}.
+% First the distance between two vertical lines is calculated and stored in |\np at width|.
+% Then |\np at tempcnta| is set to |\np at hparts| $+$ 1, to always draw the line on the
+% right side of the notes area. And finally, the lines are drawn, using the trick
+% from |\np at ns@lines| again.
+%    \begin{macrocode}
+\newcommand{\np at ns@vlines}{%
+  \np at width\textwidth\divide\np at width\np at hparts
+  \np at tempcnta\np at hparts\advance\np at tempcnta\@ne\relax
+  \let\unitlength\relax
+  \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
+  \color{NotesVColor}%
+  \multiput(\z@,\z@)(\np at width,\z@){\np at tempcnta}%
+    {\line(0,1){\remainingtextheight}}%
+  \end{picture}}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Grid}
+% \begin{macro}{\np at ns@grid}
+% This macro is used to produce the notes area for the \opt{notesstyle} \choice{grid}.
+% First the distance between two vertical lines (in |\np at width|) and their number
+% (in |\np at tempcnta|) are calculated.
+%    \begin{macrocode}
+\newcommand{\np at ns@grid}{%
+  \np at width\textwidth\divide\np at width\np at hparts
+  \np at tempcnta\np at hparts\advance\np at tempcnta\@ne\relax
+%    \end{macrocode}
+% Then the distance between two horizontal lines (in |\np at height|) and their number
+% (in |\np at tempcntb|) are calculated. Again, special cases must be handled. For
+% |vparts=0| the grid should be made from squares. Therefore |\np at height|
+% is set to |\np at width|. The following calculation of the number of whole \opt{hparts}
+% is calculated similar to |\np at ns@lines|. The number of lines is stored in
+% |\np at tempcntb|.
+%    \begin{macrocode}
+  \ifnum\np at vparts=\z@\relax
+    \np at height\np at width
+    \np at dddivide\remainingtextheight\np at height
+    \expandafter\np at tempdima\np at result\p@
+    \advance\np at tempdima0.01\p@
+    \edef\np at tempa{\expandafter\np at truncate\the\np at tempdima\np at end}%
+    \np at tempcntb\np at tempa\relax
+%    \end{macrocode}
+% The height needed for vertical lines is calculated and stored in |\np at tempdima|.
+% And the number of horizontal lines is incremented, in order to also draw the
+% top most line.
+%    \begin{macrocode}
+    \np at tempdima\np at height\multiply\np at tempdima\np at tempcntb
+    \advance\np at tempcntb\@ne\relax
+%    \end{macrocode}
+% For |vparts=1| a line on the top and the bottom should be drawn. The
+% values |\np at height|, |\np at tempcntb|, and |\np at tempdima| are set accordingly.
+%    \begin{macrocode}
+  \else\ifnum\np at vparts=\@ne\relax
+    \np at height\remainingtextheight
+    \np at tempcntb\tw@\relax
+    \np at tempdima\np at height
+  \else
+%    \end{macrocode}
+% For other values of \opt{vparts} the necessary values are calculated the same
+% way as for |\np at ns@lines|.
+%    \begin{macrocode}
+    \np at calc@vheight
+%    \end{macrocode}
+% And then, the height needed for vertical lines (|\np at tempdima|) is calculated
+% and the number of horizontal lines (|\np at tempcntb|) is incremented.
+%    \begin{macrocode}
+    \np at tempdima\np at height\multiply\np at tempdima\np at tempcntb
+    \advance\np at tempcntb\@ne
+  \fi\fi
+%    \end{macrocode}
+% Finally, all lines are drawn, using the trick from |\np at ns@lines| again.
+%    \begin{macrocode}
+  \let\unitlength\relax
+  \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
+  \color{NotesVColor}%
+  \multiput(\z@,\z@)(\np at width,\z@){\np at tempcnta}%
+    {\line(0,1){\np at tempdima}}%
+  \color{NotesHColor}%
+  \multiput(\z@,\z@)(\z@,\np at height){\np at tempcntb}%
+    {\line(1,0){\textwidth}}%
+  \end{picture}}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Text}
+% \begin{macro}{\np at ns@text}
+% This macro is used to produce the notes area for the \opt{notesstyle} \choice{text}.
+% Since |\np at titleskip| is not inserted for |titlestyle=none|, it is inserted here to
+% enable shifting the text vertically. For some unknown reason this doesn't work
+% without the invisible |\hrule|. After that, the alignement is set. For
+% |notestextalign=none| nothing is done, thus using the alignement active before
+% the notes page. For the text color |\color| is used so the user can easily set an
+% own color by using |notestext=\textcolor{mycolor}{my notes text}|.
+%    \begin{macrocode}
+\newcommand{\np at ns@text}{%
+  \def\np at tempa{none}\ifx\np at tempa\np at titlestyle
+    \hrule\@height\z@
+    \vspace*{\np at titleskip}%
+  \fi
+  \def\np at tempa{left}\ifx\np at tempa\np at notesalign
+    \raggedright
+  \else
+    \def\np at tempa{right}\ifx\np at tempa\np at notesalign
+      \raggedleft
+    \else
+      \def\np at tempa{center}\ifx\np at tempa\np at notesalign
+        \centering
+      \fi
+    \fi
+  \fi
+  \color{NotesTextColor}\notesareatext}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Using notes styles}
+% \begin{macro}{\np at inner@notespage}
+% This macro calls the command for the \opt{notesstyle} seclected. Before that,
+% |\parfillskip| is set to avoid an |overfull hbox| error, in case some class
+% or package set it to a different value (example: \pkg{KOMA-Script} classes with
+% the option \opt{parskip}).
+%    \begin{macrocode}
+\newcommand{\np at inner@notespage}{\parfillskip\z@ plus 1fil%
+  \csname np at ns@\np at notesstyle\endcsname}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{User commands}
+% \subsubsection{Building a notes page}
+% \begin{macro}{\np at notespage}
+% This macro builds a single notes page. If \opt{allowfloats} is \choice{false}
+% and \opt{startnotes} is \choice{newpage}, |\textfraction| is temporarily set to
+% 1 in order to prevent floats from being placed on the notes page.
+%    \begin{macrocode}
+\newcommand*{\np at notespage}{%
+  \ifKV at np@allowfloats\else
+    \def\np at tempa{newpage}\ifx\np at tempa\np at startnotes
+      \edef\np at orig@textfraction{\textfraction}%
+      \gdef\textfraction{1}%
+    \fi
+  \fi
+  \np at startnotespage
+  \np at savemark
+  \np at setmark
+%    \end{macrocode}
+% Here the information about the notes pages needed for saving and restoring the
+% header marks is written to the |.aux| file. Note pages with |mark=keep|
+% are excluded here, because otherwise they would mix up the header marks if used
+% within a couple of notes pages with different values for \opt{mark}.
+%    \begin{macrocode}
+  \if\np at mark@keep\else
+    \protected at write\@auxout{}%
+      {\string\@writefile{npm}{\string\npnpinfo{\the\c at page}}}%
+  \fi
+  \np at setpagestyle
+  \np at maketitle
+%    \end{macrocode}
+% If there is no notes title, |\np at titleskip| is not used. Without this, the notes
+% area wouldn't have the correct height.
+%    \begin{macrocode}
+  \def\np at tempa{none}\ifx\np at tempa\np at titlestyle\else
+    \vspace*{\np at titleskip}%
+  \fi
+  \noindent\np at calcheight
+  \ifKV at np@titlenotesfill\vfill\noindent\fi
+  \np at inner@notespage
+  \np at restoremark
+%    \end{macrocode}
+% At the end, |\textfraction| is restored and a new page is started. The latter
+% is necessary to prevent occasional problems with page breaks.
+%    \begin{macrocode}
+  \ifKV at np@allowfloats\else
+    \def\np at tempa{newpage}\ifx\np at tempa\np at startnotes
+      \xdef\textfraction{\np at orig@textfraction}%
+    \fi
+  \fi
+  \newpage}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Single notes page}
+% \begin{macro}{\notespage}
+% In |\notespage| everything is done within a group, in order to keep settings done
+% with the keys in the optional argument local to the macro. Before the keys are
+% set, the boolean |\ifnp at marktext@set| is set to false, so the option \opt{titletext}
+% will also set \opt{marktext}.
+%    \begin{macrocode}
+\newcommand*{\notespage}[1][]{%
+  \begingroup
+  \np at marktext@setfalse\setkeys{np}{#1}%
+  \np at notespage
+  \endgroup}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Multiple notes pages}
+% \begin{macro}{\notespages}
+% Also, in |\notespages| everything is done in a group to keep it local. After
+% setting the keys, the number of pages needed is calculated as follows ($p$:
+% page, $d$: \opt{multiple}, $m$: \opt{minpages}, $e$: \opt{endpages}, $n$: notes
+% pages).
+%    \begin{macrocode}
+\newcommand*{\notespages}[1][]{%
+  \begingroup
+  \np at marktext@setfalse\setkeys{np}{#1}%
+%    \end{macrocode}
+% If started on a new page, set the boolean |\ifnp at started@on at new@page| to true,
+% else to false.
+%    \begin{macrocode}
+  \ifdim\pagetotal=\z@
+    \np at started@on at new@pagetrue\else\np at started@on at new@pagefalse\fi
+%    \end{macrocode}
+% $n = p$, if(started on new page) $n = n - 1$
+%    \begin{macrocode}
+  \np at notepages\c at page
+  \ifnp at started@on at new@page\advance\np at notepages\m at ne\fi
+%    \end{macrocode}
+% This is basically $n = d - (n \bmod d)$, but with a correction, if started on
+% a new page. This will lead to $n = d$ in case $n \bmod d = 0$, which is corrected
+% by not adding $d$ at the end.
+%    \begin{macrocode}
+  \divide\np at notepages\np at multiple
+  \multiply\np at notepages\np at multiple
+  \advance\np at notepages-\c at page
+  \ifnp at started@on at new@page\advance\np at notepages\@ne\fi
+  \ifnum\np at notepages<\z@
+    \advance\np at notepages\np at multiple\fi
+%    \end{macrocode}
+% The next step is $n = n - (e \bmod d)$, because the amount of \opt{endpages}
+% fully dividable by $d$ is of no significance for calculating $n$.
+%    \begin{macrocode}
+  \np at tempcnta\np at endpages
+  \np at tempcntb\np at endpages
+  \divide\np at tempcnta\np at multiple
+  \multiply\np at tempcnta\np at multiple
+  \advance\np at tempcntb-\np at tempcnta
+  \advance\np at notepages-\np at tempcntb
+%    \end{macrocode}
+% And finally, $m$ is taken into account by $n = n + (m \div d) \cdot d$, if($n < m$)
+% $n = n + d$, leading to the value for $n$.
+%    \begin{macrocode}
+  \np at tempcnta\np at minpages
+  \divide\np at tempcnta\np at multiple
+  \multiply\np at tempcnta\np at multiple
+  \advance\np at notepages\np at tempcnta
+  \ifnum\np at notepages<\np at minpages
+    \advance\np at notepages\np at multiple\relax\fi
+%    \end{macrocode}
+% If there are notes pages to be given out, this is done in a loop.
+%    \begin{macrocode}
+  \ifnum\np at notepages>\z@\relax
+    \loop\ifnum\np at notepages>\z@\relax
+      \np at notespage\advance\np at notepages\m at ne\relax
+    \repeat
+  \fi
+  \endgroup}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Notes fill}
+% \begin{macro}{\notesfill}
+% And again, things in |\notesfill| are done in a group to keep stuff local. Since
+% the option \opt{marktext} is ignored here, it is not necessary to set
+% |\np at marktext@setfalse|, before setting the keys.
+%    \begin{macrocode}
+\newcommand*{\notesfill}[1][]{%
+  \begingroup
+  \setkeys{np}{#1}%
+%    \end{macrocode}
+% Next, the remaining height is calculated and \opt{filltopskip} is subtracted,
+% so it's not taken into account. Only if the remaining height now is at least
+% \opt{fillminspace}, the notes fill is generated.
+%    \begin{macrocode}
+  \np at calcheight
+  \advance\remainingtextheight-\np at fill@topskip
+  \ifdim\remainingtextheight<\np at fill@minspace\else
+%    \end{macrocode}
+% If the remaining height is greater than \opt{fillmaxspace}, the space to be left
+% empty is calculated and stored in |\np at tempdima|.
+%    \begin{macrocode}
+    \ifdim\remainingtextheight>\np at fill@maxspace
+      \np at tempdima\remainingtextheight
+      \advance\np at tempdima-\np at fill@maxspace
+    \else
+      \np at tempdima=\z@
+    \fi
+%    \end{macrocode}
+% Now the title is generated together with the spaces before and after it.
+%    \begin{macrocode}
+    \vspace*{\np at fill@topskip}
+    \ifKV at np@filltopfill\vfill\fi
+    \np at maketitle
+    \def\np at tempa{none}\ifx\np at tempa\np at titlestyle\else
+      \vspace*{\np at titleskip}%
+    \fi
+%    \end{macrocode}
+% And finally, the remaining height for the notes area is calculated and reduced
+% by the space to be left empty, before the notes area is generated.
+%    \begin{macrocode}
+    \noindent\np at calcheight
+    \advance\remainingtextheight-\np at tempdima
+    \ifKV at np@titlenotesfill\vfill\noindent\fi
+    \np at inner@notespage\newpage
+  \fi
+  \endgroup}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{Advanced commands}
+% \subsubsection{Setting options}
+% \begin{macro}{\setnotespages}
+% This macro takes a key value list and sets them with |\setkeys|.
+%    \begin{macrocode}
+\newcommand*{\setnotespages}[1]{%
+  \np at marktext@setfalse\setkeys{np}{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{New meta option}
+% \begin{macro}{\definenotesoption}
+% This macro defines a new key given as the first parameter, which will set the
+% keys to the values provided in the key value list given as the second parameter.
+%    \begin{macrocode}
+\newcommand*{\definenotesoption}[2]{%
+  \key at ifundefined{np}{#1}{\define at key{np}{#1}[]{\setkeys{np}{#2}}}%
+    {\PackageError{notespages}%
+      {Key #1 is already defined.\MessageBreak}%
+      {The key #1 may have been defined by some package\MessageBreak
+       or you tried to redefine this key.}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{New notes style}
+% \label{sec:newnotesstyle}
+% \begin{macro}{\definenotesstyle}
+% This macro defines a new notes style. The name is given in |#1| and the commands
+% for the new style in |#2|. First, the list of choices in |\np at notesstyle@nominations|
+% (see \autoref{sec:optnotespage}) is extended and then the key \opt{notesstyle} is
+% redefined with |\np at def@notesstyle at key|. Finally the command for the notes style
+% itself is defined.
+%    \begin{macrocode}
+\newcommand{\definenotesstyle}[2]{%
+  \edef\np at notesstyle@nominations{\np at notesstyle@nominations,#1}%
+  \expandafter\np at def@notesstyle at key\np at notesstyle@nominations\np at end
+  \long\expandafter\def\csname np at ns@#1\endcsname{#2}}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{New title style}
+% \label{sec:newtitlestyle}
+% \begin{macro}{\definetitlestyle}
+% This macros defines a new title style. It works similar to the command
+% |\definenotesstyle|.
+%    \begin{macrocode}
+\newcommand{\definetitlestyle}[2]{%
+  \edef\np at titlestyle@nominations{\np at titlestyle@nominations,#1}%
+  \expandafter\np at def@titlestyle at key\np at titlestyle@nominations\np at end
+  \long\expandafter\def\csname np at ts@#1\endcsname{#2}}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Patching \texttt{\bs chapter}}
+% \begin{macro}{\nppatchchapter}
+% This macros patches |\chapter| by adding |\notespages| in front off it. The
+% argument is used as the optional argument for the latter. Patching will only
+% be done, if |\chapter| exists.
+%    \begin{macrocode}
+\let\np at orig@chapter\chapter
+\newcommand{\nppatchchapter}[1]{%
+  \@ifundefined{chapter}{}{%
+    \def\chapter{\notespages[#1]\np at orig@chapter}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{Support for other packages}
+% \subsubsection{Babel}
+% The method of supporting \pkg{babel} was taken from Heiko Oberdieks package
+% \pkg{hyperref}.
+%
+% \begin{macro}{\np at lang@german}
+% This macro defines |\npnotesname| and |\npnotestext| for variations of the German
+% language.
+%    \begin{macrocode}
+\newcommand*{\np at lang@german}{\def\npnotesname{Notizen}%
+  \def\npnotestext{Diese Seite wurde absichtlich leer gelassen.}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at lang@english}
+% This macro defines |\npnotesname| and |\npnotestext| for variations of the English
+% language.
+%    \begin{macrocode}
+\newcommand*{\np at lang@english}{\def\npnotesname{Notes}%
+  \def\npnotestext{This page is intentionally left blank.}}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\np at lang@french}
+% This macro defines |\npnotesname| and |\npnotestext| for variations of the French
+% language.
+%    \begin{macrocode}
+\newcommand*{\np at lang@french}{\def\npnotesname{Notes}%
+  \def\npnotestext{Cette page est laiss\'{e}e intentionnellement vide.}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at declarelang}
+% This macro adds one of the macros defining |\npnotesname| and |\npnotestext| (|#2|)
+% to a language supported by \pkg{babel} (|#1|), if the language loaded.
+%    \begin{macrocode}
+\newcommand*{\np at declarelang}[2]{%
+  \@ifpackagewith{babel}{#1}{%
+    \expandafter\addto
+      \csname extras#1\expandafter\endcsname
+      \csname np at lang@#2\endcsname}{}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\np at supportbabel}
+% This macro adds one of the macros defining |\npnotesname| and |\npnotestext| to all
+% languages supported by \NP\ so far.
+%    \begin{macrocode}
+\newcommand*{\np at supportbabel}{%
+  \@ifpackageloaded{babel}{%
+    \np at declarelang{english}{english}%
+    \np at declarelang{USenglish}{english}%
+    \np at declarelang{american}{english}%
+    \np at declarelang{UKenglish}{english}%
+    \np at declarelang{british}{english}%
+    \np at declarelang{canadian}{english}%
+    \np at declarelang{australian}{english}%
+    \np at declarelang{newzealand}{english}%
+    \np at declarelang{austrian}{german}%
+    \np at declarelang{german}{german}%
+    \np at declarelang{germanb}{german}%
+    \np at declarelang{ngerman}{german}%
+    \np at declarelang{naustrian}{german}%
+    \np at declarelang{french}{french}%
+    \np at declarelang{francais}{french}%
+    \np at declarelang{canadien}{french}%
+    \np at declarelang{acadian}{french}}{}}
+%    \end{macrocode}
+% \end{macro}
+%
+% The macro is used in the |\AtBeginDocument| hook, but it also has to be called
+% here, in case \pkg{babel} was loaded before \NP.
+%    \begin{macrocode}
+\np at supportbabel
+%    \end{macrocode}
+%
+% ^^A-------------------------
+% \subsubsection{(X)Color}
+% \begin{macro}{\np at setcolors}
+% This macro defines the colors used by \NP\ for the package \pkg{color}. It first
+% checks, if the colors are already defined, in order to make it possible for the
+% user to define the colors in the preamble.
+%    \begin{macrocode}
+\newcommand*{\np at setcolors}{%
+  \@ifundefined{\string\color @NotesHColor}%
+    {\definecolor{NotesHColor}{gray}{0.7}}{}%
+  \@ifundefined{\string\color @NotesVColor}%
+    {\definecolor{NotesVColor}{gray}{0.7}}{}%
+  \@ifundefined{\string\color @NotesTextColor}%
+    {\definecolor{NotesTextColor}{gray}{0.7}}{}}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\np at setxcolors}
+% This macro defines the colors used by \NP\ for the package \pkg{xcolor}. For this,
+% |\providecolor| is used, which defines a color only, if it is not defined yet.
+%    \begin{macrocode}
+\newcommand*{\np at setxcolors}{%
+  \providecolor{NotesHColor}{gray}{0.7}%
+  \providecolor{NotesVColor}{gray}{0.7}%
+  \providecolor{NotesTextColor}{gray}{0.7}}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\np at supportcolor}
+% This macro checks, if one of the packages \pkg{color} or \pkg{xcolor} is loaded,
+% and calls either |\np at setcolors| or |\np at setxcolors| respectively. In case none
+% is loaded, the macro |\color| is set to |\@gobble|, so it can be used by
+% \NP\ without harm. |\np at supportcolor| is used in the |\AtBeginDocument| hook.
+%    \begin{macrocode}
+\newcommand*{\np at supportcolor}{%
+  \@ifpackageloaded{xcolor}{\np at setxcolors}{%
+  \@ifpackageloaded{color}{\np at setcolors}{\let\color\@gobble}}}
+%    \end{macrocode}
+% \end{macro}
+%
+% ^^A-------------------------
+% \subsubsection{Initialisation}
+% Finally, the file |\jobname.npm| is loaded and the macros |\np at supportbabel| and
+% |\np at supportcolor| are called in the |\AtBeginDocument| hook, so the order of
+% loading packages is without consequences.
+%    \begin{macrocode}
+\AtBeginDocument{\InputIfFileExists{\jobname.npm}{}{}%
+  \np at supportbabel\np at supportcolor}
+%    \end{macrocode}
+%
+% \newpage
+% \Finale\endinput
+%</package>
+% ^^A--------------------------------------------------------------------------
+% ^^A Now the source of the example
+%<*example>
+%% this document is intended to be compiled with the class scrbook, other classes
+%% will not produce a logically correct result (some notes fills are missing,
+%% pages are different, a lot of overful hboxes, and so on), they where just
+%% used for testing
+%%\documentclass[11pt,a4paper]{article}
+%%\documentclass[11pt,a4paper]{report}
+%%\documentclass[11pt,a4paper]{book}
+\documentclass[11pt,a4paper]{scrbook}
+%%\documentclass[11pt,a4paper]{scrartcl}
+%%\documentclass[11pt,a4paper]{scrreprt}
+%%\documentclass[11pt,a4paper,article]{memoir}
+%%\documentclass[11pt,a4paper]{memoir}
+\usepackage{lmodern}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{microtype}
+\usepackage[italian,ngerman,french,english]{babel}
+\usepackage[colorlinks,linkcolor=blue]{hyperref}
+\usepackage{lipsum}
+\usepackage[svgnames]{xcolor}
+\usepackage{tikz}
+\usepackage{afterpage}
+\usepackage{notespages}
+
+%% CAUTION: do not use this with the class memoir
+%%          it will not work, because memoir has its
+%%          own methods to set the header and footer
+%% this is meant to be used with KOMA-Script classes
+\usepackage{scrpage2}
+\lehead[]{\leftmark}
+\cehead[]{}
+\rehead[]{\rightmark}
+\lohead[]{\leftmark}
+\cohead[]{}
+\rohead[]{\rightmark}
+\lefoot[\pagemark]{\pagemark}
+\cefoot[]{}
+\refoot[]{\textsf{NotesPages}}
+\lofoot[]{\textsf{NotesPages}}
+\cofoot[]{}
+\rofoot[\pagemark]{\pagemark}
+\pagestyle{scrheadings}
+%% this is meant to be used with all other classes
+%%\pagestyle{headings}
+
+%% only use this for classes book, scrbook and memoir without option article
+\nppatchchapter{default,vacant,multiple=2,
+  notestext={An empty page before a new chapter.}}
+
+%% this trick will only work after \nppatchchapter
+%% this has to be used with classes article and scrartcl
+%%\let\secleveli\section
+%%\let\seclevelii\subsection
+%% this has to be used with all other classes
+\let\secleveli\chapter
+\let\seclevelii\section
+
+%%\tracingnpmarks1
+
+\newcommand{\fillit}[1][]{\minisec{Fill it}\lipsum[#1]}
+
+\begin{document}
+\thispagestyle{empty}
+\begin{center}
+\vspace*{\fill}
+\textsf{\Huge The \textbf{NotesPages} Package}\\[5ex]
+\textsf{\textbf{\Large Example File}}\\[5ex]
+Mike Kaufmann\\[2ex]
+\href{mailto:m.km at gmx.de}{\texttt{m.km at gmx.de}}\\[2ex]
+2016/08/10 (v0.8)\\[10ex]
+\textsf{\textbf{\LARGE Warning: do not print!}}\\[2ex]
+You would waste over a hundred pages!
+\vspace*{\fill}
+\vspace*{\fill}
+\end{center}
+
+\tableofcontents
+
+\secleveli{Layout variations}
+\seclevelii{Default settings}
+First let's start with the default settings. The next three and a half pages are
+filled with \verb|\notesfill|, \verb|\notespage|, and \verb|\notespages|. The
+latter will produce two pages, in order to fill up the document to a multiple
+of 4 pages.
+
+The commands are:
+
+\begin{verbatim}
+\notesfill
+\notespage
+\notespages
+\end{verbatim}
+
+\notesfill
+\notespage
+\notespages
+
+\seclevelii{The options \textsf{startnotes} and \textsf{allowfloats}}
+To show the effect of these options, some text and a float, which doesn't fit on
+this page, is needed. For the float the positioning \verb|[htb]| was used. After
+the float \verb|\notespage| was used once.
+
+Test for referencing: \autoref{fig:rect} on \autopageref{fig:rect}.
+
+\fillit[1-3]
+
+\begin{figure}[htb]
+\centering
+\textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
+\caption{Just a rectangle}\label{fig:rect}
+\end{figure}
+
+\notespage
+
+Now let's do this again, but this time using \verb|\notespage[startnotes=newpage]|.
+
+Test for referencing: \autoref{fig:rect2} on \autopageref{fig:rect2}.
+
+\fillit[1-3]
+
+\begin{figure}[htb]
+\centering
+\textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
+\caption{Another rectangle}\label{fig:rect2}
+\end{figure}
+
+\notespage[startnotes=newpage]
+
+Ok, now lets add the option \textsf{allowfloats} and see what happens. This time
+\verb|\notespages| \verb|[startnotes=newpage,allowfloats]| is used, filling the document
+up to page 16. Note: the header is already changed on the next page.
+
+Test for referencing: \autoref{fig:rect3} on \autopageref{fig:rect3}.
+
+\begin{figure}[htb]
+\centering
+\textcolor{lightgray}{\rule{0.8\textwidth}{0.5\textheight}}
+\caption{A third rectangle}\label{fig:rect3}
+\end{figure}
+
+\notespages[startnotes=newpage,allowfloats]
+
+\seclevelii{The option \textsf{pagestyle}}
+The next 3 pages show notes pages with different page styles. The commands are:
+
+\begin{verbatim}
+\notespage[pagestyle=empty]
+\notespage[pagestyle=plain]
+\notespage[pagestyle=useheadings]
+\end{verbatim}
+
+Btw.: The pagestyle for this document was defined deliberately this way to see
+both header marks as often as possible. For this, the package \textsf{scrpage2}
+from \textsf{KOMA-Script} was used.
+
+\notespage[pagestyle=empty]
+\notespage[pagestyle=plain]
+\notespage[pagestyle=useheadings]
+
+\seclevelii{The option \textsf{notesstyle}}
+Up until now, the default \textsf{notesstyle} (\textsf{\textit{grid}}) was used.
+The next example shows the other four. The commands are:
+
+\begin{verbatim}
+\notespage[notesstyle=plain]
+\notespage[vparts=35,notesstyle=lines]
+\notespage[notesstyle=vlines]
+\notespage[notesstyle=text]
+\notespage[vacant]
+\end{verbatim}
+
+For the second page \texttt{vparts=35} was used, because the default is 0 and
+therefore the notes area would be empty. The fourth page doesn't realy make sense,
+because the notes style \textsf{text} was meant to be used for otherwise empty
+pages. For this the meta option \textsf{vacant} was introduced. Its effect can be
+seen on the fifth page.
+
+\notespage[notesstyle=plain]
+\notespage[vparts=35,notesstyle=lines]
+\notespage[notesstyle=vlines]
+\notespage[notesstyle=text]
+\notespage[vacant]
+
+\seclevelii{The options \textsf{hparts}, \textsf{vparts}, and \textsf{usenotesareaheight}}
+Now let's play around a little with the options \textsf{hparts} and \textsf{vparts}.
+As mentioned in the manual, a value of 1 will always draw two lines. Let's take a
+look. The commands are:
+
+\begin{verbatim}
+\notesfill[vparts=1,notesstyle=lines]
+\notespage[hparts=1,notesstyle=vlines]
+\notespage[hparts=1,vparts=1]
+\end{verbatim}
+
+\notesfill[vparts=1,notesstyle=lines]
+\notespage[hparts=1,notesstyle=vlines]
+\notespage[hparts=1,vparts=1]
+
+With the same values for both, one gets rectangles with the same aspect ratio
+as the text body. The command:
+
+\begin{verbatim}
+\notesfill[hparts=30,vparts=30]
+\end{verbatim}
+
+\notesfill[hparts=30,vparts=30]
+
+With the option \textsf{usenotesareaheight} the height of a vertical part will
+be calculated based on the height of the notes area instead of \verb|\textheight|.
+Thus, there will be the exact number of parts given to \textsf{vparts}.
+
+But first, lets see it without \textsf{usenotesareaheight}. The command:
+
+\begin{verbatim}
+\notesfill[hparts=2,vparts=2]
+\end{verbatim}
+
+\notesfill[hparts=2,vparts=2]
+
+And now, the same command, but this time with the option \textsf{usenotesareaheight}.
+The command is:
+
+\begin{verbatim}
+\notesfill[hparts=2,vparts=2,usenotesareaheight]
+\end{verbatim}
+
+\notesfill[hparts=2,vparts=2,usenotesareaheight]
+
+But with the same command the height of a vertical part can be different each
+time, as can be seen below.
+
+\fillit[1-2]
+
+\notesfill[hparts=2,vparts=2,usenotesareaheight]
+
+\seclevelii{The option \textsf{titlestyle}}
+The following pages show the possible \textsf{titlestyle}s. Since the top most
+rectangles for the default appearance of the notes area will only be shown, if they
+fit completely into the notes area, the latter was change to be just a rectangle.
+Without this, the real distance between notes title and notes area couldn't be seen.
+The choice \textsf{minisec} wasn't used here, so this file can be compiled with
+classes, which don't support the command \verb|\minisec|. The commands are:
+
+\begin{verbatim}
+\notesfill[hparts=1,vparts=1]
+\notespage[hparts=1,vparts=1,titlestyle=subsection]
+\notespage[hparts=1,vparts=1,titlestyle=subsubsection]
+\notespage[hparts=1,vparts=1,titlestyle=text]
+\notespage[hparts=1,vparts=1,titlestyle=none]
+\end{verbatim}
+
+\notesfill[hparts=1,vparts=1]
+\notespage[hparts=1,vparts=1,titlestyle=subsection]
+\notespage[hparts=1,vparts=1,titlestyle=subsubsection]
+\notespage[hparts=1,vparts=1,titlestyle=text]
+\notespage[hparts=1,vparts=1,titlestyle=none]
+
+\seclevelii{The option \textsf{titletext}}
+With the option \textsf{titletext} a new text for the notes title can be given.
+If the new text is not just a single word, it should be given in braces. And if
+it contains a comma or an equality sign it must be given in braces.
+
+The new text is also used as the text for the header mark, if the option
+\textsf{marktext} is not used. The commands are:
+
+\begin{verbatim}
+\notesfill[hparts=1,vparts=1,titletext={Please, make some notes here}]
+\notespage[hparts=1,vparts=1,titletext={Scribble page}]
+\end{verbatim}
+
+\notesfill[hparts=1,vparts=1,titletext={Please, make some notes here}]
+\notespage[hparts=1,vparts=1,titletext={Scribble page}]
+
+\seclevelii{The option \textsf{titleskip}}
+Especially if \texttt{titlestyle=text} is given, the option \textsf{titleskip}
+is useful. With it, some space can be put between the notes title and the notes
+area. This is shown here. Compare it to page 37. The command is:
+
+\begin{verbatim}
+\notesfill[hparts=1,vparts=1,titlestyle=text,titleskip=2ex]
+\end{verbatim}
+
+\notesfill[hparts=1,vparts=1,titlestyle=text,titleskip=2ex]
+
+\seclevelii{The option \textsf{titlenotesfill}}
+The option \textsf{titlenotesfill} will move the notes area down to the end of
+the page. This can only be shown with the \textsf{notesstyle} \textsf{\textit{text}},
+for whitch it doesn't realy make sense. But if someone defines a custom notes style,
+which doesn't use the whole notes area, the option can be used to move it down.
+The command is:
+
+\begin{verbatim}
+\notesfill[notesstyle=text,filltopfill=false,titlenotesfill]
+\end{verbatim}
+
+\notesfill[notesstyle=text,filltopfill=false,titlenotesfill]
+
+\seclevelii{The option \textsf{mark}}
+Up unitl now, \textsf{mark} was set to \textsf{both}. The next pages will show
+the other choices. The commands are:
+
+\begin{verbatim}
+\notespage[mark=keep,titletext={Notes (keep)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[titletext={Notes (both)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[titletext={Notes (both)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\end{verbatim}
+
+The additional pages were put in to test, if switching between the choices of
+\textsf{mark} works.
+
+\notespage[mark=keep,titletext={Notes (keep)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[titletext={Notes (both)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+\notespage[titletext={Notes (both)}]
+\notespage[mark=right,titletext={Notes (right)}]
+\notespage[mark=left,titletext={Notes (left)}]
+
+\seclevelii{The options \textsf{marktext} and \textsf{markuppercase}}
+The option \textsf{marktext} is used the set a text for the header mark. This is
+useful, if the title text is to long for the header. Again, if the text contains
+more then one word it should be given in braces, and if it contains a comma or an
+equality sign it must be given in braces.
+
+Some classes set the header marks in uppercase letters. To do this for the header
+marks of a notes page, the option \textsf{markuppercase} exists. It is set
+automatically for the standard classes, the \textsf{KOMA-Script} classes and
+\textsf{memoir}. For other classes, the default is \textsf{\textit{false}}.
+The setting can be changed with this option, as shown in the next example.
+
+The command is:
+
+\begin{verbatim}
+\notespage[marktext=Scribbel,markuppercase,titlestyle=text,
+    titletext={This is a very long text for a scribble page. And it
+    doesn't just end after one sentence, so it is realy too long for
+    the header.}]
+\end{verbatim}
+
+\notespage[marktext=Scribbel,markuppercase,titlestyle=text,
+    titletext={This is a very long text for a scribble page. And it
+    doesn't just end after one sentence, so it is realy too long for
+    the header.}]
+
+\secleveli{Controlling the number of notes pages}
+\seclevelii{The options \textsf{multiple}, \textsf{minpages}, and \textsf{endpages}}
+The way to set these options is to think as follows: the number of pages must be
+a multiple of $d$, at least $m$ notes pages are needed, and at the end $e$ pages
+are needed for other purposes. Then just set \textsf{multiple} $=d$, \textsf{minpages}
+$=m$, and \textsf{endpages} $=e$.
+
+As an example, lets assume the number of pages should be a multiple of 4, at least
+one notes page should appear and one page is needed after the notes pages. The
+options for this are \verb|multiple=4,minpages=1,endpages=1| (\textsf{multiple}
+could be omitted, because 4 is the default value).
+
+Now this is page 57, therefore three pages are needed to fill the document to a
+multiple of 4. But there should be one page at the end for other stuff. So only
+two pages will be inserted to fulfill \verb|endpages=1|. Since there are already
+two notes pages, \verb|minpages=1| is fullfilled.
+
+If this would have been page 55, there would be 4 notes pages. Page 56 would be a
+notes page to fulfill \verb|minpages=1|, which would also fulfill \verb|multiple=4|
+but violate \verb|endpages=1|. Because of that, three additional notes pages would
+be inserted, so all three conditions are met.
+
+\notespages[multiple=4,minpages=1,endpages=1]
+
+Here we are on page 60, the page for other purposes (like for example contact
+information on the back of a manual).
+
+With \verb|minpages=0| nothing would change here. And with \verb|endpages=0|
+this page would be a notes page too.
+
+Besides the maximum and minimum values for the options, there are no limits on
+the values and there are no dependencies between them. For example, \textsf{endpages}
+may be greater than \textsf{multiple}.
+
+\seclevelii{Other examples}
+Since this is page 60 and it's a multiple of 4, a \verb|\notespages| here with
+the default setting (\verb|multiple=4,minpages=0,endpages=0|) will do nothing.
+Let's try it:
+
+\notespages
+
+Look into the source of this file, there is a \verb|\notespages| command between
+this paragraph and the former one.
+
+Inserting an exact number $n$ of notes pages can be done with
+\verb|multiple=1,minpages=|$n$. Here any value for \textsf{endpages} would have
+no effect.
+
+\secleveli{Controlling notes fills}
+\seclevelii{The option \textsf{fillminspace} and \textsf{fillmaxspace}}
+The length given to \textsf{fillminspace} is only used to decide, if a notes fill
+should appear on a page, while \textsf{fillmaxspace} only limits its height. They
+are indepentent from each other. so it's possible to set \textsf{fillminspace} to
+a value greater than \textsf{fillmaxspace}. For example,
+
+\begin{verbatim}
+\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
+\end{verbatim}
+
+\noindent
+will insert a notes fill on this page, but not on the next one. But
+
+\begin{verbatim}
+\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.2\textheight]
+\end{verbatim}
+
+\noindent
+will insert a notes fill on the page after that, allthough it has the same amount
+of text.
+
+\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
+
+\fillit[1-3]
+
+\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.5\textheight]
+
+\newpage
+\fillit[1-3]
+
+\notesfill[fillmaxspace=0.4\textheight,fillminspace=0.2\textheight]
+
+\seclevelii{The options \textsf{filltopskip}}
+The option \textsf{filltopskip} is used to get a minimum distance between the text
+and the notes fill. In order to show its effect the \textsf{titlestyle} is changed
+\textsf{\textit{text}}. The commands are
+
+\begin{verbatim}
+\notesfill[titlestyle=text]
+\notesfill[titlestyle=text,filltopskip=2ex]
+\end{verbatim}
+
+Just compare this page to the next one.
+
+\fillit[3]
+
+\notesfill[titlestyle=text]
+
+The different space between the notes title and the nots area here is due to
+the fact, that only full vertical parts are drawn.
+
+\fillit[3]
+
+\notesfill[titlestyle=text,filltopskip=2ex]
+
+\seclevelii{The option \textsf{filltopfill}}
+As can be seen on page 61, the notes fill is moved to the bottom of the page.
+This is due to the fact, that by default \textsf{filltopfill} is set to
+\textsf{\textit{true}}. With the command
+
+\begin{verbatim}
+\notesfill[fillmaxspace=0.4\textheight,filltopfill=false]
+\end{verbatim}
+
+\noindent
+the notes fill is not moved down, as can be seen here.
+
+\notesfill[fillmaxspace=0.4\textheight,filltopfill=false]
+
+\seclevelii{The restriction regarding \textsf{notesfill}}
+As mentioned in the manual, footnotes and bottom floats will appear below the
+notes fill, as shown here.\footnote{Unfortunately, this is not easy to fix.}
+But at least, it has the right height.
+
+\begin{figure}[b]
+\centering
+\textcolor{lightgray}{\rule{0.8\textwidth}{0.2\textheight}}
+\caption{Again, a rectangle}\label{fig:rect4}
+\end{figure}
+
+\notesfill
+
+\secleveli{Advanced commands}
+\seclevelii{The command \texttt{\textbackslash setnotespages}}
+This command is used to change the settings globally. It takes a key value list,
+where all options can be used. It is possible to use the command everywhere in the
+document, changing the settings from the point of its appearance on. For example,
+instead of writing
+
+\begin{verbatim}
+\notesfill[hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
+    titletext=\textsf{\textbf{Scribble}},titleskip=1ex]
+\notespage[hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
+    titletext=\textsf{\textbf{Scribble}},titleskip=1ex]
+\end{verbatim}
+
+\noindent
+it is easier to write
+
+\begin{verbatim}
+\setnotespages{hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
+    titletext=\textsf{\textbf{Scribble}},titleskip=1ex}
+\notesfill
+\notespage
+\setnotespages{default}
+\end{verbatim}
+
+\noindent
+Note, that on the next page the formatting for the \textsf{titletext} is used
+for the header too. This can be circumvented by a) also setting \textsf{marktext}
+or b) defining your own title style (see \autoref{sec:deftitlestyle}).
+
+At the end, the package defaults are restored, so following examles start from
+there.
+
+\setnotespages{hparts=1,vparts=1,titlestyle=text,filltopskip=2ex,
+    titletext=\textsf{\textbf{Scribble}},titleskip=1ex}
+\notesfill
+\notespage
+\setnotespages{default}
+
+\seclevelii{The command \texttt{\textbackslash definenotesoption}}
+This command is used to define a new meta option. It is similar to \verb|\setnotespages|,
+but instead of changing the settings, the settings are assigned to a name, which
+can then be used as an option for the commands of this package. With this, the
+last example can be realised with
+
+\begin{verbatim}
+\definenotesoption{scribblepage}{default,hparts=1,vparts=1,
+    titlestyle=text,filltopskip=2ex,titletext=\textsf{\textbf{Scribble}},
+    titleskip=1ex,marktext=Scribble}
+\notesfill[scribblepage]
+\notespage[scribblepage]
+\end{verbatim}
+
+\noindent
+Here the option \textsf{default} was used, in order to always keep the same
+appearance, even if the settings were changed with \verb|\setnotespages|. And
+the problem with the header marks in the previous example was solved using
+\textsf{marktext}.
+
+After its definition, the new option \textsf{scribblepage} can also be used in
+\verb|\setnotespages| or another \verb|\definenotesoption|.
+
+\definenotesoption{scribblepage}{default,hparts=1,vparts=1,
+    titlestyle=text,filltopskip=2ex,titletext=\textsf{\textbf{Scribble}},
+    titleskip=1ex,marktext=Scribble}
+\notesfill[scribblepage]
+\notespage[scribblepage]
+
+\seclevelii{The command \texttt{\textbackslash definetitlestyle}}
+\label{sec:deftitlestyle}
+With this command a new title style can be defined. The first argument is the
+name for the new style, which can be used as a new choice for the option
+\textsf{titlestyle} after the definition. The second argument contains the macros
+to format the title.
+
+In order to get the text set with the option \textsf{titletext} the command
+\verb|\notestitletext| must be used where the title should appear. But of course,
+it is possible to put in some text. If the indentation by \verb|\parindent| is
+unwanted, the definition should start with \verb|\noindent|. And finally, there
+has to be a \verb|\par| at the end. That said, if a predefined command is used,
+which somehow uses \verb|\noindent| and \verb|\par|, they are no longer necessary.
+For example, the title styles \textsf{\textit{section}} and \textsf{\textit{text}}
+could have been defined with
+\begin{verbatim}
+\definetitlestyle{section}{\section*{\notestitletext}}
+\definetitlestyle{text}{\noindent\notestitletext\par}
+\end{verbatim}
+Btw.: existing title styles should not be redifined, as this may cause problems.
+
+Now lets define a new title style. Here is the example from the manual:
+
+\begin{verbatim}
+\definetitlestyle{boldred}{\noindent\textcolor{red}%
+    {\textbf{\notestitletext}}\par}
+\notesfill[scribblepage,titletext={Bold Red Note},
+    titlestyle=boldred,fillminspace=0.1\textheight]
+\end{verbatim}
+
+Here the option \textsf{scribblepage} from the last example was used. And then
+\textsf{titletext} and \textsf{titlestyle} were added, overwriting some of the
+settings done with \textsf{scribblepage}. This shows the importance of the order
+of options. Putting \textsf{scribblepage} at the end would have overwritten the
+other options.
+
+Now, it is possible to put some text directly into the definition. But keep in
+mind, this text will not appear in the headers. Here an example:
+
+\begin{verbatim}
+\definetitlestyle{prefix}{\noindent Note on:
+    \textcolor{blue}{\notestitletext}\par}
+\notespage[hparts=1,vparts=1,titleskip=1ex,titletext={Title Styles},
+    titlestyle=prefix]
+\end{verbatim}
+
+\definetitlestyle{boldred}{\noindent\textcolor{red}%
+    {\textbf{\notestitletext}}\par}
+\notesfill[scribblepage,titletext={Bold Red Note},
+    titlestyle=boldred,fillminspace=0.1\textheight]
+
+\definetitlestyle{prefix}{\noindent Note on:
+    \textcolor{blue}{\notestitletext}\par}
+\notespage[hparts=1,vparts=1,titleskip=1ex,titletext={Title Styles},
+    titlestyle=prefix]
+
+\seclevelii{The command \texttt{\textbackslash definenotestyle}}
+\label{sec:defnotesstyle}
+The notes style provided with \textsf{NotesPages} are just basic ones. With this
+command it is possible to define your own styles, which can be quite fancy. But
+lets start with the simple example from the manual:
+
+\begin{verbatim}
+\definenotesstyle{yellow}{\color{LightYellow}%
+    \rule{\textwidth}{\remainingtextheight}}
+\notesfill[notesstyle=yellow]
+\end{verbatim}
+
+Again, the first argument is the name of the new style, which can then be used as
+a new choice for the option \textsf{notesstyle}. And the second argument contains
+the macros to create the notes area. Here \verb|\remainingtextheight| has to be
+used to get the height of the notes area.
+
+\definenotesstyle{yellow}{\color{LightYellow}%
+    \rule{\textwidth}{\remainingtextheight}}
+\notesfill[notesstyle=yellow]
+
+For the next example lets create a double frame around the notes area, using the
+\LaTeX\ \textsf{picture} environment:
+
+\begin{verbatim}
+\newdimen\innerwidth
+\newdimen\innerheight
+\definenotesstyle{dframe}{%
+    \innerwidth\textwidth\advance\innerwidth-10mm\relax
+    \innerheight\remainingtextheight\advance\innerheight-10mm\relax
+    \let\unitlength\relax
+    \begin{picture}(\textwidth,\remainingtextheight)(0pt,0pt)
+    \color{lightgray}
+    \put(0pt,0pt){\framebox(\textwidth,\remainingtextheight){}}
+    \put(5mm,5mm){\framebox(\innerwidth,\innerheight){}}
+    \end{picture}}
+\notesfill[notesstyle=dframe]
+\end{verbatim}
+
+Here first two dimens are needed to calculate the height and width of the inner
+frame. These length are calculated first. Then a trick is used to make the
+\textsf{picture} environment work with lengths: \verb|\unitlength| is set to
+\verb|\relax|, thus disabling it. Caution: this requires to give the optional
+argument for an offset as \verb|(0pt,0pt)|, otherwise an error will occur.
+Additionally, a color for the frames is set. Since the new notes style is used
+within a group, disabling \verb|\unitlength| and setting a color without resetting
+them has no repercussions outside the \verb|\notesfill|.
+
+\newdimen\innerwidth
+\newdimen\innerheight
+\definenotesstyle{dframe}{%
+    \innerwidth\textwidth\advance\innerwidth-10mm\relax
+    \innerheight\remainingtextheight\advance\innerheight-10mm\relax
+    \let\unitlength\relax
+    \begin{picture}(\textwidth,\remainingtextheight)(0pt,0pt)
+    \color{lightgray}
+    \put(0pt,0pt){\framebox(\textwidth,\remainingtextheight){}}
+    \put(5mm,5mm){\framebox(\innerwidth,\innerheight){}}
+    \end{picture}}
+\notesfill[notesstyle=dframe]
+
+It is also possible to use \textsf{TikZ} to define notes styles.  Here the bounding
+box is used to keep the size of the picture to the exact size of the notes area.
+For the text \verb|\notesareatext| is used, thus using the text passed to the option
+\textsf{notestext}.
+
+\begin{verbatim}
+\definenotesstyle{slash}{%
+  \begin{tikzpicture}[color=gray!25]
+  \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
+  \clip (0,0) rectangle (\textwidth,\remainingtextheight);
+  \draw[line width=2cm]
+    (0,0) to node[color=black,sloped]{\textsf{\notesareatext}}
+    (\textwidth,\remainingtextheight);
+  \end{tikzpicture}}
+\notesfill[notesstyle=slash]
+\end{verbatim}
+
+\definenotesstyle{slash}{%
+  \begin{tikzpicture}[color=gray!25]
+  \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
+  \clip (0,0) rectangle (\textwidth,\remainingtextheight);
+  \draw[line width=2cm]
+    (0,0) to node[color=black,sloped]{\textsf{\notesareatext}}
+    (\textwidth,\remainingtextheight);
+  \end{tikzpicture}}
+\notesfill[notesstyle=slash]
+
+Here is another example using \textsf{TikZ}. It defines a mm graph paper, which
+always has a whole number of cm in both direction and is centered in the notes
+area.
+
+\begin{verbatim}
+\newdimen\xoffset
+\newdimen\yoffset
+\definenotesstyle{mmgp}{%
+  \begin{tikzpicture}[color=gray!25]
+  \pgfmathsetlength{\xoffset}{
+    (\textwidth-(floor(\textwidth/1cm+0.01)*1cm))/2}
+  \pgfmathsetlength{\yoffset}{
+    (\remainingtextheight-(floor(\remainingtextheight/1cm+0.01)*1cm))/2}
+  \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
+  \draw[xshift=\xoffset,yshift=\yoffset,very thin]
+    (0,0) grid [step=1mm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \draw[xshift=\xoffset,yshift=\yoffset,line width=0.5pt]
+    (0,0) grid [step=5mm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \draw[xshift=\xoffset,yshift=\yoffset,thick]
+    (0,0) grid [step=1cm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \end{tikzpicture}}
+\notesfill[notesstyle=mmgp]
+\end{verbatim}
+
+\newdimen\xoffset
+\newdimen\yoffset
+\definenotesstyle{mmgp}{%
+  \begin{tikzpicture}[color=gray!25]
+  \pgfmathsetlength{\xoffset}{
+    (\textwidth-(floor(\textwidth/1cm+0.01)*1cm))/2}
+  \pgfmathsetlength{\yoffset}{
+    (\remainingtextheight-(floor(\remainingtextheight/1cm+0.01)*1cm))/2}
+  \useasboundingbox (0,0) rectangle (\textwidth,\remainingtextheight);
+  \draw[xshift=\xoffset,yshift=\yoffset,very thin]
+    (0,0) grid [step=1mm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \draw[xshift=\xoffset,yshift=\yoffset,line width=0.5pt]
+    (0,0) grid [step=5mm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \draw[xshift=\xoffset,yshift=\yoffset,thick]
+    (0,0) grid [step=1cm]
+    (\textwidth-2\xoffset,\remainingtextheight-2\yoffset);
+  \end{tikzpicture}}
+\notesfill[notesstyle=mmgp]
+
+The next example is just for showing the effect of the option \textsf{titlenotesfill}.
+It is not realy useful (unless you want to torture your readers for scribbling in
+your painfully worded masterpiece by making them write in circles). Here the
+bounding box is set to a square.
+
+Caution: since the height is fixed, this notes style is not realy suitable for a
+notes fill. If it doesn't fit on the page, it will be moved to the next.
+
+\begin{verbatim}
+\definenotesstyle{spiral}{%
+  \begin{tikzpicture}[color=gray!25]
+  \useasboundingbox (-0.5\textwidth,-0.5\textwidth) rectangle
+    (0.5\textwidth,0.5\textwidth);
+  \draw[domain=0:22*3.14159,smooth,variable=\t,samples=1000] plot
+    ({-0.1*\t*sin(\t r)},{0.1*\t*cos(\t r)});
+  \end{tikzpicture}}
+\notespage[notesstyle=spiral,titletext={Write in Circles}]
+\notespage[notesstyle=spiral,titletext={Write in Circles},
+           titlenotesfill]
+\end{verbatim}
+
+\definenotesstyle{spiral}{%
+  \begin{tikzpicture}[color=gray!25]
+  \useasboundingbox (-0.5\textwidth,-0.5\textwidth) rectangle
+    (0.5\textwidth,0.5\textwidth);
+  \draw[domain=0:22*3.14159,smooth,variable=\t,samples=1000] plot
+    ({-0.1*\t*sin(\t r)},{0.1*\t*cos(\t r)});
+  \end{tikzpicture}}
+\notespage[notesstyle=spiral,titletext={Write in Circles}]
+\notespage[notesstyle=spiral,titletext={Write in Circles},
+           titlenotesfill]
+
+\seclevelii{The command \texttt{\textbackslash nppatchchapter}}
+Page 68 (among others) would be empty here, if a book class is used. This is,
+because a new chapter normally starts on a right hand page and so a left hand page
+may be left empty. To put a notes page there, one could manually add a line like
+\begin{verbatim}
+\notespages[vacant,multiple=2,
+  notestext={An empty page before a new chapter.}]
+\end{verbatim}
+before every new chapter. But with \verb|\nppatchchapter| this can be automated.
+It changes \verb|\chapter| so it behaves like
+\begin{verbatim}
+\notespages[...]
+\chapter
+\end{verbatim}
+The optional argument for \verb|\notespages| is the argument passed to
+\verb|\nppatchchapter|. And the new \verb|\chapter| can just be used like the
+original one.
+
+In the preamble of this document the lines
+\begin{verbatim}
+\nppatchchapter{default,vacant,multiple=2,
+  notestext={An empty page before a new chapter.}}
+\end{verbatim}
+were added to make the empty pages before a new chapter into a notes pages. The
+option \textsf{default} asures, that no changes of the settings (this includes
+packages options and settings done with \verb|\setnotespages|) will change their
+apperance. And with \verb|multiple=2| there will be no more then one notes
+page before a new chapter instead of up to three with the default value of 4.
+
+\secleveli{Colors and Languages}
+\seclevelii{Colors}
+The \textsf{NotesPages} package uses three colors.
+\begin{itemize}
+\item \textsf{NotesHColor} for horizontal lines in the notes styles
+      \textsf{\textit{lines}} and \textsf{\textit{grid}},
+\item \textsf{NotesVColor} for vertical lines in the notes styles
+      \textsf{\textit{vlines}} and \textsf{\textit{grid}}, and
+\item \textsf{NotesTextColor} for the text in the notes style
+      \textsf{\textit{text}}.
+\end{itemize}
+Colors can be redefined, so it's possible to change them at any time. To make the
+changes local, they are put in a group here.
+
+\begin{verbatim}
+{\definecolor{NotesHColor}{rgb}{0,0,1}
+ \definecolor{NotesVColor}{rgb}{0,1,0}
+ \definecolor{NotesTextColor}{rgb}{1,0,0}
+ \notesfill
+ \notespage[notestyle=text]}
+\end{verbatim}
+
+{\definecolor{NotesHColor}{rgb}{0,0,1}
+ \definecolor{NotesVColor}{rgb}{0,1,0}
+ \definecolor{NotesTextColor}{rgb}{1,0,0}
+ \notesfill
+ \notespage[notesstyle=text]}
+
+\seclevelii{Languages}
+So far, only English, French, and German are supported. Up unitl now English was
+used in this document. Here are examples for the other ones.
+
+\begin{verbatim}
+\selectlanguage{french}
+\notespage[notesstyle=text]
+\selectlanguage{ngerman}
+\notespage[notesstyle=text]
+\selectlanguage{english}
+\end{verbatim}
+
+New languages will be supported, as users provide the translations. But naturally,
+this will take some time. So if your language is not supported yet and you can't
+wait, you can add the following to the preamble of your document (of course with
+the correct translations):
+
+\begin{verbatim}
+\setnotespages{titletext={No Clue},
+  notestext={No clue what this is in your language.}}
+\end{verbatim}
+
+This is sufficient for documents in one language. But caution, using the option
+\textsf{default} will reset these texts. That can be solved by redefining
+\verb|\npnotesname| and \verb|\npnotestext| instead. For multilingual documents
+you can add for example
+\begin{verbatim}
+\addto{\extrasitalian}{\def\npnotesname{No Clue}%
+  \def\npnotestext{No clue what this is in Italian.}}
+\end{verbatim}
+to the preamble (again, for your language and with the correct translations).
+After that you can use
+\begin{verbatim}
+\selectlanguage{italian}
+\notespage[notesstyle=text]
+\end{verbatim}
+to get a notes page in the new language.
+
+\selectlanguage{french}
+\notespage[notesstyle=text]
+\selectlanguage{ngerman}
+\notespage[notesstyle=text]
+\addto{\extrasitalian}{\def\npnotesname{No Clue}%
+  \def\npnotestext{No clue what this is in Italian.}}
+\selectlanguage{italian}
+\notespage[notesstyle=text]
+\selectlanguage{english}
+
+\secleveli{Other Stuff}
+\seclevelii{The Package \textsf{afterpage}}
+\textsf{NotesPages} can be used with the package \textsf{afterpage}. This makes
+it possible to put a notes page on the next page without leaving the page it was
+invoked half empty. So here the line
+\begin{verbatim}
+\afterpage{\notespage[titletext={Notes on \textsl{afterpage}},
+    marktext=Notes]}
+\end{verbatim}
+is inserted to get a notes page on the next page, without wasting the remaining
+space on this one (look into the source, here it comes):
+
+\afterpage{\notespage[titletext={Notes on \textsl{afterpage}},
+    marktext=Notes]}
+
+Ok, lets fill this page, so the effect of the example can be seen. You could also
+start a new section here.
+
+\fillit[1-4]
+
+\seclevelii{The End}
+Now this is the end of this example file. But I just can't resist to add one more
+example:
+\begin{verbatim}
+\notespages[multiple=100,minpages=100,endpages=1]
+\end{verbatim}
+See you on page 200.
+
+\notespages[multiple=100,minpages=100,endpages=1]
+
+\noindent
+\vspace*{\fill}
+\begin{center}
+\sffamily\bfseries
+Welcome on page 200.\\~\\
+You just scrolled through over a hundred notes pages.\\~\\
+Hey, come on, I had to test this.
+\end{center}
+\vspace*{\fill}
+\vspace*{\fill}
+\end{document}
+%</example>


Property changes on: trunk/Master/texmf-dist/source/latex/notespages/notespages.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/notespages/notespages.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/notespages/notespages.ins	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/notespages/notespages.ins	2016-08-11 21:44:36 UTC (rev 41839)
@@ -0,0 +1,86 @@
+%% notespages.ins
+%% Copyright 2016 Mike Kaufmann
+%%                m.km at gmx.de
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%% 
+%% The Current Maintainer of this work is Mike Kaufmann.
+%%
+%% This work consists of the files notespages.dtx and notespages.ins
+%% and the derived files notespages.sty and np-test.tex.
+%%
+%%
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this package when run through
+%% LaTeX or TeX.
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+
+\input docstrip.tex
+
+% some macros for conditional generation of example files
+\newif\ifaskforexample
+\newif\ifgenerateexample
+\generateexampletrue
+\askforexampletrue
+% \generateexample \askforexample   then
+%   true        false       generate example
+%   true        true        ask and generate only if answer is y/yes
+%   false       don' care   do not generate
+\def\generateExample#1{%
+    \ifgenerateexample
+    \ifaskforexample
+    \Ask\answer{^^JThere is an example file in \jobname.dtx.^^JGenerate it? [y/n]}
+    \ifx\answer\y   \generate{#1}\else
+    \ifx\answer\yes \generate{#1}\fi\fi
+    \else\generate{#1}\fi\fi}
+
+\preamble
+
+Copyright 2016 Mike Kaufmann
+               m.km at gmx.de
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3
+of this license or (at your option) any later version.
+The latest version of this license is in
+  http://www.latex-project.org/lppl.txt
+and version 1.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This work has the LPPL maintenance status `maintained'.
+ 
+The Current Maintainer of this work is Mike Kaufmann.
+
+This work consists of the files notespages.dtx and notespages.ins
+and the derived files notespages.sty and np-test.tex.
+
+\endpreamble
+
+\generate{\file{notespages.sty}{\from{notespages.dtx}{package}}}
+\generateExample{\file{np-test.tex}{\from{notespages.dtx}{example}}}
+
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space notespages.sty}
+\Msg{*}
+\Msg{* To produce the documentation run the files ending with}
+\Msg{* `.dtx' through PDFLaTeX.}
+\Msg{*}
+\Msg{* Happy TeXing}
+\Msg{***********************************************************}
+
+
+\endbatchfile

Added: trunk/Master/texmf-dist/tex/latex/notespages/notespages.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/notespages/notespages.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/notespages/notespages.sty	2016-08-11 21:44:36 UTC (rev 41839)
@@ -0,0 +1,633 @@
+%%
+%% This is file `notespages.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% notespages.dtx  (with options: `package')
+%% 
+%% Copyright 2016 Mike Kaufmann
+%%                m.km at gmx.de
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%% 
+%% This work has the LPPL maintenance status `maintained'.
+%% 
+%% The Current Maintainer of this work is Mike Kaufmann.
+%% 
+%% This work consists of the files notespages.dtx and notespages.ins
+%% and the derived files notespages.sty and np-test.tex.
+%% 
+%% \CharacterTable
+%%  {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
+%%   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
+%%   Digits        \0\1\2\3\4\5\6\7\8\9
+%%   Exclamation   \!     Double quote  \"     Hash (number) \#
+%%   Dollar        \$     Percent       \%     Ampersand     \&
+%%   Acute accent  \'     Left paren    \(     Right paren   \)
+%%   Asterisk      \*     Plus          \+     Comma         \,
+%%   Minus         \-     Point         \.     Solidus       \/
+%%   Colon         \:     Semicolon     \;     Less than     \<
+%%   Equals        \=     Greater than  \>     Question mark \?
+%%   Commercial at \@     Left bracket  \[     Backslash     \\
+%%   Right bracket \]     Circumflex    \^     Underscore    \_
+%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
+%%   Right brace   \}     Tilde         \~}
+%%
+%%
+\def\fileversion{0.8}
+\def\filedate{2016/08/10}
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{notespages}[\filedate\space
+    v\fileversion\space filling documents, so the total number of pages
+    is a multiple of a given number]
+\RequirePackage{xkeyval}
+\newcommand*{\npnotesname}{Notes}
+\newcommand*{\npnotestext}{This page is intentionally left blank.}
+\newcommand*{\remainingtextheight}{}
+\newdimen\remainingtextheight
+\newcommand*{\notestitletext}{}
+\newcommand*{\notesareatext}{}
+\newcommand*{\np at startnotes}{}
+\newcommand*{\np at pagestyle}{}
+\newcommand*{\np at notesstyle}{}
+\newcommand*{\np at titlestyle}{}
+\newcommand*{\np at titleskip}{}
+\newdimen\np at titleskip
+\newcommand*{\np at notesalign}{}
+\newcommand*{\np at mark}{}
+\newcommand*{\np at marktext}{}
+\newcommand*{\np at hparts}{}
+\newcount\np at hparts
+\newcommand*{\np at vparts}{}
+\newcount\np at vparts
+\newcommand*{\np at height}{}
+\newdimen\np at height
+\newcommand*{\np at width}{}
+\newdimen\np at width
+\newcommand*{\np at save@marks at tokens}{}
+\newtoks\np at save@marks at tokens
+\newcommand*{\ifnp at marktext@set}{}
+\newif\ifnp at marktext@set\np at marktext@setfalse
+\newcommand*{\ifnp at mark@new}{}
+\newif\ifnp at mark@new\np at mark@newfalse
+\newcommand*{\ifnp at std@class}{}
+\newif\ifnp at std@class\np at std@classfalse
+\@ifclassloaded{article}{\np at std@classtrue}{}
+\@ifclassloaded{report}{\np at std@classtrue}{}
+\@ifclassloaded{book}{\np at std@classtrue}{}
+\@ifclassloaded{memoir}{\np at std@classtrue}{}
+\newcommand*{\np at minpages}{}
+\newcount\np at minpages
+\newcommand*{\np at endpages}{}
+\newcount\np at endpages
+\newcommand*{\np at multiple}{}
+\newcount\np at multiple
+\newcommand*{\np at notepages}{}
+\newcount\np at notepages
+\newcommand*{\ifnp at started@on at new@page}{}
+\newif\ifnp at started@on at new@page
+\newcommand*{\np at fill@minspace}{}
+\newdimen\np at fill@minspace
+\newcommand*{\np at fill@maxspace}{}
+\newdimen\np at fill@maxspace
+\newcommand*{\np at fill@topskip}{}
+\newdimen\np at fill@topskip
+\newcommand*{\np at tempcnta}{}
+\newcount\np at tempcnta
+\newcommand*{\np at tempcntb}{}
+\newcount\np at tempcntb
+\newcommand*{\np at tempdima}{}
+\newdimen\np at tempdima
+\newcommand*{\np at tempa}{}
+\newcommand*{\np at check@num at range}[4]{\relax
+  \ifnum#2<#3\relax
+    \PackageWarning{notespages}{%
+      Value for #1 to small, set to #3\MessageBreak}#2=#3\relax
+  \else\ifnum#2>#4\relax
+    \PackageWarning{notespages}{%
+      Value for #1 to large, set to #4\MessageBreak}#2=#4\relax
+  \fi\fi}
+\newcommand*{\np at err@defined}[1]{%
+  \PackageError{notespages}%
+    {Key #1 is already defined.\MessageBreak}%
+    {The key #1 may have been defined by some other package\MessageBreak
+     or the NotesPages package was loaded twice.}}
+\key at ifundefined{np}{startnotes}{}{\np at err@defined{startnotes}}
+\define at choicekey{np}{startnotes}[\np at startnotes]%
+  {clearpage,newpage}[clearpage]{}
+\key at ifundefined{np}{allowfloats}{}{\np at err@defined{allowfloats}}
+\define at boolkey{np}{allowfloats}[true]{}
+\key at ifundefined{np}{pagestyle}{}{\np at err@defined{pagestyle}}
+\define at cmdkey{np}[np@]{pagestyle}[current]{%
+  \def\np at tempa{current}\ifx\np at tempa\np at pagestyle\else
+    \@ifundefined{ps@#1}{%
+      \PackageWarning{notespages}{%
+        `#1' is not a valid pagestyle, set to default\MessageBreak}%
+      \def\np at pagestyle{current}}{}\fi}
+\key at ifundefined{np}{notesstyle}{}{\np at err@defined{notesstyle}}
+\define at choicekey{np}{notesstyle}[\np at notesstyle]%
+  {plain,lines,vlines,grid,text}[grid]{}
+\newcommand*{\np at notesstyle@nominations}{plain,lines,vlines,grid,text}
+\newcommand*{\np at def@notesstyle at key}{}
+\def\np at def@notesstyle at key#1\np at end{%
+  \define at choicekey{np}{notesstyle}[\np at notesstyle]{#1}[grid]{}}
+\key at ifundefined{np}{titlestyle}{}{\np at err@defined{titlestyle}}
+\@ifundefined{minisec}{%
+  \define at choicekey{np}{titlestyle}[\np at titlestyle]%
+    {none,text,section,subsection,subsubsection}[section]{}%
+  \newcommand*{\np at titlestyle@nominations}%
+    {none,text,section,subsection,subsubsection}}{%
+  \define at choicekey{np}{titlestyle}[\np at titlestyle]%
+    {none,text,section,subsection,subsubsection,minisec}[section]{}%
+  \newcommand*{\np at titlestyle@nominations}%
+    {none,text,section,subsection,subsubsection,minisec}}
+\newcommand*{\np at def@titlestyle at key}{}
+\def\np at def@titlestyle at key#1\np at end{%
+  \define at choicekey{np}{titlestyle}[\np at titlestyle]{#1}[section]{}}
+\key at ifundefined{np}{titletext}{}{\np at err@defined{titletext}}
+\define at key{np}{titletext}[\npnotesname]%
+  {\ifnp at marktext@set\else\def\np at marktext{#1}\fi
+    \def\notestitletext{#1}}
+\key at ifundefined{np}{titleskip}{}{\np at err@defined{titleskip}}
+\define at key{np}{titleskip}[0pt]{\np at titleskip=#1}
+\key at ifundefined{np}{titlenotesfill}{}{\np at err@defined{titlenotesfill}}
+\define at boolkey{np}{titlenotesfill}[true]{}
+\key at ifundefined{np}{notestext}{}{\np at err@defined{notestext}}
+\define at key{np}{notestext}[\npnotestext]{\def\notesareatext{#1}}
+\key at ifundefined{np}{notestextalign}{}{\np at err@defined{notestextalign}}
+\define at choicekey{np}{notestextalign}[\np at notesalign]%
+  {left,right,center,none}[center]{}
+\key at ifundefined{np}{mark}{}{\np at err@defined{mark}}
+\define at choicekey{np}{mark}[\np at mark]{both,right,left,keep}[both]{}
+\key at ifundefined{np}{marktext}{}{\np at err@defined{marktext}}
+\define at cmdkey{np}[np@]{marktext}[\npnotesname]{\np at marktext@settrue}
+\key at ifundefined{np}{markuppercase}{}{\np at err@defined{markuppercase}}
+\define at boolkey{np}{markuppercase}[true]{}
+\newcommand*{\np at init@markuppercase}{%
+  \ifnp at std@class
+    \setkeys{np}{markuppercase=true}%
+  \else
+    \setkeys{np}{markuppercase=false}%
+  \fi}
+\key at ifundefined{np}{hparts}{}{\np at err@defined{hparts}}
+\define at key{np}{hparts}[25]%
+  {\np at hparts=#1\np at check@num at range{hparts}{\np at hparts}{1}{200}}
+\key at ifundefined{np}{vparts}{}{\np at err@defined{vparts}}
+\define at key{np}{vparts}[0]%
+  {\np at vparts=#1\np at check@num at range{vparts}{\np at vparts}{0}{300}}
+\key at ifundefined{np}{usenotesareaheight}{}%
+  {\np at err@defined{usenotesareaheight}}
+\define at boolkey{np}{usenotesareaheight}[true]{}
+\key at ifundefined{np}{multiple}{}{\np at err@defined{multiple}}
+\define at key{np}{multiple}[4]%
+  {\np at multiple=#1\np at check@num at range{multiple}{\np at multiple}{1}{100}}
+\key at ifundefined{np}{minpages}{}{\np at err@defined{minpages}}
+\define at key{np}{minpages}[0]%
+  {\np at minpages=#1\np at check@num at range{minpages}{\np at minpages}{0}{100}}
+\key at ifundefined{np}{endpages}{}{\np at err@defined{endpages}}
+\define at key{np}{endpages}[0]%
+  {\np at endpages=#1\np at check@num at range{endpages}{\np at endpages}{0}{100}}
+\key at ifundefined{np}{fillminspace}{}{\np at err@defined{fillminspace}}
+\define at key{np}{fillminspace}[0.25\textheight]{\np at fill@minspace=#1}
+\key at ifundefined{np}{fillmaxspace}{}{\np at err@defined{fillmaxspace}}
+\define at key{np}{fillmaxspace}[\textheight]{\np at fill@maxspace=#1}
+\key at ifundefined{np}{filltopskip}{}{\np at err@defined{filltopskip}}
+\define at key{np}{filltopskip}[0pt]{\np at fill@topskip=#1}
+\key at ifundefined{np}{filltopfill}{}{\np at err@defined{filltopfill}}
+\define at boolkey{np}{filltopfill}[true]{}
+\key at ifundefined{np}{empty}{}{\np at err@defined{empty}}
+\define at key{np}{empty}[]{\setkeys{np}{%
+  pagestyle=empty,notesstyle=plain,titlestyle=none}}
+\key at ifundefined{np}{vacant}{}{\np at err@defined{vacant}}
+\define at key{np}{vacant}[]{\setkeys{np}{pagestyle=empty,
+  notesstyle=text,titlestyle=none,titleskip=0.3\textheight}}
+\key at ifundefined{np}{default}{}{\np at err@defined{default}}
+\define at key{np}{default}[]{\setkeys{np}{%
+  startnotes,allowfloats=false,pagestyle,notesstyle,
+  titlestyle,titletext,titleskip,titlenotesfill=false,
+  notestext,notestextalign,
+  mark,marktext,
+  hparts=25,vparts=0,usenotesareaheight=false,
+  minpages,endpages,multiple=4,
+  fillminspace,fillmaxspace,filltopskip,filltopfill}%
+  \np at init@markuppercase}
+\setkeys{np}{default}
+\ProcessOptionsX<np>
+\newcommand*{\npnpinfo}[1]{%
+  \expandafter\def\csname np at np@info.#1\endcsname{}}
+\AtEndDocument{\if at filesw\newwrite\tf at npm
+  \immediate\openout\tf at npm\jobname.npm\fi
+  \ifnp at mark@new
+    \PackageWarningNoLine{notespage}{%
+      New notes pages were added.
+      Please rerun LaTeX to get header marks right.}%
+  \fi}
+\newcommand*{\tracingnpmarks}{}
+\newcount\tracingnpmarks
+\tracingnpmarks\z@
+\newcommand{\np at tracing@marks}[3]{%
+  \ifnum\tracingnpmarks>\z@
+    \PackageInfo{notespages}{#1 header marks: #2 done\MessageBreak
+      #3\MessageBreak}%
+  \fi}
+\newcommand*{\ifnp at page@has at np}{}
+\newif\ifnp at page@has at np
+\newcommand*{\np at page@has at np}[1]{%
+  \@ifundefined{np at np@info.#1}%
+    {\np at page@has at npfalse}{\np at page@has at nptrue}}
+\newcommand*{\np at mark@keep}{TT\fi
+  \def\np at tempa{keep}\ifx\np at tempa\np at mark}
+\newcommand*{\np at savemark}{%
+  \if\np at mark@keep
+    \np at tracing@marks{save}{not}{mark=keep (1)}%
+  \else
+    \np at tempcnta\c at page\advance\np at tempcnta\m at ne
+    \np at page@has at np{\the\np at tempcnta}\ifnp at page@has at np
+      \np at tracing@marks{save}{not}{np on previous page (2)}%
+    \else
+      \np at tracing@marks{save}{}{mark not keep (3)}%
+      \global\np at save@marks at tokens\expandafter{\@themark}%
+    \fi
+  \fi}
+\newcommand*{\np@@markleft}[3]{\markboth{#3}{#2}}
+\newcommand*{\np@@markright}[3]{\markboth{#1}{#3}}
+\newcommand*{\np at markleft}[1]{%
+  \expandafter\np@@markleft\the\np at save@marks at tokens{#1}}
+\newcommand*{\np at markright}[1]{%
+  \expandafter\np@@markright\the\np at save@marks at tokens{#1}}
+\newcommand*{\np at setmark}{
+  \if\np at mark@keep
+    \np at tracing@marks{set}{not}{mark=keep (4)}%
+  \else
+    \np at page@has at np{\the\c at page}\ifnp at page@has at np\else
+      \global\np at mark@newtrue
+    \fi
+    \def\np at tempa{both}\ifx\np at tempa\np at mark
+      \np at tracing@marks{set}{}{mark=both (5)}%
+      \ifKV at np@markuppercase
+        \markboth{\MakeUppercase{\np at marktext}}%
+          {\MakeUppercase{\np at marktext}}%
+      \else
+        \markboth{\np at marktext}{\np at marktext}%
+      \fi
+    \else
+      \def\np at tempa{right}\ifx\np at tempa\np at mark
+        \np at tracing@marks{set}{}{mark=right (6)}%
+        \ifKV at np@markuppercase
+          \np at markright{\MakeUppercase{\np at marktext}}%
+        \else
+          \np at markright{\np at marktext}%
+        \fi
+      \else
+        \def\np at tempa{left}\ifx\np at tempa\np at mark
+          \np at tracing@marks{set}{}{mark=left (7)}%
+          \ifKV at np@markuppercase
+            \np at markleft{\MakeUppercase{\np at marktext}}%
+          \else
+            \np at markleft{\np at marktext}%
+          \fi
+        \fi
+      \fi
+    \fi
+  \fi}
+\newcommand*{\np at restore@@mark}[4]{%
+  \begingroup
+    \let\label\relax \let\index\relax \let\glossary\relax
+    \@temptokena {#4}%
+    \unrestored at protected@xdef\@themark{%
+      {\protect\ifnum\the\np at tempcnta=\c at page
+        #3\protect\else #1\protect\fi}%
+      {\the\@temptokena}}%
+    \@temptokena \expandafter{\@themark}%
+    \mark{\the\@temptokena}%
+    \@temptokena {#4}%
+    \unrestored at protected@xdef\@themark{{#3}{\the\@temptokena}}%
+  \endgroup
+  \if at nobreak\ifvmode\nobreak\fi\fi}
+\newcommand*{\np at restore@mark}[2]{%
+  \expandafter\np at restore@@mark\@themark{#1}{#2}}
+\newcommand*{\np at restoremark}{%
+  \if\np at mark@keep
+    \np at tracing@marks{restore}{not}{mark=keep (8)}%
+  \else
+    \np at tempcnta\c at page\advance\np at tempcnta\@ne
+    \np at page@has at np{\the\np at tempcnta}\ifnp at page@has at np
+      \np at tracing@marks{restore}{not}{np on next page (9)}%
+    \else
+      \np at tracing@marks{restore}{}{(10)}%
+      \expandafter\np at restore@mark\the\np at save@marks at tokens
+    \fi
+  \fi}
+\newcommand*{\np at startnotespage}{%
+  \expandafter\csname \np at startnotes\endcsname}
+\newcommand*{\np at setpagestyle}{%
+  \def\np at tempa{current}\ifx\np at tempa\np at pagestyle\else
+    \thispagestyle{\np at pagestyle}\fi}
+\newcommand*{\np at ts@section}{\section*{\notestitletext}}
+\newcommand*{\np at ts@subsection}{\subsection*{\notestitletext}}
+\newcommand*{\np at ts@subsubsection}{\subsubsection*{\notestitletext}}
+\newcommand*{\np at ts@minisec}{\minisec{\notestitletext}}
+\newcommand*{\np at ts@text}{\noindent\notestitletext\par}
+\newcommand*{\np at ts@none}{}
+\newcommand*{\np at maketitle}{\csname np at ts@\np at titlestyle\endcsname}
+\newcommand*{\np at calcheight}{%
+  \ifdim\pagegoal=\maxdimen
+    \remainingtextheight\textheight
+  \else
+    \remainingtextheight\pagegoal
+    \advance\remainingtextheight by -\pagetotal
+    \advance\remainingtextheight by -\lineskip
+  \fi}
+\newcommand*{\np at Tc}{}
+\newcount\np at Tc
+\newcommand*{\np at Zc}{}
+\newcount\np at Zc
+\newcommand*{\np at Nc}{}
+\newcount\np at Nc
+\newcommand*{\np at Z}{}
+\newdimen\np at Z
+\newcommand*{\np at N}{}
+\newdimen\np at N
+\newcommand*{\np at result}{}
+\newcommand*{\np at calcnextdigit}{%
+  \multiply\np at Tc\np at Nc
+  \advance\np at Zc-\np at Tc
+  \multiply\np at Zc10\relax
+  \np at Tc\np at Zc
+  \divide\np at Tc\np at Nc
+  \xdef\np at result{\np at result\number\np at Tc}}
+\newcommand*{\np at divide}{%
+  \gdef\np at result{}%
+  \global\np at Zc\np at Z\global\np at Nc\np at N
+  \ifnum\np at Zc<\z@\np at Zc-\np at Zc\gdef\np at result{-}\fi
+  \ifnum\np at Nc<\z@\np at Nc-\np at Nc\xdef\np at result{\np at result-}\fi
+  \np at Tc\np at Zc
+  \divide\np at Tc\np at Nc
+  \xdef\np at result{\np at result\number\np at Tc.}%
+  \np at calcnextdigit\np at calcnextdigit\np at calcnextdigit
+  \np at calcnextdigit\np at calcnextdigit\np at calcnextdigit}
+\newcommand*{\np at dddivide}[2]{\global\np at Z#1\global\np at N#2\np at divide}
+\newcommand*{\np at truncate}{}
+\def\np at truncate#1.#2\np at end{#1}
+\newcommand{\np at ns@plain}{%
+  \phantom{\rule{\textwidth}{\remainingtextheight}}}
+\newcommand{\np at calc@vheight}{%
+  \ifKV at np@usenotesareaheight
+    \np at height\remainingtextheight\divide\np at height\np at vparts
+    \np at tempcntb\np at vparts
+  \else
+    \np at height\textheight\divide\np at height\np at vparts
+    \np at dddivide\remainingtextheight\np at height
+    \expandafter\np at tempdima\np at result\p@
+    \advance\np at tempdima0.01\p@
+    \edef\np at tempa{\expandafter\np at truncate\the\np at tempdima\np at end}%
+    \np at tempcntb\np at tempa\relax
+  \fi}
+\newcommand{\np at ns@lines}{%
+  \ifnum\np at vparts=\z@\relax
+    \PackageWarning{notespages}{vparts is 0, there are no lines
+      \MessageBreak}%
+    \np at ns@plain
+  \else\ifnum\np at vparts=\@ne\relax
+    \let\unitlength\relax
+    \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
+    \color{NotesHColor}%
+    \multiput(\z@,\z@)(\z@,\remainingtextheight){2}%
+      {\line(1,0){\textwidth}}%
+    \end{picture}%
+  \else
+    \np at calc@vheight
+    \let\unitlength\relax
+    \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
+    \color{NotesHColor}%
+    \multiput(\z@,\z@)(\z@,\np at height){\np at tempcntb}%
+      {\line(1,0){\textwidth}}%
+    \end{picture}%
+  \fi\fi}
+\newcommand{\np at ns@vlines}{%
+  \np at width\textwidth\divide\np at width\np at hparts
+  \np at tempcnta\np at hparts\advance\np at tempcnta\@ne\relax
+  \let\unitlength\relax
+  \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
+  \color{NotesVColor}%
+  \multiput(\z@,\z@)(\np at width,\z@){\np at tempcnta}%
+    {\line(0,1){\remainingtextheight}}%
+  \end{picture}}
+\newcommand{\np at ns@grid}{%
+  \np at width\textwidth\divide\np at width\np at hparts
+  \np at tempcnta\np at hparts\advance\np at tempcnta\@ne\relax
+  \ifnum\np at vparts=\z@\relax
+    \np at height\np at width
+    \np at dddivide\remainingtextheight\np at height
+    \expandafter\np at tempdima\np at result\p@
+    \advance\np at tempdima0.01\p@
+    \edef\np at tempa{\expandafter\np at truncate\the\np at tempdima\np at end}%
+    \np at tempcntb\np at tempa\relax
+    \np at tempdima\np at height\multiply\np at tempdima\np at tempcntb
+    \advance\np at tempcntb\@ne\relax
+  \else\ifnum\np at vparts=\@ne\relax
+    \np at height\remainingtextheight
+    \np at tempcntb\tw@\relax
+    \np at tempdima\np at height
+  \else
+    \np at calc@vheight
+    \np at tempdima\np at height\multiply\np at tempdima\np at tempcntb
+    \advance\np at tempcntb\@ne
+  \fi\fi
+  \let\unitlength\relax
+  \begin{picture}(\textwidth,\remainingtextheight)(\z@,\z@)%
+  \color{NotesVColor}%
+  \multiput(\z@,\z@)(\np at width,\z@){\np at tempcnta}%
+    {\line(0,1){\np at tempdima}}%
+  \color{NotesHColor}%
+  \multiput(\z@,\z@)(\z@,\np at height){\np at tempcntb}%
+    {\line(1,0){\textwidth}}%
+  \end{picture}}
+\newcommand{\np at ns@text}{%
+  \def\np at tempa{none}\ifx\np at tempa\np at titlestyle
+    \hrule\@height\z@
+    \vspace*{\np at titleskip}%
+  \fi
+  \def\np at tempa{left}\ifx\np at tempa\np at notesalign
+    \raggedright
+  \else
+    \def\np at tempa{right}\ifx\np at tempa\np at notesalign
+      \raggedleft
+    \else
+      \def\np at tempa{center}\ifx\np at tempa\np at notesalign
+        \centering
+      \fi
+    \fi
+  \fi
+  \color{NotesTextColor}\notesareatext}
+\newcommand{\np at inner@notespage}{\parfillskip\z@ plus 1fil%
+  \csname np at ns@\np at notesstyle\endcsname}
+\newcommand*{\np at notespage}{%
+  \ifKV at np@allowfloats\else
+    \def\np at tempa{newpage}\ifx\np at tempa\np at startnotes
+      \edef\np at orig@textfraction{\textfraction}%
+      \gdef\textfraction{1}%
+    \fi
+  \fi
+  \np at startnotespage
+  \np at savemark
+  \np at setmark
+  \if\np at mark@keep\else
+    \protected at write\@auxout{}%
+      {\string\@writefile{npm}{\string\npnpinfo{\the\c at page}}}%
+  \fi
+  \np at setpagestyle
+  \np at maketitle
+  \def\np at tempa{none}\ifx\np at tempa\np at titlestyle\else
+    \vspace*{\np at titleskip}%
+  \fi
+  \noindent\np at calcheight
+  \ifKV at np@titlenotesfill\vfill\noindent\fi
+  \np at inner@notespage
+  \np at restoremark
+  \ifKV at np@allowfloats\else
+    \def\np at tempa{newpage}\ifx\np at tempa\np at startnotes
+      \xdef\textfraction{\np at orig@textfraction}%
+    \fi
+  \fi
+  \newpage}
+\newcommand*{\notespage}[1][]{%
+  \begingroup
+  \np at marktext@setfalse\setkeys{np}{#1}%
+  \np at notespage
+  \endgroup}
+\newcommand*{\notespages}[1][]{%
+  \begingroup
+  \np at marktext@setfalse\setkeys{np}{#1}%
+  \ifdim\pagetotal=\z@
+    \np at started@on at new@pagetrue\else\np at started@on at new@pagefalse\fi
+  \np at notepages\c at page
+  \ifnp at started@on at new@page\advance\np at notepages\m at ne\fi
+  \divide\np at notepages\np at multiple
+  \multiply\np at notepages\np at multiple
+  \advance\np at notepages-\c at page
+  \ifnp at started@on at new@page\advance\np at notepages\@ne\fi
+  \ifnum\np at notepages<\z@
+    \advance\np at notepages\np at multiple\fi
+  \np at tempcnta\np at endpages
+  \np at tempcntb\np at endpages
+  \divide\np at tempcnta\np at multiple
+  \multiply\np at tempcnta\np at multiple
+  \advance\np at tempcntb-\np at tempcnta
+  \advance\np at notepages-\np at tempcntb
+  \np at tempcnta\np at minpages
+  \divide\np at tempcnta\np at multiple
+  \multiply\np at tempcnta\np at multiple
+  \advance\np at notepages\np at tempcnta
+  \ifnum\np at notepages<\np at minpages
+    \advance\np at notepages\np at multiple\relax\fi
+  \ifnum\np at notepages>\z@\relax
+    \loop\ifnum\np at notepages>\z@\relax
+      \np at notespage\advance\np at notepages\m at ne\relax
+    \repeat
+  \fi
+  \endgroup}
+\newcommand*{\notesfill}[1][]{%
+  \begingroup
+  \setkeys{np}{#1}%
+  \np at calcheight
+  \advance\remainingtextheight-\np at fill@topskip
+  \ifdim\remainingtextheight<\np at fill@minspace\else
+    \ifdim\remainingtextheight>\np at fill@maxspace
+      \np at tempdima\remainingtextheight
+      \advance\np at tempdima-\np at fill@maxspace
+    \else
+      \np at tempdima=\z@
+    \fi
+    \vspace*{\np at fill@topskip}
+    \ifKV at np@filltopfill\vfill\fi
+    \np at maketitle
+    \def\np at tempa{none}\ifx\np at tempa\np at titlestyle\else
+      \vspace*{\np at titleskip}%
+    \fi
+    \noindent\np at calcheight
+    \advance\remainingtextheight-\np at tempdima
+    \ifKV at np@titlenotesfill\vfill\noindent\fi
+    \np at inner@notespage\newpage
+  \fi
+  \endgroup}
+\newcommand*{\setnotespages}[1]{%
+  \np at marktext@setfalse\setkeys{np}{#1}}
+\newcommand*{\definenotesoption}[2]{%
+  \key at ifundefined{np}{#1}{\define at key{np}{#1}[]{\setkeys{np}{#2}}}%
+    {\PackageError{notespages}%
+      {Key #1 is already defined.\MessageBreak}%
+      {The key #1 may have been defined by some package\MessageBreak
+       or you tried to redefine this key.}}}
+\newcommand{\definenotesstyle}[2]{%
+  \edef\np at notesstyle@nominations{\np at notesstyle@nominations,#1}%
+  \expandafter\np at def@notesstyle at key\np at notesstyle@nominations\np at end
+  \long\expandafter\def\csname np at ns@#1\endcsname{#2}}
+\newcommand{\definetitlestyle}[2]{%
+  \edef\np at titlestyle@nominations{\np at titlestyle@nominations,#1}%
+  \expandafter\np at def@titlestyle at key\np at titlestyle@nominations\np at end
+  \long\expandafter\def\csname np at ts@#1\endcsname{#2}}
+\let\np at orig@chapter\chapter
+\newcommand{\nppatchchapter}[1]{%
+  \@ifundefined{chapter}{}{%
+    \def\chapter{\notespages[#1]\np at orig@chapter}}}
+\newcommand*{\np at lang@german}{\def\npnotesname{Notizen}%
+  \def\npnotestext{Diese Seite wurde absichtlich leer gelassen.}}
+\newcommand*{\np at lang@english}{\def\npnotesname{Notes}%
+  \def\npnotestext{This page is intentionally left blank.}}
+\newcommand*{\np at lang@french}{\def\npnotesname{Notes}%
+  \def\npnotestext{Cette page est laiss\'{e}e intentionnellement vide.}}
+\newcommand*{\np at declarelang}[2]{%
+  \@ifpackagewith{babel}{#1}{%
+    \expandafter\addto
+      \csname extras#1\expandafter\endcsname
+      \csname np at lang@#2\endcsname}{}}
+\newcommand*{\np at supportbabel}{%
+  \@ifpackageloaded{babel}{%
+    \np at declarelang{english}{english}%
+    \np at declarelang{USenglish}{english}%
+    \np at declarelang{american}{english}%
+    \np at declarelang{UKenglish}{english}%
+    \np at declarelang{british}{english}%
+    \np at declarelang{canadian}{english}%
+    \np at declarelang{australian}{english}%
+    \np at declarelang{newzealand}{english}%
+    \np at declarelang{austrian}{german}%
+    \np at declarelang{german}{german}%
+    \np at declarelang{germanb}{german}%
+    \np at declarelang{ngerman}{german}%
+    \np at declarelang{naustrian}{german}%
+    \np at declarelang{french}{french}%
+    \np at declarelang{francais}{french}%
+    \np at declarelang{canadien}{french}%
+    \np at declarelang{acadian}{french}}{}}
+\np at supportbabel
+\newcommand*{\np at setcolors}{%
+  \@ifundefined{\string\color @NotesHColor}%
+    {\definecolor{NotesHColor}{gray}{0.7}}{}%
+  \@ifundefined{\string\color @NotesVColor}%
+    {\definecolor{NotesVColor}{gray}{0.7}}{}%
+  \@ifundefined{\string\color @NotesTextColor}%
+    {\definecolor{NotesTextColor}{gray}{0.7}}{}}
+
+\newcommand*{\np at setxcolors}{%
+  \providecolor{NotesHColor}{gray}{0.7}%
+  \providecolor{NotesVColor}{gray}{0.7}%
+  \providecolor{NotesTextColor}{gray}{0.7}}
+
+\newcommand*{\np at supportcolor}{%
+  \@ifpackageloaded{xcolor}{\np at setxcolors}{%
+  \@ifpackageloaded{color}{\np at setcolors}{\let\color\@gobble}}}
+\AtBeginDocument{\InputIfFileExists{\jobname.npm}{}{}%
+  \np at supportbabel\np at supportcolor}
+\endinput
+%%
+%% End of file `notespages.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/notespages/notespages.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2016-08-11 21:43:18 UTC (rev 41838)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2016-08-11 21:44:36 UTC (rev 41839)
@@ -421,7 +421,7 @@
     nimbus15 nkarta nlctdoc
     nmbib noconflict nodetree noindentafter noitcrul nolbreaks
     nomencl nomentbl nonfloat nonumonpart nopageno norasi-c90 normalcolor
-    nostarch notes notes2bib noto notoccite nowidow nox
+    nostarch notes notes2bib notespages noto notoccite nowidow nox
     nrc ntgclass ntheorem ntheorem-vn nuc nucleardata
     numberedblock numericplots numname numprint nwejm
   oberdiek objectz obnov

Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2016-08-11 21:43:18 UTC (rev 41838)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2016-08-11 21:44:36 UTC (rev 41839)
@@ -2403,6 +2403,7 @@
  'minitoc'      => 'latex',  # requires interaction and 1000q instead of 10q
  'mylatexformat'=> 'tex',
  'nameauth'	=> 'pdflatex-preserve-pdf',
+ 'notespages'   => 'latex',  # requires interaction
  'nwejm'	=> 'tex',
  'nomentbl'     => 'latex -translate-file=empty.tcx',   # no 8-bit
  'pbsheet'      => 'latex',  # requires interaction

Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2016-08-11 21:43:18 UTC (rev 41838)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2016-08-11 21:44:36 UTC (rev 41839)
@@ -705,6 +705,7 @@
 depend nopageno
 depend normalcolor
 depend notes
+depend notespages
 depend notoccite
 depend nowidow
 depend nox

Added: trunk/Master/tlpkg/tlpsrc/notespages.tlpsrc
===================================================================


More information about the tex-live-commits mailing list