* SageTeX in export
@ 2012-08-17 4:33 mailinglists
2012-08-17 6:30 ` Nick Dokos
0 siblings, 1 reply; 4+ messages in thread
From: mailinglists @ 2012-08-17 4:33 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Some background for the interested:
Sage (http://www.sagemath.org/) is a free open source mathematics
system. It essentially takes a number of well known open source math
packages (Pari/GP, Maxima, etc) and provides it all to you under one
interface, all glued together with Python.
I highly recommend it. There was even a post here a few days ago
regarding including Sage into Org-Babel.
I want to talk about SageTeX. It's a package that allows you to call
Sage code from within your LaTeX document. You insert a Sage command
(e.g. plotting some data) and it returns the result - either an image or
relevant LaTeX code. Kind of like literate programming.
Here's how it works. If your document is file.tex and it uses the
SageTeX package, you run pdflatex on the .tex file. This will then
produce a sage script called "file.sagetex.sage". You then manually run
this sage script using Sage. Then you run pdflatex again and it will
include the results from your sage script into the document.
I'm finding myself embedding Sage code into a document I'm writing which
is meant for a LaTeX export. My problem is that Org mode's LaTeX export
can't handle the steps in my previous paragraph. I'm sure it's trivial
to do via some hook, but I'm no good at Elisp.
All I need is a way for the export to:
1. After running pdflatex, check if there is a file called
"<org_file_name>.sagetex.sage".
2. If it's present, run sage on it, and then rerun pdflatex.
3. If it's not, nothing more is left to do.
I'd really appreciate if someone could tell me how to enable this with
Org mode's export.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SageTeX in export
2012-08-17 4:33 SageTeX in export mailinglists
@ 2012-08-17 6:30 ` Nick Dokos
2012-08-19 17:10 ` Ivan Andrus
2012-08-23 2:04 ` mailinglists
0 siblings, 2 replies; 4+ messages in thread
From: Nick Dokos @ 2012-08-17 6:30 UTC (permalink / raw)
To: mailinglists; +Cc: emacs-orgmode
mailinglists@nawaz.org wrote:
> Hi,
>
> Some background for the interested:
>
> Sage (http://www.sagemath.org/) is a free open source mathematics
> system. It essentially takes a number of well known open source math
> packages (Pari/GP, Maxima, etc) and provides it all to you under one
> interface, all glued together with Python.
>
> I highly recommend it. There was even a post here a few days ago
> regarding including Sage into Org-Babel.
>
> I want to talk about SageTeX. It's a package that allows you to call
> Sage code from within your LaTeX document. You insert a Sage command
> (e.g. plotting some data) and it returns the result - either an image or
> relevant LaTeX code. Kind of like literate programming.
>
> Here's how it works. If your document is file.tex and it uses the
> SageTeX package, you run pdflatex on the .tex file. This will then
> produce a sage script called "file.sagetex.sage". You then manually run
> this sage script using Sage. Then you run pdflatex again and it will
> include the results from your sage script into the document.
>
> I'm finding myself embedding Sage code into a document I'm writing which
> is meant for a LaTeX export. My problem is that Org mode's LaTeX export
> can't handle the steps in my previous paragraph. I'm sure it's trivial
> to do via some hook, but I'm no good at Elisp.
>
> All I need is a way for the export to:
>
> 1. After running pdflatex, check if there is a file called
> "<org_file_name>.sagetex.sage".
> 2. If it's present, run sage on it, and then rerun pdflatex.
> 3. If it's not, nothing more is left to do.
>
> I'd really appreciate if someone could tell me how to enable this with
> Org mode's export.
>
All you have to do is set the variable org-latex-to-pdf-process,
something like this [fn:1]
(setq org-latex-to-pdf-process
'("pdflatex %f"
"if [ -f %b.sagetex.sage ] ;then sage %b.sagetex.sage ;fi"
"pdflatex %f"
"pdflatex %f"))
although as Achim Gratz pointed out in this thread:
http://thread.gmane.org/gmane.emacs.orgmode/58928
it's probably better to use the Customization interface, particularly if
one is an elisp beginner - do C-h v org-latex-to-pdf-process RET, read the
documentation for the variable and then click the customize link at the bottom
to get to the customization page.
Nick
Footnotes:
[fn:1] Note that the default setting for this variable is three invocations of
pdflatex, so I'm just interpolating a call to sage.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SageTeX in export
2012-08-17 6:30 ` Nick Dokos
@ 2012-08-19 17:10 ` Ivan Andrus
2012-08-23 2:04 ` mailinglists
1 sibling, 0 replies; 4+ messages in thread
From: Ivan Andrus @ 2012-08-19 17:10 UTC (permalink / raw)
To: nicholas.dokos; +Cc: mailinglists, emacs-orgmode
On Aug 17, 2012, at 8:30 AM, Nick Dokos wrote:
> mailinglists@nawaz.org wrote:
>
>> Hi,
>>
>> All I need is a way for the export to:
>>
>> 1. After running pdflatex, check if there is a file called
>> "<org_file_name>.sagetex.sage".
>> 2. If it's present, run sage on it, and then rerun pdflatex.
>> 3. If it's not, nothing more is left to do.
>>
>> I'd really appreciate if someone could tell me how to enable this with
>> Org mode's export.
>
> All you have to do is set the variable org-latex-to-pdf-process,
> something like this [fn:1]
>
> (setq org-latex-to-pdf-process
> '("pdflatex %f"
> "if [ -f %b.sagetex.sage ] ;then sage %b.sagetex.sage ;fi"
> "pdflatex %f"
> "pdflatex %f"))
>
> although as Achim Gratz pointed out in this thread:
>
> http://thread.gmane.org/gmane.emacs.orgmode/58928
>
> it's probably better to use the Customization interface, particularly if
> one is an elisp beginner - do C-h v org-latex-to-pdf-process RET, read the
> documentation for the variable and then click the customize link at the bottom
> to get to the customization page.
>
> Nick
>
> Footnotes:
>
> [fn:1] Note that the default setting for this variable is three invocations of
> pdflatex, so I'm just interpolating a call to sage.
This is cool. I've opened a ticket [1] on sage-mode to add support for this automatically. Hopefully, I'll get around to it fairly soon, but if not feel free to bug me. I'll obviously have to make it a little more robust than a simple setq, or I would do it right now.
-Ivan
[1] https://bitbucket.org/gvol/sage-mode/issue/10/add-support-for-sagetex-in-org-latex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SageTeX in export
2012-08-17 6:30 ` Nick Dokos
2012-08-19 17:10 ` Ivan Andrus
@ 2012-08-23 2:04 ` mailinglists
1 sibling, 0 replies; 4+ messages in thread
From: mailinglists @ 2012-08-23 2:04 UTC (permalink / raw)
To: emacs-orgmode
Nick Dokos <nicholas.dokos@hp.com> writes:
> All you have to do is set the variable org-latex-to-pdf-process,
> something like this [fn:1]
>
> (setq org-latex-to-pdf-process
> '("pdflatex %f"
> "if [ -f %b.sagetex.sage ] ;then sage %b.sagetex.sage ;fi"
> "pdflatex %f"
> "pdflatex %f"))
Thanks. I was kinda hoping for a solution that uses Elisp rather than
offloading it to the shell, but whatever works. In fact, had no one
answered, I would have just written a shell script called "pdflatex"
that would do the same.
I haven't tested it. Suddenly something is wrong with my SageTeX - it
was working when I posted this, but not anymore.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-23 2:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-17 4:33 SageTeX in export mailinglists
2012-08-17 6:30 ` Nick Dokos
2012-08-19 17:10 ` Ivan Andrus
2012-08-23 2:04 ` mailinglists
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).