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

Add sage.misc.latex.pdf to save the image of objects to pdf #38339

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

kwankyu
Copy link
Collaborator

@kwankyu kwankyu commented Jul 8, 2024

Thus

sage: from sage.misc.latex import pdf
sage: pdf(pi, 'test.pdf')

works. This is a companion to the existing sage.misc.latex.png, which saves png image of objects. Of course, pdf image is scalable and hence more suitable for inclusion into latex documents.

Also make view() more robust by cleaning up the temporary file after waiting for a few seconds, which is enough time for the viewer to open. For example,

sage: view(pi)  # show pi

which sometimes fails because the temporary file is removed before the viewer opens the file: https://groups.google.com/g/sage-support/c/YfyaZxc8Z6k

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@kwankyu kwankyu changed the title Add pdf() Add sage.misc.latex.pdf to save sage objects to pdf file Jul 8, 2024
Copy link

github-actions bot commented Jul 8, 2024

Documentation preview for this PR (built with commit 5a94a77; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@kwankyu kwankyu changed the title Add sage.misc.latex.pdf to save sage objects to pdf file Add sage.misc.latex.pdf to save the pdf image of objects Jul 8, 2024
@kwankyu kwankyu changed the title Add sage.misc.latex.pdf to save the pdf image of objects Add sage.misc.latex.pdf to save the image of objects to pdf Jul 8, 2024
@kwankyu kwankyu marked this pull request as ready for review July 8, 2024 12:54
@mkoeppe mkoeppe requested a review from seblabbe July 10, 2024 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants