On Fri, Feb 17, 2012 at 12:41:27AM -0800, Anne Schilling wrote:
> Do posets have a latex method? Or can they only be viewed using .show()?

Apparently not:

    sage: P = Posets().example()
    sage: P._latex_
    ...
    AttributeError: 'FiniteSetsOrderedByInclusion_with_category' object has no 
attribute '_latex_'

I have the following in my .sage/init.sage:

    view_std = view
    def view(x, **options):
        options["tightpage"] = True
        options["pdflatex"] = True
        if x in Crystals():
            x = x.digraph()
        if x in Posets().Finite():
            x = x.hasse_diagram()
        if isinstance(x, DiGraph):
            latex_options = {'format': "dot2tex", 
'edge_labels':True,'color_by_label':{1:"blue", 2:"red", 3:"green", 
4:"yellow",-1:"blue", -2:"red", -3:"green",-4:"yellow"}, 'edge_options': lambda 
(u,v,l): {'backward': l is not None and l>0}}
            if x._latex_opts is not None:
                latex_options.update(x._latex_opts._options)
            x = copy(x)
            x.set_latex_options(**latex_options)
        view_std(x, **options)

You might recognize the typical applications :-)

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

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.

Reply via email to