Opened 7 years ago
Last modified 7 years ago
#13713 closed defect
view generates a LaTex error on a graph of size 24 — at Version 6
Reported by: | slabbe | Owned by: | tbd |
---|---|---|---|
Priority: | major | Milestone: | sage-5.10 |
Component: | graphics | Keywords: | dot2tex |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
Create this graph:
sage: F = GF(3) sage: gens = [matrix(F,2,[1,0, 1,1]), matrix(F,2, [1,1, 0,1])] sage: group = MatrixGroup(gens) sage: G = group.cayley_graph()
It is not too big:
sage: G Digraph on 24 vertices
Note that since the vertices of G are matrices, the default format='tkz_graph'
does not work. One need to use format='dot2tex'
. With dot2tex-2.8.7-2 and graphviz installed, the following work:
sage: G.set_latex_options(format='dot2tex', prog='neato') sage: view(G) sage: G.set_latex_options(format='dot2tex', prog='twopi') sage: view(G) sage: G.set_latex_options(format='dot2tex', prog='fdp') sage: view(G)
But not these ones:
sage: G.set_latex_options(format='dot2tex', prog='dot') sage: view(G) An error occurred. ... LaTex error sage: G.set_latex_options(format='dot2tex', prog='circo') sage: view(G) An error occurred. ... LaTex error
It turns out that the following works:
sage: G.set_latex_options(format='dot2tex', prog='dot') sage: view(G, engine='pdflatex') sage: G.set_latex_options(format='dot2tex', prog='circo') sage: view(G, engine='pdflatex')
The default compilation is trying (tex -> dvi -> png, dvi -> ps -> pdf) and the useless (dvi -> png) conversion is broken because of overfull vbox and overfull hbox created in the first tex -> dvi compilation.
The following does the trick:
sage: view(G, engine='pdflatex', tightpage=True)
Change History (6)
comment:1 follow-up: ↓ 3 Changed 7 years ago by
comment:2 Changed 7 years ago by
- Description modified (diff)
comment:3 in reply to: ↑ 1 Changed 7 years ago by
If you run
view(G, debug=True)
, you should get more information about the error.
In a working example, relevant part of the log is below. So if I understand correctly, the command view is first trying the path tex -> dvi -> png, if some error occurs, then tries dvi -> ps -> pdf. And now I understand why it is so slow when it works::
sage: sage: G.set_latex_options(format='dot2tex', prog='neato') sage: view(G, debug=True) \documentclass{article} ... \begin{document} ... \end{document} ['sage-native-execute', 'latex', '\\nonstopmode', '\\input{sage.tex}'] ['sage-native-execute', 'dvipng', '--picky', '-q', '-T', 'tight', '-D', '150', 'sage.dvi', '-o', 'sage.png'] This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009) entering extended mode LaTeX2e <2009/09/24> Babel ... ... Output written on sage.dvi (1 page, 32420 bytes). Transcript written on sage.log. This is dvipng 1.12 Copyright 2002-2008 Jan-Ake Larsson GPL Ghostscript 8.70: Unrecoverable error, exit code 1 ... GPL Ghostscript 8.70: Unrecoverable error, exit code 1 bad dvi file; running dvips and ps2pdf instead... ['sage-native-execute', 'dvips', 'sage.dvi'] ['sage-native-execute', 'ps2pdf', 'sage.ps'] This is dvips(k) 5.98 Copyright 2009 Radical Eye Software (www.radicaleye.com) ' TeX output 2012.11.16:0002' -> sage.ps ... viewer: "sage-open" sage:
And, now the log of the non working example is below. There are some Overfull vbox and hbox during the latex -> dvi phase so that the next dvi -> png ends with an error and thus does not try "running dvips and ps2pdf instead..." as above :
sage: sage: G.set_latex_options(format='dot2tex', prog='dot') sage: view(G, debug=True) \documentclass{article} ... \begin{document} ... \end{document} ['sage-native-execute', 'latex', '\\nonstopmode', '\\input{sage.tex}'] ['sage-native-execute', 'dvipng', '--picky', '-q', '-T', 'tight', '-D', '150', 'sage.dvi', '-o', 'sage.png'] This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009) entering extended mode LaTeX2e <2009/09/24> Babel ... ... Overfull \hbox (138.51622pt too wide) detected at line 119 [] [1] Overfull \vbox (677.07953pt too high) has occurred while \output is active [2] (./sage.aux) ) (see the transcript file for additional information) Output written on sage.dvi (2 pages, 35212 bytes). Transcript written on sage.log. This is dvipng 1.12 Copyright 2002-2008 Jan-Ake Larsson GPL Ghostscript 8.70: Unrecoverable error, exit code 1 ... GPL Ghostscript 8.70: Unrecoverable error, exit code 1 An error occurred. This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009) (format=latex 2011.4.19) 15 NOV 2012 23:59 entering extended mode ... ... ... ... ... Overfull \hbox (138.51622pt too wide) detected at line 119 [] [] [1] Overfull \vbox (677.07953pt too high) has occurred while \output is active [] ... ... Output written on sage.dvi (2 pages, 35212 bytes). Latex error sage:
comment:4 Changed 7 years ago by
- Summary changed from view generates a LaTex (memory?) error on a graph of size 24 to view generates a LaTex error on a graph of size 24
Okay, it turns out that the default compilation (try : tex -> dvi -> png, except: dvi -> ps -> pdf) which doesn't like overfull vbox and hbox can be changed using the engine
option. Thus,
sage: G.set_latex_options(format='dot2tex', prog='dot') sage: view(G, engine='pdflatex')
and
sage: G.set_latex_options(format='dot2tex', prog='circo') sage: view(G, engine='pdflatex')
both compile fine and give pdf files with clear overfull vbox and hbox. And, one can see the complete graphs by using tightpage=True
:
sage: G.set_latex_options(format='dot2tex', prog='dot') sage: view(G, engine='pdflatex', tightpage=True) sage: G.set_latex_options(format='dot2tex', prog='circo') sage: view(G, engine='pdflatex', tightpage=True)
comment:5 Changed 7 years ago by
So before closing this ticket, I ask the following question:
Why is the default compilation of the command view doing (try : tex -> dvi -> png, except: dvi -> ps -> pdf) ? In which case is it better to do (tex -> dvi -> png) or (tex -> dvi -> ps -> pdf) rather then simply (tex -> pdf) ?
It has been a long time since I have seen pstricks code around here... and I would like
view(G)
to just work.
comment:6 Changed 7 years ago by
- Description modified (diff)
If you run
view(G, debug=True)
, you should get more information about the error.