Opened 10 years ago

Closed 10 years ago

# remove pstricks from default latex preamble

Reported by: Owned by: saliola jason, was major sage-4.7.1 graphics latex, days30 jhpalmieri sage-4.7.1.alpha1 Franco Saliola John Palmieri N/A

### 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: 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: view(g, pdflatex=True, tightpage=True)


So, we should remove pstricks from the default latex preamble.

### comment:1 Changed 10 years ago by saliola

• Status changed from new to needs_review

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 other sage.misc.latex.latex_examples.

I also fixed things so that there is a line break following every usepackage in the preamble:

sage: print sage.misc.latex.COMMON_HEADER
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\pagestyle{empty}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\pagestyle{empty}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\oddsidemargin 0.0in
\evensidemargin 0.0in
\textwidth 6.45in
\topmargin 0.0in
\textheight 9.0in

\documentclass[a0,8pt]{beamer}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\pagestyle{empty}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\textwidth=1.1\textwidth
\textheight=2\textheight
`

### comment:3 Changed 10 years ago by rbeezer

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 10 years ago by jhpalmieri

• 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 10 years ago by jdemeyer

• Merged in set to sage-4.7.1.alpha1
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.