summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/changes/changes.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-05-31 03:00:52 +0000
committerNorbert Preining <norbert@preining.info>2021-05-31 03:00:52 +0000
commit098258765e1921f3e57f38e424272587103189dd (patch)
treed3b0a1f7a326ceb6c783fe64f5913abe9eb6e673 /macros/latex/contrib/changes/changes.dtx
parentfd9ad0362e70874436480f729796d81aec6912a2 (diff)
CTAN sync 202105310300
Diffstat (limited to 'macros/latex/contrib/changes/changes.dtx')
-rw-r--r--macros/latex/contrib/changes/changes.dtx48
1 files changed, 38 insertions, 10 deletions
diff --git a/macros/latex/contrib/changes/changes.dtx b/macros/latex/contrib/changes/changes.dtx
index cdb43d7d46..fa99005bae 100644
--- a/macros/latex/contrib/changes/changes.dtx
+++ b/macros/latex/contrib/changes/changes.dtx
@@ -1,4 +1,4 @@
-% \CheckSum{1263}
+% \CheckSum{1275}
%
% \iffalse meta-comment
%
@@ -67,6 +67,7 @@
% \changes{v4.0.2}{2021/04/05}{bugfix: documentation with ifthenelse references}
% \changes{v4.0.3}{2021/05/09}{bugfix: compile error with cite command in change markup with final option}
% \changes{v4.0.4}{2021/05/13}{bugfix: added missing regression.dtx to ctan archive; no code change}
+% \changes{v4.1.0}{2021/05/30}{clickable list of changes}
% \GetFileInfo{changes.dtx}
% \RecordChanges
%
@@ -106,8 +107,8 @@
% Type some information to the console.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{changes}[2021/05/13 v4.0.4 changes package]
-\typeout{*** changes package 2021/05/13 v4.0.4 ***}
+\ProvidesPackage{changes}[2021/05/30 v4.1.0 changes package]
+\typeout{*** changes package 2021/05/30 v4.1.0 ***}
% \end{macrocode}
%
% Package \docpackage{xkeyval} provides options with key-value-pairs.
@@ -1332,7 +1333,7 @@
\IfIsEmpty{#2}%
{\def\Changes@locid{}}%
{\def\Changes@locid{~(#2)}}%
- \addtocontents{\Changes@locextension}{\protect\ChangesListline{#1}{#6\Changes@locid}{#7}{\thepage}}%
+ \phantomsection\addcontentsline{\Changes@locextension}{#1}{#6\Changes@locid: \truncate{\Changestruncatewidth}{#7}}%
}%
% \end{macrocode}
%
@@ -1504,14 +1505,14 @@
%
% \begin{macro}{\ChangesListline}
%
-% Output of a list line.
+% Output of a list line, calls \doccommand{contentsline} for output which uses \doccommand{l@change}.
%
% This command has the following arguments:
% \begin{enumerate}
% \item change type (added, ...)
% \item change description with author
-% \item text
% \item page
+% \item page reference for hyperref
% \end{enumerate}
%
% \begin{macrocode}
@@ -1520,31 +1521,43 @@
\@ifundefined{@dotsep}%
{\def\@dotsep{4.5}}%
{}%
- \@dottedtocline{1}{0pt}{2em}{#2: \truncate{\Changes@truncate@width}{#3}}{#4}%
+ \origcontentsline{change}{#2}{#3}{#4}
}{}%
}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\l@change}
+%
+% Output of a loc entry.
+%
+% \begin{macrocode}
+\newcommand*\l@change{\@dottedtocline{1}{0pt}{2em}}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\settruncatewidth}
%
% Set the width of the truncation.
% Argument: new width.
% \begin{macrocode}
\newcommand{\settruncatewidth}[1]{
- \setlength{\Changes@truncate@width}{#1}
+ \setlength{\Changestruncatewidth}{#1}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\Changes@truncate@width}
+% \begin{macro}{\Changestruncatewidth}
%
% Length for the width of the truncation.
%
% Default: two third of the text width
%
+% Normally, the name would be separated by @, as all internal macros are, but this leads
+% to compile errors when processing the list of changes, therefore the @ were omitted.
+%
% \begin{macrocode}
-\newlength{\Changes@truncate@width}
+\newlength{\Changestruncatewidth}
\settruncatewidth{.6\textwidth}
% \end{macrocode}
% \end{macro}
@@ -1583,6 +1596,14 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\phantomsection}
+%
+% Provide command in case \docpackage{hyperref} is not loaded.
+% \begin{macrocode}
+\providecommand\phantomsection{}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\listofchanges}
%
% This command outputs the list of changes.
@@ -1661,11 +1682,16 @@
% Print list.
%
% The \doccommand{ifeof} command is neccessary in the loop too, otherwise there are problems with the last (empty) line of the file.
+%
+% The output is done with \doccommand{contentsline}, in order to filter the output I have to redefine the command.
+% I did not find a better solution than the \doccommand{let} command.
% \begin{macrocode}
\IfIsInList{\Changes@loc@style}{list}%
{%
\IfFileExists{\jobname.\Changes@locextension}%
{%
+ \let\origcontentsline\contentsline%
+ \let\contentsline\ChangesListline%
\newread\Changes@InFile%
\openin\Changes@InFile=\jobname.\Changes@locextension%
\loop\unless\ifeof\Changes@InFile%
@@ -1675,12 +1701,14 @@
\fi
\repeat
\closein\Changes@InFile%
+ \let\contentsline\origcontentsline%
}{%
\emph{\changesnoloc}%
\PackageWarning{changes}{LaTeX rerun needed for list of changes}%
}%
}{}%
% \end{macrocode}
+%
% Print summary or compact summary.
%
% The \doccommand{ifeof} command is neccessary in the loop too, otherwise there are problems with the last (empty) line of the file.