<sage>

The <sage> tag allows the author to incorporate the computational resources of the open source library SageMath into PreTeXt.

The <sage> tag contains an <input> element, followed by an <output> element. The <input> element contains native Sage commands rendered statically in PDF and dynamically as a Sage Cell in HTML. The <output> element allows a text representation of expected output which is displayed in PDF. For further information, see the PreTeXt Guide topic on Sage.

Syntax

Attributes

Attributes for <sage>
AttributeRequired?Values
auto-evaluate = "…"optional"no""yes"
component = "…"optionalstring
doctest = "…"optionalstring
language = "…"optionalstring
tolerance = "…"optionalstring
type = "…"optionalstring

Children

The following may appear as children:<input> <output>

Parents

This element may appear as an immediate child of the following elements: <activity> <algorithm> <answer> <appendix> <article> <case> <chapter> <claim> <computation> <conclusion> <convention> <corollary> <data> <example> <exercise> <exploration> <fact> <hint> <identity> <insight> <introduction> <investigation> <lemma> <li> <note> <observation> <paragraphs> <problem> <project> <proof> <proposition> <question> <remark> <section> <solution> <statement> <subsection> <subsubsection> <task> <technology> <theorem> <warning>

Examples

Output in LaTeX format

When built for HTML, the contents of the <input> block is presented as a Sage Cell, and upon evaluating, will produce the output in LaTeX format. The contents of the <output> block is a text rendering of the Sage Cell output used only for display in PDF. The next example produces plain (text) output intentionally.

Output in plain (text) format

When executed as a Sage Cell, the output will be a text rendering which one can then copy (and freely edit) into the <output> block for use in producing PDF.

Graphics playground as a Sage Cell

In this example, we create a graphics playground by embedding <sageplot> within a <sage> environment. For producing a fixed image renderable in HTML and PDF, the standalone <sageplot> environment is the better choice.