[texhax] \special{} and postscript

Karl Berry karl at freefriends.org
Thu Mar 16 19:19:01 CET 2006


  So my questions are these:

I fear that I don't know of anything beyond the dvips manual regarding
the technical questions about \special with literal PostScript.  I don't
recall ever seeing any documentation on how xdvi handles it; you might
write the xdvi(k) maintainers.  Experimentation is probably your most
reliable guide ... :(.

  The dvips documentation tells me not to use save/restore, because
  dvips puts it there, but on examination, I can't find this in the
  resulting PS file.  Am I misunderstanding something about that?

It is hard to say without seeing the actual TeX and PostScript files
involved.  I'm sure the save/restore is abbreviated/mangled like
virtually every other command in the PS output, for the sake of brevity.

      Are any of the comments in my PS file useful as part of the \special
      (like the BoundingBox)?

Although of course TeX and dvips will know nothing about any EPS
comments in a literal special, I guess it wouldn't hurt to put them in
-- it's always possible ps2pdf or some other tool will find them.

  Can you do something like this in such a way that both pdflatex and
  dvips/ps2pdf can hack it?  I notice that pdflatex seems to blithely
  ignore my \specials, though dvips can deal with them ok.

As you probably know, PDF, by design, cannot handle general PostScript
code.  Therefore pdf(la)tex will not do anything with literal PostScript
\special's.  But I believe it is possible to insert literal PDF code,
and perhaps you can munge around specifically to make that work.  (That
is, your class would conditionally do a PS special or a PDF literal
depending on \pdfoutput.)

  Are there any decent writeups about how to write PS to be used in a
  \special?  That is, something that prescribes what is the best
  practice and what is to be avoided.  

Back when EPS was first being promulgated, I recall reading something by
Adobe which suggested things to do and things not to do in EPS; I
imagine most of that would be relevant.  In fact, I think it was an
appendix in the PS reference manual, which you can find online these
days.

Good luck ...

karl



More information about the texhax mailing list