Fidel wrote:
> Hello,
> 
> I'm running Sage Version 3.4.1 on ubuntu 8.04.
> 
> I'm trying to implement latex(G) for a graph G. After creating my own
> branch to work in I executed the command
> 
> sage -b
> 
> to build the library and got no errors.
> 
> Within the latex(G) procedure I have this fragment of code
> 
> for u in self:
>                 # then specify the color of the label
>                 s = s + '\color{' + color_names[ color_names[ u ] ] +
> '}{'
>                 if vertex_math:
>                     s = s+'$'
>                 s = s+str(latex(u))
>                 if vertex_math:
>                     s = s+'$'
>                 s = s+'},\n'
> 
> As you can observe, the function latex(u) is used, where u is a
> vertex, and this is what I get in sage
> 
> sage: G=graphs.PetersenGraph()
> sage: latex(G)
> ---------------------------------------------------------------------------
> NameError                                 Traceback (most recent call
> last)
> 
> /home/fidel/<ipython console> in <module>()
> 
> /opt/sage-3.4.1/local/lib/python2.5/site-packages/sage/misc/latex.pyc
> in latex(x)
>     138 def latex(x):
>     139     if hasattr(x, '_latex_'):
> --> 140         return LatexExpr(x._latex_())
>     141
>     142     for k, f in latex_table.iteritems():
> 
> /opt/sage-3.4.1/local/lib/python2.5/site-packages/sage/graphs/
> graph.pyc in _latex_(self, layout, bb, units, prefix, vertex_math,
> style, vertex_color, edge_color, label_color, labels)
>     778                 if vertex_math:
>     779                     s = s+'$'
> --> 780                 s = s+str(latex(u))
>     781                 if vertex_math:
>     782                     s = s+'$'
> 
> NameError: global name 'latex' is not defined
> 
> Is there a package I should import to avoid getting this message?
> 

Yes:

sage: search_src('import', 'latex')
categories/category.py:from sage.misc.latex import latex
combinat/output.py:from sage.misc.latex import latex

[snip]

So apparently it's:

from sage.misc.latex import latex


Jason


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

Reply via email to