[pstricks] vertically centering table in \psframebox
Herbert Voss
Herbert.Voss at alumni.TU-Berlin.DE
Wed Jan 21 06:49:06 CET 2004
Patrick Drechsler wrote:
> The problem is that I have a couple of these frameboxes and the
> should all have the same height. That's the reason I used \rule
> in the first place (maybe there's a more elegant way of doing
> this?).
but you have to raise this rule to get the baseline
vertically centered
Herbert
\documentclass[12pt]{article}
\usepackage{pstcol,pstricks,pst-node}
\newdimen\maxH\maxH=3cm
\def\xstrut{\raisebox{-0.5\maxH}{\rule{0pt}{\maxH}}}
\newcommand*{\XY}[3][white]{%
\rnode{#2}{%
\psframebox[framearc=.5,fillstyle=solid,fillcolor=#1]{%
\xstrut\begin{tabular}[c]{c}#3\end{tabular}%
}%
}%
}
\begin{document}
\begin{pspicture}(0,0)(14,10)
\rput(7,9){\XY{A2}{\textbf{fooooooooooo} \\
\rnode{aa1}{barr} \\[2ex] \rnode{aa2}{foooooo}}%
}
\ncline[nodesepA=3pt]{->}{aa1}{aa2}%
%% Another box with different height:
\rput(2,9){\XY{A3}{\textbf{fooooooooooo} \\
barr}%
}
\end{pspicture}
\end{document}
--
http://www.pstricks.de/
More information about the PSTricks
mailing list