Michael Anselmi
unread,Feb 6, 2011, 12:17:48 AM2/6/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sage-support
Hello all. I would like to inform you of an issue I'm having with
SageTeX's sageplot functionality, and I'm hoping you can help me
resolve the issue. This is my first time posting in sage-support, let
alone in any Google group or newsgroup-like setting. Hopefully I'm
doing this right. :)
When generating a plot with SageTeX's sageplot command, I would like
all text in the plot to be processed by LaTeX by default. I've read
that this can be done by changing the appropriate setting in Sage's
`matplotlibrc' file. So I copied `matplotlibrc' from
$SAGE_ROOT/local/lib/python2.6/site-packages/matplotlib/mpl-data/
matplotlibrc
to
$DOT_SAGE/matplotlib-1.0.0/matplotlibrc
and changed line 131 of the $SAGE_ROOT copy of `matplotlibrc' from
#text.usetex : False
to
text.usetex : True
According to matplotlib's documentation, this is the recommended way
to modify matplotlib's default behavior.
However, when running sage on an auto-generated .sage file after this
change, I receive the following output:
Processing Sage code for test.tex...
Code block begin...end
Initializing plots directory
Plot 0
**** Error in Sage code on line 21 of test.tex! Traceback follows.
Traceback (most recent call last):
File "test.py", line 25, in <module>
_st_.plot(_sage_const_0 , format='notprovided', _p_=figure)
File "/opt/local/sage/local/lib/python2.6/site-packages/sagetex.py",
line 145, in plot
_p_.save(filename=plotfilename, **kwargs)
File "/opt/local/sage/local/lib/python2.6/site-packages/sage/plot/
plot.py", line 2417, in save
figure.savefig(filename,dpi=dpi,bbox_inches='tight',**options)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
figure.py", line 1084, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
backend_bases.py", line 1852, in print_figure
**kwargs)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
backend_bases.py", line 1696, in print_pdf
return pdf.print_pdf(*args, **kwargs)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
backends/backend_pdf.py", line 2156, in print_pdf
self.figure.draw(renderer)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
figure.py", line 798, in draw
func(*args)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
axes.py", line 1934, in draw
a.draw(renderer)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
axis.py", line 1017, in draw
tick.draw(renderer)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
axis.py", line 234, in draw
self.label1.draw(renderer)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
text.py", line 567, in draw
self._fontproperties, angle)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
backends/backend_pdf.py", line 1549, in draw_tex
psfont = self.tex_font_mapping(dvifont.texname)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
backends/backend_pdf.py", line 1365, in tex_font_mapping
dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
dviread.py", line 668, in __init__
self._parse(file)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
dviread.py", line 701, in _parse
self._register(words)
File "/opt/local/sage/local/lib/python2.6/site-packages/matplotlib/
dviread.py", line 727, in _register
assert encoding is None
AssertionError
**** Running Sage on test.sage failed! Fix test.tex and try again.
The EPS image file is generated and saved as expected, but the PDF
image file is nowhere to be found. It seems that SageTeX is hanging
up on generating and/or saving the PDF file.
Before editing `matplotlibrc', Sage processes the .sage file as
expected, and EPS and PDF image files are generated and saved as
expected. Here's the output:
Processing Sage code for test.tex...
Code block begin...end
Initializing plots directory
Plot 0
Sage processing complete. Run LaTeX on test.tex again.
Here's the test LaTeX file I used in both cases (`test.tex'):
\documentclass{article}
\usepackage{sagetex}
\begin{document}
\title{SageTeX sageplot test}
\author{Michael Anselmi}
\date{\today}
\maketitle
\begin{sagesilent}
f0 = lambda x:0
f1 = lambda x:x
f2 = lambda x:2-x
f = Piecewise([ [(-1,0), f0], [(0,1), f1], [(1,2), f2], [(2,3),
f0] ])
figure = plot(f)
figure.axes_labels([r'$x$', r'$f(x)$'])
\end{sagesilent}
\begin{center}
\sageplot[width=0.5\textwidth]{figure}
\end{center}
\end{document}
Here's some potentially relevant information about my system:
Operating system:
Ubuntu 10.10 (64-bit)
Sage version:
4.6.1 (compiled from source with `make test', all tests passed)
LaTeX version:
TeX Live 2010
$PATH:
[TeX Live 2010 binary dir]:$SAGE_ROOT:[the usual PATH entries]
I'd very much like to find out what's going wrong here, be it an issue
with SageTeX or external programs/libraries. Please let me know what
else I may do to help identify the problem.
-Michael