とりあえず版、できました。inon3135@MakeTeX
MakefileでTeXをスマートにコンパイルする。
問題は
- 個別の.texファイルおよび画像などのファイル郡
- テンプレートとなるべき雛形としての.texファイルやMakefileなど
これらをめんどくさくなく管理する方法。
個別の.texファイルを書きながら作業しているなかで、テンプレートファイルとして活かしたいものや
変更したい設定なんかが出てくる。
テンプレートのファイル郡と個別化されたファイル郡のうまい同期がとりたいのだけど、
どうやってやるのかが問題。
安直にシンボリックリンクで個別化させるのは作業がめんどくさいし、
スクリプト化したところで仕様をいじるたびにスクリプトを修正するのは馬鹿らしい。
解決案 = gitを使ってみる。
別に個別化された.texファイルまでいちいちgit管理する必要はない。
Makefileでbackupfileとして貯めこんでおけばいい。
.texファイルだけなら容量も少なくて楽ちん。
つまりこんなイメージ
|__ _template/
| |_ check.tex # git add
| |_ submit.tex # git add
| |_ config.tex # git add
| |_ newcommand.tex # git add
|
|__ _local/
| |_ Makefile # git add
|
|_ Makefile # git add
これを汎用テンプレートとして使う。
個別に.texファイルを作って使う場合はこれをcloneしてから作業をする。
$ git clone hoge@fuga: make init
とでもやるとこうなる。
|__ _cloned-local/
|__ _backnumbers/ # バックアッププール
|__ _images/ # 画像ファイルプール
|__ _log/ # latex生成物プール
|
|__ _template/
| |_ check.tex # git add
| |_ submit.tex # git add
| |_ config.tex # git add
| |_ newcommand.tex # git add
|
|__ _local/
| |_ Makefile # git add
| |_ check_local.tex # 空ファイル
| |_ submi_local.tex # 空ファイル
|
|_ Makefile # git add
vimmerであるところの私は多分localディレクトリで作業するだろう。
だからそこにもMakefileをおいておく。
実際には一番下のMakefileがすべて行い、localのMakefileはただmakeコマンドを飛ばすだけ。
そうすればMakefileの仕様変更はファイル1つをいじれば良い。
.gitignoreもmakeの管理下にあって、特定のファイル以外はすべて無視されるようにする。
だからテンプレートの仕様変更なんかはこれをいじってgit push
すればよい。スマート。
色々かいたりmakeしたりするとこんな感じ。
|__ _cloned-local/
|__ _backnumbers/ # バックアッププール
| |_ check-20141010-1034.tar.gz
| |_ check-20141011-2232.tar.gz
|
|__ _images/ # 画像ファイル郡
| |__ _plots/
| | |_ plot_a.pdf
| | |_ plot_b.pdf
| | |_ source-log.md
| |
| |__ _phtos/
| |_ photo_a.jpg
| |_ photo_b.jpg
| |_ source-log.md
|
|__ _log/ # latex生成物プール
| |_ check.aux
| |_ check.bbl
| |_ check.log
| |_ check.dvi
|
|__ _template/
| |_ check.tex # git add
| |_ submit.tex # git add
| |_ config.tex # git add
| |_ newcommand.tex # git add
|
|__ _local/
| |_ Makefile # git add
| |_ check_local.tex # fixed name
| |_ submi_local.tex # fixed name
| |_ intr.tex
| |_ expe.tex
| |_ resu.tex
| |_ disc.tex
| |_ conc.tex
| |_ refe.tex
|
|_ Makefile # git add
|_ document.pdf
|__ _cloned-local/
|__>_backnumbers/ # バックアッププール
|__>_images/ # 画像ファイル郡
|__>_log/ # latex生成物プール
|__>_template/
|__ _local/
| |_ Makefile # git add
| |_ check_local.tex # fixed name
| |_ submi_local.tex # fixed name
| |_ intr.tex
| |_ expe.tex
| |_ resu.tex
| |_ disc.tex
| |_ conc.tex
| |_ refe.tex
|
|_ Makefile # git add
|_ document.pdf
シンプル!素晴らしい!!
よし、こんな感じで作ろう。
○○用テンプレートみたいな個別なのはcheck_local.texとsubmi_local.texだけでいいはず。
あるいはそれらに引用させる.texファイルで。
そういうのはまた別に管理したほうが多分かしこい。