summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/notespages
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-08-22 22:31:57 +0000
committerKarl Berry <karl@freefriends.org>2016-08-22 22:31:57 +0000
commit78dae40b2b2532ac683a14c4ab9933431f0c41bf (patch)
treeda2bebedda5e325da1982329f1419dffe9b7e5e5 /Master/texmf-dist/source/latex/notespages
parent47f08f1016ad104b753c41d9afd2eaf318ce364b (diff)
notespages (22aug16)
git-svn-id: svn://tug.org/texlive/trunk@41906 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/notespages')
-rw-r--r--Master/texmf-dist/source/latex/notespages/notespages.dtx156
1 files changed, 135 insertions, 21 deletions
diff --git a/Master/texmf-dist/source/latex/notespages/notespages.dtx b/Master/texmf-dist/source/latex/notespages/notespages.dtx
index 17911167dd0..38a956f3de7 100644
--- a/Master/texmf-dist/source/latex/notespages/notespages.dtx
+++ b/Master/texmf-dist/source/latex/notespages/notespages.dtx
@@ -35,14 +35,14 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
-% \CheckSum{1320}
+% \CheckSum{1360}
%
% \iffalse meta-comment
%
%<*package>
%%
-\def\fileversion{0.8}
-\def\filedate{2016/08/10}
+\def\fileversion{0.8.1}
+\def\filedate{2016/08/21}
%</package>
%
@@ -50,12 +50,12 @@
\documentclass{ltxdoc}
\usepackage{hypdoc}
\usepackage{graphicx}
-\hypersetup{pdfborder=0,colorlinks,linkcolor=blue}
+\hypersetup{colorlinks,linkcolor=blue}
\usepackage[all]{hypcap}
\setcounter{IndexColumns}{2}
\EnableCrossrefs
\CodelineIndex
-%\RecordChanges
+\RecordChanges
%\OnlyDescription
\makeatletter
% new, like ...Env... commands from doc.sty)
@@ -185,13 +185,14 @@
% \DoNotIndex{\unitlength,\unrestored@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}
+% \newcommand{\since}[2][changed]{\marginpar{\hfill\textsf{\textit{\textcolor[rgb]{0,0.3,0}{#1 #2}}}}}
+%
+% \changes{0.8}{2016/08/10}{initial release}
%
% \title{The \NP\ Package\\[1ex]
% Filling documents, so the total number of pages is a multiple of a given number.}
@@ -797,14 +798,26 @@
% be formated with the current settings (the defaults, the package options, or
% the last options set with |\setnotespages|).
%
+% \changes{0.8.1}{2016/08/21}{corrected manual section for \texttt{\bs nppatchchapter}}%
% 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.
+% because it will suppress the effect of this class option. Any\since{0.8.1}
+% redefinition of |\chapter|, either by loading a package or manually, must be
+% done before the \NP\ package is loaded, otherwise the redefinition and/or the
+% patching may not be effective.
+%
+% The command can be used anywhere in the document and it can be used multiple
+% time. This way, the apperance of a notes page before a new chapter can be
+% changed where ever wanted.
%
% The |\chapter| command is only patched, if it exists, so no errors will occur
% for a class without it.
%
+% \DescribeMacro\npunpatchchapter
+% \changes{0.8.1}{2016/08/21}{added \texttt{\bs npunpatchchapter}}%
+% With\since[added]{0.8.1} |\npunpatchchapter| the command |\chapter| is restored
+% to its original meaning, thus there will be no more notes pages before a new
+% chapter after issuing this command.
+%
% ^^A---------------------------------------------
% \subsection{Supporting Babel}
% \label{sec:babel}
@@ -922,8 +935,7 @@
% to the todo list. And of course, reported bugs will be added.
%
% ^^A--------------------------------------------------------------------------
-% \StopEventually{\newpage\PrintIndex}
-% ^^A \PrintChanges}
+% \StopEventually{\newpage\PrintIndex\PrintChanges}
%
% ^^A--------------------------------------------------------------------------
% \newpage
@@ -1183,6 +1195,21 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\ifnp@started@on@full@page}
+% \changes{0.8.1}{2016/08/21}{added for calculating the number of notes pages}%
+% \begin{macro}{\np@started@on@full@pagefalse}
+% \begin{macro}{\np@started@on@full@pagetrue}
+% In |\notespages| this boolean is set to true, if the current page is already
+% full. It is needed to calculate the number of pages to be inserted.
+% \since[~\\~\\\null\hfill added]{0.8.1}
+% \begin{macrocode}
+\newcommand*{\ifnp@started@on@full@page}{}
+\newif\ifnp@started@on@full@page
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
% ^^A-------------------------
% \subsubsection{``Variables'' for \texttt{\bs notesfill}}
% \begin{macro}{\np@fill@minspace}
@@ -2251,6 +2278,7 @@
%
% ^^A-------------------------
% \subsubsection{Text}
+% \label{sec:ns-text}
% \begin{macro}{\np@ns@text}
% This macro is used to produce the notes area for the \opt{notesstyle} \choice{text}.
% Since |\np@titleskip| is not inserted for |titlestyle=none|, it is inserted here to
@@ -2266,36 +2294,57 @@
\vspace*{\np@titleskip}%
\fi
\def\np@tempa{left}\ifx\np@tempa\np@notesalign
+%% \typeout{notespages debug: notestextalign=left}%
\raggedright
\else
\def\np@tempa{right}\ifx\np@tempa\np@notesalign
+%% \typeout{notespages debug: notestextalign=right}%
\raggedleft
\else
\def\np@tempa{center}\ifx\np@tempa\np@notesalign
+%% \typeout{notespages debug: notestextalign=center}%
\centering
\fi
\fi
\fi
- \color{NotesTextColor}\notesareatext}
+% \end{macrocode}
+% \changes{0.8.1}{2016/08/21}{added \texttt{\bs par} to make alignement work again}%
+% The\since{0.8.1} |\par| had to be added, to make the alignement set with
+% \opt{notesalign} work again after the group was added in |\np@inner@notespage|
+% (see \autoref{sec:use-ns}).
+% \begin{macrocode}
+ \color{NotesTextColor}\notesareatext\par}
% \end{macrocode}
% \end{macro}
%
% ^^A-------------------------
% \subsubsection{Using notes styles}
+% \label{sec:use-ns}
% \begin{macro}{\np@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}).
+%
+% \changes{0.8.1}{2016/08/21}{bug fixed regarding \texttt{\bs unitlength} and \pkg{eso-pic}}%
+% The\since{0.8.1} group around |\csname ...\endcsname| had to be added, because
+% otherwise packages like \pkg{eso-pic} (which uses a \textsf{picture} environment
+% to put something into the background of a page) will fail. The reason for the
+% latter is the |\newpage| at the end of |\np@notespage| (see \autoref{sec:build-np})
+% and the fact, that |\unitlength| would still be disabled at this point without
+% the group.
% \begin{macrocode}
\newcommand{\np@inner@notespage}{\parfillskip\z@ plus 1fil%
- \csname np@ns@\np@notesstyle\endcsname}
+ \begingroup
+ \csname np@ns@\np@notesstyle\endcsname
+ \endgroup}
% \end{macrocode}
% \end{macro}
%
% ^^A---------------------------------------------
% \subsection{User commands}
% \subsubsection{Building a notes page}
+% \label{sec:build-np}
% \begin{macro}{\np@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
@@ -2378,22 +2427,38 @@
% If started on a new page, set the boolean |\ifnp@started@on@new@page| to true,
% else to false.
% \begin{macrocode}
+%% \typeout{notespages debug:\space\the\pagetotal\space\the\pagegoal}%
\ifdim\pagetotal=\z@
\np@started@on@new@pagetrue\else\np@started@on@new@pagefalse\fi
% \end{macrocode}
+% \changes{0.8.1}{2016/08/21}{bug fixed for calculating the number of notes pages}%
+% If\since[added]{0.8.1} the |\pagetotal| is already greater or equal than |\pagegoal|,
+% the notes page will be shifted to a new page, but the calculation would be done
+% based on the current page number. For this, |\ifnp@started@on@full@page| is set.
+% \begin{macrocode}
+ \ifdim\pagetotal<\pagegoal
+ \np@started@on@full@pagefalse\else\np@started@on@full@pagetrue\fi
+% \end{macrocode}
% $n = p$, if(started on new page) $n = n - 1$
% \begin{macrocode}
\np@notepages\c@page
\ifnp@started@on@new@page\advance\np@notepages\m@ne\fi
% \end{macrocode}
+% This\since[added]{0.8.1} correction is needed in case |\notespages| started on
+% an already full page.
+% \begin{macrocode}
+ \ifnp@started@on@full@page\advance\np@notepages\@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.
+% a new page or an already full page.\since[added]{0.8.1} 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@notepages\np@multiple
\multiply\np@notepages\np@multiple
\advance\np@notepages-\c@page
\ifnp@started@on@new@page\advance\np@notepages\@ne\fi
+ \ifnp@started@on@full@page\advance\np@notepages\m@ne\fi
\ifnum\np@notepages<\z@
\advance\np@notepages\np@multiple\fi
% \end{macrocode}
@@ -2549,6 +2614,16 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\npunpatchchapter}
+% \changes{0.8.1}{2016/08/21}{added command}%
+% This macros restores the original meaning of |\chapter|, which is only done,
+% if it exists.\since[added]{0.8.1}
+% \begin{macrocode}
+\newcommand{\npunpatchchapter}{%
+ \@ifundefined{chapter}{}{\let\chapter\np@orig@chapter}}
+% \end{macrocode}
+% \end{macro}
+%
% ^^A---------------------------------------------
% \subsection{Support for other packages}
% \subsubsection{Babel}
@@ -2702,6 +2777,7 @@
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usepackage{afterpage}
+\usepackage{eso-pic}
\usepackage{notespages}
%% CAUTION: do not use this with the class memoir
@@ -2729,12 +2805,11 @@
\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\secleveli{\section}
%%\let\seclevelii\subsection
%% this has to be used with all other classes
-\let\secleveli\chapter
+\def\secleveli{\chapter}
\let\seclevelii\section
%%\tracingnpmarks1
@@ -2749,7 +2824,7 @@
\textsf{\textbf{\Large Example File}}\\[5ex]
Mike Kaufmann\\[2ex]
\href{mailto:m.km@gmx.de}{\texttt{m.km@gmx.de}}\\[2ex]
-2016/08/10 (v0.8)\\[10ex]
+2016/08/21 (v0.8.1)\\[10ex]
\textsf{\textbf{\LARGE Warning: do not print!}}\\[2ex]
You would waste over a hundred pages!
\vspace*{\fill}
@@ -2765,6 +2840,10 @@ 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.
+Btw.: In the lower left corner of this page and the next three is a bit of text,
+put there with \textsf{eso-pic}, to check, if the bug from version 0.8 is gone.
+It's in yellow, so barely visible.
+
The commands are:
\begin{verbatim}
@@ -2773,10 +2852,16 @@ The commands are:
\notespages
\end{verbatim}
+%% testing eso-pic
+\AddToShipoutPictureBG{\AtPageLowerLeft{\makebox(0,0)[bl]{\textcolor{yellow}{eos-pic test}}}}
+
\notesfill
\notespage
\notespages
+%% testing eso-pic
+\ClearShipoutPictureBG
+
\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
@@ -3488,6 +3573,24 @@ 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.
+The command \verb|\nppatchchapter| can be used multiple times in a document,
+enabling the user to change the apperance of a notes page before a new chapter.
+The command is:
+
+\begin{verbatim}
+\nppatchchapter{default,vacant,multiple=2,
+ notestext={Another notes page\\
+ automatically inserted\\
+ before a new chapter.}}
+\end{verbatim}
+
+\nppatchchapter{default,vacant,multiple=2,
+ notestext={Another notes page\\
+ automatically inserted\\
+ before a new chapter.}}
+
+\fillit[1-3]
+
\secleveli{Colors and Languages}
\seclevelii{Colors}
The \textsf{NotesPages} package uses three colors.
@@ -3584,7 +3687,18 @@ start a new section here.
\fillit[1-4]
-\seclevelii{The End}
+\seclevelii{The command \texttt{\textbackslash npunpatchchapter}}
+With \verb|\npunpatchchapter| the original meaning of \verb|\chapter| can be
+restored. After that, there may be the usual empty before a new chapter, as can
+be seen on the next page. The command:
+
+\begin{verbatim}
+\npunpatchchapter
+\end{verbatim}
+
+\npunpatchchapter
+
+\secleveli{The End}
Now this is the end of this example file. But I just can't resist to add one more
example:
\begin{verbatim}