dvips: Literal examples
5.3.5 Literal examples
----------------------
To finish off this section, the following examples of literal PostScript
are presented without explanation:
\def\rotninety{\special{ps:currentpoint currentpoint translate 90
rotate neg exch neg exch translate}}\font\huge=cmbx10 at 14.4truept
\setbox0=\hbox to0pt{\huge A\hss}\vskip16truept\centerline{\copy0
\special{ps:gsave}\rotninety\copy0\rotninety\copy0\rotninety
\box0\special{ps:grestore}}\vskip16truept
[ There are 4 'A' characters, each rotated 90 degrees about a common
center point ]
\vbox to 2truein{\special{ps:gsave 0.3 setgray}\hrule height 2in
width\hsize\vskip-2in\special{ps:grestore}\font\big=cminch\big
\vss\special{ps:gsave 1 setgray}\vbox to 0pt{\vskip2pt
\line{\hss\hskip4pt NEAT\hss}\vss}\special{ps:0 setgray}%
\hbox{\raise2pt\line{\hss NEAT\hss}\special{ps:grestore}}\vss}
[ There is a big gray box with the word 'NEAT' inside in big letters
]
Some caveats are in order, however. Make sure that each 'gsave' is
matched with a 'grestore' on the same page. Do not use 'save' and
'restore'; they can interact with the PostScript generated by Dvips if
care is not taken. Try to understand what the above macros are doing
before writing your own. The '\rotninety' macro especially has a useful
trick that appears again and again.