manus_continuum_granular1

manuscript files for first continuum-till paper
git clone git://src.adamsgaard.dk/manus_continuum_granular1
Log | Files | Refs Back to index

trackchanges.sty (26287B)


      1 %%
      2 %% This file is part of TrackChanges
      3 %% Copyright 2006-2009 
      4 %%    Novimir Antoniuk Pablant <amicitas@users.sourceforge.net>
      5 %%    Felix Salfner <salfner@informatik.hu-berlin.de>
      6 %%
      7 %% http://trackchanges.sourceforge.net/
      8 %%
      9 %% Portions of this code adapted from the 'soul' package.
     10 %% Copyright (C) 1998-2003 Melchior FRANZ
     11 %%
     12 %% TrackChanges is free software: you can redistribute it and/or modify
     13 %% it under the terms of the GNU General Public License as published by
     14 %% the Free Software Foundation, either version 2 of the License, or
     15 %% (at your option) any later version.
     16 %%
     17 %% TrackChanges is distributed in the hope that it will be useful,
     18 %% but WITHOUT ANY WARRANTY; without even the implied warranty of
     19 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     20 %% GNU General Public License for more details.
     21 %%
     22 %% You should have received a copy of the GNU General Public License
     23 %% along with TrackChanges.  If not, see <http://www.gnu.org/licenses/>.
     24 %%
     25 %%
     26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     27 %% trackchanges.sty
     28 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     29 %% A graphical interface has been written to allow the changes made
     30 %% using this style file to be interactively accepted, rejected 
     31 %% or changed.
     32 %%   trackchanges.py
     33 %%
     34 %% To find the latest versions this latex style file and the 
     35 %% associated files file go to:
     36 %%   http://trackchanges.sourceforge.net/
     37 %%
     38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     39 %% Usage:
     40 %%
     41 %%   Help files are included as part of this package:
     42 %%     ./documentation/web/html_css/help.html
     43 %%
     44 %%   TrackChanges adds the following 5 commands to allow for collaborative 
     45 %%   editing of LaTeX documents.
     46 %%
     47 %%     \add[editor]{text to add}
     48 %%     \remove[editor]{text to remove}
     49 %%     \change[editor]{text to remove}{text to add}
     50 %%     \annote[editor]{text to annotate}{note}
     51 %%     \note[editor]{note}
     52 %%  
     53 %%   In all cases 'editor' is optional.
     54 %% 
     55 %%   In order to have comments color coded by editor, the editors must
     56 %%   be added in the preamble.
     57 %%
     58 %%     \addeditor{editor}
     59 %%
     60 %% 
     61 %% Options
     62 %%
     63 %%   There are 5 display options. These are specified with the
     64 %%   \usepackage[options]{trackchanges)
     65 %%
     66 %%     finalold
     67 %%        Ignore all of the edits.  
     68 %%        The document will look as if the edits had not been added.
     69 %%     finalnew
     70 %%        Accept all of the edits. 
     71 %%        Notes will not be shown in the final output. 
     72 %%     footnotes
     73 %%        Added text will be shown inline. Removed text and notes
     74 %%        will be shown as footnotes.
     75 %%        This is the default option.
     76 %%     margins
     77 %%        Added text will be shown inline. Removed text and notes 
     78 %%        will be shown in the margin.
     79 %%        Margin notes will be aligned with the edits when possible.
     80 %%     inline
     81 %%        All edits will be shown inline.
     82 %%
     83 %%   The following two options are to be used with the 'margins' 
     84 %%   display style.  They are used to make more space for the margin
     85 %%   notes.  By default the margins are left as in the original
     86 %%   document.
     87 %%
     88 %%     movemargins
     89 %%        Move the text over to the left hand side.
     90 %%        The textwidth will stay the same.
     91 %%     adjustmargins
     92 %%        Reduce the textwidth and move the text over to the left 
     93 %%        hand side.This option will produced the most space for 
     94 %%        the margin notes.
     95 %%
     96 %%
     97 %% Advanced Usage
     98 %%
     99 %%   Certain types of commands cannot be used inside of the TrackChanges
    100 %%   edit commands without special handling.  For more details see
    101 %%   the limitations section.
    102 %%
    103 %%   This option can be used to deal with incompatible commands.
    104 %%
    105 %%     ignoremode
    106 %%
    107 %%   Additional commands can be added to the ignore list with the
    108 %%   following command.
    109 %%
    110 %%     \tcignore{<command name>}{<num args>}{<arg num to pass>}
    111 %%
    112 %%   The last argument specifies which, if any, arguments to pass
    113 %%   as plain text when the command is ignored.  If the last
    114 %%   argument is zero, then all of the arguments will be ignored.
    115 %%   If \color and \textcolor were not already on the ignore 
    116 %%   list then the following commands could be used to add them:
    117 %%
    118 %%     \tcignore{\textcolor}{2}{2}
    119 %%     \tcignore{\color}{1}{0}
    120 %%
    121 %%
    122 %%   TrackChanges also requires special handling for font changing
    123 %%   commands.  These type of commands may have to be registered
    124 %%   with track changes to be dealt with properly.  To register a
    125 %%   new command use the following command.
    126 %%
    127 %%     \tcregister{<command name>}{<num args>}
    128 %%
    129 %%   All of the standard font switching command are registered by 
    130 %%   default.  If \bf and \emph were not already registered then
    131 %%   the following commands could be used to add them:
    132 %%
    133 %%     \tcregister{\bf}{0}
    134 %%     \tcregister{\emph}{1}
    135 %%
    136 %%   While register commands is primarily for font changing it may
    137 %%   work for other types of commands that are causing problems.
    138 %%
    139 %%
    140 %%
    141 %% Limitations
    142 %%
    143 %%   - If another package is used that adjusts the margins, it
    144 %%     can take precedence over the TrackChanges handling.
    145 %%     To make sure TrackChanges has the last word, load it 
    146 %%     after all other margin related packages.
    147 %%
    148 %%   - Incompatable with the package 'ulem'
    149 %%     Use the package 'soul' instead for underlining/strikeout.
    150 %%
    151 %%   - TrackChanges cannot handle certain kinds of commands inside
    152 %%     the edit commands.  In particular \color, \textcolor and 
    153 %%     any commands from the underlining package 'soul' will not work.  
    154 %%     There are two ways to get around these issues.
    155 %%     1. The 'ignoremode' option can be used.
    156 %%          This will tell TrackChanges to ignore certain commands
    157 %%          (Including the ones mentioned above).
    158 %%          Additional commands can be added to the ignore list with
    159 %%          the \tcignore command.
    160 %%     2. Sometimes the problematic commands can be preceded by 
    161 %%        \protect. This however can have strange behavior.
    162 %% 
    163 %%   - TrackChanges requires special handling for certain kinds of
    164 %%     commands inside of edit commands.  These problematic commands
    165 %%     are generally font switching commands.  All of the common
    166 %%     font switching commands (such as \emph, \textbf, etc.)
    167 %%     are already handled.  If you run into an issue you can try
    168 %%     using \tcregister to register the problematic command.
    169 %%
    170 %%   - No easy way to tell TrackChanges not to split footnotes 
    171 %%     across multiple pages.
    172 %%
    173 %%   - Some other packages that take over footnote handling may be
    174 %%     incompatible with TrackChanges.  Using a footnote package
    175 %%     such as footmisc may fix these problems.
    176 %%
    177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    178 %% trackchanges version 0.6,   2007-06-13
    179 %% written by Felix Salfner
    180 %%
    181 %% trackchanges version 0.7,   2009-03-09
    182 %% rewritten by Novimir Pablant
    183 %%
    184 %% version 0.7.0, 2009-04-22 - Novimir Pablant
    185 %%     Overhauled how the editors are set up.  Now each editor can be
    186 %%       added simply by using the /addeditor{name} command.
    187 %%     Color system completely overhauled, now uses the 'soul' package.  
    188 %%     Added margin commands 'movemargins' and 'adjustmargins'.
    189 %%     Added an option ignoremode and a reimplementation of portions
    190 %%       of 'soul' to allow commands to be ignored inside edits.
    191 %%       Commands \tcignore and \tcregister were added.
    192 %%     Added depreciation warnings for TrackChanges v0.6 commands.
    193 %%     Numerous other internal changes.
    194 %%
    195 %%
    196 %% ---------------------------------------------------------------------
    197 %% To do:
    198 %%   - Add ability to set custom colors.
    199 %%
    200 %%   - Create a better way of adding editors that does not have a 
    201 %%     five editor limit.
    202 %%
    203 %%   - Check if the package 'ulem' is loaded, and issue an error.
    204 %%     Right now I am checking if the \ulem command exists.
    205 %%     and issuing a warning.
    206 %%
    207 %%   - Better error handling, error messages.
    208 %%
    209 %%
    210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    211 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
    212 \ProvidesPackage{trackchanges}
    213    [2009/04/22 v0.7.0 TrackChanges file ]
    214 
    215 % Setup the required packages.
    216 \RequirePackage{color}
    217 \RequirePackage{ifthen}
    218 \RequirePackage{calc}
    219 \RequirePackage{soul}
    220 \RequirePackage{morefloats}
    221 
    222 % I ran into some conflicts with other packages that deal 
    223 % with footnotes.  Adding footmisc solved those problems for me.
    224 %\RequirePackage{footmisc}
    225 %\RequirePackage{manyfoot}
    226 
    227 %%
    228 %% -------------- Setup the options
    229 \newif\if@trackchanges
    230 \@trackchangestrue
    231 \newif\if@trackinmargins
    232 \@trackinmarginsfalse
    233 \newif\if@trackinline
    234 \@trackinlinefalse
    235 \newif\if@keepnew
    236 \@keepnewfalse
    237 \newif\if@movemargins
    238 \@movemarginsfalse
    239 \newif\if@adjustmargins
    240 \@adjustmarginsfalse
    241 \newif\if@TCignoremode
    242 \@TCignoremodefalse
    243 
    244 \DeclareOption{finalold}{\@trackchangesfalse\@keepnewfalse}
    245 \DeclareOption{finalnew}{\@trackchangesfalse\@keepnewtrue}
    246 \DeclareOption{margins}{\@trackchangestrue\@trackinmarginstrue\@trackinlinefalse}
    247 \DeclareOption{inline}{\@trackchangestrue\@trackinlinetrue\@trackinmarginsfalse}
    248 \DeclareOption{footnotes}{\@trackchangestrue\@trackinmarginsfalse\@trackinlinefalse}
    249 
    250 \DeclareOption{movemargins}{\@movemarginstrue\@adjustmarginsfalse}
    251 \DeclareOption{adjustmargins}{\@adjustmarginstrue\@movemarginstrue}
    252 
    253 \DeclareOption{ignoremode}{\@TCignoremodetrue}
    254 \DeclareOption{ignoremodeoff}{\@TCignoremodefalse}
    255 
    256 %% This option exists for backwards compatibility with v0.6.
    257 %% A depreciated warning will be displayed.
    258 \DeclareOption{final}{\@trackchangesfalse\@keepnewfalse
    259   \PackageWarningNoLine{trackchanges}{%
    260     Option 'final' is depreciated.\MessageBreak%
    261     Use 'finalold' instead%
    262   }%
    263 }
    264 
    265 \ProcessOptions
    266 
    267 
    268 %%
    269 %% -------------- Inhibit footnotes getting split across pages
    270 %% This will inhibit splitting completely.
    271 %% LaTeX will complain about `Underfull \vbox' unless 
    272 %% \raggedbottom is also used.
    273 %
    274 %\interfootnotelinepenalty=10000
    275 %
    276 %% Default value is 100.
    277 
    278 
    279 %%
    280 %% -------------- Set options for the soul package
    281 \setstcolor{red}
    282 \setuloverlap{0pt}
    283 
    284 %%
    285 %% -------------- Make an alias to the 'soulregister' command.
    286 \let\tcregister\soulregister
    287 
    288 %% -------------- Setup new macros for the soul package.
    289 %% Here we setup two new commands using soul package macros.
    290 %% These will allow strikeout, and underline with colored
    291 %% text.  These are important as they ensure that color is
    292 %% maintained even in situations such as a footnote getting
    293 %% split across pages.
    294 
    295 %% This is where the color is actually added.
    296 \def\SOUL@coloreverysyllable{%
    297   \SOUL@textcolor{\the\SOUL@syllable%
    298     \SOUL@setkern\SOUL@charkern%
    299   }%
    300 }
    301 
    302 %% This is where the color is actually added.
    303 \def\SOUL@ulcoloreverysyllable{%
    304   \SOUL@textcolor{\SOUL@uleverysyllable}%
    305 }
    306 
    307 %% Here we define a new command with the text color.
    308 \def\SOUL@settextcolor#1{%
    309   \def\SOUL@textcolor{\textcolor{#1}}%
    310 }
    311 
    312 %% This is the setup command for colored text.
    313 \def\SOUL@colorsetup#1{%
    314   \SOUL@settextcolor{#1}%
    315   \SOUL@setup%
    316   \let\SOUL@everysyllable\SOUL@coloreverysyllable%
    317 }
    318 
    319 %% This is the setup command for strikeout with colored text.
    320 \def\SOUL@stcolorsetup#1{%
    321   \SOUL@settextcolor{#1}%
    322   \SOUL@stsetup%
    323   \let\SOUL@everysyllable\SOUL@ulcoloreverysyllable%
    324 }
    325 
    326 %% This is the setup command for underline with colored text.
    327 \def\SOUL@ulcolorsetup#1{%
    328   \SOUL@settextcolor{#1}%
    329   \SOUL@ulsetup%
    330   \let\SOUL@everysyllable\SOUL@ulcoloreverysyllable%
    331 }
    332 
    333 %% Here I define the new callables.
    334 
    335 %% Color with strikeout
    336 \DeclareRobustCommand*{\stcolor}[1]{%
    337   \SOUL@stcolorsetup{#1}%
    338   \SOUL@%
    339 }
    340 
    341 %% Color with underline
    342 \DeclareRobustCommand*{\ulcolor}[1]{%
    343   \SOUL@ulcolorsetup{#1}%
    344   \SOUL@%
    345 }
    346 
    347 %% Colored text
    348 \DeclareRobustCommand*{\soulcolor}[1]{%
    349   \SOUL@colorsetup{#1}%
    350   \SOUL@%
    351 }
    352 
    353 %%
    354 %% -------------- Setup counters
    355 \newcounter{userid}
    356 \setcounter{userid}{-1}
    357 \newcounter{changenumber}[page]
    358 \setcounter{changenumber}{0}
    359 \newcounter{storefootnote}
    360 \newcounter{numeditors}
    361 \setcounter{numeditors}{0}
    362 \newcounter{maxeditors}
    363 \setcounter{maxeditors}{5}
    364 
    365 
    366 %%
    367 %% ----------- Create commands for five users
    368 \newcommand{\TC@editorOne}{n/n}
    369 \newcommand{\TC@editorTwo}{n/n}
    370 \newcommand{\TC@editorThree}{n/n}
    371 \newcommand{\TC@editorFour}{n/n}
    372 \newcommand{\TC@editorFive}{n/n}
    373 
    374 
    375 %%
    376 %% ----------- create commands to add an editor.
    377 \newcommand{\addeditor}[1]{
    378   \matchuser{#1}
    379   \ifthenelse{\value{userid} = -1}
    380       {\addNewEditor{#1}}{}
    381 }
    382 \newcommand{\addNewEditor}[1]{
    383   \stepcounter{numeditors}
    384   \setcounter{userid}{\value{numeditors}}
    385   % Check the number of authors.
    386   \ifthenelse{\value{numeditors} > \value{maxeditors}}
    387       {\TC@WarningTooManyEditors}
    388       {}
    389   \ifthenelse{\value{userid} = 1}
    390       {\renewcommand{\TC@editorOne}{#1}}
    391       {\ifthenelse{\value{userid} = 2}
    392         {\renewcommand{\TC@editorTwo}{#1}}
    393         {\ifthenelse{\value{userid} = 3}
    394           {\renewcommand{\TC@editorThree}{#1}}
    395           {\ifthenelse{\value{userid} = 4}
    396             {\renewcommand{\TC@editorFour}{#1}}
    397             {\ifthenelse{\value{userid} = 5}%
    398               {\renewcommand{\TC@editorFive}{#1}}
    399               {}
    400             }
    401           }
    402         }
    403       }
    404 }
    405 
    406 
    407 %%
    408 %% --------------- define text colors for different users
    409 \newcommand{\usercolor}{%
    410    \ifthenelse{\value{userid} = 0}%
    411        {\definecolor{UserColor}{rgb}{0.33,0.11,0.46}}% Purple
    412        {\ifthenelse{\value{userid} = 1}%
    413          {\definecolor{UserColor}{rgb}{0.1,0.1,0.8}}% Blue
    414          {\ifthenelse{\value{userid} = 2}%
    415            {\definecolor{UserColor}{rgb}{0.0,0.6,0.0}}% Green
    416            {\ifthenelse{\value{userid} = 3}%
    417              {\definecolor{UserColor}{rgb}{0.68,0.17,0.5}}% Magenta
    418              {\ifthenelse{\value{userid} = 4}%
    419                {\definecolor{UserColor}{rgb}{0.13,0.60,0.65}}% Cyan
    420                {\ifthenelse{\value{userid} = 5}%
    421                  {\definecolor{UserColor}{rgb}{0.86,0.50,0.12}}% Orange
    422                  {\definecolor{UserColor}{rgb}{0.13,0.70,0.50}}% Teal
    423                }%
    424              }%
    425            }%
    426          }%
    427        }%
    428 }
    429 
    430 
    431 %%
    432 %% -------------- set counter userid according to editor
    433 \newcommand{\matchuser}[1]{%
    434    \ifthenelse{\equal{#1}{}}%
    435       {\setcounter{userid}{0}}%
    436       {\ifthenelse{\equal{#1}{\TC@editorOne}}%
    437         {\setcounter{userid}{1}}%
    438         {\ifthenelse{\equal{#1}{\TC@editorTwo}}%
    439           {\setcounter{userid}{2}}%
    440           {\ifthenelse{\equal{#1}{\TC@editorThree}}%
    441             {\setcounter{userid}{3}}%
    442             {\ifthenelse{\equal{#1}{\TC@editorFour}}%
    443               {\setcounter{userid}{4}}%
    444               {\ifthenelse{\equal{#1}{\TC@editorFive}}%
    445                 {\setcounter{userid}{5}}%
    446                 {\setcounter{userid}{-1}}%
    447               }%
    448             }%
    449           }%
    450         }%
    451       }%
    452    \usercolor%
    453 }
    454 
    455 %% --------------- Setup a command for the user label.
    456 \newcommand{\UserLabel}{}
    457 %%
    458 \newcommand{\GetUserLabel}[1]{%
    459   \ifthenelse{\equal{#1}{}}%
    460              {}%
    461              {\userco{\textit{#1}:}}%
    462 }
    463 
    464 
    465 %%
    466 %% --------------- define commands to color text.
    467 %%                 The first command works properly across paragraphs.
    468 %%                 The second works well with the footnote.
    469 %%                 
    470 %%                 The last two use the soul package.
    471 \newcommand{\usertext}[1]{\color{UserColor}{#1}\normalcolor}
    472 \newcommand{\usertextfoot}[1]{\textcolor{UserColor}{#1}}
    473 \newcommand{\userco}[1]{\soulcolor{UserColor}{#1}}
    474 \newcommand{\userst}[1]{\stcolor{UserColor}{#1}}
    475 \newcommand{\userul}[1]{\ulcolor{UserColor}{#1}}
    476 
    477 
    478 %%
    479 %% --------------- define command for margin text.
    480 \newcommand{\marginText}[2]{%
    481   \renewcommand{\baselinestretch}{0.8}%
    482   \marginpar{\raggedright%
    483              \footnotesize%
    484              \textsuperscript{\thefootnote}%
    485              \UserLabel~#2%
    486   }%
    487 }
    488 
    489 
    490 %%
    491 %% --------------- This need to be called at the beginning of every command.
    492 \newcommand{\trackingstart}[1]{%
    493   % Set the ignores if the 'ignore' option was set.
    494   \if@TCignoremode%
    495     \TC@SetIgnores%
    496   \fi%
    497   \setcounter{storefootnote}{\value{footnote}}%
    498   \refstepcounter{changenumber}%
    499   \matchuser{#1}%
    500   \ifthenelse{\value{userid} = -1}%
    501       {\TC@WarningUnknownEditor{#1}}%
    502       {}%
    503   \renewcommand{\thefootnote}{\usertextfoot{c\arabic{changenumber}}}%
    504   \setulcolor{UserColor}%
    505   \renewcommand{\UserLabel}{\GetUserLabel{#1}}%
    506 }
    507 
    508 
    509 %%
    510 %% --------------- This need to be called at the end of every command.
    511 \newcommand{\trackingend}{%
    512   \setcounter{footnote}{\value{storefootnote}}%
    513   % Reset the ignores if the 'ignore' option was set.
    514   \if@TCignoremode%
    515     \TC@ResetIgnores%
    516   \fi%
    517 }
    518 
    519 
    520 %%
    521 %% --------------- Define the frontend command: \add
    522 %%                 usage: \add[Editor]{new text}
    523 \newcommand{\add}[2][]{%
    524   \if@trackchanges%
    525     \trackingstart{#1}%
    526     \if@trackinmargins%
    527       \textsuperscript{\thefootnote}%
    528       \marginText{#1}{\userco{\textit{Text added.}}}%
    529     \else%
    530       \if@trackinline%
    531           {\footnotesize\textsuperscript{\UserLabel}}%
    532       \else%
    533         \footnote{\UserLabel~\userco{\textit{Text added.}}}%
    534       \fi%
    535     \fi%
    536     \usertext{\ul{#2}}%
    537     \trackingend%
    538   \else%
    539     %% if trackchanges is false ...
    540     \if@keepnew%
    541       %% Keep the new text.
    542       #2%
    543     \fi%
    544     %% if keepnew is false do nothing.
    545   \fi%
    546 }
    547 
    548 
    549 %%
    550 %% --------------- Define the frontend command: \remove
    551 %%                 usage: \remove[Editor]{original text}
    552 \newcommand{\remove}[2][]{%
    553   \if@trackchanges%
    554     \trackingstart{#1}%
    555     \if@trackinmargins%
    556       \textsuperscript{\thefootnote}%
    557       \marginText{#1}{\userst{#2}}%
    558     \else%
    559       \if@trackinline%
    560         {\footnotesize\textsuperscript{\UserLabel}\usertext{\st{#2}}}%     
    561       \else%
    562         \footnote{\UserLabel~\userst{#2}}%
    563       \fi%
    564     \fi%
    565     \trackingend%
    566   \else%
    567     %% if trackchanges is false ...
    568     \if@keepnew%
    569       %% Remove the old text.
    570     \else
    571       %% Keep the old text.
    572       #2%
    573     \fi%
    574   \fi%
    575 }
    576 
    577 
    578 %%
    579 %% --------------- Define the frontend command: \change
    580 %%                 usage: \change[Editor]{original text}{new text}
    581 \newcommand{\change}[3][]{%
    582   \if@trackchanges%
    583     \trackingstart{#1}%
    584     \if@trackinmargins%
    585       \textsuperscript{\thefootnote}%
    586       \marginText{#1}{\userst{#2}}%
    587     \else%
    588       \if@trackinline%
    589         {\footnotesize\textsuperscript{\UserLabel}\usertext{\st{#2}}}% 
    590       \else%
    591         \footnote{\UserLabel~\userst{#2}}%
    592       \fi%
    593     \fi%
    594     \usertext{\ul{#3}}%
    595     \trackingend%
    596   \else%
    597     %% if trackchanges is false ...
    598     \if@keepnew%
    599       %% Keep the new text.
    600       #3%
    601     \else
    602       %% Keep the old text.
    603       #2%
    604     \fi%
    605   \fi%
    606 }
    607 
    608 
    609 %%
    610 %% --------------- Define frontend command: \annonte
    611 %%                 usage: \annote[Editor]{highlighted text}{note text}
    612 \newcommand{\annote}[3][]{%
    613   % Make the underlining thicker and higher.
    614   \setul{1pt}{0.3ex}%
    615   \if@trackchanges%
    616     \trackingstart{#1}%
    617     \if@trackinmargins%
    618       \textsuperscript{\thefootnote}%
    619       \marginText{#1}{\userco{#3}}%
    620       \ul{#2}%
    621     \else%
    622       \if@trackinline%
    623         {\footnotesize\textsuperscript{\UserLabel}}%
    624         \ul{#2}%
    625         {\footnotesize\usertext{~[#3]}}%
    626       \else%
    627         \footnote{\UserLabel~\userco{#3}}%
    628         \ul{#2}%
    629       \fi%
    630     \fi%
    631     \trackingend%
    632   \else%
    633     %% if trackchanges is false ... just print text.
    634     #2%
    635   \fi%
    636   % Reset the underlineing
    637   \resetul%
    638 }
    639 
    640 
    641 %%
    642 %% --------------- Define frontend command: \note
    643 %%                 usage: \note[Editor]{note text}
    644 \newcommand{\note}[2][]{%
    645   \if@trackchanges%
    646     \trackingstart{#1}%
    647     \if@trackinmargins%
    648       \textsuperscript{\thefootnote}%
    649       \marginText{#1}{\userco{#2}}%
    650     \else%
    651       \if@trackinline%
    652         {\footnotesize\textsuperscript{\UserLabel}}%
    653         {\footnotesize\usertext{~[#2]}}%
    654       \else%
    655         \footnote{\UserLabel~\userco{#2}}%
    656       \fi%
    657     \fi%
    658     \trackingend%
    659   \else%
    660     %% if trackchanges is false ... do not print notes
    661   \fi%
    662 }
    663 
    664 
    665 %%
    666 %% --------------- Define frontend command: \refneeded
    667 %%                 usage: \refneeded[Editor]{note text}
    668 \newcommand{\refneeded}[2][]{%
    669   \if@trackchanges%
    670     \trackingstart{#1}%
    671     \if@trackinmargins%
    672       \textsuperscript{\thefootnote}%
    673       \marginText{#1}{\userco{REFERENCE NEEDED #2}}%
    674     \else%
    675       \if@trackinline%
    676         {\footnotesize\textsuperscript{\UserLabel}}%
    677         \ifthenelse{\equal{#2}{}}%
    678                    {{\footnotesize\usertext{~[REFERENCE NEEDED]}}}%
    679                    {{\footnotesize\usertext{~[REFERENCE NEEDED #2]}}}%
    680       \else%
    681         \footnote{\UserLabel~\userco{REFERENCE NEEDED #2}}%
    682       \fi%
    683     \fi%
    684     \trackingend%
    685   \else%
    686     %% if trackchanges is false ... do not print notes
    687   \fi%
    688 }
    689 
    690 
    691 %%
    692 %% -------------- Setup for margin notes.
    693 \newcommand{\setupMarginpar}{
    694   \setlength{\marginparwidth}{\paperwidth}
    695   \addtolength{\marginparwidth}{-1in}
    696   \addtolength{\marginparwidth}{-\oddsidemargin}
    697   \addtolength{\marginparwidth}{-\hoffset}
    698   \addtolength{\marginparwidth}{-\textwidth}
    699   \addtolength{\marginparwidth}{-\marginparsep}
    700   \addtolength{\marginparwidth}{-5mm}
    701 }
    702 \newcommand{\setupMoveMargins}{
    703   \setlength{\oddsidemargin}{-1in}
    704   \addtolength{\oddsidemargin}{0.5in}
    705 }
    706 \newcommand{\setupAdjustMargins}{
    707   \setlength{\textwidth}{0.5\paperwidth}
    708 }
    709 \newcommand{\setupMargins}{
    710   \if@movemargins
    711     \setupMoveMargins{}
    712   \fi
    713   \if@adjustmargins
    714     \setupAdjustMargins{}
    715   \fi
    716   % The Margins are setup using \AtBeginDocument.
    717 }
    718 
    719 %% --------------- Check that conflicting packages are not loaded.
    720 \def\TC@checkCompatibility{
    721   \ifx\uline\undefined
    722   \else
    723     \TC@WarningUlem
    724   \fi
    725 }
    726 
    727 %% ---------------- Setup for actions to be taken after the style file has been read.
    728 \AtEndOfPackage{
    729   \if@trackchanges
    730     \if@trackinmargins
    731       \setupMargins{}
    732     \else
    733     \fi
    734   \fi
    735 }
    736 
    737 %% ---------------- Setup for actions to be taken after the preamble.
    738 \AtBeginDocument{
    739   \TC@checkCompatibility
    740   \TC@checkDepreciated 
    741   \if@trackchanges
    742     \if@trackinmargins
    743       \setupMarginpar
    744     \else
    745     \fi
    746   \fi
    747 }
    748 
    749 %%
    750 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    751 %% --------------- Setup for backwards compatibility with v0.6
    752 \newcommand{\initialsOne}{}
    753 \newcommand{\initialsTwo}{}
    754 \newcommand{\initialsThree}{}
    755 \newcommand{\initialsFour}{}
    756 \newcommand{\initialsFive}{}
    757 
    758 %% --------------- Check for depreciated options
    759 \def\TC@checkDepreciated{
    760   \ifthenelse{\equal{\initialsOne}{}}
    761     {}{\TC@WarningDepreciatedInitials
    762        \addeditor{\initialsOne}}
    763   \ifthenelse{\equal{\initialsTwo}{}}
    764     {}{\TC@WarningDepreciatedInitials
    765        \addeditor{\initialsTwo}}
    766   \ifthenelse{\equal{\initialsThree}{}}
    767     {}{\TC@WarningDepreciatedInitials
    768        \addeditor{\initialsThree}}
    769   \ifthenelse{\equal{\initialsFour}{}}
    770     {}{\TC@WarningDepreciatedInitials
    771        \addeditor{\initialsFour}}
    772   \ifthenelse{\equal{\initialsFive}{}}
    773     {}{\TC@WarningDepreciatedInitials
    774        \addeditor{\initialsFive}}
    775 }
    776 
    777 %%
    778 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    779 %% --------------- Setup warnings.
    780 \newcommand{\TC@WarningTooManyEditors}{%
    781   \PackageWarningNoLine{trackchanges}{%
    782     A maximum of \arabic{maxeditors} editors are supported.\MessageBreak%
    783     Changes made by additional editors will all have\MessageBreak%
    784     the same color coding%
    785   }%
    786 }
    787 \newcommand{\TC@WarningUnknownEditor}[1]{%
    788   \PackageWarning{trackchanges}{%
    789     Editor '#1' unknown.\MessageBreak%
    790   }%
    791 }
    792 \newcommand{\TC@WarningUlem}{%
    793   \PackageWarningNoLine{trackchanges}{%
    794     TrackChanges is not compatable with the \MessageBreak%
    795     'ulem' package.\MessageBreak%
    796     Use the 'soul' package instead%
    797   }%
    798 }
    799 \newcommand{\TC@WarningDepreciatedInitials}{%
    800   \PackageWarningNoLine{trackchanges}{%
    801     The '\noexpand\renewcommand{\noexpand\initialsNum}{name}' commands\MessageBreak%
    802     are depreciated.\MessageBreak%
    803     Use '\noexpand\addeditor{name}' instead.'%
    804   }%
    805 }
    806 
    807 
    808 %% 
    809 %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    810 %% Below are a set of definitions to add an ignore list to the soul
    811 %% package. 
    812 %%
    813 %% This is not a default as it reimplements some of the internals of
    814 %% the soul package.  If a new version of soul were to come out 
    815 %% this stuff might break.
    816 \if@TCignoremode
    817 
    818 
    819 %% These two function allow us to turn on and off the ignore list.
    820 %% This is so we don't mess up soul for anyone else.
    821 \def\TC@SetIgnores{%
    822   \let\SOUL@ignores\TC@ignores%
    823 }
    824 \def\TC@ResetIgnores{%
    825   \let\SOUL@ignores\TC@emptyignores%
    826 }
    827 
    828 \newtoks\TC@ignores
    829 \newtoks\TC@emptyignores
    830 
    831 %% The commands are separated by \\. The first number is the 
    832 %% number of inputs for the command. The command name
    833 %% is given next.  The last number specifies which input to 
    834 %% pass through.  If the last number is zero nothing will be
    835 %% passed.  
    836 
    837 \TC@ignores={%
    838   \\2\textcolor{2}%
    839   \\1\color{0}%
    840   \\1\ul{1}%
    841   \\1\st{1}%
    842   \\1\hl{1}%
    843   \\1\caps{1}%
    844   \\1\so{1}%
    845 }
    846 \TC@emptyignores={}
    847 
    848 %% Initialize soul not to use the ignore list.
    849 \let\SOUL@ignores\TC@emptyignores
    850 
    851 %% This is a way to register new ignores.
    852 \def\tcignore#1#2#3{{%
    853     \edef\x{\global\TC@ignores={\the\TC@ignores
    854         \noexpand\\#2\noexpand#1#3}}\x
    855 }}
    856 
    857 
    858 %% Here I redefine \SOUL@dotoken.  
    859 %% The new version also checks for ignores.
    860 \def\SOUL@dotoken#1{%
    861   \def\SOUL@@{\SOUL@addtoken{#1}}%
    862   \def\\##1##2{%
    863     \edef\SOUL@x{\string#1}%
    864     \edef\SOUL@n{\string##2}%
    865     \ifx\SOUL@x\SOUL@n
    866       \def\SOUL@@{\SOUL@docmd{##1}{#1}}%
    867     \else
    868       \edef\SOUL@n{\string##2\space}%
    869       \ifx\SOUL@x\SOUL@n
    870         \def\SOUL@@{\SOUL@docmd{##1}{#1}}%
    871       \fi
    872     \fi
    873   }%
    874   \the\SOUL@cmds
    875   \def\\##1##2##3{%
    876     \edef\SOUL@x{\string#1}%
    877     \edef\SOUL@n{\string##2}%
    878     \ifx\SOUL@x\SOUL@n
    879       \def\SOUL@@{\SOUL@doignore{##1}{#1}{##3}}%
    880     \else
    881       \edef\SOUL@n{\string##2\space}%
    882       \ifx\SOUL@x\SOUL@n
    883         \def\SOUL@@{\SOUL@doignore{##1}{#1}{##3}}%
    884       \fi
    885     \fi
    886   }%
    887   \the\SOUL@ignores%
    888   \SOUL@@
    889 }
    890 
    891 %% This is where the actual ignoring is done.
    892 \def\SOUL@doignore#1#2#3{%
    893   \ifx2#1%
    894     \SOUL@doword%
    895     \def\SOUL@@##1##2{%
    896       \ifx1#3%
    897         \SOUL@do{##1}%
    898       \else\ifx2#3%
    899         \SOUL@do{##2}%
    900       \fi\fi%
    901       \SOUL@scan%
    902     }%
    903   \else\ifx1#1%
    904     \SOUL@doword%
    905     \def\SOUL@@##1{%
    906       \ifx1#3%
    907         \SOUL@do{##1}%
    908       \fi%
    909       \SOUL@scan%
    910     }%
    911   \else
    912     \SOUL@doword
    913     \let\SOUL@@\SOUL@scan
    914   \fi\fi
    915   \SOUL@@
    916 }
    917 
    918 \fi
    919 
    920 %%
    921 %%
    922 %% End of file trackchanges.sty