I have one followup comment, to item 2 below. On Apr 6, 3:11 pm, "William Stein" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm forwarding (with permission) John's questions and comments about > the sage programming > guide here. I hope somebody can answer them. > > -- William > > ---------- Forwarded message ---------- > From: John Palmieri <[EMAIL PROTECTED]> > Date: Sat, Apr 5, 2008 at 6:41 PM > Subject: Sage documentation: programming guide, sections 2.7.1 and 2.7.2 > To: [EMAIL PROTECTED] > > Hi William, > > For what it's worth, I'm using Sage 2.11 on Mac OS X 10.5.2. > > I have a comment on the Sage Programming Guide, sections 2.7.1 and 2.7.2: > > Section 2.7.1 is confusing me, and I think it has a typo. > > 1. Item 5 says "You can use any macros included in amsmath, amssymb, > amsfonts or the ones defined in SAGE_ROOT/doc/commontex/macros.tex." > However, I tried to use \textup{} and got an error message, saying > "Unknown control sequence '\textup' ". Note that \textup is defined > in amsmath. (I can use \text instead, but that's not exactly > equivalent to \textup.) > > 2. Item 6 says "Use view(x) to view the typeset version of an object > x", yet the example template uses latex(a) rather than view(a). When > I try latex(a), I get an error: > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/Users/palmieri/.sage/sage_notebook/worksheets/admin/10/code/5.py", > line 404, in <module> > latex(z) > File > "/Applications/sage/local/lib/python2.5/site-packages/sympy/plotting/", > line 1, in <module> > > TypeError: 'module' object is not callable > > view(a) and a._latex_() work, though. Should "latex(a)" be changed to > "view(a)"?
A bit more information: it seems that if I include the line "import sage.misc.latex as latex" in my file, then "latex(a)" gives an error. If I don't include it, "latex(a)" works fine, producing output like '\text{Sq}(1,2,3)'. A little more detail: suppose I use "attach test", and "test.py" does not include this line. Then everything works fine. If I add the line, then it breaks. If I then remove the line, it remains broken. > 3. Also, the last line of the template is > > return `\\frac{%s}{%s}''%(latex(self.numer), latex(self.denom)) > > When I tried cutting and pasting this, I got errors; I needed to > change some of the quote marks. > > 4. In Section 2.7.2, I am inferring that if I have a _repr_ method but > no __repr__ method, then Sage will use _repr_ when printing my object. > But I've tried defining a class with a _repr_ method but no __repr__ > method, and it doesn't print nicely: if I say > > sage: a = milnor_mono([1,2]) # for class milnor_mono, no __repr__ > method, only _repr_ > sage: a > <__main__.milnor_mono instance at 0x76bddc8> # this is not what I want! > sage: a._repr_() > 'Sq(1,2)' > sage: b = milnor([[1,2]]) # have both __repr__ and _repr_ > sage: b > Sq(1,2) > > Thanks, > John > > -- > J. H. Palmieri > Associate Professor of Mathematics University of Washington > Box 354350, Seattle, WA 98195-4350 [EMAIL PROTECTED] > http://www.math.washington.edu/~palmieri/ > > -- > William Stein > Associate Professor of Mathematics > University of Washington > http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---