sometimes show just display broken latex

37 views
Skip to first unread message

Kel Chan

unread,
Jul 29, 2020, 12:06:10 PM7/29/20
to sage-support
Hi all,

I'm trying to figure out why show sometimes show doesn't work in Jupyter.
See this screenshot for example.
Screen Shot 2020-07-29 at 11.56.56 AM.png
I'm running 'SageMath version 9.1, Release Date: 2020-05-20' on OSX 10.15.6.
Can someone help me with this? Thanks.

Kel

slelievre

unread,
Jul 29, 2020, 12:39:19 PM7/29/20
to sage-support
Not sure what prevents this from working.

A similar question was asked recently on Ask Sage:

    How to LaTeX the graph of a permutation?

Could you try the following workarounds below,
inspired by the answers to that question?

One solution is to use the optional package slabbe.

The other one is to define:

    def graph_from_permutation(perm):
        ee = [(i+1, perm[i]) for i in range(len(perm))]
        return DiGraph(ee, loops=True)

and then you can do:

    sage: p = Permutation([3, 2])
    sage: g = graph_from_permutation(p)
    sage: show(g)

Or you could define

    def show_permutation(perm):
        ee = [(i+1, perm[i]) for i in range(len(perm))]
        g = DiGraph(ee, loops=True)
        show(g)

and you could directly call

    sage: show_permutation(Permutation([3, 2]))

pedrito...@gmail.com

unread,
Jul 29, 2020, 5:15:02 PM7/29/20
to sage-s...@googlegroups.com
Probably MathJax cannot handle such an expression ... 

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/3bed7ef0-b102-4fb4-813a-42ea9fd2467an%40googlegroups.com.

David Lowry-Duda

unread,
Jul 30, 2020, 11:32:21 AM7/30/20
to sage-s...@googlegroups.com
On Wed, Jul 29, 2020 at 11:14:41PM +0200, pedrito...@gmail.com wrote:
> Probably MathJax cannot handle such an expression ...

Directly inserting the output of `latex(Partition([3,2]))` into
html+mathjax shows the same error, so this appears to produce latex that
mathjax doesn't handle. But I note that it is valid tex and can be
inserted into a regular latex document.

- DLD

--
David Lowry-Duda <da...@lowryduda.com> <davidlowryduda.com>

Kel Chan

unread,
Jul 30, 2020, 11:45:53 AM7/30/20
to sage-s...@googlegroups.com
Thanks. That’s interesting because a few versions back it did work. 
Maybe the generated latex code changed or some extension is missing from mathjax. 

Cheers,
Kel
--
You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/oM3jVh8NzAA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/20200730153213.GA24569%40icerm-dld.
Reply all
Reply to author
Forward
0 new messages