summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/changes/changes.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/changes/changes.dtx')
-rw-r--r--macros/latex/contrib/changes/changes.dtx140
1 files changed, 107 insertions, 33 deletions
diff --git a/macros/latex/contrib/changes/changes.dtx b/macros/latex/contrib/changes/changes.dtx
index fa99005bae..f2388c9b4a 100644
--- a/macros/latex/contrib/changes/changes.dtx
+++ b/macros/latex/contrib/changes/changes.dtx
@@ -1,4 +1,4 @@
-% \CheckSum{1275}
+% \CheckSum{1357}
%
% \iffalse meta-comment
%
@@ -68,6 +68,7 @@
% \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}
+% \changes{v4.2.0}{2021/07/07}{new macro for setting anonymous name; french translations}
% \GetFileInfo{changes.dtx}
% \RecordChanges
%
@@ -107,8 +108,8 @@
% Type some information to the console.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{changes}[2021/05/30 v4.1.0 changes package]
-\typeout{*** changes package 2021/05/30 v4.1.0 ***}
+\ProvidesPackage{changes}[2021/07/07 v4.2.0 changes package]
+\typeout{*** changes package 2021/07/07 v4.2.0 ***}
% \end{macrocode}
%
% Package \docpackage{xkeyval} provides options with key-value-pairs.
@@ -365,7 +366,8 @@
}
% \end{macrocode}
%
-% Store default author color..
+%
+% Store default author color.
% \begin{macrocode}
\newcommand{\Changes@optiondefaultcolor}{blue}
\DeclareOptionX{defaultcolor}{
@@ -616,7 +618,7 @@
% \begin{macrocode}
\newrobustcmd{\IfIsAuthorEmptyAtPosition}[4]{%
\ifboolexpr{%
- test {\IfIsAnonymous{#1}} or%
+ test {\IfIsAuthorOutputEmpty{#1}} or%
not test {\IfStrEq{\Changes@optionauthormarkupposition}{#2}}%
}%
{#3}%
@@ -625,6 +627,26 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\IfIsAuthorOutputEmpty}
+%
+% Check if author output is empty.
+%
+% This test could be removed if the test for empty \doccommand{Changes@output@author} would work. % todo
+%
+% Corresponds to the if macros of \docpackage{etoolbox}, so it can be used in it's boolean tests.
+% Mainly the last two parameters are the results of \emph{true} and \emph{false} computation.
+% \begin{macrocode}
+\newrobustcmd{\IfIsAuthorOutputEmpty}[3]{%
+ \ifboolexpr{%
+ test {\IfIsAnonymous{#1}} and%
+ not test {\IfStrEq{\Changes@optionauthormarkuptext}{name}}%
+ }%
+ {#2}%
+ {#3}%
+}
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Packages}
%
% Package \docpackage{xcolor} provides colored text.
@@ -749,6 +771,20 @@
\addto\captionsitalian{\def\changesnochanges{Nessuna modifica.}} % translation by me (EK), please provide correct translation
\addto\captionsitalian{\def\changesnoloc{La lista delle modifiche sar\`a disponibile alla prossima esecuzione di \LaTeX.}}
\addto\captionsitalian{\def\changesnosoc{Le modifiche sar\`a disponibile alla prossima esecuzione di \LaTeX.}}
+
+ \addto\captionsfrench{\def\listofchangesname{Liste des modifications}}
+ \addto\captionsfrench{\def\summaryofchangesname{Modifications}}
+ \addto\captionsfrench{\def\compactsummaryofchangesname{Modifications (compact)}}
+ \addto\captionsfrench{\def\changesaddedname{Ajout\'e}}
+ \addto\captionsfrench{\def\changesdeletedname{Supprim\'e}}
+ \addto\captionsfrench{\def\changesreplacedname{Remplac\'e}}
+ \addto\captionsfrench{\def\changeshighlightname{Mis en \'evidence}}
+ \addto\captionsfrench{\def\changescommentname{Comment\'e}}
+ \addto\captionsfrench{\def\changesauthorname{Auteur}}
+ \addto\captionsfrench{\def\changesanonymousname{Anonyme}}
+ \addto\captionsfrench{\def\changesnochanges{Pas de modification}}
+ \addto\captionsfrench{\def\changesnoloc{Liste des modifications disponible apr\`es la prochaine ex\'ecution de \LaTeX.}}
+ \addto\captionsfrench{\def\changesnosoc{Résumé des modifications disponible apr\`es la prochaine ex\'ecution de \LaTeX.}}
}
{}
% \end{macrocode}
@@ -845,6 +881,18 @@
% \end{macrocode}
%
%
+% \begin{macro}{\setanonymousname}
+% Sets the anonymous author name.
+% \begin{macrocode}
+\newrobustcmd{\setanonymousname}[1]{
+ \AtBeginDocument{
+ \def\changesanonymousname{#1}
+ }
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
% \subsubsection{Author markup}
%
% \begin{macro}{\Changes@Markup@author}
@@ -1026,7 +1074,9 @@
\IfIsColored%
{\colorlet{Changes@todocolor}{authorcolor}}%
{\colorlet{Changes@todocolor}{black}}%
- \todo[color=Changes@todocolor!10, bordercolor=Changes@todocolor, linecolor=Changes@todocolor!70, nolist]{\textbf{[\IfIsAnonymous{#2}{}{#3~}\arabic{authorcommentcount}]} #1}%
+ \todo[color=Changes@todocolor!10, bordercolor=Changes@todocolor, linecolor=Changes@todocolor!70, nolist]{%
+ \textbf{[\IfIsAuthorOutputEmpty{#2}{}{#3~}\arabic{authorcommentcount}]} #1%
+ }%
}{}%
\IfStrEq{\Changes@optioncommentmarkup}{margin}%
{%
@@ -1034,13 +1084,13 @@
\IfIsColored%
{\leavevmode\color{authorcolor}}%
{}%
- \textbf{[\IfIsAnonymous{#2}{}{#3~}\arabic{Changes@commentCount#2}]:} #1%
+ \textbf{[\IfIsAuthorOutputEmpty{#2}{}{#3~}\arabic{authorcommentcount}]:} #1%
}%
}{}%
\IfStrEq{\Changes@optioncommentmarkup}{footnote}%
{%
\footnote{%
- \textbf{[\IfIsAnonymous{#2}{}{#3~}\arabic{Changes@commentCount#2}]:} #1%
+ \textbf{[\IfIsAuthorOutputEmpty{#2}{}{#3~}\arabic{authorcommentcount}]:} #1%
}%
}{}%
\IfStrEq{\Changes@optioncommentmarkup}{uwave}%
@@ -1051,7 +1101,7 @@
{}%
\allowbreak%
\uwave{%
- \textbf{[\IfIsAnonymous{#2}{}{#3~}\arabic{Changes@commentCount#2}]:} #1%
+ \textbf{[\IfIsAuthorOutputEmpty{#2}{}{#3~}\arabic{authorcommentcount}]:} #1%
}%
}%
}{}%
@@ -1114,39 +1164,55 @@
%
% \begin{macro}{\Changes@output@author}
%
-% Output command for the author.
+% Output command for the author: id or name.
%
% This command has the following arguments:
% \begin{enumerate}
% \item author's id
-% \item position to output the author to (left or right)
% \end{enumerate}
-%
-% \doccommand{DeclareRobustCommand} is used for not breaking the todo note definition.
-% \begin{macrocode}
-\newrobustcmd{\Changes@output@author}[2]{%
-% \end{macrocode}
-%
-% Output author text only if author's id is given and the position matches, otherwise output empty text.
% \begin{macrocode}
- \IfIsAuthorEmptyAtPosition{#1}{#2}%
+\newrobustcmd{\Changes@output@author}[1]{%
+ \IfStrEq{\Changes@optionauthormarkuptext}{id}%
+ {#1}%
{}%
+ \IfStrEq{\Changes@optionauthormarkuptext}{name}%
{%
- \IfStrEq{\Changes@optionauthormarkuptext}{id}%
- {#1}%
- {}%
- \IfStrEq{\Changes@optionauthormarkuptext}{name}%
+ \IfIsAnonymous{#1}%
+ {\changesanonymousname}%
{%
- % \end{macrocode}
- %
- % I cannot use \doccommand{IfIsEmpty} here, because it does not work in this case.
- % I cannot add the test with \doccommand{IfStrEq} to \doccommand{IfIsEmpty} because it breaks e.g. with a \doccommand{cite} command in the final option.
- % \begin{macrocode}
+ % \end{macrocode}
+ %
+ % I cannot use \doccommand{IfIsEmpty} here, because it does not work in this case.
+ % I cannot add the test with \doccommand{IfStrEq} to \doccommand{IfIsEmpty} because
+ % it breaks e.g. with a \doccommand{cite} command in the final option.
+ % \begin{macrocode}
\IfStrEq{\csuse{Changes@AuthorName#1}}{}%
{#1}%
{\csuse{Changes@AuthorName#1}}%
- }%
- {}%
+ }%
+ }%
+ {}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Changes@output@author@position}
+%
+% Output command for the author at the given position.
+%
+% This command has the following arguments:
+% \begin{enumerate}
+% \item author's id
+% \item position to output the author to (left or right)
+% \end{enumerate}
+%
+% \doccommand{DeclareRobustCommand} is used for not breaking the todo note definition.
+% \begin{macrocode}
+\newrobustcmd{\Changes@output@author@position}[2]{%
+ \IfIsAuthorEmptyAtPosition{#1}{#2}%
+ {}%
+ {%
+ \Changes@output@author{#1}%
}%
}
% \end{macrocode}
@@ -1272,7 +1338,7 @@
\IfIsColored%
{\color{authorcolor}}%
{}%
- \Changes@Markup@author{\Changes@output@author{#2}{left}}%
+ \Changes@Markup@author{\Changes@output@author@position{#2}{left}}%
}}%
}{}%
% \end{macrocode}
@@ -1303,7 +1369,7 @@
\IfIsColored%
{\color{authorcolor}}%
{}%
- \Changes@Markup@author{\Changes@output@author{#2}{right}}%
+ \Changes@Markup@author{\Changes@output@author@position{#2}{right}}%
}}%
}{}%
% \end{macrocode}
@@ -1324,7 +1390,7 @@
\Changes@Markup@comment%
{#5}%
{#2}%
- {\Changes@output@author{#2}{left}\Changes@output@author{#2}{right}}%
+ {\Changes@output@author{#2}}%
}%
}%
% \end{macrocode}
@@ -1717,6 +1783,10 @@
{%
\IfFileExists{\jobname.\Changes@socextension}%
{%
+% \end{macrocode}
+% Deactivate semicolon as shorthand in order to avoid problems reading the semicolon separated lines.
+% \begin{macrocode}
+ \ifbabelshorthand{;}{\shorthandoff{;}}{}
\newread\Changes@InFile%
\openin\Changes@InFile = \jobname.\Changes@socextension%
% \end{macrocode}
@@ -1781,6 +1851,10 @@
% \begin{macrocode}
\repeat
\closein\Changes@InFile%
+% \end{macrocode}
+% Reactivate semicolon as shorthand.
+% \begin{macrocode}
+ \ifbabelshorthand{;}{\shorthandon{;}}{}
}{%
\emph{\changesnosoc}%
\PackageWarning{changes}{LaTeX rerun needed for summary of changes}%