2

This question follows on from a prior question but is separate and can stand alone.

The prior question is at pst-plot graph offset on page when graph has non-zero origin.

This question is related to conversion of dvi to ps and subsequent inclusion of that ps in latex.

For example:

1) The code below is run through latex and dvi output is produced.

\documentclass[pstricks,border=2mm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pst-plot}

\begin{document}

\readdata{\OPA}{transferCharacteristics.txt}
\readdata{\OPB}{transferCharacteristics2.txt}
\readdata{\OPC}{transferCharacteristics3.txt}
\readdata{\OPD}{transferCharacteristics4.txt}

\pslegend[lt]{\black\rule[1ex]{2em}{1pt} & 10~V\\
\red\rule[1ex]{2em}{1pt} & 30~V\\
\green\rule[1ex]{2em}{1pt} & 50~V\\
\blue\rule[1ex]{2em}{1pt} & 70~V}

\psset{llx=-1.5cm,lly=-1cm, xAxisLabel={$V_{\mathrm{BE}}$ [V]}, xAxisLabelPos={c,-0.3in}, yAxisLabel={$I_\mathrm{C}$ [A]}, yAxisLabelPos={-0.5in,c},ury=0.0cm,urx=0cm}

\begin{psgraph}[axesstyle=axes,xticksize=0 0.20,yticksize=0 0.30, subticks=0, Dx=0.1, Dy=0.02, Oy=0, Ox=0.5](0.5,0)(0.5,0)(0.801,0.201){6cm}{5cm}
\listplot[linecolor=black,linewidth=1pt]{\OPA}
\listplot[linecolor=red,linewidth=1pt]{\OPB}
\listplot[linecolor=green,linewidth=1pt]{\OPC} 
\listplot[linecolor=blue,linewidth=1pt]{\OPD}
\end{psgraph}

\end{document}

2) DVIPS is used to convert the dvi output to postscript using

dvips -o test.ps test.dvi 

at the command line. Viewing test.ps in Okular or similar looks similar to

http://www.iceamplifiers.co.uk/randomstuff/DVIPSweird/test.png

There's a lot of white space (well transparent actually) and the image is upside down and mirrored. The image should, in my view, look like

http://www.iceamplifiers.co.uk/randomstuff/DVIPSweird/test.png
(source: iceamplifiers.co.uk)

which was produced by converting the dvi to the ps (above!) then converting the ps to pdf then converting the pdf to png (for web use).

Unsurprisingly using the ps in a latex document does not produce the desired result. Also unsurprisingly using the pdf that was generated from the ps in a pdflatex document works fine.

I'm not too worried about using latex over pdflatex or vice versa but I would like to know how the ps to pdf conversion stage manages to get the right looking picture in the pdf file and how I can make the ps file look like the pdf.

All files available from http://www.iceamplifiers.co.uk/randomstuff/DVIPSweird/.

1 Answer 1

2

It makes no sense to view the dvi output. It cannot show rotations and also sometimes not the correct image size. Use always the pdf output which should be upside down and cropped.

latex <file>
dvips -o <file>.ps <file>
ps2pdf -dAutoRotatePages=/None <file>.ps

However, the easiest way is to run xelatex, it does the conversion process in the background. But it needs a ghostscript version not younger than 9.10

2
  • The output I'm showing in the first image in the question is the ps output, is that the same as viewing the dvi output? By what method could I use latex and include the image as eps (just for curiosity)? Oct 8, 2014 at 16:32
  • no, the ps output should be correct. But sometimes the viewers which uses ghostscript are too clever and rotate images where they shouldn't. If you want to be on the safe side use always the pdf output.
    – user2478
    Oct 8, 2014 at 16:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .