About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Latest news 2019-12-05: new blog post "RSS Feeds and Other Notifications."


13.1 Change Markup

There are many entries listed on the editorial topic that allow you to mark changes in a document. Some of these are for LaTeX2.09, Plain TeX, ConTeXt or LuaTeX, but even discounting these, there are still too many to describe, so I'm just going to describe the changes package [44], which is available on both TeX Live and MiKTeX. The changes package provides a way for the user to manually markup changes, such as additions, deletions or replacements.

The changes package provides an anonymous author that's used by default, but if you want to track the changes according to a particular author, you need to define each tracked author using:

\definechangesauthor[options]{id}

where ⟨options⟩ is a key=value list of options and ⟨id⟩ is a label identifying the author. Available options:

name
The author's name.
color
The colour to use when marking up this author's changes. (Defaults to black.)

Example:

\definechangesauthor[name={Mabel Canary},color=cyan]{MC}

To markup changes you can use:

\added[options]{text}

to indicate that ⟨text⟩ has been added,

\deleted[options]{text}

to indicate that ⟨text⟩ has been deleted, and

\replaced[options]{new text}{old text}

to indicate that ⟨old text⟩ has been replaced by ⟨new text⟩. Each of these commands has an optional argument that's a key=value list where the following keys are available:

id
The author's ID (as provided in \definechangesauthor).
remark
A remark about the change.

You can create a list or summary of the changes using

\listofchanges[options]

The optional argument is again a key=value list, but there is currently only one key available: style, which may have the value list or summary. The default value is list. As with commands such as \tableofcontents and \listoffigures, this command requires two LaTeX runs to produce the list. The default extension for the summary of changes file is .soc, but this can be changed using

\setsocextension{extension}

You can suppress the change markup using the final package option:

\usepackage[final]{changes}

The draft option enables the markup. The other package options are key⟩=⟨value options, where the following keys are available:

There are also commands to provide custom markup. See the changes documentation [44] for further details.

The changes package automatically loads the ulem [2] and xcolor packages. You can pass options to these packages using the ulem and xcolor keys. For example

\usepackage[ulem={normalem,normalbf}]{changes}

The changes package also provides

\textsubscript{text}

which is analogous to LaTeX's \textsuperscript kernel command.

You can't markup floats, such as figures or tables. Paragraph breaks within the markup text can also cause a problem. See the changes documentation [44] for further details.

Example 65. Recording Changes (changes package)

This example document has been edited by three authors: Mabel Canary, Fred Canary and Prof Important Person:

\documentclass[12pt]{article}

\usepackage[ulem={normalem,normalbf}]{changes}

\definechangesauthor[name={Mabel Canary},color=violet]{MC}
\definechangesauthor[name={Fred Canary},color=blue]{FC}
\definechangesauthor[name={Prof Important Person},color=teal]{IP}

\begin{document}
\section{About the Lab}

The Secret Lab of Experimental Stuff is a
\replaced[id=MC]{top-secret}{sinister} laboratory
whose existence is highly classified so don't tell 
anyone about it \added[id=FC]{or we'll get really cross with you}.

The \added[id=IP]{world-renown} University of Somewhere denies all
knowledge of the Secret Lab of Experimental Stuff, except on Open
Days where members of the public may visit the facility and ask
questions as long as they consent to a memory wipe when they leave.
The memory wipe is \deleted[id=MC,remark={no it isn't}]{completely}
harmless and your memory of the visit will be replaced by a
\added[id=MC]{pleasant} recollection of spending the day feeding the
\replaced[id=FC,remark={what geese?}]{ducks}{geese}
\added[id=MC,remark={they're the weird-looking ducks}]{and geese} in
the nearby pond.

\end{document}

The changes are colour-coded according to the author who made the edit. Any remarks are added as footnotes, as shown in Figure 13.1. You can download or view this example.

Figure 13.1: Recording Changes
 

1 About the Lab

The Secret Lab of Experimental Stuff is a top-secretsinisterMC laboratory whose existence is highly classified so don't tell anyone about it or we'll get really cross with youFC.

The world-renownIP University of Somewhere denies all knowledge of the Secret Lab of Experimental Stuff, except on Open Days where members of the public may visit the facility and ask questions as long as they consent to a memory wipe when they leave. The memory wipe is completelyMC1 harmless and your memory of the visit will be replaced by a pleasantMC recollection of spending the day feeding the ducksgeeseFC2 and geeseMC3 in the nearby pond.


1MC: no it isn't

2FC: what geese?

3MC: they're the weird-looking ducks

End of Image.


This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-07-4).

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs