15
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gitで管理されているtexファイルの差分pdfを作成するスクリプト

Posted at

シェルスクリプト

git-latexdiff.shに以下のソースをコピー.

#!/bin/bash

# 作業用の一時ファイルを作成
TMPDIR=$(mktemp -d /tmp/git-latexdiff.XXXXXX)
export this=`mktemp $TMPDIR/latex-diff.XXXXXX`
export that=`mktemp $TMPDIR/latex-diff.XXXXXX`

# gitからソースを取得
git show "$2:$1" > $this
git show "$3:$1" > $that

latexdiff -e utf8 -t CFONT "$this" "$that" > $TMPDIR/diff.tex
platex -output-directory $TMPDIR $TMPDIR/diff.tex
dvipdfmx $TMPDIR/diff.dvi

# macを使用している場合
open diff.pdf

rm -rf $TMPDIR

使い方

sh git-latexdiff.sh document.tex HEAD HEAD^
sh git-latexdiff.sh 対象ファイル 旧リビジョン 新リビジョン

複数ファイルに分割している場合動かなさそうだったり,目次ファイルが正しく出力されなかったり,要改善な状態ですが,メモとして残しておきます.

参考文献

15
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?