When you compile a file with AUCTeX, it will prompt you to re-run LaTeX and BibTeX as necessary. Is there a way to get it to also run sage when using SageTeX?


If you haven’t already discovered an answer: If I under stand correctly, you want to be able to do the sage 'compile' step from emacs. If that's the case, add this to your .emacs:

;; SageTeX setup
;; This adds the command sage when in LaTeX mode (to invoke type C-C C-c sage)
(eval-after-load "tex"
'(setq TeX-command-list
(append TeX-command-list
(list "sage" "sage %s.sagetex.sage" 'TeX-run-command nil t :help "Run SAGE on the SAGE file corresponding to this LaTeX file (run latex first).")))))

source: with slight modification ( sage generated files are now x.sagetex.sage ).

It still will not prompt you that sage should be run (output will simply be ...unresolved references... if you do not run sage), but its better than switching to a terminal.

  • I had forgotten I even asked the question. Thanks! – Anthony Jan 21 '13 at 4:00
  • a thousand upvotes to you! – Brian Fitzpatrick May 16 '16 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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