The process of academic writing often culminates in a prolonged exchange between writers and proofreaders. And after n-th revision it is easy to loose a track of changes in the document. Of course, using diff utilities of a revision control system is a possible way to highlight changes (I assume, every sensible person starts a new writing project by creating a repository), but these diffs are cryptic and very time-consuming to read.
Wouldn't it be much more convenient to have new passages highlighted in red directly in the pdf-document generated from you LaTeX source? This post shows you how to do it.
Latexdiff is a Perl script that compares two LaTeX files and creates a new LaTeX document, where the differences are highlighted. It is in Ubuntu repository, so you can install it simply by executing
The command is very simple:
Note that I use two parameters here: The parameter
The parameter
Another important parameter you will probably find useful is
Another extremely useful script in the
Wouldn't it be much more convenient to have new passages highlighted in red directly in the pdf-document generated from you LaTeX source? This post shows you how to do it.
Latexdiff is a Perl script that compares two LaTeX files and creates a new LaTeX document, where the differences are highlighted. It is in Ubuntu repository, so you can install it simply by executing
sudo apt-get install latexdiffOr you can download the package archive from here.
The command is very simple:
latexdiff [ OPTIONS ] old.tex new.tex > diff.texNow, for example we create two tex files:
- rev0.tex with pdf that looks like this:
- and rev1.tex with pdf that looks like this:
perl /path/to/latexdiff --encoding=utf8 --type=UNDERLINE rev0.tex rev1.tex > diff.texThe pdf-document generated from the diff.tex would look like this:
Note that I use two parameters here: The parameter
--encoding is self explanatory, I am using utf8 here because of the special German characters in the text. Also you can use ascii, latin1, or latin9.The parameter
--type is responsible for the highlighting style. I found UNDERLINE as most useful. The latexdiff manual describes its behavior as follows:Added text is wavy-underlined and blue, discarded text is struck out and red (Requires color and ulem packages). Overstriking does not work in displayed math equations such that deleted parts of equation are underlined, not struck out (this is a shortcoming inherent to the ulem package).It would be enough for 90% of all cases, but if you are looking for something different, read the manual.
Another important parameter you will probably find useful is
--flatten. It resolves the \input and \include directives in the latex files and allows latexdiff to process complex documents that consist of multiple files.Another extremely useful script in the
latexdiff package is latexdiff-vc. It is a wrapper script that calls latexdiff directly on the different revisions of a file in your revision control system (CVS, RCS, and SVN are supported). The (simplified) synopsis is as follows:latexdiff-vc [latexdiff-options] [latexdiff-vc-options] -r [rev1] [-r rev2] [--pdf] file.texWithout
-r rev2, it compares rev1 with the working copy of file.tex, otherwise it compares two revisions of the file. The resulting tex-file is saved under the name [file]-diff[rev1]-[rev2].tex. The script tries to guess your revision control system, but you can also specify it with parameters --svn, --rcs, or --cvs. Finally, --pdf would directly generate a pdf-document using pdflatex.


No comments:
Post a Comment