複数の tex ファイルを使うときも reftex-mode を使う
スペルチェックとか遅すぎるから Word で下書きした方がいいんじゃないか・・・。という話はさておき。
reftex-mode は C-c [ で bibtex の一覧を表示、正規表現検索してくれる便利なモードです。bib ファイル中のタグなんか覚えてませんからね。どの bib ファイルを参照すればいいかは、編集中の buffer から \bibliography を探すようなんですが、\input でファイルを複数に分けているとこれが各ファイル中にはないため reftex-mode を使えない・・・、と思ってました。
実は、対処法があったんですね。ちゃんと使い方にも書いてある。
;; 6. Multifile Documents
;; Multifile Documents are fully supported. The included files must
;; have a file variable `TeX-master' or `tex-main-file' pointing to
;; the master file. RefTeX provides cross-referencing information
;; from all parts of the document, and across document borders
;; (`xr.sty').
上記サイトの通り yatex-mode-hook で enable-local-variables して、各 .tex ファイルに TeX-master 変数をセットすれば良いようです。TeX-master 変数の値は .tex を抜いたもので良いみたい。具体的には、まず .emacs に
(add-hook 'yatex-mode-hook 'turn-on-reftex) (add-hook 'yatex-mode-hook '(lambda () (setq enable-local-variables t)))
を書いて、各ソースの .tex ファイルの最後に以下のコメントを追加。
%%% Local Variables: %%% mode: yatex %%% TeX-master: "thesis" %%% End: