Ask Your Question
3

How "run a .sage file"?

asked 12 years ago

murray gravatar image

I'm trying to use the sagetex style file in LaTeX. After trying to process the example.tex file provided with sagetex, I get error messages in the log that say to "Run Sage on example.sagetex.sage".

On my OS X system, Sage is installed as a clickable .app. After I start the app, I know how to start a Terminal command session of Sage by using the right-click menu from the Sage icon in the dock.

But how do I process such a .sage file in there?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
3

answered 12 years ago

If your Sage app is /Applications/Sage.app, for example, then from a Terminal window, run

$ /Applications/Sage.app/Contents/Resources/sage/sage example.sagetex.sage

You can instead add the directory /Applications/Sage.app/Contents/Resources/sage to your $PATH, and then you'll be able to do

$ sage example.sagetex.sage

Actually, once you add the sage directory to your $PATH, if you have latexmk, you can just do

$ latexmk example.tex

and it will run LaTeX and sage as many times as needed for the document (and also bibtex and any other needed TeX components).

Preview: (hide)
link

Comments

I didn't know latexmk will run sage for you. Does it need special configuration, because the one I have installed (from MacTeX) doesn't seem to do it automatically?

Ivan Andrus gravatar imageIvan Andrus ( 12 years ago )

Hmm. I seem to have some customizations in my .latexmkrc file, apparently downloaded from https://bitbucket.org/ddrake/sagetex/wiki/UsingSageTeX.

John Palmieri gravatar imageJohn Palmieri ( 12 years ago )

I should have thought to look there. Thanks.

Ivan Andrus gravatar imageIvan Andrus ( 12 years ago )

On my machine, this setting (with others) was also available in `[TexLive2011Path]/texmf-dist/doc/support/latexmk/example_rcfiles `

T. Verron gravatar imageT. Verron ( 12 years ago )

I would also add `push @generated_exts, "sage";`to the .latexmkrc file, it should prevent latexmk from trying to run sage on the .sage file before the first latex run (useful in case there was a syntax error in your sage code for example).

T. Verron gravatar imageT. Verron ( 12 years ago )
0

answered 12 years ago

Ivan Andrus gravatar image

If you just double-click the sage file that will run it with Sage.app.

If you use Emacs and AUCTeX, then I'm working on support for automatically detecting and running Sage as necessary, together with support for automatically finding the sage executable in Sage.app.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 12 years ago

Seen: 11,120 times

Last updated: Apr 25 '12