[pstricks] latex->dvips->ps2pdf->pdflatex

David Arnold dwarnold45 at suddenlink.net
Wed Jun 24 18:27:58 CEST 2009


Herbert et al,

I am afraid I just don't understand what is going on with this  
psgraph. I've cleaned this up:

\documentclass[12pt]{article}

\usepackage{pst-bar}
\usepackage{pst-plot}
\usepackage{pst-tree}
\usepackage{pstricks-add}
\usepackage{filecontents}

\begin{document}

The following bar chart show the average price (in cents) of one  
gallon of regular gasoline in the United States over five consecutive  
weeks in 2009, running from May 18 through June 22.

\begin{filecontents*}{GasolinePrices.csv}
5/18, 5/25, 6/1, 6/15, 6/22
230, 243, 252, 267, 269
\end{filecontents*}

\psset{xAxisLabel={Date (2009)},xAxisLabelPos={c,-0.3in},
      yAxisLabel={PPG Regular Gasoline},yAxisLabelPos={-0.5in,c}}
\begin{psgraph} 
[axesstyle=frame,ticks=y,labels=y,Dy=10,Oy=220,yticksize=0 5](0,0) 
(5,60){5cm}{4cm}
\readpsbardata[header=true]{\data}{GasolinePrices.csv}
\psbarscale(1){220 sub}
\psbarchart[barstyle=blue]{\data}
\end{psgraph}

What was the price (in cents) of one gallon of regular gasoline on  
June 1, 2009?

\end{document}

Now, if I run latex --shell-escape on this file, it compiles fine. But  
if I change the preamble:

\usepackage{pst-pdf}
\\usepackage{pst-bar}
\usepackage{pst-plot}
\usepackage{pst-tree}
\usepackage{pstricks-add}
\usepackage{filecontents}

Then I get this error when running latex --shell-escape:

Runaway argument?
{0,0})({5,60})\pr at endbox {5cm}{4cm} \readpsbardata [header=true]{\data  
\ETC.
! Paragraph ended before \psgraph at ii was complete.
<to be read again>
                    \par
l.26

If I change the preamble again:

\usepackage{pst-pdf}
\usepackage{pst-bar}
\usepackage{pst-plot}
\usepackage{pst-tree}
\usepackage{pstricks-add}

\usepackage{preview}
\PreviewEnvironment{psgraph}

\usepackage{filecontents}


Then each of these works:

latex --shell-escape HerbertPSGraph.tex
dvips -o HerbertPSGraph-pics.ps HerbertPSGraph.dvi
ps2pdf HerbertPSGraph-pics.ps

But when I follow these three with:

pdflatex --shell-escape HerbertPSGraph.tex

I get this error:

<HerbertPSGraph-pics.pdf, id=2, page=1, 143.26523pt x 114.81895pt>
<use HerbertPSGraph-pics.pdf, page 1>
! Too many }'s.
\psgraph ...{#1}\else \Addto at Envbody {#1\end {#2}}
                                                   \fi \process at envbody
l.29 \end{psgraph}


I absolutely don't understand what is going on. We have a script in  
our testing system that works just fine on files with this preamble:

\usepackage{pst-pdf}
\usepackage{pst-bar}
\usepackage{pst-plot}
\usepackage{pst-tree}
\usepackage{pstricks-add}
\usepackage{filecontents}

Relevant part of our perl script:

     system "latex --shell-escape $testbank.tex";
     system "dvips -o $testbank-pics.ps $testbank.dvi";
     system "ps2pdf -dAutoRotatePages=/None $testbank-pics.ps  
$testbank-pics.pdf";
     system "pdflatex $testbank.tex";
     system "rm $testbank.dvi $testbank-pics.ps $testbank.aux";
     system "open $testbank.pdf";

But as soon as I try to use the psgraph environment, things blow up as  
described above.

Please don't overestimate my ability or understanding of pst-pdf. We  
just played around til we got something to work. I have no deep  
understanding of what is going on in the background.

Any help appreciated.

David.


More information about the PSTricks mailing list