[pdftex] pdflatex and gnuplot and type-1 fonts

Allin Cottrell cottrell at wfu.edu
Sun Aug 12 12:07:46 CEST 2001

On Sat, 11 Aug 2001, Kevin E. Cahill wrote:

> Actually, now the ps file does not work, but since my old way
> worked for it, I can revert to that for the ps file.
> Xdvi displays the figures with a big rectangle drawn around them;
> xdvi also complains...  "cannot find PS file `1A1S.ps'"

Sorry, there was an error in the script I posted.  Here's a corrected
version that will let you make dvi/ps or pdf with equal ease.

Allin Cottrell


# Allin Cottrell, August 12, 2001

# I suppose we are starting from a pair of files foo.tex and
# foo.ps, generated by Gnuplot with the terminal type set
# to "pslatex auxfile".  E.g., in gnuplot:
# > set term pslatex auxfile
# > set output 'foo.tex'
# This script requires one parameter, namely the base name of the
# two gnuplot output files ("foo", in the example).

# After running this script you should have foo.tex, foo.eps
# and foo.pdf in the current directory.  You should then be
# able to put something like:
#     \begin{figure}
#     \input foo
#     \end{figure}
# into your main LaTeX source file.  If you use
#     \usepackage[dvips]{graphicx}
# then foo.eps will get used.  If you substitute "[pdftex]" for
# "[dvips]" in the call to graphicx, then foo.pdf will get used
# instead.

if (@ARGV != 1) {
   print "Please supply one argument: " .
   "the basename of the gnuplot output files\n";
my $source = $ARGV[0];
my $ready;

# Rename foo.ps as foo.eps
rename "$source.ps", "$source.eps";

# Use ghostscript to convert the eps file to pdf
my $gscmd = "gs -q -sDEVICE=pdfwrite -dNOCACHE " .
  "-dUseFlateCompression=false -dNOPAUSE -dBATCH " .
  "-sOutputFile=$source.pdf $source.eps";

# Throw away the garbage from foo.tex
open (IN, "< $source.tex") || die "Can't open $source.tex";
open (OUT, "> $source.tmp") || die "Can't open $source.tmp";
$ready = 0;
while (<IN>) {
   if (/setlength{/) { $ready = 1; }
   if (/special{psfile/) { next; }
   if (/end{picture}/) { last; }
   if (/includegraphics/) { last; }
   if ($ready) { print OUT; }

print OUT "\\includegraphics{$source}\n";
print OUT "\\end{picture}\n";

close (IN);
close (OUT);

rename "$source.tmp", "$source.tex";

More information about the pdftex mailing list