# Why doesn't pdfTeX support PStricks directly?

I am sorry, I have to remove the previous question. I didn't realize I had messed up everything (from my other questions) here. The hidden idea was actually as follows, but I had simplified it in a wrong way.

I should say the question as follows.

LaTeX allows us to use PSTricks code in the input file. Why does pdfTEX not directly support this feature also?

Note: auto-pst-pdf can allow us to use PSTricks in an input file compiled with pdfTeX but with limited features such as

1. we cannot use PSTricks to draw objects on JPEG, PNG, PDF images
2. we can use PSTricks to add annotation on equations with \label{} but the cross-reference no longer works.
-
a ped file can't incorporate an eps file; this has to be done by some tool. why would you think that a single tool incorporated in or called from pdftex would perform a better conversion in your "unsatisfactory" case than a carefully selected external tool? – barbara beeton Jul 31 '11 at 14:33
When does converting eps to pdf ever produce rasterized pdf? (I know plenty of cases of the reverse, pdf to eps, conversion causing rasterization, but there should be no reason for eps to pdf to be rasterized). – Lev Bishop Jul 31 '11 at 15:06
@barbara: Please see my update. The previous question was made without my normal consciousness. (I will delete this comment later) – xport Jul 31 '11 at 15:59

TeX knows nothing about images, only the bounding box is of interest to TeX. All the rest is done by the driver files. And if you want to support eps, tiff, gif, ... then create one, which passes the height/width to TeX and does the including of the image. PSTricks code cannot be used inside pdflatex if in the pdf mode because it has no internal driver which detects the \special commands as xetex does and running an external programm to convert all that \special snippets into a pdf one.

-
In the case of PDFTeX, the driver is build in in the same program, though. – Paŭlo Ebermann Jul 31 '11 at 15:32
@Paŭlo Ebermann: What do you mean with "build in the same program"? pdftex uses pdftex.def or dvips.defor ... – Herbert Jul 31 '11 at 16:37
I considered as driver the program which finally embeds the image in the document, e.g. the DVI-to-PS converter or the PDFTeX backend. If you consider as driver the definition file for the graphics package, you are right, then this is simply analogous to the existing ones. – Paŭlo Ebermann Jul 31 '11 at 16:49

PSTricks works by creating PostScript code which will be embedded in \special{...} sections in the DVI, and then integrated into the PostScript output by some "driver", e.g. by a program which converts DVI to PS. Later another program can interpret this generated PostScript document when converting it to PDF or some other format. (PostScript is a programming language used in printers, but also implemented in some programs which run on a normal computer, like most programs which convert PostScript files to other formats.)
(Some DVI previewers also understand some PSTricks specials.)

If we don't generate PS, but generate PDF directly, there is no way of embedding PSTricks code in it. Several tools like auto-pst-pdf make some workarounds, by first creating a DVI containing the PSTricks-related parts of the document, converting this to PS (thereby integrating the PSTricks code) and then converting the PS to PDF for embedding (as images) into the final PDF output.

Of course, this has the usual problems of using images, like what you mentioned. This also only works for PSTricks sections which are clearly separable from the main contents, as you have seen with your label example.

It does not work together with other image formats supported directly by PDFTeX, since these can't be embedded in the normal LaTeX-DVI-PS way.

For the original question (why does PDFLaTeX not support embedding EPS):

The main reason that PDFTeX supports some image formats directly (JPEG, PNG) is that these can in fact be included directly as objects in the PDF format, without any conversion being necessary. Similar rules apply for PDF files (which will be a bit converted, of course).

For EPS, this is not possible.

Of course, one can automatically call some conversion program (and from the comments, this seems to be done with TeXLive 2010/2011), but this will not give any better results than converting them by manually calling the same tool.

-