7

I would like to find easy tool, which compares two TeX codes and generates a PDF file of the first code, in which the differences from the second code are marked by a given color. I use winedt 7.0 under windows 7.

I just noticed that latexdiff provides what I need. As far as I understand it is included in Miktex. Is there an interface (menu commands) in winedt 7.0, which allow to work with latexdiff ?

  • Why not Notepad++ with the compare plugin? – Mario S. E. Oct 3 '13 at 19:00
  • 1
    You could write an arara rule which would be editor independent – cmhughes Oct 3 '13 at 19:32
  • Should this question be edited to reflect the new question? Maybe a follow-up question? – Sean Allred Oct 3 '13 at 20:36
  • @SeanAllred Yes, you are absolutely right. For the moment I use latexdiff command using console (cmd.exe). Note that one also need to install Perl to work with this command. – Vahagn Poghosyan Oct 3 '13 at 21:29
  • 1
    If you show me an example of command-line you use to launch latexdiff, I will tell you how to have a button in WinEdt to do that. – karlkoeller Oct 4 '13 at 5:14
7

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.

  1. Show the "Options Interface" (Options -> Options Interface)

    enter image description here

  2. Double-click the "Main Menu" item (MainMenu.ini gets opened)

  3. 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"
    
  4. Press Shift+Ctrl+F9

  5. Now (in the "Options Interface") double-click the "Toolbar" item (Toolbar.ini gets opened)

  6. Just before the line

      BUTTON="Compile"
    

    add the following line

      BUTTON="LaTeXdiff"
    
  7. Press Shift+Ctrl+F9


That's it. Now you have a toolbar button

enter image description here

a menu item in the "Accessories" menu

enter image description here

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 those who are interested, I found here (see reply by James Melton | 8 May 2012 08:12) a more suitable and more interactive MACRO – Vahagn Poghosyan Oct 5 '13 at 13:35
  • Karl, Can you please add a line for using accept and / decline and rcs/vcs.. versions too? How about making a macro for winedt.org? Sorry but I always find pleasure in troubling you ;-) BTW +1. – user11232 Oct 5 '13 at 23:26
  • @Harish Busy with v8.1, so no chance for a contribution for winedt.org. About the first question, I don't understand. – karlkoeller Oct 6 '13 at 7:21
  • Oh. sorry Karl. But you got a mail! – user11232 Oct 6 '13 at 11:58
4

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.

  • I need to see the differences in the compiled dvi/PDF file. – Vahagn Poghosyan Oct 3 '13 at 21:31
  • http://ctan.org/pkg/latexdiff The latexdiff command takes two tex codes and generates a new tex code. Compiling this new tex code, one gets dvi/PDF file with the differences marked in red (for old version) and blue (for new version). – Vahagn Poghosyan Oct 3 '13 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.