| 1 | initial version |
The sagetex.pdf TeXdoc file for SageTeX recommends (§ 4.7.1) to set up a set of file on cloud.sagemath.org (now cocalc). That doesn't seem very reasonable unless your correspondent is able to use Sage...
However, §4.7.2 of the same document points to the makestatic.pyscript, which _should_ get you a \LaTeX file producing the same output as your original file. Parphrased from this doc :
There is another option, and that is to use the makestatic.py script included with SageTEX. This script has been unmaintained for some time and likely won’t work. If you want or need to use it and run into trouble, email the sage-support group and let us know.
Use of the script is quite simple. Copy it and
sagetexparse.pyto the directory with your document, and run
`python makestatic.py inputfile [outputfile]`
where
inputfileis your document. (You can also set the executable bit of makestatic.py and use ./makestatic.py.) This script needs thepyparsingmodule to be installed. You may optionally specifyoutputfile; if you do so, the results will be written to that file. If the file exists, it won’t be overwritten unless you also specify the -o switch.You will need to run this after you’ve compiled your document and run Sage on the .sage file. The script reads in the
.soutfile and replaces all the calls to\sageand\sageplotwith their plain\LaTeXequivalent, and turns thesageblockand 'sageverbatim' environments intoverbatimenvironments. Anysagesilentenvironment is turned into acommentenvironment. Anysagecommandlineenvironment is turned into alstlistingenvironment, typesetting the relevant part of the.scmdfile. The resulting document should compile to something identical, or very nearly so, to the original file.One large limitation of this script is that it can’t change anything while SageTeX is paused, since Sage doesn’t compute anything for such parts of your document. It also doesn’t check to see if
pauseandunpausecommands are inside comments orverbatimenvironments. If you’re going to usemakestatic.py, just remove allpause/unpausestatements.The parsing that makestatic.py does is pretty good, but not perfect. Right now it doesn’t support having a comma-separated list of packages, so you can’t have
\usepackage{sagetex,foo}. You need to have just \usepackage{sagetex}. (Along with package options; those are handled correctly.) If you find other parsing errors, please let me know.
Caveat : I have never used this script myself (yet). But it sounds like a possible solution (possibly modulo some script fixes...).
Could you let us know :
If you tried this solution,
if it worked,
if it needed fixes, and if so, which ones ?
possibly by a post to sage-support or sage-devel ?
HTH,
| 2 | No.2 Revision |
EDIT : I checked makestatic.py, and it turns out that this script currently does not work. I keep the rest of my answer here as a hint to people interested in fixing it.
The sagetex.pdf TeXdoc file for SageTeX recommends (§ 4.7.1) to set up a set of file on cloud.sagemath.org (now cocalc). That doesn't seem very reasonable unless your correspondent is able to use Sage...
However, §4.7.2 of the same document points to the makestatic.pyscript, which _should_ get you a \LaTeX file producing the same output as your original file. Parphrased from this doc :
There is another option, and that is to use the makestatic.py script included with SageTEX. This script has been unmaintained for some time and likely won’t work. If you want or need to use it and run into trouble, email the sage-support group and let us know.
Use of the script is quite simple. Copy it and
sagetexparse.pyto the directory with your document, and run
`python makestatic.py inputfile [outputfile]`
where
inputfileis your document. (You can also set the executable bit of makestatic.py and use ./makestatic.py.) This script needs thepyparsingmodule to be installed. You may optionally specifyoutputfile; if you do so, the results will be written to that file. If the file exists, it won’t be overwritten unless you also specify the -o switch.You will need to run this after you’ve compiled your document and run Sage on the .sage file. The script reads in the
.soutfile and replaces all the calls to\sageand\sageplotwith their plain\LaTeXequivalent, and turns thesageblockand 'sageverbatim' environments intoverbatimenvironments. Anysagesilentenvironment is turned into acommentenvironment. Anysagecommandlineenvironment is turned into alstlistingenvironment, typesetting the relevant part of the.scmdfile. The resulting document should compile to something identical, or very nearly so, to the original file.One large limitation of this script is that it can’t change anything while SageTeX is paused, since Sage doesn’t compute anything for such parts of your document. It also doesn’t check to see if
pauseandunpausecommands are inside comments orverbatimenvironments. If you’re going to usemakestatic.py, just remove allpause/unpausestatements.The parsing that makestatic.py does is pretty good, but not perfect. Right now it doesn’t support having a comma-separated list of packages, so you can’t have
\usepackage{sagetex,foo}. You need to have just \usepackage{sagetex}. (Along with package options; those are handled correctly.) If you find other parsing errors, please let me know.
Caveat : I have never used this script myself (yet). But it sounds like a possible solution (possibly modulo some script fixes...).
Could you let us know :
If you tried this solution,
if it worked,
if it needed fixes, and if so, which ones ?
possibly by a post to sage-support or sage-devel ?
HTH,
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.