To run latexdiff on a CSL machine:
/s/texlive-2010/bin/latexdiff --flatten
[flags] old.tex new.tex
> output.tex
(--flatten is
suggested, not mandatory; see below.) Then run Latex
on output.tex and fix any errors (more on that in a bit). On
other machines, if latex is in your path, latexdiff
might be there and available as well. Try it and see.
If you get errors and don't see why immediately (or you see lots
of ^Ms in the output when you open it in Emacs,
run dos2unix blah.tex on the input files and
rerun latexdiff. Make sure you get any files that are
included. See below for more on this and other possible errors.
You need both versions checked out at once, which means you probably need
to copy your working directory to somewhere else (or else check out a new
copy), then revert it to an older revision (with svn up
-rold).
By default, latexdiff does not follow \input
or \include commands. The --flatten flag instructs it
to. There are a couple limitations:
- It is not transitive (despite the name); it only follows includes
from the top-level document
- It does not understand that \include is commented out
in %\include{foo.tex} and it will include it anyway (with
likely-unpredictable results)
- It does not understand that it should not include something immediately
when it sees \newcommand{\inputFancy}[1]{Here's something fancy:
\input{#1}} and will try to open #1.tex.
The output may not be legal Latex. Here are some problems I've run into:
- The insertion of } characters in between the carriage return
and line feed in Windows-style CRLF line endings. Latex doesn't like
this. Run dos2unix on the input files as described above. (You
might even consider committing this change to avoid problems in the
future. Do it as its own commit though, and know that Notepad won't like
it.) Note: I'm not sure how the Windows version
of latexdiff will behave WRT line endings.
- Line numbers in Latex's reports are off. This can also be caused by the
CRLF issue above. Run dos2unix. In general, run dos2unix
if you see ^M in the output if you run into any problems.
- I ran into an issue where it outputted \texttt} which caused
Latex to complain about a missing argument. Not sure what caused it.
- I wrote a wrapper command for \item and changed the command
between revisions. latexdiff dutifully added insertion/deletion
macros around my wrapper commands, which then made Latex complain about
missing \items.
- Moving around or combining complex stuff like tables has made it output
invalid code. With sweeping changes like that, I just wiped out the diff
code and put in the new version.
Finally, I've also messed around with the formatting of the outputted
file. In particular, I've softened the colors used in \DIFaddtex
and \DIFdeltex, though I'm not sure what I used. I think it makes it a bit easier to read.