|
From: Darren D. <dar...@co...> - 2008-04-23 20:55:51
|
On Wednesday 23 April 2008 11:35:36 am Yong-Duk Jin wrote:
> I'm using matplotlib 0.9.12 from ubuntu hardy 8.04.
>
> To take advantage of the LaTeX handling capability in matplotlib,
> I've added next two lines in /etc/matplotlib
>
> text.usetex : True
> text.latex.preamble : \usepackage{amsmath}
If I may quote from the matplotlibrc file:
#text.latex.preamble :
# IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES
# AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP
# IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO.
> Then, I tried next test code.
>
> from pylab import *
> x = []; y = []
> figure(figsize=(2,2))
> plot(x,y,label=r'$\theta=$0.0deg'); axis([0,1,0,1]); legend()
> text(0.5, 0.5, r'\begin{align*}x&=\alpha\\y&=\beta\end{align*}')
> savefig('test.eps')
>
> However, I've got the following error message without a resulting eps file.
It looks like the text line is a problem. Latex doesnt like use of align or
eqnarray environments inside figures. It looks like a latex limitation, not
matplotlib. On the other hand, if you can figure out how to make it work in
latex, and can prove that it is a limitation in matplotlib, please let me
know so we can fix it.
> ====================================================================
>
> Traceback (most recent call last):
> File "test.py", line 6, in <module>
> savefig('test.eps')
> File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 269,
> in savefig
> return fig.savefig(*args, **kwargs)
> File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 782,
> in savefig
> self.canvas.print_figure(*args, **kwargs)
> File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
> 1195, in print_figure
> **kwargs)
> File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
> 1099, in print_eps
> return ps.print_eps(*args, **kwargs)
> File
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", line
> 1018, in print_eps
> return self._print_ps(outfile, 'eps', *args, **kwargs)
> File
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", line
> 1041, in _print_ps
> orientation, isLandscape, papertype)
> File
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", line
> 1289, in _print_figure_tex
> orientation)
> File
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", line
> 1376, in convert_psfrags
> \nHere is the full report generated by LaTeX: \n\n%s'% fh.read())
> RuntimeError: LaTeX was not able to process your file:
> Here is the full report generated by LaTeX:
>
> This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
> %&-line parsing enabled.
> entering extended mode
> (/tmp/8c18ecc500de49027f0ed1df1bec10b8.tex
> LaTeX2e <2005/12/01>
> Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang,
> noh
> yphenation, loaded.
> (/usr/share/texmf-texlive/tex/latex/base/article.cls
> Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
> (/usr/share/texmf-texlive/tex/latex/base/size10.clo))
> (/usr/share/texmf-texlive/tex/latex/type1cm/type1cm.sty)
> (/usr/share/texmf-texlive/tex/latex/psnfss/helvet.sty
> (/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty))
> (/usr/share/texmf-texlive/tex/latex/psnfss/courier.sty)
> (/usr/share/texmf-texlive/tex/latex/base/textcomp.sty
> (/usr/share/texmf-texlive/tex/latex/base/ts1enc.def))
> (/usr/share/texmf-texlive/tex/latex/amsmath/amsmath.sty
> For additional information on amsmath, use the `?' option.
> (/usr/share/texmf-texlive/tex/latex/amsmath/amstext.sty
> (/usr/share/texmf-texlive/tex/latex/amsmath/amsgen.sty))
> (/usr/share/texmf-texlive/tex/latex/amsmath/amsbsy.sty)
> (/usr/share/texmf-texlive/tex/latex/amsmath/amsopn.sty))
> (/usr/share/texmf-texlive/tex/latex/geometry/geometry.sty
>
> Package geometry Warning: Over-specification in `h'-direction.
> `width' (614.295pt) is ignored.
>
>
> Package geometry Warning: Over-specification in `v'-direction.
> `height' (794.96999pt) is ignored.
>
> ) (/usr/share/texmf-texlive/tex/latex/psfrag/psfrag.sty
> (/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty
> (/usr/share/texmf-texlive/tex/latex/graphics/trig.sty)
> (/etc/texmf/tex/latex/config/graphics.cfg)
> (/usr/share/texmf-texlive/tex/latex/graphics/dvips.def)))
> (/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty)
> (/usr/share/texmf-texlive/tex/latex/graphics/color.sty
> (/etc/texmf/tex/latex/config/color.cfg)
> (/usr/share/texmf-texlive/tex/latex/graphics/dvipsnam.def))
> (./8c18ecc500de49027f0ed1df1bec10b8.aux)
> (/usr/share/texmf-texlive/tex/latex/base/ts1cmr.fd)
> (/usr/share/texmf-texlive/tex/latex/psnfss/ot1pnc.fd)
> <8c18ecc500de49027f0ed1df1bec10b8.eps>
> (/usr/share/texmf-texlive/tex/latex/psnfss/ot1phv.fd)
> ! Missing \endgroup inserted.
> <inserted text>
> \endgroup
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing } inserted.
> <inserted text>
> }
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing \endgroup inserted.
> <inserted text>
> \endgroup
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing } inserted.
> <inserted text>
> }
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
>
> ! LaTeX Error: There's no line here to end.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type H <return> for immediate help.
> ...
>
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing $ inserted.
> <inserted text>
> $
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing } inserted.
> <inserted text>
> }
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing } inserted.
> <inserted text>
> }
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing } inserted.
> <inserted text>
> }
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing \cr inserted.
> <inserted text>
> \cr
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing { inserted.
> <inserted text>
> {
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing { inserted.
> <inserted text>
> {
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Extra }, or forgotten $.
> <recently read> }
>
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing $ inserted.
> <inserted text>
> $
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing } inserted.
> <inserted text>
> }
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Misplaced alignment tab character &.
> <argument> x&=\alpha \\y&
> =\beta
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing $ inserted.
> <inserted text>
> $
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Misplaced \cr.
> \math@cr@@@ ->\cr
>
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Misplaced \noalign.
> \math@cr@@ ... \iffalse }\fi \math@cr@@@ \noalign
> {\vskip #1\relax }
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing $ inserted.
> <inserted text>
> $
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing } inserted.
> <inserted text>
> }
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Extra }, or forgotten \endgroup.
> \math@cr@@ ...th@cr@@@ \noalign {\vskip #1\relax }
>
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Misplaced \noalign.
> \black@ #1->\noalign
> {\ifdim #1>\displaywidth \dimen@ \prevdepth
> \nointerlin...
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Extra }, or forgotten \endgroup.
> \endalign ->\math@cr \black@ \totwidth@ \egroup
>
> \ifingather@\restorealignst... l.32
> ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
>
> ! LaTeX Error: \begin{figure} on input line 15 ended by \end{align*}.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type H <return> for immediate help.
> ...
>
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing $ inserted.
> <inserted text>
> $
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Display math should end with $$.
> <to be read again>
> \endgroup
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing } inserted.
> <inserted text>
> }
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing } inserted.
> <inserted text>
> }
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Extra }, or forgotten \endgroup.
> \Gin@erotate ...angle {#1}\setbox \z@ \hbox {{#2}}
> \Grot@x \z@ \Grot@y
> \z@\G... l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Undefined control sequence.
> <argument> \Grot@angle
>
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing number, treated as zero.
> <to be read again>
> )
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Undefined control sequence.
> <argument> \Grot@angle
>
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing number, treated as zero.
> <to be read again>
> )
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Undefined control sequence.
> <argument> \Grot@angle
>
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing number, treated as zero.
> <to be read again>
> )
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Undefined control sequence.
> <argument> \Grot@angle
>
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Missing number, treated as zero.
> <to be read again>
> )
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Undefined control sequence.
> \Grot@start ...currentpoint translate \Grot@angle
> \space neg rotate neg
> exch...
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Extra }, or forgotten \endgroup.
> \mbox #1->\leavevmode \hbox {#1}
>
> l.32 ...e=0]{8c18ecc500de49027f0ed1df1bec10b8.eps}
>
> ! Too many }'s.
> \@endfloatbox ...pagefalse \outer@nobreak \egroup
> \color@endbox
> l.33 \end{figure}
>
> ! Extra \endgroup.
> \color@endgroup ->\endgraf \endgroup
>
> l.33 \end{figure}
>
> ! Too many }'s.
> \color@endbox ->\color@endgroup \egroup
>
> l.33 \end{figure}
>
>
> ! LaTeX Error: \begin{document} ended by \end{figure}.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type H <return> for immediate help.
> ...
>
> l.33 \end{figure}
>
> ! Extra \endgroup.
> <recently read> \endgroup
>
> l.33 \end{figure}
>
> [1] (./8c18ecc500de49027f0ed1df1bec10b8.aux) )
> (see the transcript file for additional information)
> Output written on 8c18ecc500de49027f0ed1df1bec10b8.dvi (1 page, 424 bytes).
> Transcript written on 8c18ecc500de49027f0ed1df1bec10b8.log.
>
> ====================================================================
>
> How can I save a plot with a LaTeX environment in eps format?
--
Darren S. Dale, Ph.D.
Staff Scientist
Cornell High Energy Synchrotron Source
Cornell University
275 Wilson Lab
Rt. 366 & Pine Tree Road
Ithaca, NY 14853
dar...@co...
office: (607) 255-3819
fax: (607) 255-9001
http://www.chess.cornell.edu
|