summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/versonotes/versonotes.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-07-06 20:41:23 +0000
committerKarl Berry <karl@freefriends.org>2019-07-06 20:41:23 +0000
commit7ecd3c9fef7acbaf8f22ce67409122655ad704a3 (patch)
treee0d616faaa4969c61fceaf033b7c571799b99989 /Master/texmf-dist/source/latex/versonotes/versonotes.dtx
parent82f960603e3cb2b85ba3eed11f6422e354979d69 (diff)
versonotes (6jul19)
git-svn-id: svn://tug.org/texlive/trunk@51568 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/versonotes/versonotes.dtx')
-rw-r--r--Master/texmf-dist/source/latex/versonotes/versonotes.dtx97
1 files changed, 73 insertions, 24 deletions
diff --git a/Master/texmf-dist/source/latex/versonotes/versonotes.dtx b/Master/texmf-dist/source/latex/versonotes/versonotes.dtx
index 8711ded03f7..afcdc70719f 100644
--- a/Master/texmf-dist/source/latex/versonotes/versonotes.dtx
+++ b/Master/texmf-dist/source/latex/versonotes/versonotes.dtx
@@ -2,9 +2,9 @@
% This is versonotes.dtx, which supports adding notes on verso pages,
% opposite annotation on the recto pages. Still sketchy
%%
-%% Release version 0.3, 2015 December 8.
+%% Release version 0.4, 2019 July 6.
%%
-%% Copyright 2014, 2015 Norman Gray <http://nxg.me.uk>
+%% Copyright 2014, 2015, 2019 Norman Gray <https://nxg.me.uk>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -23,16 +23,16 @@
%%
%%%% File: versonotes.dtx
-%<+package|driver|example>%%%% Source: 1ce01fd3d4fc, 2015-09-16T13:05:15+01:00
+%<+package|driver|example>%%%% Source: 7d4f5fb7b19e, 2019-07-06T19:09:45+01:00
%%
%<+package>\NeedsTeXFormat{LaTeX2e}
-%<+package>\ProvidesPackage{versonotes}[2015/12/08 v0.3]
+%<+package>\ProvidesPackage{versonotes}[2019/07/06 v0.4]
%
%<*driver>
\documentclass{ltxdoc}
\title{versonotes: Notes on verso pages}
-\author{Norman Gray\\\url{http://nxg.me.uk}}
-\date{Release 0.3, 2015 December 8}
+\author{Norman Gray\\\url{https://nxg.me.uk}}
+\date{Release 0.4, 2019 July 6}
\usepackage{url}
\newcommand\Lopt[1]{\textsf {#1}} % options
\newcommand\file[1]{\texttt {#1}}
@@ -64,7 +64,6 @@
\def\bs{$\backslash$}
-%\OnlyDescription
\begin{document}
\maketitle
%\tableofcontents
@@ -93,6 +92,11 @@
%
% To invoke the package, use the command |\usepackage{versonotes}|.
%
+% It is possible to start the document other than on page one. To do
+% this, you can call |\setcounter{page}{|\emph{n}|}| as usual, but it
+% must be done \emph{before} the line |\usepackage{versonotes}|. The
+% package may get confused if the page number is changed at other times.
+%
% If two notes come too close after one another, the second would
% overprint the first if we did not take steps to avoid this. By
% default, they are separated from each other by a short horizontal
@@ -112,7 +116,7 @@
% The dimensions |\versoleftmargin| and |\versotextwidth| specify the
% position of the text block on the verso page. The defaults for
% these are based on the |\textwidth| and |\evensidemargin| of the
-% document at the time the package is loaded.
+% document \emph{at the time the package is loaded}.
% By default, verso paragraphs are set ragged-left; with the
% declarations in |\versolayout| setting the paragraph parameters.
% You may reset the first two dimensions with for example
@@ -147,6 +151,9 @@
% located opposite the position where the |\versonote| macro was
% called on the \emph{previous} run.
%
+% \item If notes collide, you may well have to re-run \LaTeX\ several
+% times. There is quite a lot of state in the |.aux| file.
+%
% \item The package is available on CTAN at
% \texttt{macros/latex/contrib/versonotes/}. The source is hosted at
% \url{https://bitbucket.org/nxg/versonotes}, where you can also find
@@ -154,10 +161,28 @@
%
% \end{itemize}
%
-% \subsection*{Acknowledgements}
-%
-% Thanks to Thomas H.\ Luxon for permission to include the `Paradise
-% Lost' notes in the sample text, and to Axel Berger for suggesting the `rectonotes' option.
+% \subsection*{Acknowledgements, and release notes}
+%
+% \iffalse @RELEASENOTES@ \fi
+%
+%
+% Thanks to Thomas H. Luxon for permission to include the
+% ‘Paradise Lost’ notes in the sample text.
+%
+% \begin{description}
+% \item[Version 0.4, 2019 July 6]\relax
+% Support changing the initial page number
+% (thanks to P J Couch for the suggestion).
+% \item[Version 0.3, 2015 December 8]\relax
+% \leavevmode\begin{itemize}
+% \item Minor documentation adjustments.
+% \item Added the [rectonotes] option
+% (thanks to Axel Berger for this suggestion).
+% \end{itemize}
+% \item[Version 0.2, 2015 February 16]\relax
+% Initial public release.
+% \end{description}
+%
%
% \StopEventually{}
@@ -252,8 +277,16 @@
% before being transferred as a unit into |\verso@pages|.
% \begin{macrocode}
\newtoks\verso@currentpage
+% \end{macrocode}
+% We keep track of page numbers when invoking |\verso@note| below. We
+% initialise this to be the current page number (typically~1). Doing
+% this this way means that if the document sets the current page
+% number using |\setcounter{page}{n}| \emph{before} loading the
+% package, then we will respect that. We will get confused if the
+% page number is changed at other points.
+% \begin{macrocode}
\newcount\verso@currentpagenum
- \verso@currentpagenum=1
+ \verso@currentpagenum=\c@page
\newcount\verso@currentnotenum
\verso@currentnotenum=0
\newdimen\verso@spacerskip
@@ -298,14 +331,14 @@
\long\def\verso@note#1#2#3{%
\global\@verso@processversonotestrue
% \end{macrocode}
-% Store the target page number, and issue a warning if this was
+% Store the target page number. It would be nice to issue a warning if this is
% indicated to appear on the (ignored) first page; such notes are
-% silently discarded below.
+% silently discarded below. However detecting this here requires that
+% |\@tempcnta| is equal to~1 on the call of this, and we can't
+% guarantee this if we support calling |\setcounter{page}{x}| before
+% loading the package.
% \begin{macrocode}
\@tempcnta=#1
- \ifnum\@tempcnta=1
- \PackageWarning{versopages}{page 1 verso text will be ignored}
- \fi
% \end{macrocode}
% Gather pages from the .aux file, assembling them into a single list
% in |\verso@pages| with one group per page, each containing a
@@ -518,6 +551,22 @@
% must similarly do nothing on pages~1 and~2. This works because
% in the latter case we have initialised |\verso@pages| with an extra
% leading |{{}}|.
+%
+% We manage the page skipping by decrementing a `pages to skip'
+% counter. The more obvious way of doing that it to test the value of
+% |\@tempcnta|, which at this point holds the current page number, but
+% this produces the wrong answer if the document starts at other than
+% page~1 (perhaps because the document includes |\setcounter{page}{99}|).
+% \begin{macrocode}
+\newcount\verso@pagestoskip
+\if@verso@notesonleft
+ \verso@pagestoskip=1
+\else
+ \verso@pagestoskip=2
+\fi
+% \end{macrocode}
+%
+% Define |\verso@processonepage@|.
% \begin{macrocode}
\long\def\verso@processonepage@#1#2\@nil{
\def\@tempa{#1}
@@ -526,12 +575,7 @@
% recto case). Any notes which would appear in such a position are
% silently discarded.
% \begin{macrocode}
- \if@verso@notesonleft
- \@tempcnta=1
- \else
- \@tempcnta=2
- \fi
- \ifnum\c@page>\@tempcnta
+ \ifnum\verso@pagestoskip=0
% \end{macrocode}
% If there are no verso-notes on this page, then ship out an empty box.
% \begin{macrocode}
@@ -575,6 +619,11 @@
#1}
\endgroup
\fi
+ \else
+% \end{macrocode}
+% The |\verso@pagestoskip| counter is still positive, so decrement it.
+% \begin{macrocode}
+ \global\advance\verso@pagestoskip -1
\fi
% \end{macrocode}
% Finally, set |\verso@pages| to the tail of the list.