[pstricks] Vertical alignment of an inline pspicture?

Jean-Côme Charpentier jean-come.charpentier at wanadoo.fr
Sun Jun 14 10:51:38 CEST 2009

Troy Woo a écrit :
> Just as tabular and array can be vertically aligned by
> \begin[pos]{tabular} and \begin[pos]{array}{...}, is there a way to
> vertically align a pspicture (inlined)?
> Such as \begin[pos]{pspicture}? (which I tried and failed.)

  It seems to me that an old version of pspicture have this feature.
Actually, it was \begin{pspicture}[-0.5](...) which shifts the picture
by half of its height. I'm not sure and Herbert will correct me if I
write some garbage :-)
  Nowadays, pspicture environment accept optional argument and the key
'shift'. Yhis key indicates the vertical shift of the whole picture.
Example below will be clearer than a long talking:


  \@ifnextchar({\pst at cpicture(#1,#2)}%
               {\pst at cpicture(0,0)(#1,#2)}%
\def\pst at cpicture(#1,#2)(#3,#4){%
  \pssetylength\pst at dima{#2}%
  \pssetylength\pst at dimb{#4}%
  \advance\pst at dimb -\pst at dima
  \pst at dimb -.5\pst at dimb
  \edef\pictureshift{shift=\the\pst at dimb}%

% Without shift parameter

% In order to center, shift = -(ymax-ymin)/2
% Here: -(3-(-1))/2 = -2

% Automatic way

  Jean-Côme Charpentier

More information about the PSTricks mailing list