36

I need a way to add text comments in "Word style" to a Latex document. I don't mean to comment the source code of the document. What I want is a way to add corrections, suggestions, etc. to the document, so that they don't interrupt the text flow, but that would still make it easy for everyone to know, which part of the sentence they are related to. They should also "disappear" when compiling the document for printing.

At first, I thought about writing a new command, that would just forward the input to \marginpar{}, and when compiling for printing would just make the definition empty. The problem is you have no guarantee where the comments will appear and you will not be able to distinguish them from the other marginpars.

Any idea?

Egalth
  • 962
  • 9
  • 22
Mouk
  • 1,807
  • 2
  • 18
  • 26

9 Answers9

45

todonotes is another package that makes nice looking callouts. You can see a number of examples in the documentation.

godbyk
  • 8,359
  • 1
  • 31
  • 26
4

Since LaTeX is a text format, if you want to show someone the differences in a way that they can use them (and cherry pick from them) use the standard diff tool (e.g., diff -u orig.tex new.tex > docdiffs). This is the best way to annotate something like LaTeX documents, and can be easily used by anyone involved in the production of a document from LaTeX sources. You can then use standard LaTeX comments in your patch to explain the changes, and they can be very easily integrated. If the document lives in a version control system of some sort, just use the VCS to generate a patch file that can be reviewed.

Michael Trausch
  • 3,187
  • 1
  • 21
  • 29
  • Unfortunately, this will not work. For me, as a programmer, it’s not a problem to start a program from the command line do something and check in. But it will be for the other editors of my book very hard to get rid of all the familiar convenience in Word and start command line hacking. – Mouk Mar 06 '09 at 07:41
  • 1
    You could always include a set of shell scripts and batch files that automate it for them... – Michael Trausch Mar 06 '09 at 09:42
  • 3
    `latexdiff` generates a nicely rendered diff. See, [for example.](https://www.sharelatex.com/blog/images/latexdiff/changes-in-footer-latexdiff.png) – Davidmh Oct 13 '15 at 11:13
3

My little home-rolled "fixme" tool uses \marginpar where possible and goes inline in places (like captions) where that is hard to arrange. This works out because I don't often use margin paragraphs for other things. This does mean you can't finalize the layout until everything is fixed, but I don't feel much pain from that...

Other than that I heartily agree with Michael about using standard tools and version control.

See also:

and a self-plug:

Community
  • 1
  • 1
dmckee --- ex-moderator kitten
  • 98,632
  • 24
  • 142
  • 234
3

I have used changes.sty, which gives basic change colouring:

\added{new text}
\deleted{old text}
\replaced{new text}{old text}

All of these take an optional parameter with the initials of the author who did this change. This results in different colours used, and these initials are displayed superscripted after the changed text.

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

You can hide the change marks by giving the option final to the changes package.

This is very basic, and comments are not supported, but it might help.

Svante
  • 50,694
  • 11
  • 78
  • 122
  • Nice package, I'd forgotten about it. It supports comments in the source via a second optional argument to those commands. I suspect they end up in the \listofcomments. – Will Robertson Mar 05 '09 at 22:53
  • Although not exactly what I was looking for, I will be using this package too for sure. Very nice. – Mouk Mar 06 '09 at 07:51
2

You could also try the trackchanges package.

cbrnr
  • 1,564
  • 1
  • 14
  • 28
1

The best package I know is Easy Review that provides the commenting functionality into LaTeX environment. For example, you can use the following simple commands such as \add{NEW TEXT}, \remove{OLD TEXT}, \replace{OLD TEXT}{NEW TEXT}, \comment{TEXT}{COMMENT}, \highlight{TEXT}, and \alert{TEXT}.

Some examples can be found here.

Borhan Kazimipour
  • 405
  • 1
  • 6
  • 13
  • 1
    Thanks! For difference I use `latexdiff` (it's absolutely non-intrusive), but for comments this package is great (unfortunately, they don't work very well together). – Yaroslav Nikitenko Nov 08 '21 at 10:51
1

You can use the changebar package to highlight areas of text that have been affected.

If you don't want to do the markup manually (which can be tedious and interrupt the flow of editing) the neat latexdiff utility will take a diff of your document and produce a version of it with markup added to visually display the changes between the two versions in the typeset output.

This would be my preferred solution, although I haven't tested it out on large, multi-file documents.

Will Robertson
  • 62,540
  • 32
  • 99
  • 117
  • 1
    latexdiff works fine on large documents: I've used it with several clients and it's been no problem. It falls over with mutlipart docs - in the bad old days I used to convert these into a single file just to get latexdiff to work. The whole of the problem was that it inserts \usepackage directives into the preamble, making latex fall over - and so the new texdiff package solves the problem by leaving package inclusions and macro definitions to the user. – Charles Stewart May 17 '10 at 12:42
0

Package trackchanges.sty works exactly the way changes.sty. See @Svante's reply. It has easy to remember commands and you can change how edits will appear after compiling the document. You can also hide the edits for printing.

XtrimA
  • 143
  • 11
0

The todonotes package looks great, but if that proves too cumbersome to use, a simple solution is just to use footnotes (e.g. in red to separate them from regular footnotes).

Nagel
  • 2,576
  • 3
  • 22
  • 20