> Note that Jan-Ake Larsson stated that supporting postscript specials > means embedding a postscript interpreter into dvipng, and he has no > time for that. So, I doubt that you are on the right track.
I read that post too, but what I'm saying is not to make dvipng actually work but just detect if it would. DVI, as you'll know, is a sort of assembly language (but not Turing-complete, more info [1]) made of directives (identified by opcodes). Now, opcodes from 239 to 242 [2] identifies specials, dvipng can interpret several of these (e.g. GIF, PNG, EPS image inclusion) but not all of them, in particular doesn't work well with PostScript literals. PostScript literals are identified by the "ps:" prefix, so if we find in a DVI file a sequence of one of those special opcodes followed by "ps:", we'll know that dvipng most probably will fail. To be truth not all postscript literals are unsupported, but I think that using the legacy method when postscript is needed is the safest solution. Math, XY-pic, image rendering and so on will work without problems in dvipng. Moreover this solution is extremly specific for each preview, instead the heuristic way would make all the preview in the same document work with the legacy method, as the "\usepackage{pstricks}" directive goes in the preamble which is included in all the tex preview code. I wrote to the author of dvipng (Jan-Ake Larsson [jan-ake.lars...@liu.se]) and even him thinks this is the best solution: > The imminent 1.14 release will also have a switch --norawps that will > completely disable trying to render all raw PS specials, even those that > dvipng (thinks it) can handle. We can't wait for 1.14 diffusion, and in any case some processing would get done in any case (e.g. a very long code without PS and a last PS special), so in the next days I'm going to write the python code to detect PS specials. It should be pretty straightforward, as DVI is a simple format. What do you think? venom00 P.S. Sorry for the multiple e-mails, but I've been experiencing problems [1] http://www-users.math.umd.edu/~asnowden/comp-cont/dvi.html [2] http://www-users.math.umd.edu/~asnowden/comp-cont/dvi.html#xxx