On Mon, Feb 16, 2009 at 5:32 PM, Alasdair <[email protected]> wrote:
>
> Are there any guidelines or conventions as how this is best to be
> done?  Most examples I've seen just use chunks of verbatim text, as if
> copied and pasted from a console.  But this has the problem that Sage
> output is flush left, and so hard to distinguish visually from Sage
> input.

I like the listings LaTeX package...  Some of my code files at

http://wiki.wstein.org/09/582e/code

start as below:

\documentclass{article}
\usepackage{fullpage}
\usepackage{listings}
\usepackage{color}
\title{Partial Sage Implementation of First Part of Class Group
Algorithm from Stevenhagen's Paper}
\author{William Stein}
\date{February 2, 2009}
\begin{document}
\maketitle
\lstset{language=python}
\lstset{commentstyle=\textit}
\lstset{keywordstyle=\color{blue}\bfseries}
\lstset{showstringspaces=false}
\lstset{frame=trbl}

\begin{lstlisting}[caption=Primes up to a bound]{}
def primes_of_bounded_norm(K, B):
    """
    Return sorted list of the primes up to a given norm B.
    EXAMPLES:
        sage: K.<a> = NumberField(x^2 + 5)
        sage: primes_of_bounded_norm(K, 3)
        [Fractional ideal (2, a + 1), Fractional ideal (3, a + 1),
         Fractional ideal (3, a - 1)]


> I am trying to emulate the notebook interface, with verbatim input in
> boxes, and typeset output.  This does look nicer, but is a royal pain,
> because of the way LaTeX deals with verbatim text.
>
> If anybody has a an easy way - maybe a nice LaTeX style to do this,
> I'd be grateful.  Or is it possible to get Sage to put output say, in
> the middle of the line in a console session, or even in a different
> color, such as Pari/GP does?
>
> Thanks,
> Alasdair
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to