Opened 7 years ago
Closed 6 years ago
#13713 closed defect (fixed)
view: change engine default value from 'latex' to 'pdflatex'
Reported by: | slabbe | Owned by: | tbd |
---|---|---|---|
Priority: | major | Milestone: | sage-5.10 |
Component: | graphics | Keywords: | dot2tex |
Cc: | Merged in: | sage-5.10.beta0 | |
Authors: | Sébastien Labbé | Reviewers: | John Palmieri, Travis Scrimshaw |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
In view
function, the default value for engine argument is 'latex'
. With this value, the compilation is trying (tex -> dvi -> png, and if an exception raised then dvi -> ps -> pdf). For some input, it is broken (example below) because of overfull vbox and overfull hbox created in the first tex -> dvi compilation.
When engine is 'pdflatex'
, the compilation just work.
The purpose of this ticket is to change engine default value from 'latex' to 'pdflatex'.
EXAMPLE::
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 following does the trick:
sage: view(G, engine='pdflatex', tightpage=True)
Apply trac_13713_engine_pdflatex-sl.patch, trac_13713-examples-jhp.patch.
Attachments (2)
Change History (21)
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)
comment:7 follow-up: ↓ 8 Changed 6 years ago by
At first sight, I am also in favor of switching to pdflatex as default engine.
comment:8 in reply to: ↑ 7 Changed 6 years ago by
Replying to nthiery:
At first sight, I am also in favor of switching to pdflatex as default engine.
Sounds okay to me.
comment:9 Changed 6 years ago by
- Description modified (diff)
- Summary changed from view generates a LaTex error on a graph of size 24 to view: change engine default value from 'latex' to 'pdflatex'
comment:10 Changed 6 years ago by
- Description modified (diff)
comment:11 Changed 6 years ago by
- Status changed from new to needs_review
comment:12 Changed 6 years ago by
- Reviewers set to John Palmieri
I'm happy with the main patch. I think it requires some modifications to the documentation in the latex_examples
class, so I've attached a referee patch to deal with that.
Changed 6 years ago by
comment:13 Changed 6 years ago by
For what it's worth, I was getting the "latex error" on just using view with 'latex' after I did some updatings (even doing something as simple as view(2)
). However with the 'pdflatex', things are working again, so I think this is a good switch to make.
comment:14 Changed 6 years ago by
- Component changed from packages: optional to graphics
Don't forget to indicate which patch(es) need to be applied.
comment:15 Changed 6 years ago by
- Description modified (diff)
comment:16 Changed 6 years ago by
There are 5 tests failing on the patchbot, but do not seem related to this ticket :
sage -t sage/interfaces/expect.py # 1 doctest failed sage -t sage/interacts/debugger.py # 8 doctests failed sage -t doc/en/prep/Intro-Tutorial.rst # Killed due to kill signal sage -t sage/modules/free_module_homspace.py # Killed due to kill signal sage -t sage/graphs/generators/world_map.py # Killed due to kill signal
comment:17 Changed 6 years ago by
- Reviewers changed from John Palmieri to John Palmieri, Travis Scrimshaw
- Status changed from needs_review to positive_review
Everything looks good to me.
comment:18 Changed 6 years ago by
- Milestone changed from sage-5.9 to sage-5.10
comment:19 Changed 6 years ago by
- Merged in set to sage-5.10.beta0
- Resolution set to fixed
- Status changed from positive_review to closed
If you run
view(G, debug=True)
, you should get more information about the error.