If you want to see the plain-text output as well as the typeset output,

renew the \texttt{sageexampleincludetextoutput} command to True:

+ \renewcommand{\sageexampleincludetextoutput}{True}

\renewcommand{\sageexampleincludetextoutput}{True}

+This can be useful to check that the two outputs are consistent.

% fiddle with spacing to demonstrate the kind of thing mentioned in the

the page number is the output of a command, when in fact the real output

is on the next page. If the output of a command below looks like

\thepage, don't worry, that's just the page number.

\renewcommand{\sageexampleincludetextoutput}{False}

- ....: '''This function is really quite nice,

- ....: although perhaps not very useful.'''

- ....: print "f called with a = ", a

- ....: y = integrate(SR(cyclotomic_polynomial(10)) + a, x)

+ ... '''This function is really quite nice,

+ ... although perhaps not very useful.'''

+ ... print "f called with a = ", a

+ ... y = integrate(SR(cyclotomic_polynomial(10)) + a, x)

1/5*x^5 - 1/4*x^4 + 1/3*x^3 + x + 1

\renewcommand{\sageexampleincludetextoutput}{False}

-\ldots but it should be possible to run the usual Sage doctest mechanism

-on the generated \texttt{.sage} file---or perhaps the \texttt{.py} file.

-Running doctests on files outside the main Sage library does not always

-work, so contact sage-support if you run into troubles.

+However, typesetting your document produces a file named

+\texttt{example\_test.sage} containing all the doctest-like examples,

+and you can have Sage check them for you with:

+> sage -t example_test.sage

+sage -t "example_test.sage"

+**********************************************************************

+File "/home/nthiery/Sage-Combinat/sagetex/example_test.sage", line 30:

+**********************************************************************

+ 1 of 11 in __main__.example_0

+***Test Failed*** 1 failures.

+For whitespace errors, see the file /.../.sage//tmp/.doctest_example_test.py

+----------------------------------------------------------------------

+The following tests failed:

+ sage -t "example_test.sage"

+Total time for all tests: 3.7 seconds

+Please look into this file for the original line numbers.

+Beware that \texttt{sage -t} does not handle well file names with

+special characters in them (even just \texttt{example-test.sage}).

+Also, running doctests on files outside the main Sage library does not

+always work, so contact \texttt{sage-support} if you run into

Some more examples. This environment is implemented a little bit

differently than the other environments, so it's good to make sure that

that in future \texttt{sageexample} blocks:

1/5*x^5 - 1/4*x^4 + 1/3*x^3 - 1/2*x^2 + 5*x + 1