[comp.text.tex] windows in LaTeX

MMAC@vax.oxford.ac.uk (The_Edible_Dormouse) (07/17/90)

Here's another little postscript 'short' to include as a \special...add it
after you after produced your final layout as it needs to be measured up. Its
effect? Draws a window (shaded box with darker shadow) over a table, area of
text etc below the \special command.

Anyone out there really clever want ot work out a way to make it automatically
scale? :-)

This is based on a routine on my local vax...all credit to OUCS as far as I
know...all blame to me of course.

%----------------------start of ps file--------------------------
% first part draws the light shaded rectangle

72 72 scale          % units are now inches instead of big points

newpath              % prepare to draw a rectangle
   -.1 -0.3 moveto   % top left corner is a little left and above origin
   0 -0.9 rlineto     % down 1.2 (depth of your box)
   5.3 0 rlineto     % right 5.5 (width of your box)
   0 0.9 rlineto      % up 1.2
closepath            % complete rectangle
gsave                % save current path
.92 setgray          % use very light shading on LaserWriter (0=black, 1=white)
fill                 % paint interior of rectangle
grestore             % restore current path
.01 setlinewidth     % thickness of borders
stroke               % paint borders
newpath
   0 -1.2 moveto     % these next lines draw the shadow of the window
   0 -0.1 rlineto    % the dimensions are in inches and are x,y ordered
   5.3 0 rlineto     % all movement commands are relative
   0 0.9 rlineto     
   -0.1 0 rlineto
   0 -0.8 rlineto
closepath
0 setgray
fill

showpage

%-----------------------end of ps file-----------------

The effect is very impressive---looks quite 'dtpish' if used sparingly.

Edi

===============================================================================
MMAC@UK.AC.OX.VAX (Janet)		  = The opinions expressed above are
MMAC%VAX.OX.AC.UK@UKACRL.BITNET (Bitnet)  = not necessarily those of any person
MMAC%VAX.OXFORD.AC.UK@NSS.CS.UCL.AC.UK	  = living, dead, undead or the subject
	(Internet)			  = of a Schrodinger's cat experiment.
"Trust me I'm a Physicist !" 		  = They may or may not be my own.
===============================================================================

spqr@ecs.soton.ac.uk (Sebastian Rahtz) (07/19/90)

In article <9007181350.AA22847@ucbvax.Berkeley.EDU> MMAC@vax.oxford.ac.uk (The_Edible_Dormouse) writes:

   needs to be measured up. Its effect? Draws a window (shaded box
   with darker shadow) over a table, area of text etc below the
   \special command.

   Anyone out there really clever want ot work out a way to make it
   automatically scale? :-)

thats not very tricky.... just put the text in a box, get the size of
the box, then rewrite your PS so that the dimensions are
parameterized.

another solution is to put a TeX rule over the top of your box, and
put specials around that to change the gray level.

incidentally, I strongly recommend James Clark's dvitops to anyone who
likes a good interface for their PostScript \specials. It provides
some useful builtins, like changing gray level or color

sebastian
 
--
Sebastian Rahtz                        S.Rahtz@uk.ac.soton.ecs (JANET)
Computer Science                       S.Rahtz@ecs.soton.ac.uk (Bitnet)
Southampton S09 5NH, UK                S.Rahtz@sot-ecs.uucp    (uucp)