From 78dae40b2b2532ac683a14c4ab9933431f0c41bf Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 22 Aug 2016 22:31:57 +0000 Subject: notespages (22aug16) git-svn-id: svn://tug.org/texlive/trunk@41906 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/notespages/README | 1 + .../texmf-dist/doc/latex/notespages/notespages.pdf | Bin 577571 -> 613627 bytes Master/texmf-dist/doc/latex/notespages/np-test.pdf | Bin 701209 -> 702961 bytes Master/texmf-dist/doc/latex/notespages/np-test.tex | 49 ++++++- .../source/latex/notespages/notespages.dtx | 156 ++++++++++++++++++--- .../texmf-dist/tex/latex/notespages/notespages.sty | 22 ++- 6 files changed, 198 insertions(+), 30 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/notespages/README b/Master/texmf-dist/doc/latex/notespages/README index 5ca152ae677..d3e772e64ca 100644 --- a/Master/texmf-dist/doc/latex/notespages/README +++ b/Master/texmf-dist/doc/latex/notespages/README @@ -42,6 +42,7 @@ as follows: pdflatex notespages.dtx pdflatex notespages.dtx makeindex -s gind.ist notespages.idx +makeindex -s gglo.ist -o notespages.gls notespages.glo pdflatex notespages.dtx diff --git a/Master/texmf-dist/doc/latex/notespages/notespages.pdf b/Master/texmf-dist/doc/latex/notespages/notespages.pdf index b595c7adac2..2272a92acc9 100644 Binary files a/Master/texmf-dist/doc/latex/notespages/notespages.pdf and b/Master/texmf-dist/doc/latex/notespages/notespages.pdf differ diff --git a/Master/texmf-dist/doc/latex/notespages/np-test.pdf b/Master/texmf-dist/doc/latex/notespages/np-test.pdf index 5d5e8ebe701..a96aa154d32 100644 Binary files a/Master/texmf-dist/doc/latex/notespages/np-test.pdf and b/Master/texmf-dist/doc/latex/notespages/np-test.pdf differ diff --git a/Master/texmf-dist/doc/latex/notespages/np-test.tex b/Master/texmf-dist/doc/latex/notespages/np-test.tex index 0a5d0efadb0..72324900080 100644 --- a/Master/texmf-dist/doc/latex/notespages/np-test.tex +++ b/Master/texmf-dist/doc/latex/notespages/np-test.tex @@ -62,6 +62,7 @@ \usepackage[svgnames]{xcolor} \usepackage{tikz} \usepackage{afterpage} +\usepackage{eso-pic} \usepackage{notespages} %% CAUTION: do not use this with the class memoir @@ -89,12 +90,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 @@ -109,7 +109,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} @@ -125,6 +125,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} @@ -133,10 +137,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 @@ -848,6 +858,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. @@ -944,7 +972,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} 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} % % @@ -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} diff --git a/Master/texmf-dist/tex/latex/notespages/notespages.sty b/Master/texmf-dist/tex/latex/notespages/notespages.sty index a0600451ce9..c8ec6a4ad38 100644 --- a/Master/texmf-dist/tex/latex/notespages/notespages.sty +++ b/Master/texmf-dist/tex/latex/notespages/notespages.sty @@ -41,8 +41,8 @@ %% Right brace \} Tilde \~} %% %% -\def\fileversion{0.8} -\def\filedate{2016/08/10} +\def\fileversion{0.8.1} +\def\filedate{2016/08/21} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{notespages}[\filedate\space @@ -94,6 +94,8 @@ \newcount\np@notepages \newcommand*{\ifnp@started@on@new@page}{} \newif\ifnp@started@on@new@page +\newcommand*{\ifnp@started@on@full@page}{} +\newif\ifnp@started@on@full@page \newcommand*{\np@fill@minspace}{} \newdimen\np@fill@minspace \newcommand*{\np@fill@maxspace}{} @@ -457,19 +459,24 @@ \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} + \color{NotesTextColor}\notesareatext\par} \newcommand{\np@inner@notespage}{\parfillskip\z@ plus 1fil% - \csname np@ns@\np@notesstyle\endcsname} + \begingroup + \csname np@ns@\np@notesstyle\endcsname + \endgroup} \newcommand*{\np@notespage}{% \ifKV@np@allowfloats\else \def\np@tempa{newpage}\ifx\np@tempa\np@startnotes @@ -507,14 +514,19 @@ \newcommand*{\notespages}[1][]{% \begingroup \np@marktext@setfalse\setkeys{np}{#1}% +%% \typeout{notespages debug:\space\the\pagetotal\space\the\pagegoal}% \ifdim\pagetotal=\z@ \np@started@on@new@pagetrue\else\np@started@on@new@pagefalse\fi + \ifdim\pagetotal<\pagegoal + \np@started@on@full@pagefalse\else\np@started@on@full@pagetrue\fi \np@notepages\c@page \ifnp@started@on@new@page\advance\np@notepages\m@ne\fi + \ifnp@started@on@full@page\advance\np@notepages\@ne\fi \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 \np@tempcnta\np@endpages @@ -579,6 +591,8 @@ \newcommand{\nppatchchapter}[1]{% \@ifundefined{chapter}{}{% \def\chapter{\notespages[#1]\np@orig@chapter}}} +\newcommand{\npunpatchchapter}{% + \@ifundefined{chapter}{}{\let\chapter\np@orig@chapter}} \newcommand*{\np@lang@german}{\def\npnotesname{Notizen}% \def\npnotestext{Diese Seite wurde absichtlich leer gelassen.}} \newcommand*{\np@lang@english}{\def\npnotesname{Notes}% -- cgit v1.2.3