But I've never tried this combination of python.sty/Beamer/LaTeX
personally. Can you send us the output of your plot on its own (ps or
pdf...)?
Mike
Wow thanks. I was afraid no one would respond. I suppose if Matplotlib is so
mature that we are left worrying about bugs when embedding it in Latex then it
has come a long way.
I created a tiny test.tex that shows the problem. Just type
pdflatex -shell-escape test.tex ; xpdf test.pdf
in the same directory with the 2 files test.tex and python.sty below and
attached. I also attached the final PDF since you asked for it.
\documentclass{beamer}
\usepackage{beamerthemesplit}
\usepackage{graphicx}
\usepackage{python}
\begin{document}
\title[Example of zorder trouble]{Example of zorder trouble}
\author[Matplotlib fan]{Matplotlib fan}
\date{}
\setbeamertemplate{navigation symbols}{}
\frame{\titlepage}
\begin{frame}[fragile]\frametitle{No zorder - notice footer ok}
\begin{python}
import pylab
pylab.plot(range(10), range(10))
pylab.scatter([5], [5])
pylab.savefig('plot1.pdf')
print r'\includegraphics[width=200pt]{plot1.pdf}'
\end{python}
\end{frame}
\begin{frame}[fragile]\frametitle{zorder - notice footer messed up}
\begin{python}
import pylab
pylab.plot(range(10), range(10), zorder = 1)
pylab.scatter([5], [5], zorder = 9)
pylab.savefig('plot2.pdf')
print r'\includegraphics[width=200pt]{plot2.pdf}'
\end{python}
\end{frame}
\end{document}
%% This program is free software; you can redistribute it and/or
%% modify it under the terms of the GNU General Public License
%% as published by the Free Software Foundation; either version 2
%% of the License, or (at your option) any later version.
%%
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software
%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
%%
%% Author: Martin R. Ehmsen, ehmsen@...2204...
%% Department of Mathematics and Computer Science,
%% University of Southern Denmark, DK
%%
%% You can find an online copy of the GPL at
%% The GNU General Public License v3.0 - GNU Project - Free Software Foundation .
%%
%% Note: shell-escape needs to be activated for this to work.
%% This can either be done by passing -shell-escape as an option to
%% latex or by adding/changing "shell_escape = t" in your texmf.cnf .
% 0.2 -> 0.21: Moved \newwrite\@module from \@writemodule and out, since
% no more than 15 \newwrites are allowed (and the previous version created a new
% every time \@writemodule was called.
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{python}[2007/06/07 v0.21 Python in LaTeX]
\newwrite\@out
\newwrite\@module
\begingroup \catcode `|=0 \catcode `[=1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12
\catcode`\\=12 |gdef|@xpython#1\end{python}[|immediate|write|@out[#1]|end[python]]
endgroup
\def\python{\kernel@...2205... [{\@python}{\@python}}
\def\@python[#1]{%
\gdef\@pythoninclude{#1}
\immediate\openout\@out=\jobname.py
\newlinechar='15
\begingroup \catcode`\^^M=12 %
\let\do\@makeother\dospecials\obeyspaces%
\@xpython}
\def\endpython{%
\endgroup
\immediate\closeout\@out
\@writemodule
\immediate\write18{cat \@pythoninclude\space\jobname.py | python > \jobname.py.out 2> \jobname.py.err}
\immediate\input\jobname.py.out}
%\immediate\write{\begin{verbatim}}
%\immediate\input\jobname.py.err
%\immediate\write{\end{verbatim}}}
\def\@writemodule{%
\immediate\openout\@module=latex.py
\immediate\write\@module{jobname="\jobname"}
\immediate\closeout\@module}
% BUGS:
% 1. If anything gets send to stderr then it should be included
% in \begin{verbatim}...\end{verbatim} to be properly displayed
%
% \immediate\write18{cat \@pythoninclude\space\jobname.py | python > \jobname.py.out 2>\jobname.py.err}
%
% 2. Watch out for indentation done by aucTeX in Emacs
%
% 3. Let the package accept a "final version" option, such
% that the output of each python run is saved such that it can be
% inserted into the document by hand
% (conference, journals are not likely to compile with
% shell_escape or have python).
%
% \gdef\@prepython{}
% \def\prepython#1{%
% \gdef\@prepython{#1}
% }
% sed -e 's/^ //g' cluster.py
% \immediate\write18{\@prepython\space\jobname.py > \
test.tex (829 Bytes)
python.sty (2.97 KB)
test.pdf (41.5 KB)
···
On Tue, Oct 14, 2008 at 08:21:08AM -0400, Michael Droettboom wrote: