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

Adding a save method to class Standalone/TikzPicture for compatibility with sagetex #35394

Merged
merged 8 commits into from
Apr 6, 2023

Conversation

seblabbe
Copy link
Contributor

We add a save method to class Standalone/TikzPicture for compatibility with sagetex. In particular, so that \sageplot{t} works when t is an instance of Standalone/TikzPicture classes.

For example the following file.tex:

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{sagetex}
\begin{document}
\begin{sagecommandline}
sage: from sage.misc.latex_standalone import TikzPicture
sage: V = [[1,0,1],[1,0,0],[1,1,0],[0,0,-1],[0,1,0],
....:      [-1,0,0],[0,1,1],[0,0,1],[0,-1,0]]
sage: P = Polyhedron(vertices=V).polar()
sage: s = P.projection().tikz([674,108,-731],112, output_type='LatexExpr')
sage: t = TikzPicture(s)
\end{sagecommandline}
\begin{center}
    \sageplot{t}
\end{center}
\end{document}

will compile fine with the commands:

pdflatex file.tex
sage file.sagetex.sage
pdflatex file.tex

provided the sagetex.sty file is in the same repository.

Since sagetex creates by defaults eps and pdf images, we added methods dvi and eps to the class Standalone following what was done in the other methods. Also, we added a feature dvips to tag the doctests with this new external feature. Finally, we made a small improvement to the latex feature by providing more information in the reason why a latex feature does not work.

  • The title is concise, informative, and self-explanatory.
  • 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 accordingly.

@fchapoton
Copy link
Contributor

one failing doctest, see the checks

@seblabbe
Copy link
Contributor Author

the log of the build of the pdf finishes with:

2023-03-31T02:21:58.1267892Z [sagemath_doc_pdf-none]   Citation `../references/index:yip2018' on page 2786 undefined on input line 283001
2023-03-31T02:21:58.1269333Z [sagemath_doc_pdf-none]   Citation `../references/index:zei2011' on page 3729 undefined on input line 379261
2023-03-31T02:21:58.1270141Z [sagemath_doc_pdf-none] Rule 'pdflatex': File changes, etc:
2023-03-31T02:21:58.1271492Z [sagemath_doc_pdf-none]    Changed files, or newly in use since previous run(s):
2023-03-31T02:21:58.1272123Z [sagemath_doc_pdf-none]       '/root/.texlive2019/texmf-var/web2c/pdftex/pdflatex.fmt'
2023-03-31T02:21:58.1273534Z [sagemath_doc_pdf-none] Latexmk: Maximum runs of pdflatex reached without getting stable files
2023-03-31T02:21:58.1274169Z [sagemath_doc_pdf-none] Latexmk: Summary of warnings from last run of *latex:
2023-03-31T02:21:58.1275531Z [sagemath_doc_pdf-none]   =====Latex reported missing or unavailable character(s).
2023-03-31T02:21:58.1276081Z [sagemath_doc_pdf-none] =====See log file for details.
2023-03-31T02:21:58.1277545Z [sagemath_doc_pdf-none]   Latex failed to resolve 999 citation(s)
2023-03-31T02:21:58.1278494Z [sagemath_doc_pdf-none] ----------------------
2023-03-31T02:21:58.1336198Z [sagemath_doc_pdf-none] This message may duplicate earlier message.
2023-03-31T02:21:58.1336751Z [sagemath_doc_pdf-none] Latexmk: Failure in processing file 'combinat.tex':
2023-03-31T02:21:58.1337407Z [sagemath_doc_pdf-none]    'pdflatex' needed too many passes
2023-03-31T02:21:58.1337800Z [sagemath_doc_pdf-none] ----------------------
2023-03-31T02:21:58.1338276Z [sagemath_doc_pdf-none] Latexmk: Use the -f option to force complete processing,
2023-03-31T02:21:58.1338834Z [sagemath_doc_pdf-none]  unless error was exceeding maximum runs, or warnings treated as errors.
2023-03-31T02:21:58.1339075Z [sagemath_doc_pdf-none] Latexmk: Examining 'combinat.log'
2023-03-31T02:21:58.1339445Z [sagemath_doc_pdf-none] === TeX engine is 'pdfTeX'
2023-03-31T02:21:58.1339928Z [sagemath_doc_pdf-none] Latexmk: applying rule 'pdflatex'...
2023-03-31T02:21:58.1340188Z [sagemath_doc_pdf-none] Latexmk: All targets (combinat.pdf) are up-to-date
2023-03-31T02:21:58.1365398Z [sagemath_doc_pdf-none] make[5]: *** [Makefile:29: combinat.pdf] Error 12
2023-03-31T02:21:58.1366819Z [sagemath_doc_pdf-none] Error building the documentation.
2023-03-31T02:21:58.1368703Z [sagemath_doc_pdf-none] Traceback (most recent call last):
2023-03-31T02:21:58.1369365Z [sagemath_doc_pdf-none]   File "<frozen runpy>", line 198, in _run_module_as_main
2023-03-31T02:21:58.1413800Z [sagemath_doc_pdf-none]   File "<frozen runpy>", line 88, in _run_code
2023-03-31T02:21:58.1414178Z [sagemath_doc_pdf-none]   File "/__w/sage/sage/pkgs/sage-docbuild/sage_docbuild/__main__.py", line 498, in <module>
2023-03-31T02:21:58.1417874Z [sagemath_doc_pdf-none]     sys.exit(main())
2023-03-31T02:21:58.1421097Z [sagemath_doc_pdf-none]              ^^^^^^
2023-03-31T02:21:58.1424150Z [sagemath_doc_pdf-none]   File "/__w/sage/sage/pkgs/sage-docbuild/sage_docbuild/__main__.py", line 495, in main
2023-03-31T02:21:58.1426458Z [sagemath_doc_pdf-none]     builder()
2023-03-31T02:21:58.1429153Z [sagemath_doc_pdf-none]   File "/__w/sage/sage/pkgs/sage-docbuild/sage_docbuild/builders.py", line 300, in pdf
2023-03-31T02:21:58.1431931Z [sagemath_doc_pdf-none]     raise RuntimeError(error_message % (command, tex_dir))
2023-03-31T02:21:58.1434952Z [sagemath_doc_pdf-none] RuntimeError: failed to run $MAKE all-pdf in /sage/local/share/doc/sage/latex/en/reference/combinat
2023-03-31T02:21:58.1437658Z [sagemath_doc_pdf-none] 
2023-03-31T02:21:58.1440585Z [sagemath_doc_pdf-none]     Note: incremental documentation builds sometimes cause spurious
2023-03-31T02:21:58.1443212Z [sagemath_doc_pdf-none]     error messages. To be certain that these are real errors, run
2023-03-31T02:21:58.1445829Z [sagemath_doc_pdf-none]     "make doc-clean doc-uninstall" first and try again.
2023-03-31T02:22:08.5659519Z [sagemath_doc_pdf-none] make[4]: *** [Makefile:69: doc-pdf--reference-combinat] Error 1
2023-03-31T02:22:08.5703005Z [sagemath_doc_pdf-none] make[3]: *** [Makefile:78: doc-pdf-reference] Error 2
2023-03-31T02:22:08.5707125Z [sagemath_doc_pdf-none] make[3]: *** Waiting for unfinished jobs....
2023-03-31T02:22:12.5926901Z make[2]: *** [Makefile:3323: sagemath_doc_pdf-SAGE_DOCS-no-deps] Error 2
2023-03-31T02:22:12.7399250Z make[1]: *** [Makefile:3323: /sage/local/var/lib/sage/installed/sagemath_doc_pdf-none] Error 2

Is the PR responsible of that?

@fchapoton
Copy link
Contributor

It seems that the pdf doc build is also broken on many other recent pull requests.

@seblabbe
Copy link
Contributor Author

ok

@seblabbe
Copy link
Contributor Author

so what happens in this situation?

@seblabbe seblabbe requested a review from fchapoton April 4, 2023 13:23
Copy link
Contributor

@fchapoton fchapoton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, c'est correct

@vbraun vbraun merged commit 3d5a754 into sagemath:develop Apr 6, 2023
@mkoeppe mkoeppe added this to the sage-10.0 milestone Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants