Quantcast
Channel: geekoverdose
Viewing all articles
Browse latest Browse all 70

latexdiff-git: highlight changes between revisions of latex files managed in git

$
0
0

latexdiff is a useful tool to determine changes between different versions of latex files and highlight them in a pdf (similar to MS word does with tracking changes). latexdiff-git is a wrapper around latexdiff optimized for git (and mercurial, but we’ll only look into git here). With it you can specify a latex document file (which is in a git repository) and a commit hash from that repository to look for changes between the file and its version from the specified commit. Same is possible with e.g. specifying two different commit hashes.

Installation (Linux)

  1. Clone latexdiff-git
    git clone git@gitorious.org:git-latexdiff/git-latexdiff.git
    
  2. All further steps are stated in the README file inside the repository you just cloned:
    1. Ensure you have a ~/.gitconfig file and that it’s accessible for your user.
    2. Add the following lines to .git/config
      [difftool.latex]
       cmd = latexdiff "$LOCAL" "$REMOTE"
      [difftool]
       prompt = false
      [alias]
       ldiff = difftool -t latex
      
    3. Change the checked out script file latexbatchdiff.sh: search for revlatexdiffcmd='please define' and replace it with revlatexdiffcmd='git ldiff'
  3. Place latexbatchdiff.sh somewhere in your path (I tend to place it in ~/bin) and make it executable: chmod +x latexbatchdiff.sh

Usage

You can generate a tex file from differences between a latex file and a revision checked into git with (replace GITHASH and FILE with your git commit hash and latex file)

latexdiff-git -r GITHASH FILE

Alternatively you can generate the tex file from changes between two specific commits of a latex file:

latexdiff-git -r GITHASH1 -r GITHASH2 FILE

To view changes hightlighted in a pdf:

pdflatex *diff*tex # create pdf highlighting diff
evince *diff*pdf # replace evince with your preferred pdf-viewer


Viewing all articles
Browse latest Browse all 70

Trending Articles