Dear all, I am new to AUCTeX and using it with 'TeX-PDF-mode. Last week, I noticed `Command on buffer' and got a thunder in my ear. It is such a nice implementation!
I am writing a report with numerous sub-files. It is nice to keep `_region_.pdf' for each sub-file. Also, I want to have `_region.pdf' even AUCTeX cannot find his master. Things required are listed below. 1. Have a reasonable template file 2. When AUCTeX cannot find master, copy the template to `./_master_.tex' and set `TeX-master' to it. 3. Feed compile option -jobname=%(jobname). When a sub-file is `figure0.tex', $(jobname) should be something like `figure0~'. This cannot be `figure0' because co-existence of `image.jpg' and `image.pdf' is problematic. I setup my environment and barely works. My ability assumes existence of local template file and to be used only by pdflatex. I thought this might be useful and can be improved especially `TeX-command-list' part. Can you give me suggestions? Best regards, Tak Kunihiro (add-hook 'LaTeX-mode-hook 'my-auctex-setup) (defvar TeX-template-file "~/templates/template.tex") (defvar TeX-master-missing "_master_") (defun TeX-pdflatex-buffer () "Create a compile ready `TeX-region-file' (default: _region_.tex) from `TeX-master-file' and current-buffer (or region if active). When `TeX-master-file' is not found, `TeX-template-file' is copied to `TeX-master-file'. Then `TeX-region-file' is compiled and renamed by `pdflatex'. This is a fork of `TeX-command-buffer'." (interactive) (let ((start (point-min)) (end (point-max)) (reg TeX-master)) (unless (stringp TeX-master) (setq TeX-master TeX-master-missing)) (unless (file-exists-p (TeX-master-file t)) (copy-file TeX-template-file (TeX-master-file t))) (when (region-active-p) (setq start (region-beginning)) (setq end (region-end))) (TeX-region-create (TeX-region-file TeX-default-extension) (buffer-substring start end) (file-name-nondirectory (buffer-file-name)) (TeX-current-offset start)) (TeX-command "pdflatex" 'TeX-region-file) (setq TeX-master reg))) ;; try to restore (defun my-auctex-setup () (add-to-list 'TeX-command-list '("pdflatex" "pdftex -fmt=pdflatex -enable-write18 %S%(mode)%(jobname) %t" TeX-run-TeX nil (plain-tex-mode latex-mode doctex-mode) :help "run pdflatex with appropriate jobname")) (add-to-list 'TeX-expand-list '("%(jobname)" (lambda nil (format " -jobname=%s~" (file-name-sans-extension (TeX-current-file-name-master-relative))))))) _______________________________________________ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex