| 1 |
% \CheckSum{1361} |
| 2 |
% |
| 3 |
% \iffalse meta-comment |
| 4 |
% |
| 5 |
% Copyright (C) 2007-2021 |
| 6 |
% Ekkart Kleinod ([email protected]) |
| 7 |
% -------------------------------------------------------------------------- |
| 8 |
% |
| 9 |
% This work may be distributed and/or modified under the |
| 10 |
% conditions of the \LaTeX\ Project Public License, either version~1.3 |
| 11 |
% of this license or any later version. |
| 12 |
% The latest version of this license is in\\ |
| 13 |
% \url{http://www.latex-project.org/lppl.txt}\\ |
| 14 |
% and version~1.3 or later is part of all distributions of \LaTeX\ |
| 15 |
% version 2005/12/01 or later. |
| 16 |
% |
| 17 |
% This work has the LPPL maintenance status "maintained". |
| 18 |
% The current maintainer of this work is Ekkart Kleinod. |
| 19 |
% |
| 20 |
% Some code for providing multilanguage documentation was |
| 21 |
% used from the pst-pdf package by Rolf Niepraschk and Hubert Gaesslein. |
| 22 |
% \fi |
| 23 |
% |
| 24 |
% \CharacterTable |
| 25 |
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 26 |
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 27 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 28 |
% Exclamation \! Double quote \" Hash (number) \# |
| 29 |
% Dollar \$ Percent \% Ampersand \& |
| 30 |
% Acute accent \' Left paren \( Right paren \) |
| 31 |
% Asterisk \* Plus \+ Comma \, |
| 32 |
% Minus \- Point \. Solidus \/ |
| 33 |
% Colon \: Semicolon \; Less than \< |
| 34 |
% Equals \= Greater than \> Question mark \? |
| 35 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 36 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 37 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 38 |
% Right brace \} Tilde \~} |
| 39 |
% |
| 40 |
% \changes{v0.1}{2007/01/16}{Initial version.} |
| 41 |
% \changes{v0.2}{2007/01/17}{new convenience commands, LPPL, bugfixes: missing babel package, ifthen-placement, loc, author markup} |
| 42 |
% \changes{v0.3}{2007/01/22}{english documentation, replaced command changed with command replaced} |
| 43 |
% \changes{v0.4}{2007/01/24}{pdfcolmk for improved markup, introduced author-ids, first CTAN version} |
| 44 |
% \changes{v0.5}{2007/08/26}{reimplementation without array package, UTF-8, grayed text, change pf command arguments} |
| 45 |
% \changes{v0.5.1}{2007/08/27}{deleted text is striked out again using package ulem, greying didn't work} |
| 46 |
% \changes{v0.5.2}{2007/10/10}{package options for ulem and xcolor} |
| 47 |
% \changes{v0.5.3}{2010/11/22}{use class options (final, draft) as well} |
| 48 |
% \changes{v0.5.4}{2011/04/25}{extract user documentation; default language changed to English; script for removal of commands} |
| 49 |
% \changes{v0.6.0}{2012/01/11}{redefined user interface for setting options, markup, authors; newly structured documentation} |
| 50 |
% \changes{v1.0.0}{2012/04/25}{key-value-interface for change commands; special characters in list of changes} |
| 51 |
% \changes{v2.0.0}{2013/06/30}{fixed problem with special characters in tabbing environment (loc), real list of changes, authormarkup} |
| 52 |
% \changes{v2.0.1}{2013/08/10}{no changes in behavior or code; fixed problems with CTAN upload} |
| 53 |
% \changes{v2.0.2}{2013/08/13}{again no changes in behavior or code; fixed CTAN upload - pdf files were corrupt; improved documentation} |
| 54 |
% \changes{v2.0.3}{2014/10/15}{bugfix when using with amsart} |
| 55 |
% \changes{v2.0.4}{2015/04/27}{unknown language does not lead to error: fallback English} |
| 56 |
% \changes{v2.1.0}{2018/10/10}{fixed problems with final option and additional spaces/blanks, warning for wrong list style} |
| 57 |
% \changes{v3.0.0}{2018/11/04}{commands for commenting and highlighting text, rewriting a lot of code, remark is now comment} |
| 58 |
% \changes{v3.1.0}{2018/12/17}{new script for markup removal, improved user manual} |
| 59 |
% \changes{v3.1.1}{2018/12/18}{bugfix: uneven dot fills in summaries} |
| 60 |
% \changes{v3.1.2}{2019/01/26}{bugfix: problems with amsart class} |
| 61 |
% \changes{v3.1.3}{2019/07/21}{bugfix: option clash for ulem and truncate; documentation of known problems and solutions} |
| 62 |
% \changes{v3.2.0}{2019/10/28}{Merge changes script (pyMergeChanges): Support nested brackets} |
| 63 |
% \changes{v3.2.1}{2019/11/17}{removed obsolete package pdfcolmk} |
| 64 |
% \changes{v3.2.2}{2020/06/16}{Merge changes script (pyMergeChanges): Correctly handle multiple different macros in the same line} |
| 65 |
% \changes{v4.0.0}{2021/01/28}{new: convenience macros, setlocextension, option commandnameprefix, defaultcolor; removed: xifthen, remark} |
| 66 |
% \changes{v4.0.1}{2021/02/14}{bugfix: Command do undefined} |
| 67 |
% \changes{v4.0.2}{2021/04/05}{bugfix: documentation with ifthenelse references} |
| 68 |
% \changes{v4.0.3}{2021/05/09}{bugfix: compile error with cite command in change markup with final option} |
| 69 |
% \changes{v4.0.4}{2021/05/13}{bugfix: added missing regression.dtx to ctan archive; no code change} |
| 70 |
% \changes{v4.1.0}{2021/05/30}{clickable list of changes} |
| 71 |
% \changes{v4.2.0}{2021/07/07}{new macro for setting anonymous name; french translations} |
| 72 |
% \changes{v4.2.1}{2021/07/15}{bugfix: missing babel package produces error} |
| 73 |
% \GetFileInfo{changes.dtx} |
| 74 |
% \RecordChanges |
| 75 |
% |
| 76 |
%^^A -------------------------------------------------------------------------- |
| 77 |
% |
| 78 |
% \maketitle |
| 79 |
% |
| 80 |
% \tableofcontents |
| 81 |
% \cleardoublepage |
| 82 |
% |
| 83 |
% \ifENGLISH |
| 84 |
% \input{userdoc/changes.en} |
| 85 |
% \fi |
| 86 |
% \ifGERMAN |
| 87 |
% \input{userdoc/changes.de} |
| 88 |
% \fi |
| 89 |
% |
| 90 |
%^^A -- source code |
| 91 |
% |
| 92 |
% \StopEventually |
| 93 |
% |
| 94 |
% \selectlanguage{english} |
| 95 |
% |
| 96 |
% \cleardoublepage |
| 97 |
% \section{The documented sourcecode} |
| 98 |
% |
| 99 |
% The sourcecode is documented in English only. |
| 100 |
% This is intended, please do not provide translations for the text below, just corrections or improvements. |
| 101 |
% |
| 102 |
% \begin{macrocode} |
| 103 |
%<*changes> |
| 104 |
% \end{macrocode} |
| 105 |
% |
| 106 |
% \subsection{Package information and options} |
| 107 |
% |
| 108 |
% Set needed \hologo{LaTeX}-format to \hologo{LaTeXe}, provide name, date, version. |
| 109 |
% Type some information to the console. |
| 110 |
% \begin{macrocode} |
| 111 |
\NeedsTeXFormat{LaTeX2e} |
| 112 |
\ProvidesPackage{changes}[2021/07/15 v4.2.1 changes package] |
| 113 |
\typeout{*** changes package 2021/07/15 v4.2.1 ***} |
| 114 |
% \end{macrocode} |
| 115 |
% |
| 116 |
% Package \docpackage{xkeyval} provides options with key-value-pairs. |
| 117 |
% \begin{macrocode} |
| 118 |
\RequirePackage{xkeyval} |
| 119 |
% \end{macrocode} |
| 120 |
% |
| 121 |
% Package \docpackage{etoolbox} provides improved \emph{if}, \emph{bools} as well as a \emph{list} operations. |
| 122 |
% todo |
| 123 |
% \begin{macrocode} |
| 124 |
\RequirePackage{etoolbox} |
| 125 |
% \end{macrocode} |
| 126 |
% |
| 127 |
% Package \docpackage{xstring} provides improved string test and handling methods. |
| 128 |
% \begin{macrocode} |
| 129 |
\RequirePackage{xstring} |
| 130 |
% \end{macrocode} |
| 131 |
% |
| 132 |
% \begin{macro}{\IfIsInList} |
| 133 |
% |
| 134 |
% Helper macro: tests if one of the pipe separated values is in the second list of pipe separated values (boolean or). |
| 135 |
% |
| 136 |
% Corresponds to the if macros of \docpackage{etoolbox}, so it can be used in it's boolean tests. |
| 137 |
% Mainly the last two parameters are the results of \emph{true} and \emph{false} computation. |
| 138 |
% |
| 139 |
% Declare list parsers. |
| 140 |
% \begin{macrocode} |
| 141 |
\DeclareListParser{\dopsvlist}{|} |
| 142 |
\DeclareListParser*{\forpsvlist}{|} |
| 143 |
% \end{macrocode} |
| 144 |
% |
| 145 |
% A temporary list and flag. |
| 146 |
% \begin{macrocode} |
| 147 |
\newcommand{\Changes@tmplist}{} |
| 148 |
\newbool{Changes@inlist} |
| 149 |
% \end{macrocode} |
| 150 |
% |
| 151 |
% Fill list with values, then check if one of the values of the first list is in the second one. |
| 152 |
% \begin{macrocode} |
| 153 |
\newrobustcmd{\IfIsInList}[4]{% |
| 154 |
\renewcommand{\Changes@tmplist}{}% |
| 155 |
% \end{macrocode} |
| 156 |
% |
| 157 |
% I could not get |
| 158 |
% \doccommand{forpsvlist}\{\doccommand{listadd}\doccommand{Changes@tmplist}\}\{\#2\} |
| 159 |
% to work if \#2 is a macro, so I used the code below. |
| 160 |
% |
| 161 |
% Thanks to Ulrike Fischer for the fix of the macro call of \doccommand{dopsvlist} with \doccommand{expandafter}. |
| 162 |
% |
| 163 |
% To make sure \doccommand{do} can be renewed, we define it first, some macros, such as \doccommand{chapter} undefine it. |
| 164 |
% \begin{macrocode} |
| 165 |
\def\do{}% |
| 166 |
\renewcommand*{\do}[1]{% |
| 167 |
\listadd{\Changes@tmplist}{##1}% |
| 168 |
}% |
| 169 |
\expandafter\dopsvlist\expandafter{#2}% |
| 170 |
% \end{macrocode} |
| 171 |
% End fo the workaround for \doccommand{forpsvlist}. |
| 172 |
% \begin{macrocode} |
| 173 |
\setbool{Changes@inlist}{false}% |
| 174 |
\renewcommand*{\do}[1]{% |
| 175 |
\ifinlist{##1}{\Changes@tmplist}% |
| 176 |
{\setbool{Changes@inlist}{true}}% |
| 177 |
{}% |
| 178 |
}% |
| 179 |
\expandafter\dopsvlist\expandafter{#1}% |
| 180 |
\ifbool{Changes@inlist}% |
| 181 |
{#3}% |
| 182 |
{#4}% |
| 183 |
} |
| 184 |
% \end{macrocode} |
| 185 |
% \end{macro} |
| 186 |
% |
| 187 |
% \subsubsection{Package options} |
| 188 |
% |
| 189 |
% Option \docoption{draft}, \emph{default} is \emph{true}. |
| 190 |
% \begin{macrocode} |
| 191 |
\newbool{Changes@optiondraft} |
| 192 |
\setbool{Changes@optiondraft}{true} |
| 193 |
\DeclareOptionX{draft}{ |
| 194 |
\setbool{Changes@optiondraft}{true} |
| 195 |
\typeout{changes-option '\CurrentOption'} |
| 196 |
} |
| 197 |
% \end{macrocode} |
| 198 |
% |
| 199 |
% Option \docoption{final}, sets \docoption{draft} to \emph{false}. |
| 200 |
% \begin{macrocode} |
| 201 |
\DeclareOptionX{final}{ |
| 202 |
\setbool{Changes@optiondraft}{false} |
| 203 |
\typeout{changes-option '\CurrentOption'} |
| 204 |
} |
| 205 |
% \end{macrocode} |
| 206 |
% |
| 207 |
% Declare storage for authormarkup option and store option value or set to default value \emph{superscript}. |
| 208 |
% \begin{macrocode} |
| 209 |
\newcommand{\Changes@optioncommandnameprefix}{none} |
| 210 |
\DeclareOptionX{commandnameprefix}{ |
| 211 |
\ifblank{#1} |
| 212 |
{} |
| 213 |
{ |
| 214 |
\IfIsInList{#1}{none|always|ifneeded} |
| 215 |
{\renewcommand{\Changes@optioncommandnameprefix}{#1}} |
| 216 |
{\PackageWarning{changes}{commandnameprefix '#1' unknown, using '\Changes@optioncommandnameprefix'}} |
| 217 |
} |
| 218 |
\typeout{changes-option 'commandnameprefix=\Changes@optioncommandnameprefix'} |
| 219 |
} |
| 220 |
% \end{macrocode} |
| 221 |
% |
| 222 |
% Declare storage for markup options, they are set by the markup option but can be changed with the more special options, therefore they have to be declared at this place. |
| 223 |
% Replacement markup is a combination of added and deleted markup, thus there is no special markup storage. |
| 224 |
% \begin{macrocode} |
| 225 |
\newcommand{\Changes@optionaddedmarkup}{colored} |
| 226 |
\newcommand{\Changes@optiondeletedmarkup}{sout} |
| 227 |
\newcommand{\Changes@optionhighlightmarkup}{background} |
| 228 |
\newcommand{\Changes@optioncommentmarkup}{todo} |
| 229 |
% \end{macrocode} |
| 230 |
% |
| 231 |
% Option \docoption{markup}, sets markup options accordingly. |
| 232 |
% \begin{macrocode} |
| 233 |
\newcommand{\Changes@optionmarkup}{default} |
| 234 |
\DeclareOptionX{markup}{ |
| 235 |
\ifblank{#1} |
| 236 |
{} |
| 237 |
{ |
| 238 |
\IfIsInList{#1}{bfit|default|nocolor|underlined} |
| 239 |
{\renewcommand{\Changes@optionmarkup}{#1}} |
| 240 |
{\PackageWarning{changes}{markup '#1' unknown, using '\Changes@optionmarkup'}} |
| 241 |
} |
| 242 |
\IfStrEq{\Changes@optionmarkup}{default} |
| 243 |
{ |
| 244 |
% nothing to do, included for symmetry and potential later use |
| 245 |
} |
| 246 |
{} |
| 247 |
\IfStrEq{\Changes@optionmarkup}{underlined} |
| 248 |
{ |
| 249 |
\renewcommand{\Changes@optionaddedmarkup}{uline} |
| 250 |
\renewcommand{\Changes@optionhighlightmarkup}{uwave} |
| 251 |
} |
| 252 |
{} |
| 253 |
\IfStrEq{\Changes@optionmarkup}{bfit} |
| 254 |
{ |
| 255 |
\renewcommand{\Changes@optionaddedmarkup}{bf} |
| 256 |
\renewcommand{\Changes@optiondeletedmarkup}{it} |
| 257 |
} |
| 258 |
{} |
| 259 |
\IfStrEq{\Changes@optionmarkup}{nocolor} |
| 260 |
{ |
| 261 |
\renewcommand{\Changes@optionaddedmarkup}{uline} |
| 262 |
\renewcommand{\Changes@optionhighlightmarkup}{uwave} |
| 263 |
} |
| 264 |
{} |
| 265 |
\typeout{changes-option 'markup=\Changes@optionmarkup'} |
| 266 |
} |
| 267 |
% \end{macrocode} |
| 268 |
% |
| 269 |
% Option \docoption{addedmarkup}, stored or set to default value \emph{colored}. |
| 270 |
% \begin{macrocode} |
| 271 |
\DeclareOptionX{addedmarkup}{ |
| 272 |
\ifblank{#1} |
| 273 |
{} |
| 274 |
{ |
| 275 |
\IfIsInList{#1}{bf|colored|dashuline|dotuline|em|it|sl|uline|uuline|uwave} |
| 276 |
{\renewcommand{\Changes@optionaddedmarkup}{#1}} |
| 277 |
{\PackageWarning{changes}{addedmarkup '#1' unknown, using '\Changes@optionaddedmarkup'}} |
| 278 |
} |
| 279 |
\typeout{changes-option 'addedmarkup=\Changes@optionaddedmarkup'} |
| 280 |
} |
| 281 |
% \end{macrocode} |
| 282 |
% |
| 283 |
% Option \docoption{deletedmarkup}, stored or set to default value \emph{sout}. |
| 284 |
% \begin{macrocode} |
| 285 |
\DeclareOptionX{deletedmarkup}{ |
| 286 |
\ifblank{#1} |
| 287 |
{} |
| 288 |
{ |
| 289 |
\IfIsInList{#1}{bf|colored|dashuline|dotuline|em|it|sl|sout|uline|uuline|uwave|xout} |
| 290 |
{\renewcommand{\Changes@optiondeletedmarkup}{#1}} |
| 291 |
{\PackageWarning{changes}{deletedmarkup '#1' unknown, using '\Changes@optiondeletedmarkup'}} |
| 292 |
} |
| 293 |
\typeout{changes-option 'deletedmarkup=\Changes@optiondeletedmarkup'} |
| 294 |
} |
| 295 |
% \end{macrocode} |
| 296 |
% |
| 297 |
% Option \docoption{highlightmarkup}, stored or set to default value \emph{background}. |
| 298 |
% \begin{macrocode} |
| 299 |
\DeclareOptionX{highlightmarkup}{ |
| 300 |
\ifblank{#1} |
| 301 |
{} |
| 302 |
{ |
| 303 |
\IfIsInList{#1}{background|uuline|uwave} |
| 304 |
{\renewcommand{\Changes@optionhighlightmarkup}{#1}} |
| 305 |
{\PackageWarning{changes}{highlightmarkup '#1' unknown, using '\Changes@optionhighlightmarkup'}} |
| 306 |
} |
| 307 |
\typeout{changes-option 'highlightmarkup=\Changes@optionhighlightmarkup'} |
| 308 |
} |
| 309 |
% \end{macrocode} |
| 310 |
% |
| 311 |
% Option \docoption{commentmarkup}, stored or set to default value \emph{todo}. |
| 312 |
% \begin{macrocode} |
| 313 |
\DeclareOptionX{commentmarkup}{ |
| 314 |
\ifblank{#1} |
| 315 |
{} |
| 316 |
{ |
| 317 |
\IfIsInList{#1}{footnote|margin|todo|uwave} |
| 318 |
{\renewcommand{\Changes@optioncommentmarkup}{#1}} |
| 319 |
{\PackageWarning{changes}{commentmarkup '#1' unknown, using '\Changes@optioncommentmarkup'}} |
| 320 |
} |
| 321 |
\typeout{changes-option 'commentmarkup=\Changes@optioncommentmarkup'} |
| 322 |
} |
| 323 |
% \end{macrocode} |
| 324 |
% |
| 325 |
% Declare storage for authormarkup option and store option value or set to default value \emph{superscript}. |
| 326 |
% \begin{macrocode} |
| 327 |
\newcommand{\Changes@optionauthormarkup}{superscript} |
| 328 |
\DeclareOptionX{authormarkup}{ |
| 329 |
\ifblank{#1} |
| 330 |
{} |
| 331 |
{ |
| 332 |
\IfIsInList{#1}{brackets|footnote|none|subscript|superscript} |
| 333 |
{\renewcommand{\Changes@optionauthormarkup}{#1}} |
| 334 |
{\PackageWarning{changes}{authormarkup '#1' unknown, using '\Changes@optionauthormarkup'}} |
| 335 |
} |
| 336 |
\typeout{changes-option 'authormarkup=\Changes@optionauthormarkup'} |
| 337 |
} |
| 338 |
% \end{macrocode} |
| 339 |
% |
| 340 |
% Declare storage for authormarkupposition option and store option value or set to default value \emph{right}. |
| 341 |
% \begin{macrocode} |
| 342 |
\newcommand{\Changes@optionauthormarkupposition}{right} |
| 343 |
\DeclareOptionX{authormarkupposition}{ |
| 344 |
\ifblank{#1} |
| 345 |
{} |
| 346 |
{ |
| 347 |
\IfIsInList{#1}{left|right} |
| 348 |
{\renewcommand{\Changes@optionauthormarkupposition}{#1}} |
| 349 |
{\PackageWarning{changes}{authormarkupposition '#1' unknown, using '\Changes@optionauthormarkupposition'}} |
| 350 |
} |
| 351 |
\typeout{changes-option 'authormarkupposition=\Changes@optionauthormarkupposition'} |
| 352 |
} |
| 353 |
% \end{macrocode} |
| 354 |
% |
| 355 |
% Declare storage for authormarkuptext option and store option value or set to default value \emph{id}. |
| 356 |
% \begin{macrocode} |
| 357 |
\newcommand{\Changes@optionauthormarkuptext}{id} |
| 358 |
\DeclareOptionX{authormarkuptext}{ |
| 359 |
\ifblank{#1} |
| 360 |
{} |
| 361 |
{ |
| 362 |
\IfIsInList{#1}{id|name} |
| 363 |
{\renewcommand{\Changes@optionauthormarkuptext}{#1}} |
| 364 |
{\PackageWarning{changes}{authormarkuptext '#1' unknown, using '\Changes@optionauthormarkuptext'}} |
| 365 |
} |
| 366 |
\typeout{changes-option 'authormarkuptext=\Changes@optionauthormarkuptext'} |
| 367 |
} |
| 368 |
% \end{macrocode} |
| 369 |
% |
| 370 |
% |
| 371 |
% Store default author color. |
| 372 |
% \begin{macrocode} |
| 373 |
\newcommand{\Changes@optiondefaultcolor}{blue} |
| 374 |
\DeclareOptionX{defaultcolor}{ |
| 375 |
\ifblank{#1} |
| 376 |
{} |
| 377 |
{ |
| 378 |
\renewcommand{\Changes@optiondefaultcolor}{#1} |
| 379 |
} |
| 380 |
\typeout{changes-option 'defaultcolor=\Changes@optiondefaultcolor'} |
| 381 |
} |
| 382 |
% \end{macrocode} |
| 383 |
% |
| 384 |
% |
| 385 |
% Options for package \docpackage{todonotes} are directly passed to the package. |
| 386 |
% \begin{macrocode} |
| 387 |
\DeclareOptionX{todonotes}{ |
| 388 |
\typeout{todonotes-option '#1', passed to package todonotes} |
| 389 |
\PassOptionsToPackage{#1}{todonotes} |
| 390 |
} |
| 391 |
% \end{macrocode} |
| 392 |
% |
| 393 |
% Options for package \docpackage{truncate} are directly passed to the package. |
| 394 |
% \begin{macrocode} |
| 395 |
\DeclareOptionX{truncate}{ |
| 396 |
\typeout{truncate-option '#1', passed to package truncate} |
| 397 |
\PassOptionsToPackage{#1}{truncate} |
| 398 |
} |
| 399 |
% \end{macrocode} |
| 400 |
% |
| 401 |
% Options for package \docpackage{ulem} are directly passed to the package. |
| 402 |
% \begin{macrocode} |
| 403 |
\DeclareOptionX{ulem}{ |
| 404 |
\typeout{ulem-option '#1', passed to package ulem} |
| 405 |
\PassOptionsToPackage{#1}{ulem} |
| 406 |
} |
| 407 |
% \end{macrocode} |
| 408 |
% |
| 409 |
% Options for package \docpackage{xcolor} are directly passed to the package. |
| 410 |
% \begin{macrocode} |
| 411 |
\DeclareOptionX{xcolor}{ |
| 412 |
\typeout{xcolor-option '#1', passed to package xcolor} |
| 413 |
\PassOptionsToPackage{#1}{xcolor} |
| 414 |
} |
| 415 |
% \end{macrocode} |
| 416 |
% |
| 417 |
% Unknown options generate a package warning. |
| 418 |
% \begin{macrocode} |
| 419 |
\DeclareOptionX*{ |
| 420 |
\PackageWarning{changes}{Unknown option '\CurrentOption'} |
| 421 |
} |
| 422 |
% \end{macrocode} |
| 423 |
% |
| 424 |
% \subsubsection{Command options} |
| 425 |
% |
| 426 |
% All options for commands (e.g. \doccommand{definechangesauthor}) have to be declared before option processing. |
| 427 |
% |
| 428 |
% \minisec{\doccommand{definechangesauthor}} |
| 429 |
% |
| 430 |
% Declare available options of the command, define value storage. |
| 431 |
% \begin{macrocode} |
| 432 |
\DeclareOptionX<Changes@definechangesauthor>{name}{\def\Changes@definechangesauthor@name{#1}} |
| 433 |
\DeclareOptionX<Changes@definechangesauthor>{color}{\def\Changes@definechangesauthor@color{#1}} |
| 434 |
% \end{macrocode} |
| 435 |
% |
| 436 |
% Set the default values of the options. |
| 437 |
% \begin{macrocode} |
| 438 |
\presetkeys{Changes@definechangesauthor}{ |
| 439 |
name=\@empty, |
| 440 |
color=\Changes@optiondefaultcolor |
| 441 |
}{} |
| 442 |
% \end{macrocode} |
| 443 |
% |
| 444 |
% \minisec{\doccommand{added}} |
| 445 |
% |
| 446 |
% Declare available options of the command, define value storage. |
| 447 |
% \begin{macrocode} |
| 448 |
\DeclareOptionX<Changes@added>{id}{\def\Changes@added@id{#1}} |
| 449 |
\DeclareOptionX<Changes@added>{comment}{\def\Changes@added@comment{#1}} |
| 450 |
% \end{macrocode} |
| 451 |
% |
| 452 |
% Set the default values of the options. |
| 453 |
% \begin{macrocode} |
| 454 |
\presetkeys{Changes@added}{ |
| 455 |
id=\@empty, |
| 456 |
comment=\@empty, |
| 457 |
}{} |
| 458 |
% \end{macrocode} |
| 459 |
% |
| 460 |
% \minisec{\doccommand{deleted}} |
| 461 |
% |
| 462 |
% Declare available options of the command, define value storage. |
| 463 |
% \begin{macrocode} |
| 464 |
\DeclareOptionX<Changes@deleted>{id}{\def\Changes@deleted@id{#1}} |
| 465 |
\DeclareOptionX<Changes@deleted>{comment}{\def\Changes@deleted@comment{#1}} |
| 466 |
% \end{macrocode} |
| 467 |
% |
| 468 |
% Set the default values of the options. |
| 469 |
% \begin{macrocode} |
| 470 |
\presetkeys{Changes@deleted}{ |
| 471 |
id=\@empty, |
| 472 |
comment=\@empty, |
| 473 |
}{} |
| 474 |
% \end{macrocode} |
| 475 |
% |
| 476 |
% \minisec{\doccommand{replaced}} |
| 477 |
% |
| 478 |
% Declare available options of the command, define value storage. |
| 479 |
% \begin{macrocode} |
| 480 |
\DeclareOptionX<Changes@replaced>{id}{\def\Changes@replaced@id{#1}} |
| 481 |
\DeclareOptionX<Changes@replaced>{comment}{\def\Changes@replaced@comment{#1}} |
| 482 |
% \end{macrocode} |
| 483 |
% |
| 484 |
% Set the default values of the options. |
| 485 |
% \begin{macrocode} |
| 486 |
\presetkeys{Changes@replaced}{ |
| 487 |
id=\@empty, |
| 488 |
comment=\@empty, |
| 489 |
}{} |
| 490 |
% \end{macrocode} |
| 491 |
% |
| 492 |
% \minisec{\doccommand{highlight}} |
| 493 |
% |
| 494 |
% Declare available options of the command, define value storage. |
| 495 |
% \begin{macrocode} |
| 496 |
\DeclareOptionX<Changes@highlight>{id}{\def\Changes@highlight@id{#1}} |
| 497 |
\DeclareOptionX<Changes@highlight>{comment}{\def\Changes@highlight@comment{#1}} |
| 498 |
% \end{macrocode} |
| 499 |
% |
| 500 |
% Set the default values of the options. |
| 501 |
% \begin{macrocode} |
| 502 |
\presetkeys{Changes@highlight}{ |
| 503 |
id=\@empty, |
| 504 |
comment=\@empty, |
| 505 |
}{} |
| 506 |
% \end{macrocode} |
| 507 |
% |
| 508 |
% \minisec{\doccommand{comment}} |
| 509 |
% |
| 510 |
% Declare available options of the command, define value storage. |
| 511 |
% \begin{macrocode} |
| 512 |
\DeclareOptionX<Changes@comment>{id}{\def\Changes@comment@id{#1}} |
| 513 |
% \end{macrocode} |
| 514 |
% |
| 515 |
% Set the default values of the options. |
| 516 |
% \begin{macrocode} |
| 517 |
\presetkeys{Changes@comment}{ |
| 518 |
id=\@empty, |
| 519 |
}{} |
| 520 |
% \end{macrocode} |
| 521 |
% |
| 522 |
% \minisec{\doccommand{listofchanges}} |
| 523 |
% |
| 524 |
% Declare available options of the command, define value storage. |
| 525 |
% \begin{macrocode} |
| 526 |
\DeclareOptionX<Changes@loc>{style}{\def\Changes@loc@style{#1}} |
| 527 |
\DeclareOptionX<Changes@loc>{title}{\def\Changes@loc@title{#1}} |
| 528 |
\DeclareOptionX<Changes@loc>{show}{\def\Changes@loc@show{#1}} |
| 529 |
% \end{macrocode} |
| 530 |
% |
| 531 |
% Set the default values of the options. |
| 532 |
% \begin{macrocode} |
| 533 |
\presetkeys{Changes@loc}{ |
| 534 |
style=list, |
| 535 |
title=\@empty, |
| 536 |
show=all, |
| 537 |
}{} |
| 538 |
% \end{macrocode} |
| 539 |
% |
| 540 |
% \subsubsection{Package options} |
| 541 |
% |
| 542 |
% In order to avoid option clashes for options, state them here instead at the moment of requiring the package. |
| 543 |
% Thanks for Markus Pahlow for pointing this out and providing the solution. |
| 544 |
% \begin{macrocode} |
| 545 |
\ExecuteOptionsX{ |
| 546 |
ulem={normalem,normalbf}, |
| 547 |
truncate={breakall,fit} |
| 548 |
} |
| 549 |
% \end{macrocode} |
| 550 |
% |
| 551 |
% \subsubsection{Option processing} |
| 552 |
% |
| 553 |
% Process the options. |
| 554 |
% \begin{macrocode} |
| 555 |
\ProcessOptionsX*\relax |
| 556 |
% \end{macrocode} |
| 557 |
% |
| 558 |
% \subsection{Utility tests} |
| 559 |
% |
| 560 |
% \begin{macro}{\IfIsColored} |
| 561 |
% |
| 562 |
% Check if text should be colored. |
| 563 |
% |
| 564 |
% Corresponds to the if macros of \docpackage{etoolbox}, so it can be used in it's boolean tests. |
| 565 |
% Mainly the last two parameters are the results of \emph{true} and \emph{false} computation. |
| 566 |
% \begin{macrocode} |
| 567 |
\newrobustcmd{\IfIsColored}[2]{% |
| 568 |
\IfStrEq{\Changes@optionmarkup}{nocolor}% |
| 569 |
{#2}% |
| 570 |
{#1}% |
| 571 |
} |
| 572 |
% \end{macrocode} |
| 573 |
% \end{macro} |
| 574 |
% |
| 575 |
% \begin{macro}{\IfIsEmpty} |
| 576 |
% |
| 577 |
% Checks if text in \docoption{\#1} is empty, executes \docoption{\#2} if empty, \docoption{\#3} otherwise. |
| 578 |
% |
| 579 |
% Corresponds to the if macros of \docpackage{etoolbox}, so it can be used in it's boolean tests. |
| 580 |
% Mainly the last two parameters are the results of \emph{true} and \emph{false} computation. |
| 581 |
% |
| 582 |
% 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, see issue \#102. |
| 583 |
% This test does not work (yet) with \doccommand{csuse} as parameter, see \doccommand{Changes@output@author} for the problem. |
| 584 |
% \begin{macrocode} |
| 585 |
\newrobustcmd{\IfIsEmpty}[3]{% |
| 586 |
\ifboolexpr{% |
| 587 |
test {\ifblank{#1}} or% |
| 588 |
test {\ifstrempty{#1}} or% |
| 589 |
test {\ifdefstring{#1}{}} or% |
| 590 |
test {\ifdefstring{#1}{\@empty}}% |
| 591 |
}% |
| 592 |
{#2}% |
| 593 |
{#3}% |
| 594 |
} |
| 595 |
% \end{macrocode} |
| 596 |
% \end{macro} |
| 597 |
% |
| 598 |
% \begin{macro}{\IfIsAnonymous} |
| 599 |
% |
| 600 |
% Check if author id is empty, therefore the author is anonymous. |
| 601 |
% |
| 602 |
% Corresponds to the if macros of \docpackage{etoolbox}, so it can be used in it's boolean tests. |
| 603 |
% Mainly the last two parameters are the results of \emph{true} and \emph{false} computation. |
| 604 |
% \begin{macrocode} |
| 605 |
\newrobustcmd{\IfIsAnonymous}[3]{% |
| 606 |
\IfIsEmpty{#1}{#2}{#3}% |
| 607 |
} |
| 608 |
% \end{macrocode} |
| 609 |
% \end{macro} |
| 610 |
% |
| 611 |
% \begin{macro}{\IfIsAuthorEmptyAtPosition} |
| 612 |
% |
| 613 |
% Check if author is anonymous or position does not equal needed position, therefore the author text is empty. |
| 614 |
% |
| 615 |
% This test could be removed if the test for empty \doccommand{Changes@output@author} would work. % todo |
| 616 |
% |
| 617 |
% Corresponds to the if macros of \docpackage{etoolbox}, so it can be used in it's boolean tests. |
| 618 |
% Mainly the last two parameters are the results of \emph{true} and \emph{false} computation. |
| 619 |
% \begin{macrocode} |
| 620 |
\newrobustcmd{\IfIsAuthorEmptyAtPosition}[4]{% |
| 621 |
\ifboolexpr{% |
| 622 |
test {\IfIsAuthorOutputEmpty{#1}} or% |
| 623 |
not test {\IfStrEq{\Changes@optionauthormarkupposition}{#2}}% |
| 624 |
}% |
| 625 |
{#3}% |
| 626 |
{#4}% |
| 627 |
} |
| 628 |
% \end{macrocode} |
| 629 |
% \end{macro} |
| 630 |
% |
| 631 |
% \begin{macro}{\IfIsAuthorOutputEmpty} |
| 632 |
% |
| 633 |
% Check if author output is empty. |
| 634 |
% |
| 635 |
% This test could be removed if the test for empty \doccommand{Changes@output@author} would work. % todo |
| 636 |
% |
| 637 |
% Corresponds to the if macros of \docpackage{etoolbox}, so it can be used in it's boolean tests. |
| 638 |
% Mainly the last two parameters are the results of \emph{true} and \emph{false} computation. |
| 639 |
% \begin{macrocode} |
| 640 |
\newrobustcmd{\IfIsAuthorOutputEmpty}[3]{% |
| 641 |
\ifboolexpr{% |
| 642 |
test {\IfIsAnonymous{#1}} and% |
| 643 |
not test {\IfStrEq{\Changes@optionauthormarkuptext}{name}}% |
| 644 |
}% |
| 645 |
{#2}% |
| 646 |
{#3}% |
| 647 |
} |
| 648 |
% \end{macrocode} |
| 649 |
% \end{macro} |
| 650 |
% |
| 651 |
% \subsection{Packages} |
| 652 |
% |
| 653 |
% Package \docpackage{xcolor} provides colored text. |
| 654 |
% \begin{macrocode} |
| 655 |
\IfIsColored |
| 656 |
{\RequirePackage{xcolor}} |
| 657 |
{} |
| 658 |
% \end{macrocode} |
| 659 |
% |
| 660 |
% Package \docpackage{ulem} provides commands for striking out text. |
| 661 |
% Providing the needed package options via \doccommand{ExecuteOptionsX}. |
| 662 |
% \begin{macrocode} |
| 663 |
\ifboolexpr{ |
| 664 |
test {\IfIsInList{\Changes@optionaddedmarkup}{dashuline|dotuline|sout|uline|uuline|uwave|xout}} or |
| 665 |
test {\IfIsInList{\Changes@optiondeletedmarkup}{dashuline|dotuline|sout|uline|uuline|uwave|xout}} or |
| 666 |
test {\IfIsInList{\Changes@optionhighlightmarkup}{dashuline|dotuline|sout|uline|uuline|uwave|xout}} |
| 667 |
} |
| 668 |
{\RequirePackage{ulem}} |
| 669 |
{} |
| 670 |
% \end{macrocode} |
| 671 |
% |
| 672 |
% Package \docpackage{todonotes} provides commands for todo notes in the margin. |
| 673 |
% \begin{macrocode} |
| 674 |
\IfStrEq{\Changes@optioncommentmarkup}{todo} |
| 675 |
{\RequirePackage{todonotes}} |
| 676 |
{} |
| 677 |
% \end{macrocode} |
| 678 |
% |
| 679 |
% \subsection{Language dependent texts} |
| 680 |
% |
| 681 |
% If the \docpackage{babel} package is not loaded, the default language is English, in order to use another language, the user has to redefine the variables. |
| 682 |
% If the \docpackage{babel} or the \docpackage{polyglossia} package is loaded, the default language is English too for undefined languages. |
| 683 |
% \begin{macrocode} |
| 684 |
\def\listofchangesname{List of changes} |
| 685 |
\def\summaryofchangesname{Changes} |
| 686 |
\def\compactsummaryofchangesname{Changes (compact)} |
| 687 |
\def\changesaddedname{Added} |
| 688 |
\def\changesdeletedname{Deleted} |
| 689 |
\def\changesreplacedname{Replaced} |
| 690 |
\def\changeshighlightname{Highlighted} |
| 691 |
\def\changescommentname{Commented} |
| 692 |
\def\changesauthorname{Author} |
| 693 |
\def\changesanonymousname{anonymous} |
| 694 |
\def\changesnochanges{No changes.} |
| 695 |
\def\changesnoloc{List of changes is available after the next \LaTeX\ run.} |
| 696 |
\def\changesnosoc{Summary of changes is available after the next \LaTeX\ run.} |
| 697 |
% \end{macrocode} |
| 698 |
% |
| 699 |
% The check for \docpackage{babel} or \docpackage{polyglossia}, define language dependent texts afterwards. |
| 700 |
% \begin{macrocode} |
| 701 |
\ifboolexpr{ |
| 702 |
test {\@ifpackageloaded{babel}} or |
| 703 |
test {\@ifpackageloaded{polyglossia}} |
| 704 |
} |
| 705 |
{ |
| 706 |
\addto\captionsngerman{\def\listofchangesname{Liste der \"Anderungen}} |
| 707 |
\addto\captionsngerman{\def\summaryofchangesname{\"Anderungen}} |
| 708 |
\addto\captionsngerman{\def\compactsummaryofchangesname{\"Anderungen (kompakt)}} |
| 709 |
\addto\captionsngerman{\def\changesaddedname{Eingef\"ugt}} |
| 710 |
\addto\captionsngerman{\def\changesdeletedname{Gel\"oscht}} |
| 711 |
\addto\captionsngerman{\def\changesreplacedname{Ersetzt}} |
| 712 |
\addto\captionsngerman{\def\changeshighlightname{Hervorgehoben}} |
| 713 |
\addto\captionsngerman{\def\changescommentname{Kommentiert}} |
| 714 |
\addto\captionsngerman{\def\changesauthorname{Autor:in}} |
| 715 |
\addto\captionsngerman{\def\changesanonymousname{Anonym}} |
| 716 |
\addto\captionsngerman{\def\changesnochanges{Keine \"Anderungen.}} |
| 717 |
\addto\captionsngerman{\def\changesnoloc{Liste der \"Anderungen nach dem n\"achsten \LaTeX-Lauf verf\"ugbar.}} |
| 718 |
\addto\captionsngerman{\def\changesnosoc{\"Anderungen nach dem n\"achsten \LaTeX-Lauf verf\"ugbar.}} |
| 719 |
|
| 720 |
\addto\captionsgerman{\def\listofchangesname{Liste der \"Anderungen}} |
| 721 |
\addto\captionsgerman{\def\summaryofchangesname{\"Anderungen}} |
| 722 |
\addto\captionsgerman{\def\compactsummaryofchangesname{\"Anderungen (kompakt)}} |
| 723 |
\addto\captionsgerman{\def\changesaddedname{Eingef\"ugt}} |
| 724 |
\addto\captionsgerman{\def\changesdeletedname{Gel\"oscht}} |
| 725 |
\addto\captionsgerman{\def\changesreplacedname{Ersetzt}} |
| 726 |
\addto\captionsgerman{\def\changeshighlightname{Hervorgehoben}} |
| 727 |
\addto\captionsgerman{\def\changescommentname{Kommentiert}} |
| 728 |
\addto\captionsgerman{\def\changesauthorname{Autor:in}} |
| 729 |
\addto\captionsgerman{\def\changesanonymousname{Anonym}} |
| 730 |
\addto\captionsgerman{\def\changesnochanges{Keine \"Anderungen.}} |
| 731 |
\addto\captionsgerman{\def\changesnoloc{Liste der \"Anderungen nach dem n\"achsten \LaTeX-Lauf verf\"ugbar.}} |
| 732 |
\addto\captionsgerman{\def\changesnosoc{\"Anderungen nach dem n\"achsten \LaTeX-Lauf verf\"ugbar.}} |
| 733 |
|
| 734 |
\addto\captionsenglish{\def\listofchangesname{List of changes}} |
| 735 |
\addto\captionsenglish{\def\summaryofchangesname{Changes}} |
| 736 |
\addto\captionsenglish{\def\compactsummaryofchangesname{Changes (compact)}} |
| 737 |
\addto\captionsenglish{\def\changesaddedname{Added}} |
| 738 |
\addto\captionsenglish{\def\changesdeletedname{Deleted}} |
| 739 |
\addto\captionsenglish{\def\changesreplacedname{Replaced}} |
| 740 |
\addto\captionsenglish{\def\changeshighlightname{Highlighted}} |
| 741 |
\addto\captionsenglish{\def\changescommentname{Commented}} |
| 742 |
\addto\captionsenglish{\def\changesauthorname{Author}} |
| 743 |
\addto\captionsenglish{\def\changesanonymousname{anonymous}} |
| 744 |
\addto\captionsenglish{\def\changesnochanges{No changes.}} |
| 745 |
\addto\captionsenglish{\def\changesnoloc{List of changes is available after the next \LaTeX\ run.}} |
| 746 |
\addto\captionsenglish{\def\changesnosoc{Summary of changes is available after the next \LaTeX\ run.}} |
| 747 |
|
| 748 |
\addto\captionsbritish{\def\listofchangesname{List of changes}} |
| 749 |
\addto\captionsbritish{\def\summaryofchangesname{Changes}} |
| 750 |
\addto\captionsbritish{\def\compactsummaryofchangesname{Changes (compact)}} |
| 751 |
\addto\captionsbritish{\def\changesaddedname{Added}} |
| 752 |
\addto\captionsbritish{\def\changesdeletedname{Deleted}} |
| 753 |
\addto\captionsbritish{\def\changesreplacedname{Replaced}} |
| 754 |
\addto\captionsbritish{\def\changeshighlightname{Highlighted}} |
| 755 |
\addto\captionsbritish{\def\changescommentname{Commented}} |
| 756 |
\addto\captionsbritish{\def\changesauthorname{Author}} |
| 757 |
\addto\captionsbritish{\def\changesanonymousname{anonymous}} |
| 758 |
\addto\captionsbritish{\def\changesnochanges{No changes.}} |
| 759 |
\addto\captionsbritish{\def\changesnoloc{List of changes is available after the next \LaTeX\ run.}} |
| 760 |
\addto\captionsbritish{\def\changesnosoc{Summary of changes is available after the next \LaTeX\ run.}} |
| 761 |
|
| 762 |
\addto\captionsitalian{\def\listofchangesname{Lista delle modifiche}} |
| 763 |
\addto\captionsitalian{\def\summaryofchangesname{Modifiche}} |
| 764 |
\addto\captionsitalian{\def\compactsummaryofchangesname{Modifiche (coerente)}} % translation by me (EK), please provide correct translation |
| 765 |
\addto\captionsitalian{\def\changesaddedname{Aggiunte}} |
| 766 |
\addto\captionsitalian{\def\changesdeletedname{Cancellazioni}} |
| 767 |
\addto\captionsitalian{\def\changesreplacedname{Sostituzioni}} |
| 768 |
\addto\captionsitalian{\def\changeshighlightname{Accentare}} % translation by me (EK), please provide correct translation |
| 769 |
\addto\captionsitalian{\def\changescommentname{Commenti}} % translation by me (EK), please provide correct translation |
| 770 |
\addto\captionsitalian{\def\changesauthorname{Autore}} |
| 771 |
\addto\captionsitalian{\def\changesanonymousname{anonimo}} |
| 772 |
\addto\captionsitalian{\def\changesnochanges{Nessuna modifica.}} % translation by me (EK), please provide correct translation |
| 773 |
\addto\captionsitalian{\def\changesnoloc{La lista delle modifiche sar\`a disponibile alla prossima esecuzione di \LaTeX.}} |
| 774 |
\addto\captionsitalian{\def\changesnosoc{Le modifiche sar\`a disponibile alla prossima esecuzione di \LaTeX.}} |
| 775 |
|
| 776 |
\addto\captionsfrench{\def\listofchangesname{Liste des modifications}} |
| 777 |
\addto\captionsfrench{\def\summaryofchangesname{Modifications}} |
| 778 |
\addto\captionsfrench{\def\compactsummaryofchangesname{Modifications (compact)}} |
| 779 |
\addto\captionsfrench{\def\changesaddedname{Ajout\'e}} |
| 780 |
\addto\captionsfrench{\def\changesdeletedname{Supprim\'e}} |
| 781 |
\addto\captionsfrench{\def\changesreplacedname{Remplac\'e}} |
| 782 |
\addto\captionsfrench{\def\changeshighlightname{Mis en \'evidence}} |
| 783 |
\addto\captionsfrench{\def\changescommentname{Comment\'e}} |
| 784 |
\addto\captionsfrench{\def\changesauthorname{Auteur}} |
| 785 |
\addto\captionsfrench{\def\changesanonymousname{Anonyme}} |
| 786 |
\addto\captionsfrench{\def\changesnochanges{Pas de modification}} |
| 787 |
\addto\captionsfrench{\def\changesnoloc{Liste des modifications disponible apr\`es la prochaine ex\'ecution de \LaTeX.}} |
| 788 |
\addto\captionsfrench{\def\changesnosoc{Résumé des modifications disponible apr\`es la prochaine ex\'ecution de \LaTeX.}} |
| 789 |
} |
| 790 |
{} |
| 791 |
% \end{macrocode} |
| 792 |
% |
| 793 |
% \subsection{File extensions} |
| 794 |
% |
| 795 |
% \begin{macro}{\Changes@locextension} |
| 796 |
% Store file extension for list of changes, set default to \emph{loc}. |
| 797 |
% \begin{macrocode} |
| 798 |
\newcommand{\Changes@locextension}{loc} |
| 799 |
% \end{macrocode} |
| 800 |
% \end{macro} |
| 801 |
% |
| 802 |
% \begin{macro}{\setlocextension} |
| 803 |
% Sets a new file extension for list of changes. |
| 804 |
% \begin{macrocode} |
| 805 |
\newcommand{\setlocextension}[1]{ |
| 806 |
\renewcommand{\Changes@locextension}{#1} |
| 807 |
} |
| 808 |
% \end{macrocode} |
| 809 |
% \end{macro} |
| 810 |
% |
| 811 |
% \begin{macro}{\Changes@socextension} |
| 812 |
% Store file extension for summary of changes, set default to \emph{soc}. |
| 813 |
% \begin{macrocode} |
| 814 |
\newcommand{\Changes@socextension}{soc} |
| 815 |
% \end{macrocode} |
| 816 |
% \end{macro} |
| 817 |
% |
| 818 |
% \begin{macro}{\setsocextension} |
| 819 |
% Sets a new file extension for summary of changes. |
| 820 |
% \begin{macrocode} |
| 821 |
\newcommand{\setsocextension}[1]{ |
| 822 |
\renewcommand{\Changes@socextension}{#1} |
| 823 |
} |
| 824 |
% \end{macrocode} |
| 825 |
% \end{macro} |
| 826 |
% |
| 827 |
% |
| 828 |
% \subsection{Authors} |
| 829 |
% |
| 830 |
% \subsubsection{Author management} |
| 831 |
% |
| 832 |
% Author counter. |
| 833 |
% \begin{macrocode} |
| 834 |
\newcounter{Changes@AuthorCount} |
| 835 |
\setcounter{Changes@AuthorCount}{0} |
| 836 |
\newcounter{Changes@Author} |
| 837 |
% \end{macrocode} |
| 838 |
% |
| 839 |
% \begin{macro}{\definechangesauthor} |
| 840 |
% Define a new author. |
| 841 |
% Mandatory argument: author's id. |
| 842 |
% Optional arguments (key-value): author's name (default: empty) and author's color (default: \doccommand{Changes@optiondefaultcolor} (blue)). |
| 843 |
% |
| 844 |
% Store id, name and color using named variables. |
| 845 |
% Define counter and color per author. |
| 846 |
% \begin{macrocode} |
| 847 |
\newcommand*\definechangesauthor[2][]{ |
| 848 |
% \end{macrocode} |
| 849 |
% |
| 850 |
% Call \emph{setkeys} in order to evaluate the key-value-options and fill the value storage. |
| 851 |
% \begin{macrocode} |
| 852 |
\setkeys{Changes@definechangesauthor}{#1} |
| 853 |
% \end{macrocode} |
| 854 |
% |
| 855 |
% Increment author counter, later needed for \emph{while} loop of authors. |
| 856 |
% \begin{macrocode} |
| 857 |
\stepcounter{Changes@AuthorCount} |
| 858 |
% \end{macrocode} |
| 859 |
% |
| 860 |
% Store the id in a name with the given counter/index. |
| 861 |
% All other storage refers to the id. |
| 862 |
% \begin{macrocode} |
| 863 |
\@namedef{Changes@AuthorID\theChanges@AuthorCount}{#2} |
| 864 |
% \end{macrocode} |
| 865 |
% |
| 866 |
% Store the author's definition in according variables/colors, create change counters. |
| 867 |
% \begin{macrocode} |
| 868 |
\expandafter\let\csname Changes@AuthorName#2\endcsname=\Changes@definechangesauthor@name |
| 869 |
\expandafter\let\csname Changes@AuthorColor#2\endcsname=\Changes@definechangesauthor@color |
| 870 |
\newcounter{Changes@addedCount#2} |
| 871 |
\newcounter{Changes@deletedCount#2} |
| 872 |
\newcounter{Changes@replacedCount#2} |
| 873 |
\newcounter{Changes@highlightCount#2} |
| 874 |
\newcounter{Changes@commentCount#2} |
| 875 |
} |
| 876 |
% \end{macrocode} |
| 877 |
% \end{macro} |
| 878 |
% |
| 879 |
% Define default-author (anonymous) with empty id and default color. |
| 880 |
% \begin{macrocode} |
| 881 |
\definechangesauthor{\@empty} |
| 882 |
% \end{macrocode} |
| 883 |
% |
| 884 |
% |
| 885 |
% \begin{macro}{\setanonymousname} |
| 886 |
% Sets the anonymous author name. |
| 887 |
% \begin{macrocode} |
| 888 |
\newrobustcmd{\setanonymousname}[1]{ |
| 889 |
\AtBeginDocument{ |
| 890 |
\def\changesanonymousname{#1} |
| 891 |
} |
| 892 |
} |
| 893 |
% \end{macrocode} |
| 894 |
% \end{macro} |
| 895 |
% |
| 896 |
% |
| 897 |
% \subsubsection{Author markup} |
| 898 |
% |
| 899 |
% \begin{macro}{\Changes@Markup@author} |
| 900 |
% Store markup for authors. |
| 901 |
% \begin{macrocode} |
| 902 |
\newcommand{\Changes@Markup@author}[1]{% |
| 903 |
\IfStrEq{\Changes@optionauthormarkup}{superscript}% |
| 904 |
{\textsuperscript{#1}}% |
| 905 |
{}% |
| 906 |
\IfStrEq{\Changes@optionauthormarkup}{subscript}% |
| 907 |
{\textsubscript{#1}}% |
| 908 |
{}% |
| 909 |
\IfStrEq{\Changes@optionauthormarkup}{brackets}% |
| 910 |
{(#1)}% |
| 911 |
{}% |
| 912 |
\IfStrEq{\Changes@optionauthormarkup}{footnote}% |
| 913 |
{\footnote{#1}}% |
| 914 |
{}% |
| 915 |
\IfStrEq{\Changes@optionauthormarkup}{none}% |
| 916 |
{}% |
| 917 |
{}% |
| 918 |
} |
| 919 |
% \end{macrocode} |
| 920 |
% \end{macro} |
| 921 |
% |
| 922 |
% \begin{macro}{\setauthormarkup} |
| 923 |
% Set markup for authors. |
| 924 |
% \begin{macrocode} |
| 925 |
\newcommand{\setauthormarkup}[1]{ |
| 926 |
\renewcommand{\Changes@Markup@author}[1]{#1} |
| 927 |
} |
| 928 |
% \end{macrocode} |
| 929 |
% \end{macro} |
| 930 |
% |
| 931 |
% \begin{macro}{\setauthormarkupposition} |
| 932 |
% Set position for author markup text. |
| 933 |
% \begin{macrocode} |
| 934 |
\newcommand{\setauthormarkupposition}[1]{ |
| 935 |
\renewcommand{\Changes@optionauthormarkupposition}{#1} |
| 936 |
} |
| 937 |
% \end{macrocode} |
| 938 |
% \end{macro} |
| 939 |
% |
| 940 |
% \begin{macro}{\setauthormarkuptext} |
| 941 |
% Set author markup text to be displayed. |
| 942 |
% \begin{macrocode} |
| 943 |
\newcommand{\setauthormarkuptext}[1]{ |
| 944 |
\renewcommand{\Changes@optionauthormarkuptext}{#1} |
| 945 |
} |
| 946 |
% \end{macrocode} |
| 947 |
% \end{macro} |
| 948 |
% |
| 949 |
% \subsection{Change management commands} |
| 950 |
% |
| 951 |
% \subsubsection{Text markup definition} |
| 952 |
% |
| 953 |
% Replaced text is always typeset as follows: \meta{added text}\meta{deleted text}. |
| 954 |
% Therefore no extra command for markup of replaced text is given. |
| 955 |
% |
| 956 |
% \begin{macro}{\Changes@Markup} |
| 957 |
% Predefined markups for text. |
| 958 |
% \begin{macrocode} |
| 959 |
\newcommand{\Changes@Markup}[2]{% |
| 960 |
\IfStrEq{#1}{background}% |
| 961 |
{% |
| 962 |
\IfIsColored% |
| 963 |
{\colorbox{authorcolor!30}{#2}}% |
| 964 |
{#2}% |
| 965 |
}% |
| 966 |
{}% |
| 967 |
\IfStrEq{#1}{bf}% |
| 968 |
{\textbf{#2}}% |
| 969 |
{}% |
| 970 |
\IfStrEq{#1}{colored}% |
| 971 |
{#2}% |
| 972 |
{}% |
| 973 |
\IfStrEq{#1}{dashuline}% |
| 974 |
{\dashuline{#2}}% |
| 975 |
{}% |
| 976 |
\IfStrEq{#1}{dotuline}% |
| 977 |
{\dotuline{#2}}% |
| 978 |
{}% |
| 979 |
\IfStrEq{#1}{em}% |
| 980 |
{\emph{#2}}% |
| 981 |
{}% |
| 982 |
\IfStrEq{#1}{it}% |
| 983 |
{\textit{#2}}% |
| 984 |
{}% |
| 985 |
\IfStrEq{#1}{sl}% |
| 986 |
{\textsl{#2}}% |
| 987 |
{}% |
| 988 |
\IfStrEq{#1}{sout}% |
| 989 |
{\sout{#2}}% |
| 990 |
{}% |
| 991 |
\IfStrEq{#1}{uline}% |
| 992 |
{\uline{#2}}% |
| 993 |
{}% |
| 994 |
\IfStrEq{#1}{uuline}% |
| 995 |
{\uuline{#2}}% |
| 996 |
{}% |
| 997 |
\IfStrEq{#1}{uwave}% |
| 998 |
{\uwave{#2}}% |
| 999 |
{}% |
| 1000 |
\IfStrEq{#1}{xout}% |
| 1001 |
{\xout{#2}}% |
| 1002 |
{}% |
| 1003 |
} |
| 1004 |
% \end{macrocode} |
| 1005 |
% \end{macro} |
| 1006 |
% |
| 1007 |
% \begin{macro}{\Changes@Markup@added} |
| 1008 |
% Store markup for added text. |
| 1009 |
% \begin{macrocode} |
| 1010 |
\newcommand{\Changes@Markup@added}[1]{% |
| 1011 |
\Changes@Markup{\Changes@optionaddedmarkup}{#1}{}% |
| 1012 |
} |
| 1013 |
% \end{macrocode} |
| 1014 |
% \end{macro} |
| 1015 |
% |
| 1016 |
% \begin{macro}{\setaddedmarkup} |
| 1017 |
% Set markup for added text. |
| 1018 |
% \begin{macrocode} |
| 1019 |
\newcommand{\setaddedmarkup}[1]{ |
| 1020 |
\renewcommand{\Changes@Markup@added}[1]{#1} |
| 1021 |
} |
| 1022 |
% \end{macrocode} |
| 1023 |
% \end{macro} |
| 1024 |
% |
| 1025 |
% \begin{macro}{\Changes@Markup@deleted} |
| 1026 |
% Store markup for deleted text. |
| 1027 |
% \begin{macrocode} |
| 1028 |
\newcommand{\Changes@Markup@deleted}[1]{% |
| 1029 |
\Changes@Markup{\Changes@optiondeletedmarkup}{#1}{}% |
| 1030 |
} |
| 1031 |
% \end{macrocode} |
| 1032 |
% \end{macro} |
| 1033 |
% |
| 1034 |
% \begin{macro}{\setdeletedmarkup} |
| 1035 |
% Set markup for deleted text. |
| 1036 |
% \begin{macrocode} |
| 1037 |
\newcommand{\setdeletedmarkup}[1]{ |
| 1038 |
\renewcommand{\Changes@Markup@deleted}[1]{#1} |
| 1039 |
} |
| 1040 |
% \end{macrocode} |
| 1041 |
% \end{macro} |
| 1042 |
% |
| 1043 |
% \begin{macro}{\Changes@Markup@highlight} |
| 1044 |
% |
| 1045 |
% Store markup for highlighted text. |
| 1046 |
% \begin{macrocode} |
| 1047 |
\newcommand{\Changes@Markup@highlight}[1]{% |
| 1048 |
\Changes@Markup{\Changes@optionhighlightmarkup}{#1}{}% |
| 1049 |
} |
| 1050 |
% \end{macrocode} |
| 1051 |
% \end{macro} |
| 1052 |
% |
| 1053 |
% \begin{macro}{\sethighlightmarkup} |
| 1054 |
% Set markup for highlighted text. |
| 1055 |
% \begin{macrocode} |
| 1056 |
\newcommand{\sethighlightmarkup}[1]{ |
| 1057 |
\renewcommand{\Changes@Markup@highlight}[1]{#1} |
| 1058 |
} |
| 1059 |
% \end{macrocode} |
| 1060 |
% \end{macro} |
| 1061 |
% |
| 1062 |
% \begin{macro}{\Changes@Markup@comment} |
| 1063 |
% Store markup for comments. |
| 1064 |
% |
| 1065 |
% Parameters: |
| 1066 |
% \begin{enumerate} |
| 1067 |
% \item text |
| 1068 |
% \item author's id |
| 1069 |
% \item author's id/name output |
| 1070 |
% \end{enumerate} |
| 1071 |
% \begin{macrocode} |
| 1072 |
\newcommand{\Changes@Markup@comment}[3]{% |
| 1073 |
\IfStrEq{\Changes@optioncommentmarkup}{todo}% |
| 1074 |
{% |
| 1075 |
\IfIsColored% |
| 1076 |
{\colorlet{Changes@todocolor}{authorcolor}}% |
| 1077 |
{\colorlet{Changes@todocolor}{black}}% |
| 1078 |
\todo[color=Changes@todocolor!10, bordercolor=Changes@todocolor, linecolor=Changes@todocolor!70, nolist]{% |
| 1079 |
\textbf{[\IfIsAuthorOutputEmpty{#2}{}{#3~}\arabic{authorcommentcount}]} #1% |
| 1080 |
}% |
| 1081 |
}{}% |
| 1082 |
\IfStrEq{\Changes@optioncommentmarkup}{margin}% |
| 1083 |
{% |
| 1084 |
\marginpar{% |
| 1085 |
\IfIsColored% |
| 1086 |
{\leavevmode\color{authorcolor}}% |
| 1087 |
{}% |
| 1088 |
\textbf{[\IfIsAuthorOutputEmpty{#2}{}{#3~}\arabic{authorcommentcount}]:} #1% |
| 1089 |
}% |
| 1090 |
}{}% |
| 1091 |
\IfStrEq{\Changes@optioncommentmarkup}{footnote}% |
| 1092 |
{% |
| 1093 |
\footnote{% |
| 1094 |
\textbf{[\IfIsAuthorOutputEmpty{#2}{}{#3~}\arabic{authorcommentcount}]:} #1% |
| 1095 |
}% |
| 1096 |
}{}% |
| 1097 |
\IfStrEq{\Changes@optioncommentmarkup}{uwave}% |
| 1098 |
{% |
| 1099 |
{% |
| 1100 |
\IfIsColored% |
| 1101 |
{\color{authorcolor}}% |
| 1102 |
{}% |
| 1103 |
\allowbreak% |
| 1104 |
\uwave{% |
| 1105 |
\textbf{[\IfIsAuthorOutputEmpty{#2}{}{#3~}\arabic{authorcommentcount}]:} #1% |
| 1106 |
}% |
| 1107 |
}% |
| 1108 |
}{}% |
| 1109 |
} |
| 1110 |
% \end{macrocode} |
| 1111 |
% \end{macro} |
| 1112 |
% |
| 1113 |
% \begin{macro}{\setcommentmarkup} |
| 1114 |
% Set markup for comments. |
| 1115 |
% \begin{macrocode} |
| 1116 |
\newcommand{\setcommentmarkup}[1]{ |
| 1117 |
\renewcommand{\Changes@Markup@comment}[3]{#1} |
| 1118 |
} |
| 1119 |
% \end{macrocode} |
| 1120 |
% \end{macro} |
| 1121 |
% |
| 1122 |
% |
| 1123 |
% \subsubsection{Change management command definition} |
| 1124 |
% |
| 1125 |
% \begin{macro}{\Changes@check@author} |
| 1126 |
% |
| 1127 |
% Check if author id is valid. |
| 1128 |
% An empty id is valid by default. |
| 1129 |
% |
| 1130 |
% If the id is not valid, a package error is raised. |
| 1131 |
% |
| 1132 |
% Loop code is taken from \url{https://texfaq.org/FAQ-repeat-num} |
| 1133 |
% |
| 1134 |
% This command has the following arguments: |
| 1135 |
% \begin{enumerate} |
| 1136 |
% \item author's id |
| 1137 |
% \end{enumerate} |
| 1138 |
% |
| 1139 |
% \begin{macrocode} |
| 1140 |
\newbool{Changes@WrongID} |
| 1141 |
\newcommand{\Changes@check@author}[1]{% |
| 1142 |
\IfIsEmpty{#1}% |
| 1143 |
{}% |
| 1144 |
{% |
| 1145 |
\setbool{Changes@WrongID}{true}% |
| 1146 |
\setcounter{Changes@Author}{0}% |
| 1147 |
\loop% |
| 1148 |
\stepcounter{Changes@Author}% |
| 1149 |
\IfStrEq{#1}{\csuse{Changes@AuthorID\theChanges@Author}}% |
| 1150 |
{\setbool{Changes@WrongID}{false}}% |
| 1151 |
{}% |
| 1152 |
\ifnum\theChanges@Author<\theChanges@AuthorCount% |
| 1153 |
\repeat% |
| 1154 |
\ifbool{Changes@WrongID}% |
| 1155 |
{% |
| 1156 |
\PackageError{changes}% |
| 1157 |
{Undefined changes author: #1}% |
| 1158 |
{You have to define the author #1 with e.g.: \definechangesauthor{#1}}% |
| 1159 |
}% |
| 1160 |
{}% |
| 1161 |
}% |
| 1162 |
} |
| 1163 |
% \end{macrocode} |
| 1164 |
% \end{macro} |
| 1165 |
% |
| 1166 |
% \begin{macro}{\Changes@output@author} |
| 1167 |
% |
| 1168 |
% Output command for the author: id or name. |
| 1169 |
% |
| 1170 |
% This command has the following arguments: |
| 1171 |
% \begin{enumerate} |
| 1172 |
% \item author's id |
| 1173 |
% \end{enumerate} |
| 1174 |
% \begin{macrocode} |
| 1175 |
\newrobustcmd{\Changes@output@author}[1]{% |
| 1176 |
\IfStrEq{\Changes@optionauthormarkuptext}{id}% |
| 1177 |
{#1}% |
| 1178 |
{}% |
| 1179 |
\IfStrEq{\Changes@optionauthormarkuptext}{name}% |
| 1180 |
{% |
| 1181 |
\IfIsAnonymous{#1}% |
| 1182 |
{\changesanonymousname}% |
| 1183 |
{% |
| 1184 |
% \end{macrocode} |
| 1185 |
% |
| 1186 |
% I cannot use \doccommand{IfIsEmpty} here, because it does not work in this case. |
| 1187 |
% I cannot add the test with \doccommand{IfStrEq} to \doccommand{IfIsEmpty} because |
| 1188 |
% it breaks e.g. with a \doccommand{cite} command in the final option. |
| 1189 |
% \begin{macrocode} |
| 1190 |
\IfStrEq{\csuse{Changes@AuthorName#1}}{}% |
| 1191 |
{#1}% |
| 1192 |
{\csuse{Changes@AuthorName#1}}% |
| 1193 |
}% |
| 1194 |
}% |
| 1195 |
{}% |
| 1196 |
} |
| 1197 |
% \end{macrocode} |
| 1198 |
% \end{macro} |
| 1199 |
% |
| 1200 |
% \begin{macro}{\Changes@output@author@position} |
| 1201 |
% |
| 1202 |
% Output command for the author at the given position. |
| 1203 |
% |
| 1204 |
% This command has the following arguments: |
| 1205 |
% \begin{enumerate} |
| 1206 |
% \item author's id |
| 1207 |
% \item position to output the author to (left or right) |
| 1208 |
% \end{enumerate} |
| 1209 |
% |
| 1210 |
% \doccommand{DeclareRobustCommand} is used for not breaking the todo note definition. |
| 1211 |
% \begin{macrocode} |
| 1212 |
\newrobustcmd{\Changes@output@author@position}[2]{% |
| 1213 |
\IfIsAuthorEmptyAtPosition{#1}{#2}% |
| 1214 |
{}% |
| 1215 |
{% |
| 1216 |
\Changes@output@author{#1}% |
| 1217 |
}% |
| 1218 |
} |
| 1219 |
% \end{macrocode} |
| 1220 |
% \end{macro} |
| 1221 |
% |
| 1222 |
% \begin{macro}{\Changes@set@color} |
| 1223 |
% |
| 1224 |
% Sets the author's color. |
| 1225 |
% |
| 1226 |
% This command has the following argument: |
| 1227 |
% \begin{enumerate} |
| 1228 |
% \item author's id |
| 1229 |
% \end{enumerate} |
| 1230 |
% |
| 1231 |
% \begin{macrocode} |
| 1232 |
\newrobustcmd{\Changes@set@color}[1]{% |
| 1233 |
\IfIsColored% |
| 1234 |
{\colorlet{authorcolor}{\csuse{Changes@AuthorColor#1}}}% |
| 1235 |
{}% |
| 1236 |
} |
| 1237 |
% \end{macrocode} |
| 1238 |
% \end{macro} |
| 1239 |
% |
| 1240 |
% \begin{macro}{\Changes@set@commentcount} |
| 1241 |
% |
| 1242 |
% Sets the author's comment count. |
| 1243 |
% |
| 1244 |
% This command has the following argument: |
| 1245 |
% \begin{enumerate} |
| 1246 |
% \item author's id |
| 1247 |
% \end{enumerate} |
| 1248 |
% |
| 1249 |
% \begin{macrocode} |
| 1250 |
\newcounter{authorcommentcount} |
| 1251 |
\newrobustcmd{\Changes@set@commentcount}[1]{% |
| 1252 |
\setcounter{authorcommentcount}{\value{Changes@commentCount#1}}% |
| 1253 |
} |
| 1254 |
% \end{macrocode} |
| 1255 |
% \end{macro} |
| 1256 |
% |
| 1257 |
% \begin{macro}{\Changes@set@commandname} |
| 1258 |
% |
| 1259 |
% Sets the command name according to setting of \docoption{commandname}. |
| 1260 |
% \begin{macrocode} |
| 1261 |
\def\Changes@commandprefix{ch} |
| 1262 |
\newrobustcmd{\Changes@set@commandname}[1]{ |
| 1263 |
\def\Changes@commandname{#1} |
| 1264 |
\IfStrEq{\Changes@optioncommandnameprefix}{always} |
| 1265 |
{ |
| 1266 |
\def\Changes@commandname{\Changes@commandprefix#1} |
| 1267 |
\typeout{changes-package option commandnameprefix=always: using prefix on #1, new command name is \Changes@commandname.} |
| 1268 |
}{ |
| 1269 |
\ifcsdef{#1} |
| 1270 |
{ |
| 1271 |
\IfStrEq{\Changes@optioncommandnameprefix}{none} |
| 1272 |
{ |
| 1273 |
\PackageError{changes} |
| 1274 |
{Command #1 is already defined.} |
| 1275 |
{Try package option commandnameprefix with "always" or "ifneeded", e.g. usepackage[commandnameprefix=always]{changes}} |
| 1276 |
}{} |
| 1277 |
\IfStrEq{\Changes@optioncommandnameprefix}{ifneeded} |
| 1278 |
{ |
| 1279 |
\def\Changes@commandname{\Changes@commandprefix#1} |
| 1280 |
\PackageWarning{changes}{Command #1 is already defined, using \Changes@commandname} |
| 1281 |
}{} |
| 1282 |
} |
| 1283 |
{} |
| 1284 |
} |
| 1285 |
} |
| 1286 |
% \end{macrocode} |
| 1287 |
% \end{macro} |
| 1288 |
% |
| 1289 |
% \begin{macro}{\Changes@output} |
| 1290 |
% |
| 1291 |
% Output command for the changed text. |
| 1292 |
% |
| 1293 |
% This command has the following arguments: |
| 1294 |
% \begin{enumerate} |
| 1295 |
% \item change id (added, deleted, replaced, highlight, comment) |
| 1296 |
% \item author's id |
| 1297 |
% \item final text |
| 1298 |
% \item deleted/replaced text |
| 1299 |
% \item comment |
| 1300 |
% \item change type name for list of changes |
| 1301 |
% \item text for list of changes |
| 1302 |
% \end{enumerate} |
| 1303 |
% \begin{macrocode} |
| 1304 |
\newrobustcmd{\Changes@output}[7]{% |
| 1305 |
% \end{macrocode} |
| 1306 |
% |
| 1307 |
% Output changed text if option \docoption{draft} is set, otherwise output unchanged text. |
| 1308 |
% \begin{macrocode} |
| 1309 |
\ifbool{Changes@optiondraft}% |
| 1310 |
{% |
| 1311 |
% \end{macrocode} |
| 1312 |
% |
| 1313 |
% Check if author's id is valid and set author's color. |
| 1314 |
% \begin{macrocode} |
| 1315 |
\Changes@check@author{#2}% |
| 1316 |
\Changes@set@color{#2}% |
| 1317 |
% \end{macrocode} |
| 1318 |
% |
| 1319 |
% Start output. |
| 1320 |
% \begin{macrocode} |
| 1321 |
{% |
| 1322 |
% \end{macrocode} |
| 1323 |
% |
| 1324 |
% Output for change commands: added, deleted, replaced, highlight. |
| 1325 |
% |
| 1326 |
% I think this code is not elegant but it gets the work done for now. |
| 1327 |
% \begin{macrocode} |
| 1328 |
\IfIsInList{#1}{added|deleted|replaced|highlight}% |
| 1329 |
{% |
| 1330 |
% \end{macrocode} |
| 1331 |
% |
| 1332 |
% Author text for left positioning (only without comment). |
| 1333 |
% \begin{macrocode} |
| 1334 |
\IfIsEmpty{#5}% |
| 1335 |
{% |
| 1336 |
\IfIsAuthorEmptyAtPosition{#2}{left}% |
| 1337 |
{}% |
| 1338 |
{{% |
| 1339 |
\IfIsColored% |
| 1340 |
{\color{authorcolor}}% |
| 1341 |
{}% |
| 1342 |
\Changes@Markup@author{\Changes@output@author@position{#2}{left}}% |
| 1343 |
}}% |
| 1344 |
}{}% |
| 1345 |
% \end{macrocode} |
| 1346 |
% |
| 1347 |
% Changed/highlighted text. |
| 1348 |
% \begin{macrocode} |
| 1349 |
{% |
| 1350 |
\IfStrEq{#1}{highlight}% |
| 1351 |
{}{% |
| 1352 |
\IfIsColored% |
| 1353 |
{\color{authorcolor}}% |
| 1354 |
{}% |
| 1355 |
}% |
| 1356 |
\IfStrEq{#1}{added}{\Changes@Markup@added{#3}}{}% |
| 1357 |
\IfStrEq{#1}{deleted}{\Changes@Markup@deleted{#4}}{}% |
| 1358 |
\IfStrEq{#1}{replaced}{{\Changes@Markup@added{#3}}\allowbreak\Changes@Markup@deleted{#4}}{}% |
| 1359 |
\IfStrEq{#1}{highlight}{\Changes@Markup@highlight{#3}}{}% |
| 1360 |
}% |
| 1361 |
% \end{macrocode} |
| 1362 |
% |
| 1363 |
% Author text for right positioning (only without comment). |
| 1364 |
% \begin{macrocode} |
| 1365 |
\IfIsEmpty{#5}% |
| 1366 |
{% |
| 1367 |
\IfIsAuthorEmptyAtPosition{#2}{right}% |
| 1368 |
{}% |
| 1369 |
{{% |
| 1370 |
\IfIsColored% |
| 1371 |
{\color{authorcolor}}% |
| 1372 |
{}% |
| 1373 |
\Changes@Markup@author{\Changes@output@author@position{#2}{right}}% |
| 1374 |
}}% |
| 1375 |
}{}% |
| 1376 |
% \end{macrocode} |
| 1377 |
% |
| 1378 |
% Update counters. |
| 1379 |
% \begin{macrocode} |
| 1380 |
\stepcounter{Changes@#1Count#2}% |
| 1381 |
}{}% |
| 1382 |
% \end{macrocode} |
| 1383 |
% |
| 1384 |
% Comments. |
| 1385 |
% \begin{macrocode} |
| 1386 |
\IfIsEmpty{#5}% |
| 1387 |
{}% |
| 1388 |
{% |
| 1389 |
\stepcounter{Changes@commentCount#2}% |
| 1390 |
\Changes@set@commentcount{#2}% |
| 1391 |
\Changes@Markup@comment% |
| 1392 |
{#5}% |
| 1393 |
{#2}% |
| 1394 |
{\Changes@output@author{#2}}% |
| 1395 |
}% |
| 1396 |
}% |
| 1397 |
% \end{macrocode} |
| 1398 |
% Store line for list of changes. |
| 1399 |
% \begin{macrocode} |
| 1400 |
\IfIsEmpty{#2}% |
| 1401 |
{\def\Changes@locid{}}% |
| 1402 |
{\def\Changes@locid{~(#2)}}% |
| 1403 |
\phantomsection\addcontentsline{\Changes@locextension}{#1}{#6\Changes@locid: \truncate{\Changestruncatewidth}{#7}}% |
| 1404 |
}% |
| 1405 |
% \end{macrocode} |
| 1406 |
% |
| 1407 |
% Output unchanged text (option \docoption{final} was set). |
| 1408 |
% \begin{macrocode} |
| 1409 |
{% |
| 1410 |
\IfIsEmpty{#3}% |
| 1411 |
{\@bsphack\@esphack}% |
| 1412 |
{#3}% |
| 1413 |
}% |
| 1414 |
} |
| 1415 |
% \end{macrocode} |
| 1416 |
% \end{macro} |
| 1417 |
% |
| 1418 |
% \begin{macro}{\added} |
| 1419 |
% The command formats text as new text. |
| 1420 |
% |
| 1421 |
% Mandatory argument: added text. |
| 1422 |
% Optional argument (key-value): author's id, comment |
| 1423 |
% \begin{macrocode} |
| 1424 |
\Changes@set@commandname{added} |
| 1425 |
\expandafter\newcommand\expandafter{\csname\Changes@commandname\endcsname}[2][\@empty]{% |
| 1426 |
% \end{macrocode} |
| 1427 |
% Call \emph{setkeys} in order to evaluate the key-value-options and fill the value storage. |
| 1428 |
% \begin{macrocode} |
| 1429 |
\setkeys{Changes@added}{#1}% |
| 1430 |
\Changes@output% |
| 1431 |
{added}% |
| 1432 |
{\Changes@added@id}% |
| 1433 |
{#2}% |
| 1434 |
{}% |
| 1435 |
{\Changes@added@comment}% |
| 1436 |
{\changesaddedname}% |
| 1437 |
{#2}% |
| 1438 |
} |
| 1439 |
% \end{macrocode} |
| 1440 |
% \end{macro} |
| 1441 |
% |
| 1442 |
% \begin{macro}{\deleted} |
| 1443 |
% The command formats text as deleted text. |
| 1444 |
% |
| 1445 |
% The definition of the empty text for unchanged text is provided by Frank Mittelbach, slightly modified by me. |
| 1446 |
% It solves the problem of additional space caused by an empty command (e.g. when using the \docoption{final} option). |
| 1447 |
% Before that, there was a slightly erroneous version from \texttt{de.comp.text.tex} (issue \#2). |
| 1448 |
% |
| 1449 |
% Mandatory argument: deleted text. |
| 1450 |
% Optional argument (key-value): author's id, comment |
| 1451 |
% \begin{macrocode} |
| 1452 |
\Changes@set@commandname{deleted} |
| 1453 |
\expandafter\newcommand\expandafter{\csname\Changes@commandname\endcsname}[2][\@empty]{% |
| 1454 |
% \end{macrocode} |
| 1455 |
% Call \emph{setkeys} in order to evaluate the key-value-options and fill the value storage. |
| 1456 |
% \begin{macrocode} |
| 1457 |
\setkeys{Changes@deleted}{#1}% |
| 1458 |
\Changes@output% |
| 1459 |
{deleted}% |
| 1460 |
{\Changes@deleted@id}% |
| 1461 |
{}% |
| 1462 |
{#2}% |
| 1463 |
{\Changes@deleted@comment}% |
| 1464 |
{\changesdeletedname}% |
| 1465 |
{#2}% |
| 1466 |
} |
| 1467 |
% \end{macrocode} |
| 1468 |
% \end{macro} |
| 1469 |
% |
| 1470 |
% \begin{macro}{\replaced} |
| 1471 |
% The command formats text as replaced text. |
| 1472 |
% |
| 1473 |
% Mandatory arguments: new text and old text. |
| 1474 |
% Optional argument (key-value): author's id, comment |
| 1475 |
% \begin{macrocode} |
| 1476 |
\Changes@set@commandname{replaced} |
| 1477 |
\expandafter\newcommand\expandafter{\csname\Changes@commandname\endcsname}[3][\@empty]{% |
| 1478 |
% \end{macrocode} |
| 1479 |
% Call \emph{setkeys} in order to evaluate the key-value-options and fill the value storage. |
| 1480 |
% \begin{macrocode} |
| 1481 |
\setkeys{Changes@replaced}{#1}% |
| 1482 |
\Changes@output% |
| 1483 |
{replaced}% |
| 1484 |
{\Changes@replaced@id}% |
| 1485 |
{#2}% |
| 1486 |
{#3}% |
| 1487 |
{\Changes@replaced@comment}% |
| 1488 |
{\changesreplacedname}% |
| 1489 |
{#2}% |
| 1490 |
} |
| 1491 |
% \end{macrocode} |
| 1492 |
% \end{macro} |
| 1493 |
% |
| 1494 |
% \begin{macro}{\highlight} |
| 1495 |
% The command formats text as highlighted text. |
| 1496 |
% |
| 1497 |
% Mandatory argument: highlighted text. |
| 1498 |
% Optional argument (key-value): author's id, comment |
| 1499 |
% \begin{macrocode} |
| 1500 |
\Changes@set@commandname{highlight} |
| 1501 |
\expandafter\newcommand\expandafter{\csname\Changes@commandname\endcsname}[2][\@empty]{% |
| 1502 |
% \end{macrocode} |
| 1503 |
% |
| 1504 |
% Call \emph{setkeys} in order to evaluate the key-value-options and fill the value storage. |
| 1505 |
% \begin{macrocode} |
| 1506 |
\setkeys{Changes@highlight}{#1}% |
| 1507 |
\Changes@output% |
| 1508 |
{highlight}% |
| 1509 |
{\Changes@highlight@id}% |
| 1510 |
{#2}% |
| 1511 |
{}% |
| 1512 |
{\Changes@highlight@comment}% |
| 1513 |
{\changeshighlightname}% |
| 1514 |
{#2}% |
| 1515 |
} |
| 1516 |
% \end{macrocode} |
| 1517 |
% \end{macro} |
| 1518 |
% |
| 1519 |
% \begin{macro}{\comment} |
| 1520 |
% The command formats text as comment. |
| 1521 |
% |
| 1522 |
% Mandatory argument: comment text. |
| 1523 |
% Optional argument (key-value): author's id |
| 1524 |
% \begin{macrocode} |
| 1525 |
\Changes@set@commandname{comment} |
| 1526 |
\expandafter\newcommand\expandafter{\csname\Changes@commandname\endcsname}[2][\@empty]{% |
| 1527 |
% \end{macrocode} |
| 1528 |
% |
| 1529 |
% Call \emph{setkeys} in order to evaluate the key-value-options and fill the value storage. |
| 1530 |
% \begin{macrocode} |
| 1531 |
\setkeys{Changes@comment}{#1}% |
| 1532 |
\Changes@output% |
| 1533 |
{comment}% |
| 1534 |
{\Changes@comment@id}% |
| 1535 |
{}% |
| 1536 |
{}% |
| 1537 |
{#2}% |
| 1538 |
{\changescommentname}% |
| 1539 |
{#2}% |
| 1540 |
} |
| 1541 |
% \end{macrocode} |
| 1542 |
% \end{macro} |
| 1543 |
% |
| 1544 |
% \subsection{List of changes} |
| 1545 |
% |
| 1546 |
% The list of changes truncates text, therefore the \docpackage{truncate} package is used. |
| 1547 |
% (Using fit and redefining the marker: suggestion and code by Frank Mittelbach) |
| 1548 |
% Providing the needed package options via \doccommand{ExecuteOptionsX}. |
| 1549 |
% \begin{macrocode} |
| 1550 |
\RequirePackage{truncate} |
| 1551 |
\renewcommand\TruncateMarker{ [\dots\negthinspace]\ } |
| 1552 |
% \end{macrocode} |
| 1553 |
% |
| 1554 |
% \begin{macro}{\changes@chopline} |
| 1555 |
% Auxiliary command for reading the content of the loc-files. |
| 1556 |
% The content is read line by line. |
| 1557 |
% One line is parsed with this macro, the order of entries is: id, color, name, added, deleted, replaced, highlighted, comment. |
| 1558 |
% The contents have to be separated by a semicolon. |
| 1559 |
% \begin{macrocode} |
| 1560 |
\def\changes@chopline#1;#2;#3;#4;#5;#6;#7;#8 \\{% |
| 1561 |
\def\Changes@Inid{#1}% |
| 1562 |
\def\Changes@Incolor{#2}% |
| 1563 |
\def\Changes@Inname{#3}% |
| 1564 |
\def\Changes@Inadded{#4}% |
| 1565 |
\def\Changes@Indeleted{#5}% |
| 1566 |
\def\Changes@Inreplaced{#6}% |
| 1567 |
\def\Changes@Inhighlight{#7}% |
| 1568 |
\def\Changes@Incomment{#8}% |
| 1569 |
} |
| 1570 |
% \end{macrocode} |
| 1571 |
% \end{macro} |
| 1572 |
% |
| 1573 |
% \begin{macro}{\ChangesListline} |
| 1574 |
% |
| 1575 |
% Output of a list line, calls \doccommand{contentsline} for output which uses \doccommand{l@change}. |
| 1576 |
% |
| 1577 |
% This command has the following arguments: |
| 1578 |
% \begin{enumerate} |
| 1579 |
% \item change type (added, ...) |
| 1580 |
% \item change description with author |
| 1581 |
% \item page |
| 1582 |
% \item page reference for hyperref |
| 1583 |
% \end{enumerate} |
| 1584 |
% |
| 1585 |
% \begin{macrocode} |
| 1586 |
\newcommand{\ChangesListline}[4]{% |
| 1587 |
\IfIsInList{#1}{\Changes@loc@show}{% |
| 1588 |
\@ifundefined{@dotsep}% |
| 1589 |
{\def\@dotsep{4.5}}% |
| 1590 |
{}% |
| 1591 |
\origcontentsline{change}{#2}{#3}{#4} |
| 1592 |
}{}% |
| 1593 |
} |
| 1594 |
% \end{macrocode} |
| 1595 |
% \end{macro} |
| 1596 |
% |
| 1597 |
% \begin{macro}{\l@change} |
| 1598 |
% |
| 1599 |
% Output of a loc entry. |
| 1600 |
% |
| 1601 |
% \begin{macrocode} |
| 1602 |
\newcommand*\l@change{\@dottedtocline{1}{0pt}{2em}} |
| 1603 |
% \end{macrocode} |
| 1604 |
% \end{macro} |
| 1605 |
% |
| 1606 |
% \begin{macro}{\settruncatewidth} |
| 1607 |
% |
| 1608 |
% Set the width of the truncation. |
| 1609 |
% Argument: new width. |
| 1610 |
% \begin{macrocode} |
| 1611 |
\newcommand{\settruncatewidth}[1]{ |
| 1612 |
\setlength{\Changestruncatewidth}{#1} |
| 1613 |
} |
| 1614 |
% \end{macrocode} |
| 1615 |
% \end{macro} |
| 1616 |
% |
| 1617 |
% \begin{macro}{\Changestruncatewidth} |
| 1618 |
% |
| 1619 |
% Length for the width of the truncation. |
| 1620 |
% |
| 1621 |
% Default: two third of the text width |
| 1622 |
% |
| 1623 |
% Normally, the name would be separated by @, as all internal macros are, but this leads |
| 1624 |
% to compile errors when processing the list of changes, therefore the @ were omitted. |
| 1625 |
% |
| 1626 |
% \begin{macrocode} |
| 1627 |
\newlength{\Changestruncatewidth} |
| 1628 |
\settruncatewidth{.6\textwidth} |
| 1629 |
% \end{macrocode} |
| 1630 |
% \end{macro} |
| 1631 |
% |
| 1632 |
% \begin{macro}{\setsummarywidth} |
| 1633 |
% |
| 1634 |
% Set the width of the change summary. |
| 1635 |
% Argument: new width. |
| 1636 |
% \begin{macrocode} |
| 1637 |
\newcommand{\setsummarywidth}[1]{ |
| 1638 |
\setlength{\Changes@summary@width}{#1} |
| 1639 |
} |
| 1640 |
% \end{macrocode} |
| 1641 |
% \end{macro} |
| 1642 |
% |
| 1643 |
% \begin{macro}{\setsummarytowidth} |
| 1644 |
% |
| 1645 |
% Set the width of the change summary to width of given text. |
| 1646 |
% Argument: text. |
| 1647 |
% \begin{macrocode} |
| 1648 |
\newcommand{\setsummarytowidth}[1]{ |
| 1649 |
\settowidth{\Changes@summary@width}{#1} |
| 1650 |
} |
| 1651 |
% \end{macrocode} |
| 1652 |
% \end{macro} |
| 1653 |
% |
| 1654 |
% \begin{macro}{\Changes@summary@width} |
| 1655 |
% |
| 1656 |
% Length for the width of the change summary. |
| 1657 |
% |
| 1658 |
% Default: one third of the text width |
| 1659 |
% |
| 1660 |
% \begin{macrocode} |
| 1661 |
\newlength{\Changes@summary@width} |
| 1662 |
\setsummarywidth{.3\textwidth} |
| 1663 |
% \end{macrocode} |
| 1664 |
% \end{macro} |
| 1665 |
% |
| 1666 |
% \begin{macro}{\phantomsection} |
| 1667 |
% |
| 1668 |
% Provide command in case \docpackage{hyperref} is not loaded. |
| 1669 |
% \begin{macrocode} |
| 1670 |
\providecommand\phantomsection{} |
| 1671 |
% \end{macrocode} |
| 1672 |
% \end{macro} |
| 1673 |
% |
| 1674 |
% \begin{macro}{\listofchanges} |
| 1675 |
% |
| 1676 |
% This command outputs the list of changes. |
| 1677 |
% Options: \docoption{title}, \docoption{style} and \docoption{show}. |
| 1678 |
% |
| 1679 |
% The following styles are available: |
| 1680 |
% \begin{description} |
| 1681 |
% \item [\docoption{list}] prints the list of changes like a list of figures |
| 1682 |
% \item [\docoption{summary}] prints the number of changes grouped by author |
| 1683 |
% \item [\docoption{compactsummary}] same as \docoption{summary} but entries with count 0 are omitted |
| 1684 |
% \end{description} |
| 1685 |
% |
| 1686 |
% The following show values are available: |
| 1687 |
% \begin{description} |
| 1688 |
% \item [\docoption{all}] all kinds of changes |
| 1689 |
% \item [\docoption{added}] print only additions (same for delete, replace, highlight, comment) |
| 1690 |
% \item [\docoption{added|deleted}] print additions and deletions (and other combinations with |) |
| 1691 |
% \end{description} |
| 1692 |
% |
| 1693 |
% For the lists, the values are read from the auxiliary files (loc and soc). |
| 1694 |
% If no loc/soc-files exists, an according message is generated. |
| 1695 |
% \begin{macrocode} |
| 1696 |
\newcommand{\listofchanges}[1][\@empty]{% |
| 1697 |
\setkeys{Changes@loc}{#1}% |
| 1698 |
% \end{macrocode} |
| 1699 |
% All work is done only in draft mode. |
| 1700 |
% \begin{macrocode} |
| 1701 |
\ifbool{Changes@optiondraft}% |
| 1702 |
{% |
| 1703 |
% \end{macrocode} |
| 1704 |
% |
| 1705 |
% Check if style is known, otherwise use \docoption{list} by default. |
| 1706 |
% \begin{macrocode} |
| 1707 |
\IfIsInList{\Changes@loc@style}{list|summary|compactsummary}% |
| 1708 |
{}% |
| 1709 |
{% |
| 1710 |
\PackageWarning{changes}{Wrong style for list of changes: '\Changes@loc@style', using 'list' instead.}% |
| 1711 |
\def\Changes@loc@style{}% |
| 1712 |
}% |
| 1713 |
\IfIsEmpty{\Changes@loc@style}% |
| 1714 |
{\def\Changes@loc@style{list}}% |
| 1715 |
{}% |
| 1716 |
% \end{macrocode} |
| 1717 |
% |
| 1718 |
% Check if show-value is known, otherwise use \docoption{all} by default. |
| 1719 |
% \begin{macrocode} |
| 1720 |
\IfStrEq{\Changes@loc@show}{all}% |
| 1721 |
{\def\Changes@loc@show{added|deleted|replaced|highlight|comment}}% |
| 1722 |
{}% |
| 1723 |
\IfIsInList{\Changes@loc@show}{added|deleted|replaced|highlight|comment}% |
| 1724 |
{}% |
| 1725 |
{% |
| 1726 |
\PackageWarning{changes}{Wrong show-value for list of changes: '\Changes@loc@show', using 'all' instead.}% |
| 1727 |
\def\Changes@loc@show{}% |
| 1728 |
}% |
| 1729 |
\IfIsEmpty{\Changes@loc@show}% |
| 1730 |
{\def\Changes@loc@show{added|deleted|replaced|highlight|comment}}% |
| 1731 |
{}% |
| 1732 |
% \end{macrocode} |
| 1733 |
% |
| 1734 |
% Print heading. |
| 1735 |
% \begin{macrocode} |
| 1736 |
\IfIsEmpty{\Changes@loc@title}% |
| 1737 |
{% |
| 1738 |
\IfStrEq{\Changes@loc@style}{list}% |
| 1739 |
{\def\Changes@heading{\listofchangesname}}{}% |
| 1740 |
\IfStrEq{\Changes@loc@style}{summary}% |
| 1741 |
{\def\Changes@heading{\summaryofchangesname}}{}% |
| 1742 |
\IfStrEq{\Changes@loc@style}{compactsummary}% |
| 1743 |
{\def\Changes@heading{\compactsummaryofchangesname}}{}% |
| 1744 |
}% |
| 1745 |
{\def\Changes@heading{\Changes@loc@title}}% |
| 1746 |
\section*{\Changes@heading} |
| 1747 |
% \end{macrocode} |
| 1748 |
% |
| 1749 |
% Print list. |
| 1750 |
% |
| 1751 |
% The \doccommand{ifeof} command is neccessary in the loop too, otherwise there are problems with the last (empty) line of the file. |
| 1752 |
% |
| 1753 |
% The output is done with \doccommand{contentsline}, in order to filter the output I have to redefine the command. |
| 1754 |
% I did not find a better solution than the \doccommand{let} command. |
| 1755 |
% \begin{macrocode} |
| 1756 |
\IfIsInList{\Changes@loc@style}{list}% |
| 1757 |
{% |
| 1758 |
\IfFileExists{\jobname.\Changes@locextension}% |
| 1759 |
{% |
| 1760 |
\let\origcontentsline\contentsline% |
| 1761 |
\let\contentsline\ChangesListline% |
| 1762 |
\newread\Changes@InFile% |
| 1763 |
\openin\Changes@InFile=\jobname.\Changes@locextension% |
| 1764 |
\loop\unless\ifeof\Changes@InFile% |
| 1765 |
\read\Changes@InFile to \Changes@Line% |
| 1766 |
\ifeof\Changes@InFile\else% |
| 1767 |
\Changes@Line% |
| 1768 |
\fi |
| 1769 |
\repeat |
| 1770 |
\closein\Changes@InFile% |
| 1771 |
\let\contentsline\origcontentsline% |
| 1772 |
}{% |
| 1773 |
\emph{\changesnoloc}% |
| 1774 |
\PackageWarning{changes}{LaTeX rerun needed for list of changes}% |
| 1775 |
}% |
| 1776 |
}{}% |
| 1777 |
% \end{macrocode} |
| 1778 |
% |
| 1779 |
% Print summary or compact summary. |
| 1780 |
% |
| 1781 |
% The \doccommand{ifeof} command is neccessary in the loop too, otherwise there are problems with the last (empty) line of the file. |
| 1782 |
% \begin{macrocode} |
| 1783 |
\IfIsInList{\Changes@loc@style}{summary|compactsummary}% |
| 1784 |
{% |
| 1785 |
\IfFileExists{\jobname.\Changes@socextension}% |
| 1786 |
{% |
| 1787 |
% \end{macrocode} |
| 1788 |
% Deactivate semicolon as shorthand in order to avoid problems reading the semicolon separated lines. |
| 1789 |
% \begin{macrocode} |
| 1790 |
\ifdef{\ifbabelshorthand}{% |
| 1791 |
\ifbabelshorthand{;}{\shorthandoff{;}}{}% |
| 1792 |
}{}% |
| 1793 |
\newread\Changes@InFile% |
| 1794 |
\openin\Changes@InFile = \jobname.\Changes@socextension% |
| 1795 |
% \end{macrocode} |
| 1796 |
% Every line contains the author's id, color and number of changes. |
| 1797 |
% \begin{macrocode} |
| 1798 |
\loop\unless\ifeof\Changes@InFile% |
| 1799 |
\read\Changes@InFile to \Changes@Line% |
| 1800 |
\ifeof\Changes@InFile\else% |
| 1801 |
\expandafter\changes@chopline\Changes@Line\\% |
| 1802 |
\textbf{% |
| 1803 |
\IfIsColored% |
| 1804 |
{\color{\Changes@Incolor}}% |
| 1805 |
{}% |
| 1806 |
\IfIsAnonymous{\Changes@Inid}% |
| 1807 |
{\changesauthorname: \changesanonymousname}% |
| 1808 |
{% |
| 1809 |
\changesauthorname: \Changes@Inid% |
| 1810 |
\IfIsEmpty{\Changes@Inname}% |
| 1811 |
{}% |
| 1812 |
{ (\Changes@Inname)}% |
| 1813 |
}% |
| 1814 |
}\\% |
| 1815 |
% \end{macrocode} |
| 1816 |
% Compute the relevant sum of changes in order to print "no changes" correctly. |
| 1817 |
% |
| 1818 |
% To make sure \doccommand{do} can be renewed, we define it first, some macros, such as \doccommand{chapter} undefine it. |
| 1819 |
% \begin{macrocode} |
| 1820 |
\numdef{\Changes@InSum}{0}% |
| 1821 |
\def\do{}% |
| 1822 |
\renewcommand*{\do}[1]{% |
| 1823 |
\numdef{\Changes@InSum}{\Changes@InSum + \csuse{Changes@In########1}}% |
| 1824 |
}% |
| 1825 |
\expandafter\dopsvlist\expandafter{\Changes@loc@show}% |
| 1826 |
% \end{macrocode} |
| 1827 |
% Print summary. |
| 1828 |
% \begin{macrocode} |
| 1829 |
\ifnumcomp{\Changes@InSum}{=}{0}% |
| 1830 |
{% |
| 1831 |
\parbox{\Changes@summary@width}{\changesnochanges}\\[1ex]% |
| 1832 |
}% |
| 1833 |
{% |
| 1834 |
\numdef{\Changes@InCount}{0}% |
| 1835 |
\renewcommand*{\do}[1]{% |
| 1836 |
\numdef{\Changes@InCount}{\Changes@InCount + \csuse{Changes@In########1}}% |
| 1837 |
\ifboolexpr{% |
| 1838 |
not test {\IfStrEq{\Changes@loc@style}{compactsummary}} or% |
| 1839 |
test {\ifnumgreater{\csuse{Changes@In########1}}{0}}% |
| 1840 |
}% |
| 1841 |
{% |
| 1842 |
\parbox{\Changes@summary@width}{\csuse{changes########1name}~\let\cleaders\leaders\dotfill~\csuse{Changes@In########1}}% |
| 1843 |
\ifnumless{\Changes@InCount}{\Changes@InSum}% |
| 1844 |
{\\}% |
| 1845 |
{\\[1ex]}% |
| 1846 |
}% |
| 1847 |
{}% |
| 1848 |
}% |
| 1849 |
\expandafter\dopsvlist\expandafter{\Changes@loc@show}% |
| 1850 |
}% |
| 1851 |
\fi% |
| 1852 |
% \end{macrocode} |
| 1853 |
% File read loop. |
| 1854 |
% \begin{macrocode} |
| 1855 |
\repeat |
| 1856 |
\closein\Changes@InFile% |
| 1857 |
% \end{macrocode} |
| 1858 |
% Reactivate semicolon as shorthand. |
| 1859 |
% \begin{macrocode} |
| 1860 |
\ifdef{\ifbabelshorthand}{% |
| 1861 |
\ifbabelshorthand{;}{\shorthandon{;}}{}% |
| 1862 |
}{}% |
| 1863 |
}{% |
| 1864 |
\emph{\changesnosoc}% |
| 1865 |
\PackageWarning{changes}{LaTeX rerun needed for summary of changes}% |
| 1866 |
}% |
| 1867 |
}{}% |
| 1868 |
% \end{macrocode} |
| 1869 |
% In final mode print nothing. |
| 1870 |
% \begin{macrocode} |
| 1871 |
}{}% |
| 1872 |
} |
| 1873 |
% \end{macrocode} |
| 1874 |
% \end{macro} |
| 1875 |
% |
| 1876 |
% At the end of the document: write the list of changes in the loc-file, therefore open file, write values, close file. |
| 1877 |
% Changes are written as \hologo{LaTeX}-formatted text, so they can simply be read via \doccommand{input}. |
| 1878 |
% |
| 1879 |
% The order of entries is: id, color, name, added, deleted, replaced, comment, highlight. |
| 1880 |
% The contents have to be separated by a semicolon. |
| 1881 |
% \begin{macrocode} |
| 1882 |
\AtEndDocument{% |
| 1883 |
% \end{macrocode} |
| 1884 |
% Open output file. |
| 1885 |
% \begin{macrocode} |
| 1886 |
\newwrite\Changes@OutFile |
| 1887 |
\immediate\openout\Changes@OutFile = \jobname.\Changes@socextension |
| 1888 |
% \end{macrocode} |
| 1889 |
% Redefine expandable of \doccommand{protect} in order to write correct special characters. |
| 1890 |
% Store original definition for resetting \doccommand{protect}. |
| 1891 |
% \begin{macrocode} |
| 1892 |
\let\Changes@protect\protect |
| 1893 |
\let\protect\@unexpandable@protect |
| 1894 |
% \end{macrocode} |
| 1895 |
% Output data for list of changes. |
| 1896 |
% \begin{macrocode} |
| 1897 |
\setcounter{Changes@Author}{0} |
| 1898 |
\loop\unless\ifnum\theChanges@Author = \value{Changes@AuthorCount} |
| 1899 |
\stepcounter{Changes@Author}% |
| 1900 |
\def\Changes@ID{\csuse{Changes@AuthorID\theChanges@Author}}% |
| 1901 |
\immediate\write\Changes@OutFile{\Changes@ID;% |
| 1902 |
\csuse{Changes@AuthorColor\Changes@ID};% |
| 1903 |
\csuse{Changes@AuthorName\Changes@ID};% |
| 1904 |
\the\value{Changes@addedCount\Changes@ID};% |
| 1905 |
\the\value{Changes@deletedCount\Changes@ID};% |
| 1906 |
\the\value{Changes@replacedCount\Changes@ID};% |
| 1907 |
\the\value{Changes@highlightCount\Changes@ID};% |
| 1908 |
\the\value{Changes@commentCount\Changes@ID}}% |
| 1909 |
\repeat |
| 1910 |
% \end{macrocode} |
| 1911 |
% Close output file. |
| 1912 |
% \begin{macrocode} |
| 1913 |
\immediate\closeout\Changes@OutFile |
| 1914 |
% \end{macrocode} |
| 1915 |
% Restore original definition of \doccommand{protect}. |
| 1916 |
% \begin{macrocode} |
| 1917 |
\let\protect\Changes@protect |
| 1918 |
% \end{macrocode} |
| 1919 |
% |
| 1920 |
% Write content of listofchanges to file. |
| 1921 |
% \begin{macrocode} |
| 1922 |
\if@filesw |
| 1923 |
\@ifundefined{tf@\Changes@locextension}{ |
| 1924 |
\expandafter\newwrite\csname tf@\Changes@locextension\endcsname |
| 1925 |
\immediate\openout \csname tf@\Changes@locextension\endcsname \jobname.\Changes@locextension\relax |
| 1926 |
}{} |
| 1927 |
\fi |
| 1928 |
} |
| 1929 |
% \end{macrocode} |
| 1930 |
% |
| 1931 |
% \begin{macrocode} |
| 1932 |
%</changes> |
| 1933 |
% \end{macrocode} |
| 1934 |
% |
| 1935 |
% \PrintChanges |
| 1936 |
% \PrintIndex |
| 1937 |
% |
| 1938 |
%\Finale |
| 1939 |
\endinput |