How to compare two TeX codes and mark differences with color
Update (2016-04-10)
An add-on for running latexdiff
from within WinEdt is available: latexdiff.
If you want, you can revert the changes in MainMenu.ini and Toolbar.ini and install the add-on.
Original answer
This is a simple way to have a button in WinEdt 7 (this one works in v7 only) to run latexdiff
.
Show the "Options Interface" (Options -> Options Interface)
Double-click the "Main Menu" item (
MainMenu.ini
gets opened)Just before the line
ITEM="Compile"
add the following lines
ITEM="LaTeXdiff" CAPTION="&LaTeXdiff" CONFIG_FILTER="Default;MiKTeX;TeX Live" IMAGE="CompareDocs" SAVE_INPUT=1 MACRO=`WinExe('','cmd.exe /C latexdiff old_%n.tex %n.tex > new_%n.tex','%p','',011100);Open("new_%n.tex");` SHORTCUT="16452::Ctrl+D"
Press Shift+Ctrl+F9
Now (in the "Options Interface") double-click the "Toolbar" item (
Toolbar.ini
gets opened)Just before the line
BUTTON="Compile"
add the following line
BUTTON="LaTeXdiff"
Press Shift+Ctrl+F9
That's it. Now you have a toolbar button
a menu item in the "Accessories" menu
and a shortcut (Ctrl+D) to run latexdiff
.
How to use it
Suppose you are working on a file foo.tex
. Save the old version as old_foo.tex
. Make the changes you need in foo.tex
and make sure that foo.tex
is the file in the main window.
At this point, choose one of the above methods to run latexdiff
. A resulting file new_foo.tex
will get opened.
For this purpose I use program winmerge on windows.
You can load both file to be compared and each difference is marked. You can change in winmerge the code, copy from one file to the other and so on. Please see the shown screenshots on the web page http://winmerge.org/?lang=en.
From the homepage (follow the link above):
WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.