I just made a new installation of Sage, and was getting some errors in
SageTeX. The TeX file contains:

\documentclass{article}

\usepackage{sagetex}

\begin{document}
$2+2$ is $\sage{2+2}$.
\end{document}

pdflatex runs without error, but when running Sage on the .sage file I get
the following exceptions:

Processing Sage code for sttest.tex...
Inline formula 0

**** Error in Sage code on line 6 of sttest.tex! Traceback follows.
Traceback (most recent call last):
  File "sttest.py", line 7, in <module>
    _st_.inline(_sage_const_0 , _sage_const_2 +_sage_const_2 )
  File
"/home/sageuser/sage-4.6.1/local/lib/python2.6/site-packages/sagetex.py",
line 73, in inline
    s.rstrip() + '}{}{}{}{}}\n')
  File "element.pyx", line 306, in
sage.structure.element.Element.__getattr__ (sage/structure/element.c:2666)
  File "parent.pyx", line 272, in
sage.structure.parent.getattr_from_other_class
(sage/structure/parent.c:2840)
  File "parent.pyx", line 170, in
sage.structure.parent.raise_attribute_error (sage/structure/parent.c:2611)
AttributeError: 'sage.rings.integer.Integer' object has no attribute
'rstrip'

The offending code in sagetex.py is:

  def inline(self, counter, s):
    self.progress('Inline formula {0}'.format(counter))
    self.souttmp.write('\\newlabel{@sageinline' + str(counter) + '}{{%\n' +
                 s.rstrip() + '}{}{}{}{}}\n')          # <<<<<<<<<<<<<<<<
s is not a string, can be any sage object here

I changed this to:

  def inline(self, counter, s):
    self.progress('Inline formula {0}'.format(counter))
    self.souttmp.write('\\newlabel{@sageinline' + str(counter) + '}{{%\n' +
                 latex(s).rstrip() + '}{}{}{}{}}\n')

And it works correctly. The versions I'm using are sage 4.6.1, and sagetex
[2010/03/25 v2.2.5 embedding Sage into LaTeX documents]

I downloaded both today, and followed the "recommended" method for
installing SageTex

-- 
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
URL: http://www.sagemath.org

Reply via email to