Included below is a patch to add pdflatex compatibility to the pslatex term when the auxfile option is selected. Without the patch, the output of this term is incompatible with pdflatex because of the use of postscript specials and the mechanism used to include the postscript graphics file. The patch modifies the terminal in auxfile mode so that postscript specials aren't used, and the graphics file is included using a mechanism which works for postscript and pdf (ps2pdf should be used to generate the pdf version of the postscript graphics file). Including the following before \begin{document} allows latex and pdflatex to be run on the same latex source file when including pslatex (with auxfile option) outputs from the patched gnuplot: \newif\ifpdf \ifx\pdfoutput\undefined \pdffalse \else \pdfoutput=1 \pdftrue \fi \ifpdf \usepackage{graphicx} \DeclareGraphicsExtensions{.pdf} \pdfcompresslevel=9 \else \usepackage{graphicx} \DeclareGraphicsExtensions{.pstex,.ps,.eps} \fi Notes: The patched version hasn't been tested very extensively, (all testing under RedHat 6.1 Linux) but seems to do the trick. Some of the changes could probably improved upon - this is intended as an initial version to stimulate further development. The #define of PDFLATEX_COMPAT should probably be moved to the central configuration mechanism. Instructions: Copy the patch file into the term directory of the gnuplot 3.7.1 build and then run patch < patchfilename before rebuilding. *** pslatex.trm.orig Wed May 3 13:59:50 2000 --- pslatex.trm Wed May 3 13:59:50 2000 *************** *** 51,56 **** --- 51,58 ---- #include "driver.h" + #define PDFLATEX_COMPAT 1 + #ifdef TERM_REGISTER register_term(pslatex) register_term(pstex) *************** *** 309,317 **** --- 311,321 ---- } /* generate special which xdvi and dvips can handle */ + #ifndef PDFLATEX_COMPAT fprintf(gpoutfile, "\\special{psfile=%s llx=0 lly=0 urx=%d ury=%d rwi=%d}\n", psfile_basename, urx, ury, 10 * urx); + #endif tmp = gpoutfile; gpoutfile = PSLATEX_auxFile; PS_graphics(); *************** *** 417,425 **** --- 421,433 ---- break; case 1: /* put text in a short stack */ if (PSLATEX_rotate) { + #ifdef PDFLATEX_COMPAT + fputs("%\n\\rotatebox{90}{%\n", gpoutfile); + #else fputs("\ %\n\\special{ps: gsave currentpoint currentpoint translate\n\ 270 rotate neg exch neg exch translate}%\n", gpoutfile); + #endif } switch (tc->justify) { case LEFT: *************** *** 442,448 **** --- 450,460 ---- break; } if (PSLATEX_rotate) { + #ifdef PDFLATEX_COMPAT + fputs("%\n}%\n", gpoutfile); + #else fputs("%\n\\special{ps: currentpoint grestore moveto}%\n", gpoutfile); + #endif } } fputs("}%\n", gpoutfile); *************** *** 456,461 **** --- 468,485 ---- } if (PSLATEX_output) { + #ifdef PDFLATEX_COMPAT + if (PSLATEX_auxFile) { + char *filename_noext = 0, *dotpos = 0; + filename_noext = malloc(strlen(PSLATEX_psfile)+1); + strcpy(filename_noext, PSLATEX_psfile); + dotpos = strrchr(filename_noext, '.'); + if (dotpos) + *dotpos = '\0'; + fprintf(gpoutfile, "\\includegraphics{%s}%\n",filename_noext); + free(filename_noext); + } + #endif fputs("\ \\end{picture}%\n\ \\endgroup\n\