[pstricks] pBox macro

Herbert Voss Herbert.Voss at FU-Berlin.DE
Thu Jul 23 21:53:30 CEST 2009


David Arnold schrieb:

> \documentclass{article}
> \usepackage{pstricks}
> 
> \newpsstyle{bgCyan}{fillstyle=solid,fillcolor=cyan!10,linestyle=none,framesep=6pt}
> 
> \def\pBox#1{\psframebox[style=bgCyan]{{%
>   \tabular{@{}c@{}}#1\endtabular}}}
> 
> \begin{document}
> 
> \begin{center}
> \begin{tabular}{ccccc}
> \pBox{Original\\Balance} & plus & \pBox{Student\\Deposit} & equals &
> \pBox{Current\\Balance}\\
> $B$ & $+$ & \$120 & $=$ & $-\$75$
> \end{tabular}
> \end{center}
> 
> \end{document}
> 
> When I compile in Texshop on the mac, I get this result:
> 
> 
> 
> When I compile with ps4pdf, I get this result:

for latex it is a tabular which is always vertically centered
to the current baseline, but for ps4pdf the psframebox is a
grafic with its lower side on the baseline.
This should help:

\documentclass{article}
\usepackage{pstricks}
\usepackage{ifpdf}

\newpsstyle{bgCyan}{fillstyle=solid,fillcolor=cyan!10,linestyle=none,framesep=6pt}
\ifpdf
  \def\pBox#1{\raisebox{-.5\height}{\psframebox[style=bgCyan]{{%
    \tabular{@{}c@{}}#1\endtabular}}}}
\else
  \def\pBox#1{\psframebox[style=bgCyan]{{%
    \tabular{@{}c@{}}#1\endtabular}}}
\fi
...


Herbert


More information about the PSTricks mailing list