Skip to content

Troubles in plotting to a postscript file (not to png)

1 message · Paul Murrell

#
Hi

I think the problem is that the viewer you are using for the PS file 
cannot find the ComputerModern fonts that are referenced in the PS file. 
  If you use something like ghostscript to process the file you can see 
this happening ...

[pmur002 at stat18 Temp]$ gs plot_example.ps
ESP Ghostscript 815.02 (2006-04-19)
Copyright (C) 2004 artofcode LLC, Benicia, CA.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Can't find (or can't open) font file 
/usr/share/ghostscript/8.15/Resource/Font/CMR10.
Can't find (or can't open) font file CMR10.
Querying operating system for font files...
Didn't find this font on the system!
Substituting font Courier for CMR10.
<snip>

... and if your viewer is having this problem, it probably solves it in 
the same way, by substituting a different font, which will result in 
missing characters, wrong character widths, etc and produce the sort of 
carnage that you are seeing.

The "ComputerModern" font family and the "TeXtext.enc" encoding are very 
special cases set up for only the PostScript device and designed to be 
used for including a figure in a LaTeX document (see the section on "TeX 
fonts" in the help page ?postscript).  Your plot_example.ps file can be 
used successfully in this way.  For example, if you create the following 
simple latex doc ...

\documentclass{article}
\usepackage{graphicx}
\begin{document}
   \includegraphics{plot_example}
\end{document}

... and process that with ...

latex test.tex

... and then process the resulting .dvi with ...

dvips -o test.ps -j0 test.dvi

... then the resulting postscript file, test.ps, has the fonts all 
correctly embedded and there are no missing characters and no nasty 
overlaps (I can send you the test.ps that I produced directly if you like).

So in summary, the plot_example.ps file is actually correct, for its 
intended use.

It is worth pointing out that other solutions exist for this sort of 
thing, including the cmsyase font (see 
http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html) and the 'tikzDevice' 
package, so depending on what you are trying to do it might be worth 
taking a look at those.

Hope that helps.

Paul
pilchat wrote: