-% Copyright (C) 2009 by Dan Drake <ddrake~~@member.ams.~~org>

+% Copyright (C) 2009 by Dan Drake <ddrake (at) member (dot) ams (dot) org>

% -------------------------------------------------------

% See the "Copying and licenses" section at the end of this file for the

%<latex>\NeedsTeXFormat{LaTeX2e}

%<latex>\ProvidesPackage{sagetex}

- [2009/0~~1~~/2~~7~~ v2.0.~~1~~ embedding Sage into LaTeX documents]

+ [2009/04/21 v2.0.2 embedding Sage into LaTeX documents]

% \title{The \ST{} package\thanks{This document

% corresponds to \ST~\fileversion, dated \filedate.}}

-% \author{Dan Drake (\texttt{ddrake~~@member.ams.~~org}) and others}

+% \author{Dan Drake (\texttt{ddrake (at) member (dot) ams (dot) org}) and others}

% |The prime factorization of the current page number plus foo|\\

% |is $\sage{factor(foo + \thepage)}$|.

% Here, I'll do just that right now: the prime factorization of the

-% current page number plus $12$ is $\sage{factor(\thepage + 12)}$.

-% (Wrong answer? See footnote.\footnote{Is the above factorization

-% wrong? If the current page number plus $12$ is one larger than the

-% claimed factorization, you need to do another Sage/\LTX cycle on

-% this source file. Why? The first time you run \LTX on this file, the

-% sine graph isn't available, so the text where I've talked about the

-% prime factorization is back one page. Then you run Sage, and it

-% creates the sine graph and does the factorization. When you run \LTX

-% again, the sine graph pushes the text onto the next page, but it

-% uses the Sage-computed value from the previous page. Meanwhile, the

-% |.sage| file has been rewritten with the correct page number, so if

-% you do another Sage/\LTX cycle, you'll get the correct value

-% above.}) The |\sage| command doesn't automatically use math mode for

-% its output, so be sure to use dollar signs or a displayed math

+% current page number plus $12$ is $\sage{factor(\thepage + 12)}$ and

+% \thepage. (Wrong answer? See footnote.\footnote{Is the above

+% factorization wrong? If the current page number plus $12$ is one

+% larger than the claimed factorization, another Sage/\LTX cycle on

+% this source file should fix it. Why? The first time you run \LTX on

+% this file, the sine graph isn't available, so the text where I've

+% talked about the prime factorization is back one page. Then you run

+% Sage, and it creates the sine graph and does the factorization. When

+% you run \LTX again, the sine graph pushes the text onto the next

+% page, but it uses the Sage-computed value from the previous page.

+% Meanwhile, the |.sage| file has been rewritten with the correct page

+% number, so if you do another Sage/\LTX cycle, you should get the

+% correct value above. However, in some cases, even \emph{that}

+% doesn't work because of some kind of \TeX{} weirdness in ending the

+% one page a bit short and starting another.}) The |\sage| command

+% doesn't automatically use math mode for its output, so be sure to use

+% dollar signs or a displayed math environment

% \DescribeMacro{\percent} If you are doing modular arithmetic or string

again.' % ((self.filename,) * 2))

os.remove(self.filename + '.sout.tmp')

+% We use |int(1)| above to make sure |sys.exit| sees a Python integer;

+% \href{http://trac.sagemath.org/sage_trac/ticket/2861#comment:5}{ticket

+% \changes{v2.0.2}{2008/04/21}{Make sure sys.exit sees a Python integer.}

% \begin{macro}{endofdoc}

% confident the pagebreak problems won't occur.