Opened 11 years ago
Closed 11 years ago
#11315 closed defect (fixed)
remove pstricks from default latex preamble
Reported by: | saliola | Owned by: | jason, was |
---|---|---|---|
Priority: | major | Milestone: | sage-4.7.1 |
Component: | graphics | Keywords: | latex, days30 |
Cc: | jhpalmieri | Merged in: | sage-4.7.1.alpha1 |
Authors: | Franco Saliola | Reviewers: | John Palmieri |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
At Sage Days 30 we noticed some problems with trying to view
a
graph using pdflatex on Mac OS X. It seems to be related to having
pstricks loaded as part of the default latex preamble:
! LaTeX Error: You have run the document with pdflatex, but PSTricks requires latex->dvips->ps2pdf or alternatively the use of the package `auto-pst-pdf'. Then you can run `pdflatex -shell-escape <file>' (TeX Live) or `pdflatex -enable-write18 <file>' (MikTeX). See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.3 \begin{document} ?
If you have a Mac, you can test this on the following minimal example. (I have the latest version of MacTeX installed.)
\documentclass{article} \usepackage{pstricks} \begin{document} \begin{center}{\Large\bf SAGE}\end{center} \end{document}
This causes the following example to fail:
sage: g = sage.misc.latex.latex_examples.graph() sage: latex.add_to_preamble(r"\usepackage{tkz-graph}") sage: view(g, pdflatex=True, tightpage=True) ... Latex error
But it works if we remove pstricks from LATEX_HEADER:
sage: LATEX_HEADER = sage.misc.latex.LATEX_HEADER sage: sage.misc.latex.LATEX_HEADER = LATEX_HEADER.replace(r"\usepackage{pstricks}","") sage: view(g, pdflatex=True, tightpage=True)
So, we should remove pstricks from the default latex preamble.
Attachments (1)
Change History (6)
Changed 11 years ago by
comment:1 Changed 11 years ago by
- Status changed from new to needs_review
comment:2 Changed 11 years ago by
- Keywords days30 added
comment:3 Changed 11 years ago by
Thanks, Franco. This patch looks good to me, in principle. But I'm traveling and am not really in a position to fully test, so will not be able to do a review for a while.
Rob
comment:4 Changed 11 years ago by
- Reviewers set to John Palmieri
- Status changed from needs_review to positive_review
Looks good to me, fixes the problem, and passes all tests. I still think we should get rid of "
usepackage{graphicx}" as well, but that can happen another time.
comment:5 Changed 11 years ago by
- Merged in set to sage-4.7.1.alpha1
- Resolution set to fixed
- Status changed from positive_review to closed
I modified the
_repr_
method of the pstricks example to explain that one needs to add the pstricks package to the preamble. This is consistent with how things are done in the othersage.misc.latex.latex_examples
.I also fixed things so that there is a line break following every usepackage in the preamble: