TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
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 at 23:14

Your Answer


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.