[Tex/LaTex] Error viewing dvi file: Postscript specials could not be rendered


How to rectify this error while viewing .dvi file,

Error: /undefined in H.S
Operand stack:
   --nostringval--   PermitFileReading   --nostringval--   PermitFileWriting   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1930   1   3   %oparray_pop   1929   1   3   %oparray_pop   1913   1   3   %oparray_pop   1803   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1176/1684(ro)(G)--   --dict:0/20(G)--   --dict:80/200(L)--   --dict:95/300(L)--   --dict:17/200(L)--
Current allocation mode is local
MiKTeX GPL Ghostscript 9.05: Unrecoverable error, exit code 1


my tex file

Best Answer

This problem occurs sometimes when compiling a tex file with latex and using a dvi viewer like YAP.

Not sure what exactly causes the problem. In my case, I used MikTex 2.9 to compile a tex file and yap.exe that came along with the MikTex distribution to view the dvi file.

After some browsing on the web, I found that this error might occur if you have included the package hyperref. There are other possibilities as well, which I don't fully understand.

Accordingly, there are two solutions that I found on the web:

  1. Change the rendering method from Pk to Dvips. Open Yap: From the menu, select View --> Render Method --> Dvips.

    Although this solves the problem, the dvips rendering method is extremely slow and can cut productivity. To see this, just try compiling a 30 page tex file and scrolling down the resulting dvi file. For more details on rendering methods in yap, see http://blog.miktex.org/post/2011/02/Yap-24-render-method.aspx.

  2. The second solution works if you have included the package hyperref. Then use the hypertex-driver with hyperref, i.e., \usepackage[hypertex]{hyperref}. Note that you will have to remove this driver option if you want to process the dvi with dvips.

See also https://groups.google.com/forum/#!topic/comp.text.tex/jVyH1xat-9Q

Sometimes, even though you may not have explicitly included the hyperref package, it is possible that it might be contained as part of the class file. To make sure, open the document class file you are loading and if hyperref package is loaded, change it to include the hypertex option.

NOTE: The hypertex option will cause all hyperlinks in the document to be underlined. If you do not want this, then retain it while developing the tex file, so that you can continue using Yap with Pk rendering, and later remove it in the final version.