On Saturday, November 7, 2015 at 1:34:49 PM UTC-8, slabbe wrote:
>
> This opens a pdf:
>
> sage: g = graphs.PetersenGraph()
> sage: s = latex(g)
> sage: view(s, tightpage=True)
>
> But is there a way to just save that pdf file locally and not open it?
>
Until you quite the Sage session, the file should be saved some place like
.sage/temp/HOSTNAME/9348/sage.pdf (9348 is some random number). So if you
don't mind having it open, it is available. I thought there was another way
to do this, but I can't find a simple one. You can do:
sage: from sage.misc.latex import _latex_file_
sage: t = _latex_file_(s) # the contents of the file to be run through
LaTeX
Or even better, mimic the effects of tightpage=True:
sage: t = _latex_file_(s,
extra_preamble='\\usepackage[tightpage,active]{preview}\\PreviewEnvironment{page}',
math_left='\\begin{page}$', math_right='$\\end{page}')
Then save to a file and run PDFLaTeX on it:
sage: file = "/home/palmieri/my_file.tex"
sage: O = open(file, 'w')
sage: O.write(t)
sage: O.close
sage: from sage.misc.latex import _run_latex_
sage: _run_latex_(file)
--
John
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.