あなたが本当に完全な解決策を望んでいるのか、それとももっと自分で探求したいのかはわかりませんが、ここに役立つはずのいくつかのことがあります。行き詰まったら、もう一度投稿してください。
(FWIW、出力PDF出力は現在のファイルではなくTeX-masterと一致すると思います。)
[2011年3月24日編集-コードを提供]
これは、次のようなローカル変数ブロックを持つTeXファイルで機能するはずです。
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% pdf-copy-path: "/pdf/copy/path"
%%% End:
TeX-master値とpdf-copy-path値を二重引用符で囲んでいることに注意してください。TeX-masterはt
(defun copy-master-pdf ()
"Copies the TeX master pdf file into the path defined by the
file-local variable `pdf-copy-path', given that both exist."
(interactive)
;; make sure we have local variables, and the right ones
(when (and (boundp 'file-local-variables-alist)
(assoc 'pdf-copy-path file-local-variables-alist)
(assoc 'TeX-master file-local-variables-alist))
(let* ((path (cdr (assoc 'pdf-copy-path file-local-variables-alist)))
(master (cdr (assoc 'TeX-master file-local-variables-alist)))
(pdf (cond ((stringp master)
;; When master is a string, it should name another file.
(concat (file-name-sans-extension master) ".pdf"))
((and master (buffer-file-name))
;; When master is t, the current file is the master.
(concat (file-name-sans-extension buffer-file-name) ".pdf"))
(t ""))))
(when (and (file-exists-p pdf)
(file-directory-p path))
;; The 1 tells copy-file to ask before clobbering
(copy-file pdf path 1)))))