2. Basic of git(incomplete)
git init
git add *.tex
git commit -m "msg"
edit your tex file.
edit your tex file.
git add -u
git commit -m "msg"
add all tracked file.
new file will not add . git commit -a -m "msg"
git push origin push(sync.) to remote
3. Compare two versions of tex
use latexdiff
$ latexdiff draft.tex revision.tex > diff.tex
$ latex diff.tex
https://www.inf.unibz.it/dis/wiki/doku.php?id=latex:diff
4. Combine git and latexdiff
$ git log --oneline --all --decorate --graph --color
$ git latexdiff --latexmk --latexopt "-xelatex"
--main main.tex master dev
$ git latexdiff --latexmk --latexopt "-xelatex"
--main main.tex 981a665 dev
Version history (GUI & CLI)
Compare last in 2 branch (master & dev) Compare 2 commit (981a665 & last)
LaTeX compiler
use xelatex
5. Tool list
1.git → VCS(Version Control System)
2.xelatex → LaTeX compiler, Chinese(if use unicode) need.
3.latexdiff → Compare two versions of tex.
4.latexpand → Expand input{} or include{} in tex.
5.git-latexdiff →It is a wrapper around git and latexdiff.
6.latexmk →It is a perl script for running LaTeX the
correct number of times to resolve cross references.
And use it bridge git-latexdiff and xelatex.
You should have it already. Or choose what you like.
6. Install tools in debian
# apt-get install latexdiff latexmk
$ git clone https://gitlab.com/git-latexdiff/git-latexdiff.git
$ cd git-latexdiff/
$ sudo make install-bin
git-latexdiff
latexdiff & latexmk
latexpand
debian 8(jessie)
texlive(2014.20141024-1) +
# apt-get install
texlive-extra-utils
debian 7(wheezy)
texlive(2012)
Download from ctan, put
under $PATH (eg. ~/bin)
git and xelatex
use apt, I don't
write here.
8. Note, list difference in big project
In big project has many tex file, maybe you only want to know
which file changed.
So you can use below command:
$ git diff master dev --name-only
main.bib
main.tex
$ git diff master dev --name-status
A main.bib
M main.tex