Skip to content

sanjayankur31/zaphod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

95df50e · Feb 15, 2016

History

42 Commits
Feb 9, 2016
Feb 15, 2016
Feb 15, 2016
Feb 15, 2016

Repository files navigation

Zaphod


A LaTeX change tracking tool.

The name

Zaphod Beeblebrox is a fictional character in the various versions of the humorous science fiction story The Hitchhiker's Guide to the Galaxy by Douglas Adams.

The tool

A wrapper around latexdiff that recursively checks changes in LaTeX sources between two Git revisions and generates a nice annotated PDF in a new Git branch. This Git branch sits on top of the newer revision - after one has accepted/rejected changes, one can remove the annotations and simply commit and merge to the master branch - a nice workflow.

It's rather simple at the moment and probably has heaps of issues. Feel free to modify it to suit your purposes and open pull requests.

Here is a test repository with LaTeX sources and a resultant latexdiff-annotated branch to play with: https://github.com/sanjayankur31/latex-changes

Usage

usage: zaphod [-h] {revise,diff} ...

positional arguments:
  {revise,diff}  additional help
    revise       Interactive revision (UNIMPLEMENTED)
    diff         Generate changes output

optional arguments:
  -h, --help     View subcommand help

NOTES:
    The idea of this program is to help LaTeX users track, review, and
    see changes that have been made in their source files. The script
    only works when git is used as a version control system.

Expected workflow:
    *) Make changes, commit
    *) Run this program:
        It will generate a pdf with differences between the two
        provided Git revisions using latexdiff. It will also commit the
        annotated TeX sources in a new Git branch called "changes".
        *) Review commits using generated PDF.
        *) Accept/ignore changes.
        *) Commit once finished.
        *) Merge to master branch.
        *) Profit.

Requires:
    *) latexdiff
    *) Git
    *) pdflatex
    *) bibtex
    *) Python3


Subcommand: 'revise'
usage: zaphod revise [-h] [-m MAIN] [-s SUBDIR]

optional arguments:
  -h, --help            show this help message and exit
  -m MAIN, --main MAIN  Name of main file. Only used to generate final pdf
                        with changes.
                        Default: main.tex
  -s SUBDIR, --subdir SUBDIR
                        Name of subdirectory where main file resides.
                        Default: .
  -c, --citations       Document contains citations. Will run pdflatex and
                        bibtex as required. Default: False

TIP: To accept all - switch to rev2 branch/revision.
TIP: To reject all - switch to rev1 branch/revision.
Yay! Git!

Subcommand: 'diff'
usage: zaphod diff [-h] [-r REV1] [-t REV2] [-m MAIN] [-s SUBDIR] [-e EXCLUDE]
                   [-p TYPE]

optional arguments:
  -h, --help            show this help message and exit
  -r REV1, --rev1 REV1  First revision to diff against
  -t REV2, --rev2 REV2  Second revision to diff with.
  -m MAIN, --main MAIN  Name of main file. Only used to generate final pdf
                        with changes.
                        Default: main.tex
  -s SUBDIR, --subdir SUBDIR
                        Name of subdirectory where main file resides.
                        Default: .
  -e EXCLUDE, --exclude EXCLUDE
                        Pass exclude options to latexdiff. Please read man
                        latexdiff for information on --exclude-textcmd and
                        related options.
  -p TYPE, --type TYPE  Pass markup type option to latexdiff. Please read man
                        latexdiff for options.
  -c, --citations       Document contains citations. Will run pdflatex and
                        bibtex as required. Default: False