ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 22 Jun 2012 22:35:10 -0500How "run a .sage file"?http://ask.sagemath.org/question/8915/how-run-a-sage-file/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?Sun, 22 Apr 2012 08:56:12 -0500http://ask.sagemath.org/question/8915/how-run-a-sage-file/Answer by John Palmieri for <p>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".</p>
<p>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.</p>
<p>But how do I process such a .sage file in there?</p>
http://ask.sagemath.org/question/8915/how-run-a-sage-file/?answer=13489#post-id-13489If 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](http://www.phys.psu.edu/~collins/software/latexmk-jcc/), 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).
Sun, 22 Apr 2012 16:04:42 -0500http://ask.sagemath.org/question/8915/how-run-a-sage-file/?answer=13489#post-id-13489Comment by T. Verron for <p>If your Sage app is <code>/Applications/Sage.app</code>, for example, then from a Terminal window, run</p>
<pre><code>$ /Applications/Sage.app/Contents/Resources/sage/sage example.sagetex.sage
</code></pre>
<p>You can instead add the directory <code>/Applications/Sage.app/Contents/Resources/sage</code> to your <code>$PATH</code>, and then you'll be able to do</p>
<pre><code>$ sage example.sagetex.sage
</code></pre>
<p>Actually, once you add the sage directory to your <code>$PATH</code>, if you have <a href="http://www.phys.psu.edu/~collins/software/latexmk-jcc/">latexmk</a>, you can just do</p>
<pre><code>$ latexmk example.tex
</code></pre>
<p>and it will run LaTeX and sage as many times as needed for the document (and also bibtex and any other needed TeX components).</p>
http://ask.sagemath.org/question/8915/how-run-a-sage-file/?comment=19522#post-id-19522I 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).Fri, 22 Jun 2012 22:35:10 -0500http://ask.sagemath.org/question/8915/how-run-a-sage-file/?comment=19522#post-id-19522Comment by Ivan Andrus for <p>If your Sage app is <code>/Applications/Sage.app</code>, for example, then from a Terminal window, run</p>
<pre><code>$ /Applications/Sage.app/Contents/Resources/sage/sage example.sagetex.sage
</code></pre>
<p>You can instead add the directory <code>/Applications/Sage.app/Contents/Resources/sage</code> to your <code>$PATH</code>, and then you'll be able to do</p>
<pre><code>$ sage example.sagetex.sage
</code></pre>
<p>Actually, once you add the sage directory to your <code>$PATH</code>, if you have <a href="http://www.phys.psu.edu/~collins/software/latexmk-jcc/">latexmk</a>, you can just do</p>
<pre><code>$ latexmk example.tex
</code></pre>
<p>and it will run LaTeX and sage as many times as needed for the document (and also bibtex and any other needed TeX components).</p>
http://ask.sagemath.org/question/8915/how-run-a-sage-file/?comment=19869#post-id-19869I 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?Tue, 24 Apr 2012 21:52:09 -0500http://ask.sagemath.org/question/8915/how-run-a-sage-file/?comment=19869#post-id-19869Comment by John Palmieri for <p>If your Sage app is <code>/Applications/Sage.app</code>, for example, then from a Terminal window, run</p>
<pre><code>$ /Applications/Sage.app/Contents/Resources/sage/sage example.sagetex.sage
</code></pre>
<p>You can instead add the directory <code>/Applications/Sage.app/Contents/Resources/sage</code> to your <code>$PATH</code>, and then you'll be able to do</p>
<pre><code>$ sage example.sagetex.sage
</code></pre>
<p>Actually, once you add the sage directory to your <code>$PATH</code>, if you have <a href="http://www.phys.psu.edu/~collins/software/latexmk-jcc/">latexmk</a>, you can just do</p>
<pre><code>$ latexmk example.tex
</code></pre>
<p>and it will run LaTeX and sage as many times as needed for the document (and also bibtex and any other needed TeX components).</p>
http://ask.sagemath.org/question/8915/how-run-a-sage-file/?comment=19868#post-id-19868Hmm. I seem to have some customizations in my .latexmkrc file, apparently downloaded from https://bitbucket.org/ddrake/sagetex/wiki/UsingSageTeX. Wed, 25 Apr 2012 04:27:51 -0500http://ask.sagemath.org/question/8915/how-run-a-sage-file/?comment=19868#post-id-19868Comment by Ivan Andrus for <p>If your Sage app is <code>/Applications/Sage.app</code>, for example, then from a Terminal window, run</p>
<pre><code>$ /Applications/Sage.app/Contents/Resources/sage/sage example.sagetex.sage
</code></pre>
<p>You can instead add the directory <code>/Applications/Sage.app/Contents/Resources/sage</code> to your <code>$PATH</code>, and then you'll be able to do</p>
<pre><code>$ sage example.sagetex.sage
</code></pre>
<p>Actually, once you add the sage directory to your <code>$PATH</code>, if you have <a href="http://www.phys.psu.edu/~collins/software/latexmk-jcc/">latexmk</a>, you can just do</p>
<pre><code>$ latexmk example.tex
</code></pre>
<p>and it will run LaTeX and sage as many times as needed for the document (and also bibtex and any other needed TeX components).</p>
http://ask.sagemath.org/question/8915/how-run-a-sage-file/?comment=19866#post-id-19866I should have thought to look there. Thanks.Wed, 25 Apr 2012 06:58:33 -0500http://ask.sagemath.org/question/8915/how-run-a-sage-file/?comment=19866#post-id-19866Comment by T. Verron for <p>If your Sage app is <code>/Applications/Sage.app</code>, for example, then from a Terminal window, run</p>
<pre><code>$ /Applications/Sage.app/Contents/Resources/sage/sage example.sagetex.sage
</code></pre>
<p>You can instead add the directory <code>/Applications/Sage.app/Contents/Resources/sage</code> to your <code>$PATH</code>, and then you'll be able to do</p>
<pre><code>$ sage example.sagetex.sage
</code></pre>
<p>Actually, once you add the sage directory to your <code>$PATH</code>, if you have <a href="http://www.phys.psu.edu/~collins/software/latexmk-jcc/">latexmk</a>, you can just do</p>
<pre><code>$ latexmk example.tex
</code></pre>
<p>and it will run LaTeX and sage as many times as needed for the document (and also bibtex and any other needed TeX components).</p>
http://ask.sagemath.org/question/8915/how-run-a-sage-file/?comment=19523#post-id-19523On my machine, this setting (with others) was also available in `[TexLive2011Path]/texmf-dist/doc/support/latexmk/example_rcfiles `Fri, 22 Jun 2012 22:19:26 -0500http://ask.sagemath.org/question/8915/how-run-a-sage-file/?comment=19523#post-id-19523Answer by Ivan Andrus for <p>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".</p>
<p>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.</p>
<p>But how do I process such a .sage file in there?</p>
http://ask.sagemath.org/question/8915/how-run-a-sage-file/?answer=13498#post-id-13498If 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.Wed, 25 Apr 2012 06:57:12 -0500http://ask.sagemath.org/question/8915/how-run-a-sage-file/?answer=13498#post-id-13498