[pstricks] graphical sboxes with pstricks

Miguel Telleria de Esteban miguel at mtelleria.com
Fri Nov 4 18:26:40 CET 2005


Dear all,

I would like to create the equivalent to an sbox/savebox but with
graphical content and then place several instances of it with \rput.

If I use the standard LaTeX sbox/usebox with a pspicture environment in
it I get a slight horizontal misalignment (of about 1-2pt).

Here is the example:

\newsavebox{\grphbox}
\sbox{\grphbox}
{
\begin{pspicture}(0,0)(3.5,2)
   \psset{linewidth=0.4pt}
   \psline(0,0.5)(0,0)(0.5,0)
   \psline(0,1.5)(0,2)(0.5,2)
   \psline(3,2)(3.5,2)(3.5,1.5)
   \psline(3,0)(3.5,0)(3.5,0.5)
\end{pspicture}
}

and then just to compare:

\begin{pspicture}(0,0)(8,3)
  \rput[tl](0.5,2.5){\usebox{\grphbox}}
 
\rput[bl](0,0.5){
  \psset{linecolor=green}
   \psline(0,0.5)(0,0)(0.5,0)
   \psline(0,1.5)(0,2)(0.5,2)
   \psline(3,2)(3.5,2)(3.5,1.5)
   \psline(3,0)(3.5,0)(3.5,0.5)
}

You will see that the green lines are slightly to the left compared with
their respective black lines.

SO MY QUESTIONS ARE:
Is there a way to reuse pstricks code in several instances? 

Do I have to pass any extra options for \usebox to not cause a
misalignment?

Is there a PStricks version of sbox and usebox?

Thanks in advance,

	Miguel Telleria


-- 

      (O-O)
---oOO-(_)-OOo-----------------------------------------------------
 Miguel TELLERIA DE ESTEBAN               Personal Homepage:
 Email: Miguel at mtelleria.com           http://www.mtelleria.com

 Miembro de http://www.linuca.org         Tel home: +32 2 280 1614
 Membre de  http://www.bxlug.be           GSM:      +32 497 038804
-------------------------------------------------------------------




More information about the PSTricks mailing list