From ca487dbeb03c631fe30615694b8d836c3487f1d8 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 11 Oct 2018 20:47:40 +0000
Subject: changes (11oct18)

git-svn-id: svn://tug.org/texlive/trunk@48883 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/changes/changes.dtx | 179 ++++++++++++---------
 1 file changed, 104 insertions(+), 75 deletions(-)

(limited to 'Master/texmf-dist/source/latex/changes/changes.dtx')

diff --git a/Master/texmf-dist/source/latex/changes/changes.dtx b/Master/texmf-dist/source/latex/changes/changes.dtx
index 5a302b36ff4..a2637ca7f16 100644
--- a/Master/texmf-dist/source/latex/changes/changes.dtx
+++ b/Master/texmf-dist/source/latex/changes/changes.dtx
@@ -1,8 +1,8 @@
-% \CheckSum{1086}
+% \CheckSum{1115}
 %
 % \iffalse meta-comment
 %
-%  Copyright (C) 2007-2015
+%  Copyright (C) 2007-2018
 %  Ekkart Kleinod (ekleinod@edgesoft.de)
 % --------------------------------------------------------------------------
 %
@@ -53,6 +53,7 @@
 % \changes{v2.0.2}{2013/08/13}{again no changes in behavior or code; fixed CTAN upload - pdf files were corrupt; improved documentation}
 % \changes{v2.0.3}{2014/10/15}{bugfix when using with amsart}
 % \changes{v2.0.4}{2015/04/27}{unknown language does not lead to error: fallback English}
+% \changes{v2.1.0}{2018/10/10}{fixed problems with final option and additional spaces/blanks, warning for wrong list style}
 % \GetFileInfo{changes.dtx}
 % \RecordChanges
 %
@@ -76,6 +77,7 @@
 %
 % \selectlanguage{english}
 %
+% \cleardoublepage
 % \section{The documented sourcecode}
 %
 % The sourcecode is documented in English only.
@@ -92,8 +94,8 @@
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{changes}
-[2015/04/27 v2.0.4 changes package]
-\typeout{*** changes package 2015/04/27 v2.0.4 ***}
+[2018/10/10 v2.1.0 changes package]
+\typeout{*** changes package 2018/10/10 v2.1.0 ***}
 %    \end{macrocode}
 %
 % Package \chpackage{xkeyval} provides options with key-value-pairs.
@@ -579,7 +581,7 @@
 %  Store id, name and color using named variables.
 %  Define counter and color per author.
 %    \begin{macrocode}
-\newcommand*\definechangesauthor[2][]{%
+\newcommand*\definechangesauthor[2][]{
 %    \end{macrocode}
 %
 % Call \emph{setkeys} in order to evaluate the key-value-options and fill the value storage.
@@ -909,9 +911,14 @@
 % Call \emph{setkeys} in order to evaluate the key-value-options and fill the value storage.
 %    \begin{macrocode}
 	\setkeys{Changes@added}{#1}%
+	\let\Changes@esphack\relax%
 	\Changes@output%
 		{\Changes@Markup@Added{#2}}%
-		{#2}%
+		{%
+			\ifthenelse{\equal{\@empty}{#2}}%
+				{\@bsphack \let\Changes@esphack\@esphack}%
+				{#2}%
+		}%
 		{\Changes@added@id}%
 		{\Changes@added@remark}%
 		{#2}%
@@ -920,6 +927,7 @@
 		{\Changes@added@decid}%
 		{\Changes@added@decremark}%
 	\stepcounter{Changes@AddCount\Changes@added@id}%
+	\Changes@esphack%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -927,8 +935,9 @@
 % \begin{macro}{\deleted}
 %  The command formats text as deleted text.
 %
-%  The definition of the empty text for unchanged text is taken from a tip from \texttt{de.comp.text.tex}.
-%  It solves the problem of additional space caused by an empty command.
+%  The definition of the empty text for unchanged text is provided by Frank Mittelbach, slightly modified by me.
+%  It solves the problem of additional space caused by an empty command (e.g. when using the \choption{final} option).
+%  Before that, there was a slightly erroneous version from \texttt{de.comp.text.tex} (issue \#2).
 %
 %  Mandatory argument: deleted text.
 %  Optional argument (key-value): author's id, remark, decision, decision author's id, decision remark
@@ -938,9 +947,10 @@
 % Call \emph{setkeys} in order to evaluate the key-value-options and fill the value storage.
 %    \begin{macrocode}
 	\setkeys{Changes@deleted}{#1}%
+	\let\Changes@esphack\relax%
 	\Changes@output%
 		{\Changes@Markup@Deleted{#2}}%
-		{\@bsphack \expandafter \@esphack}%
+		{\@bsphack \let\Changes@esphack\@esphack}%
 		{\Changes@deleted@id}%
 		{\Changes@deleted@remark}%
 		{#2}%
@@ -949,6 +959,7 @@
 		{\Changes@deleted@decid}%
 		{\Changes@deleted@decremark}%
 	\stepcounter{Changes@DeleteCount\Changes@deleted@id}%
+	\Changes@esphack%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -964,10 +975,15 @@
 % Call \emph{setkeys} in order to evaluate the key-value-options and fill the value storage.
 %    \begin{macrocode}
 	\setkeys{Changes@replaced}{#1}%
-	\Changes@output
-		{{\Changes@Markup@Added{#2}}{\Changes@Markup@Deleted{#3}}}
-		{#2}
-		{\Changes@replaced@id}
+	\let\Changes@esphack\relax%
+	\Changes@output%
+		{{\Changes@Markup@Added{#2}}{\Changes@Markup@Deleted{#3}}}%
+		{%
+			\ifthenelse{\equal{\@empty}{#2}}%
+				{\@bsphack \let\Changes@esphack\@esphack}%
+				{#2}%
+		}%
+		{\Changes@replaced@id}%
 		{\Changes@replaced@remark}%
 		{#2}%
 		{\changesreplacename}%
@@ -975,6 +991,7 @@
 		{\Changes@replaced@decid}%
 		{\Changes@replaced@decremark}%
 	\stepcounter{Changes@ReplaceCount\Changes@replaced@id}%
+	\Changes@esphack%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -1026,72 +1043,84 @@
 %    \begin{macrocode}
 \newcommand{\listofchanges}[1][style=list]{%
 	\setkeys{Changes@loc}{#1}%
-	\ifthenelse{\equal{\@empty}{\Changes@loc@style}}
-		{\def\Changes@loc@style{list}}
-		{
-			\ifthenelse{
-				\equal{\Changes@loc@style}{list}\or
-				\equal{\Changes@loc@style}{summary}
-			}
-				{}
-				{\def\Changes@loc@style{list}}
-		}
+%    \end{macrocode}
+%	All work is done only in draft mode.
+%    \begin{macrocode}
+	\ifthenelse{\boolean{Changes@optiondraft}}%
+		{%
+%    \end{macrocode}
+% Check if style is known, otherwise use \choption{list} by default.
+%    \begin{macrocode}
+			\ifthenelse{\equal{\@empty}{\Changes@loc@style}}%
+				{\def\Changes@loc@style{list}}%
+				{%
+					\ifthenelse{%
+						\equal{\Changes@loc@style}{list}\or%
+						\equal{\Changes@loc@style}{summary}%
+					}%
+						{}%
+						{%
+							\PackageWarning{changes}{Wrong style for list of changes: '\Changes@loc@style', using 'list' instead.}%
+							\def\Changes@loc@style{list}%
+						}%
+				}%
 %    \end{macrocode}
 %	Print list.
 %    \begin{macrocode}
-	\ifthenelse{\equal{\Changes@loc@style}{list}}
-		{
-			\section*{\listofchangesname}
-			\IfFileExists{\jobname.loc}
-				{}{
-					\emph{\changesnoloc}
-					\PackageWarning{changes}{LaTeX rerun needed for list of changes}
-				}
-			\@starttoc{loc}{}
-		}
+			\ifthenelse{\equal{\Changes@loc@style}{list}}%
+				{%
+					\section*{\listofchangesname}%
+					\IfFileExists{\jobname.loc}%
+						{}{%
+							\emph{\changesnoloc}%
+							\PackageWarning{changes}{LaTeX rerun needed for list of changes}%
+						}%
+					\@starttoc{loc}{}%
+				}%
 %    \end{macrocode}
 %	Print summary, but only in draft mode.
 %    \begin{macrocode}
-		{
-			\ifthenelse{\boolean{Changes@optiondraft}}
-				{
-					\section*{\summaryofchangesname}
-					\IfFileExists{\jobname.\Changes@extension}
-						{
-							\setboolean{Changes@MoreLines}{true}
-							\newread\Changes@InFile
-							\openin\Changes@InFile = \jobname.\Changes@extension
-							\whiledo{\boolean{Changes@MoreLines}}{
-								\read\Changes@InFile to \Changes@Line
-								\ifeof\Changes@InFile
-									\setboolean{Changes@MoreLines}{false}
-								\else
-									\expandafter\changes@chopline\Changes@Line\\
+				{%
+					\section*{\summaryofchangesname}%
+					\IfFileExists{\jobname.\Changes@extension}%
+						{%
+							\setboolean{Changes@MoreLines}{true}%
+							\newread\Changes@InFile%
+							\openin\Changes@InFile = \jobname.\Changes@extension%
+							\whiledo{\boolean{Changes@MoreLines}}{%
+								\read\Changes@InFile to \Changes@Line%
+								\ifeof\Changes@InFile%
+									\setboolean{Changes@MoreLines}{false}%
+								\else%
+									\expandafter\changes@chopline\Changes@Line\\%
 									\textbf{%
-										\ifthenelse{\boolean{Changes@colored}}
-											{\color{\Changes@InColor}}
-											{}
-										\ifthenelse{\equal{\Changes@InID}{\@empty}}
-											{\changesauthorname: \changesanonymousname}
+										\ifthenelse{\boolean{Changes@colored}}%
+											{\color{\Changes@InColor}}%
+											{}%
+										\ifthenelse{\equal{\Changes@InID}{\@empty}}%
+											{\changesauthorname: \changesanonymousname}%
 											{%
-												\changesauthorname: \Changes@InID
-												\ifthenelse{\equal{\Changes@InName}{\@empty}}
-													{}
-													{ (\Changes@InName)}
-											}
-									}\\
-									\parbox{\Changes@Len@summ}{\changesaddname~\dotfill~\Changes@InAdded}\\
-									\parbox{\Changes@Len@summ}{\changesdeletename~\dotfill~\Changes@InDeleted}\\
-									\parbox{\Changes@Len@summ}{\changesreplacename~\dotfill~\Changes@InReplaced}\\[1ex]
-								\fi
-							}
-							\closein\Changes@InFile
+												\changesauthorname: \Changes@InID%
+												\ifthenelse{\equal{\Changes@InName}{\@empty}}%
+													{}%
+													{ (\Changes@InName)}%
+											}%
+									}\\%
+									\parbox{\Changes@Len@summ}{\changesaddname~\dotfill~\Changes@InAdded}\\%
+									\parbox{\Changes@Len@summ}{\changesdeletename~\dotfill~\Changes@InDeleted}\\%
+									\parbox{\Changes@Len@summ}{\changesreplacename~\dotfill~\Changes@InReplaced}\\[1ex]%
+								\fi%
+							}%
+							\closein\Changes@InFile%
 						}{%
-							\emph{\changesnosoc}
-							\PackageWarning{changes}{LaTeX rerun needed for summary of changes}
-						}
-				}{}
-		}
+							\emph{\changesnosoc}%
+							\PackageWarning{changes}{LaTeX rerun needed for summary of changes}%
+						}%
+				}%
+%    \end{macrocode}
+%	In final mode print nothing.
+%    \begin{macrocode}
+		}{}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -1118,16 +1147,16 @@
 % Output data for list of changes.
 %    \begin{macrocode}
 	\setcounter{Changes@Author}{0}
-	\whiledo{\value{Changes@Author} < \value{Changes@AuthorCount}}{
-		\stepcounter{Changes@Author}
-		\def\Changes@ID{\@nameuse{Changes@AuthorID\theChanges@Author}}
+	\whiledo{\value{Changes@Author} < \value{Changes@AuthorCount}}{%
+		\stepcounter{Changes@Author}%
+		\def\Changes@ID{\@nameuse{Changes@AuthorID\theChanges@Author}}%
 		\immediate\write\Changes@OutFile{\Changes@ID;%
 			\@nameuse{Changes@AuthorColor\Changes@ID};%
 			\@nameuse{Changes@AuthorName\Changes@ID};%
 			\the\value{Changes@AddCount\Changes@ID};%
 			\the\value{Changes@DeleteCount\Changes@ID};%
-			\the\value{Changes@ReplaceCount\Changes@ID}}
-	}
+			\the\value{Changes@ReplaceCount\Changes@ID}}%
+	}%
 %    \end{macrocode}
 % Close output file.
 %    \begin{macrocode}
-- 
cgit v1.2.3

