Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with view on MacOS #38745

Open
2 tasks done
anneschilling opened this issue Sep 30, 2024 · 8 comments · May be fixed by #38759 or #38764
Open
2 tasks done

Problem with view on MacOS #38745

anneschilling opened this issue Sep 30, 2024 · 8 comments · May be fixed by #38759 or #38764

Comments

@anneschilling
Copy link

Steps To Reproduce

On MacOS 15.0 with SageMath built from source (version 10.5.beta2) and ticket #38339 applied and also on MacOS 10.15.7 installed with Conda (version 10.5.beta2) the following commands:

sage: B = crystals.Tableaux(['B',2],shape=[1])
sage: view(B)

produce a pdf where most of the picture is missing.

Expected Behavior

The expected behavior is that the full crystal 1 -1-> 2 -2-> 0 -2-> -2 -1-> -1 appears in the pdf.

Actual Behavior

Only -1-> -1 appears in the pdf.
sage.pdf

Additional Information

No response

Environment

  • OS: MacOS 15.0 and also MacOS 10.15.7
  • Sage Version: 10.5.beta2

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
@seblabbe
Copy link
Contributor

seblabbe commented Oct 3, 2024

Bonjour Anne,

Can you tell me if the following works better?

sage: B = crystals.Tableaux(['B',2],shape=[1])
sage: from sage.misc.latex_standalone import TikzPicture
sage: t = TikzPicture(B._latex_())
sage: t.pdf()
'/tmp/tmpmkwx1dh_/tikz_itohmrqj.pdf'

I was myself very disapointed with the view command a few years ago. My opinion is that using object oriented programming works better than a global function like view. I spent a long time writing and improving the class TikzPicture inside my slabbe package so that it matches how I do research and it is now in SageMath since 2 or 3 years, but which could be used a bit more within SageMath. See documentation here: https://doc.sagemath.org/html/en/reference/misc/sage/misc/latex_standalone.html

It can even be used with sagetex as follows:

\begin{sagesilent}
sage: B = crystals.Tableaux(['B',2],shape=[1])
sage: from sage.misc.latex_standalone import TikzPicture
sage: tikz = TikzPicture(B._latex_(), standalone_config=["border=4mm"])
\end{sagesilent}

\begin{center}
        \sageplot[scale=.5][pdf]{tikz}
\end{center}

Years ago, I was also having an issue with the border when using view on Mac. I fixed it by allowing the possibility of providing config options from the latex standalone package. For instance, the following is from the doc:

      sage: g = graphs.PetersenGraph()
      sage: s = latex(g)
      sage: t = TikzPicture(s, standalone_config=["border=4mm"], usepackage=['tkz-graph'])
      sage: _ = t.pdf(view=False)               # long time

Also, you may check that I give a default border of 4mm in the code of TikzPicture.from_graph exactly to fix an issue I was having on Mac only.

I would suggest to add a new method tikz to the class Tableaux so that one could now do:

sage: B = crystals.Tableaux(['B',2],shape=[1])
sage: t = T.tikz()
sage: t.pdf()
'/tmp/tmpmkwx1dh_/tikz_itohmrqj.pdf'

If you wish, I may create a pull request about that shortly.

@anneschilling
Copy link
Author

Bonjour Sebastien!

Yes, thank you, your suggestions work great for me (except that after the t.pdf() command sage hangs and the prompt does not reappear).

@kwankyu
Copy link
Collaborator

kwankyu commented Oct 4, 2024

For me, your command

sage: B = crystals.Tableaux(['B',2],shape=[1])
sage: view(B)

runs latex and the latex fails. Hence no image is produced at all.

I wonder how you got your (deficient) image.

Anyway I investigated the latex code produced for B. It has indeed problems. My latex engine cannot swallow the code.

With more work, I got this:

sage2.pdf

Is this want you expect to see?

@kwankyu kwankyu linked a pull request Oct 4, 2024 that will close this issue
5 tasks
@tscrim
Copy link
Collaborator

tscrim commented Oct 4, 2024

@kwankyu We typically use the dot2tex optional Sage package (coupled with a system install of graphviz) for drawing the crystal graphs. Do you know offhand if a system install of dot2tex (instead of the Sage package) will then perform in the same way?

@anneschilling Is the dot2tex package installed? Does installing it produce the crystal graphs as expected?

Of course, there issue here that still needs to be fixed, independent of dot2tex being installed or not.

@kwankyu
Copy link
Collaborator

kwankyu commented Oct 4, 2024

I have no idea about dot2tex. I don't know it.

@anneschilling
Copy link
Author

@kwankyu We typically use the dot2tex optional Sage package (coupled with a system install of graphviz) for drawing the crystal graphs. Do you know offhand if a system install of dot2tex (instead of the Sage package) will then perform in the same way?

@anneschilling Is the dot2tex package installed? Does installing it produce the crystal graphs as expected?

Of course, there issue here that still needs to be fixed, independent of dot2tex being installed or not.

Hi Travis,

yes, I installed dot2tex before running view. Sebastien has a fix to my problem, see #38759.

Best wishes,

Anne

@tscrim
Copy link
Collaborator

tscrim commented Oct 6, 2024

@anneschilling Thank you for the clarification. Will you be reviewing #38759?

@anneschilling
Copy link
Author

@anneschilling Thank you for the clarification. Will you be reviewing #38759?

@tscrim I was planning to, but now I am having trouble compiling sage again, so I need to figure out why. Also, I have to fold in #38339, otherwise the view command did not work either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants