Hi Dan!

I played with sagetex today. That's cool stuff :-)

I have a feature request: an environment where I could use the same
syntax as in usual doctests (without the sage results):

  \begin{sageexample}
      sage: 1 + 1
      sage: def f(x):
      ...       x^2
      sage: f(3)
  \end{sageexample}

And have it typeset with the sage commands in texttt, interspersed
with the Sage outputs, in (display) math mode:

      sage: 1 + 1
                            2

      sage: def f(x):
      ...       x^2
      sage: f(3)
                            9


Here is my current partial implementation:

\newenvironment{sageexample}{%
\def\verba...@processline{\hspace{\sagetexindent}sage: 
\the\verba...@line\[\sage{\the\verbatim@line}\]}%
\verbatim}%
{\endverbatim}

It does not handle the sage: / ... line prefixes. Those should
probably be passed down to sage + sagetex.py and handled there,
reusing the doctest infrastructure.


Oh, and by the way, another dream feature would be a
\sageinert{diff(sin(x),x)} which would typeset an inert version of the
given formula, without evaluating it. A typical use case would be to
get nicely typeset equations like:

        \sageinert{diff(sin(x),x)} = \sage{diff(sin(x),x)}

But I don't know how feasible or even meaningful this would currently
be. For the record, MuPAD had such a mechanism which was used for
typesetting formulas in the documentation.

Cheers,
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to