latex(g) is returning a tikzpicture string with command defined in tkz-graph.sty, so it is necessary to have it available in order to compile the pdf.
There is a feature in sage testing the presence of tkz-graph.sty: sage: from sage.features.latex import LaTeXPackage sage: LaTeXPackage("tkz-graph").is_present() FeatureTestResult('latex_package_tkz_graph', True) It seems tkz-graph.sty is not in the CTAN since 2020 though, maybe that is why you don't have it?: https://tex.stackexchange.com/questions/547173/texlive-2020-how-to-deal-with-tikz-berge-and-tikz-kiviat-packages-that-were-rem On Thursday, September 29, 2022 at 7:17:49 AM UTC+2 David Coudert wrote: > The command t.pdf() is not working for me for the following reason: > ---- > Warning: `tkz-graph.sty` is not part of this computer's TeX installation. > This package is required to render graphs in LaTeX. > Visit 'https://www.ctan.org/pkg/tkz-graph'. > > Warning: `tkz-berge.sty` is not part of this computer's TeX installation. > This package is required to render graphs in LaTeX. > Visit 'https://www.ctan.org/pkg/tkz-berge'. > ---- > > On Wednesday, September 28, 2022 at 10:56:29 AM UTC+2 Sébastien Labbé > wrote: > >> With the new latex_standalone.py module in sage misc, you have access to >> more control on the options to construct a tikzpicture within a latex file >> with standalone document class. See the documentation here: >> >> https://doc.sagemath.org/html/en/reference/misc/sage/misc/latex_standalone.html >> >> I am curious that you test whether the following example taken from the >> above documentation works for you: >> >> g = graphs.PetersenGraph() >> s = latex(g) >> from sage.misc.latex_standalone import TikzPicture >> t = TikzPicture(s, standalone_config=["border=4mm"], usepackage=[ >> 'tkz-graph']) >> t >> t.pdf() >> >> >> On Tuesday, September 27, 2022 at 9:16:03 PM UTC+2 Ben Salisbury wrote: >> >>> Hi all, >>> >>> I'm having trouble with the view method. For example, >>> >>> sage: G = graphs.PetersenGraph() >>> sage: view(G) >>> >>> produced the following error. >>> >>> An error occurred. >>> This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) >>> (preloaded format=pdflatex 2022.9.9) 17 SEP 2022 18:58 >>> entering extended mode >>> restricted \write18 enabled. >>> %&-line parsing enabled. >>> **\nonstopmode \input{sage.tex} >>> (./sage.tex >>> (/usr/local/texlive/2022/texmf-dist/tex/latex/base/article.cls >>> Document Class: article 2021/10/04 v1.4n Standard LaTeX document class >>> (/usr/local/texlive/2022/texmf-dist/tex/latex/base/size10.clo >>> File: size10.clo 2021/10/04 v1.4n Standard LaTeX file (size option) >>> ) >>> \c@part=\count185 >>> \c@section=\count186 >>> \c@subsection=\count187 >>> \c@subsubsection=\count188 >>> \c@paragraph=\count189 >>> \c@subparagraph=\count190 >>> \c@figure=\count191 >>> \c@table=\count192 >>> \abovecaptionskip=\skip47 >>> \belowcaptionskip=\skip48 >>> \bibindent=\dimen138 >>> ) >>> (/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsmath.sty >>> Package: amsmath 2021/10/15 v2.17l AMS math features >>> \@mathmargin=\skip49 >>> >>> <snip> >>> >>> ! Undefined control sequence. >>> \@outputpage ...istfalse \@parboxrestore \shipout >>> \vbox >>> {\set@typeset@protec... >>> l.118 \end{document} >>> >>> (That makes 100 errors; please try again.) >>> Here is how much of TeX's memory you used: >>> 17546 strings out of 478268 >>> 364860 string characters out of 5846348 >>> 670991 words of memory out of 5000000 >>> 35436 multiletter control sequences out of 15000+600000 >>> 472216 words of font info for 40 fonts, out of 8000000 for 9000 >>> 1141 hyphenation exceptions out of 8191 >>> 94i,9n,104p,428b,907s stack positions out of >>> 10000i,1000n,20000p,200000b,200000s >>> >>> ! ==> Fatal error occurred, no output PDF file produced! >>> >>> Latex error >>> >>> Is there a known error or is my installation messed up (or something >>> else)? >>> >>> Best, >>> Ben >>> >> -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/8e5248d9-1d66-4b8d-a4d1-3a86f6220f3an%40googlegroups.com.