\sagestr{pascals_triangle(n)}

+\section{Include doctest-like examples in your document}

+Here are some examples of using the \texttt{sageexample} environment:

+ sage: factor(x^2 + 2*x + 1)

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

+output, renew the \texttt{sageexampleincludetextoutput} variable to

+\renewcommand{\sageexampleincludetextoutput}{True}

+ sage: factor(x^2 + 2*x + 1)

+Multiline statements are support, as are triple-quoted strings

+delimited by single quotes:

+\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)

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

+When typesetting your document, the validity of the outputs is not

+checked (go ahead and try changing something above) 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.

+Some more examples. This environment is implemented a little bit

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

+that definitions are preserved across multiple uses:

+After that, Sage should remember that $a = \sage{a}$, and be able to

+use 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