Saturday, October 19, 2013

Highlighting the different between Latex Documents in Windows 7 using Latexdiff

Wondering is there a way how to make a diff for latex files or documents?
The answer is a definite Yes! You need latexdiff which comes with Miktex

Following is a step by step guide for installing it in Windows 7:
You need to install:
  1. Miktex (
  2. Perl (can use Strawberry Perl:

Step By Step Guide
Assume Miktex and Perl Interpreter are installed, and Miktex is installed in "C:\Program Files (x86)\MiKTeX 2.9\" (Other directory is fine, just adapt accordingly)

  1. Go to  "C:\Program Files (x86)\MiKTeX 2.9\scripts\latexdiff\"
  2. Create a a new folder "perl" in "C:\Program Files (x86)\MiKTeX 2.9\scripts\latexdiff\"
  3. Copy all files in "C:\Program Files (x86)\MiKTeX 2.9\scripts\latexdiff\" to new folder "C:\Program Files (x86)\MiKTeX 2.9\scripts\latexdiff\perl"
  4. Rename all files (without extension) in "C:\Program Files (x86)\MiKTeX 2.9\scripts\latexdiff\perl", with an extension .ple.g., latexdiff to
  5. Add "C:\Program Files (x86)\MiKTeX 2.9\scripts\latexdiff\perl" to the PATH environment (if you are not sure how to do so, see here)
  6. Open Command Prompt, and type in --flatten PreviousFile CurrentFile> diffe.g., --flatten "C:\old.tex" "C:\new.tex" > "C:\Diff.tex"

Below is  a sample for Diff.tex, where you can see what's old (cross out, red color) and new (underline, blue color) easily, pretty cool right :)


  1. Apparently between steps 5 and 6 you must additionally go to the admin settings of Miktex and refresh the FNDB or it will not work (will not be able to find the latexdiff script).

  2. Why am I getting this error? Access is denied.

  3. Why am I getting this error? Access is denied.