Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Since I'm used to use latexmk -pvc I'd like to do the following:

  • Run latexmk -pvc (externally) on the _region_.tex file
  • Use AUCTeX to just write the region file instead of compiling.

Is there a way to achieve this?

This way I do not block emacs all the time compiling and if an error occurs I use my standard C-c C-c command.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Short answer: yes.

Long answer: I am by no means an elisp hacker, but looking at TeX-command-region I thought that this could help:

(defun TeX-save-region ()
  "Saves the TeX region to the file whose name is defined by TeX-region."
  (interactive)
  (and (or (null TeX-command-region-begin)
       (markerp TeX-command-region-begin))
       (TeX-active-mark)
       (TeX-pin-region (region-beginning) (region-end)))
  (let ((begin (or TeX-command-region-begin (region-beginning)))
    (end (or TeX-command-region-end (region-end))))
    (TeX-region-create (TeX-region-file TeX-default-extension)
               (buffer-substring begin end)
               (file-name-nondirectory (buffer-file-name))
               (TeX-current-offset begin))))

(Not that I exactly understand each and every part of this code, but the general idea should be more or less clear.) Now it remains to bind this to your favorite key.

Notice also that compiling with C-c C-r does not "block" emacs, and in my setup I can hit C-c C-r, continue editing the document, and as soon as the compilation finishes, the pdf viewer updates automatically.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.