[pstricks] Surround with oval box

Herbert Voss Herbert.Voss at FU-Berlin.DE
Fri Mar 6 09:05:47 CET 2009


David Arnold schrieb:
> All,
> 
> I'm trying to emulate the dice example to surround the 3 boxes in the  
> first column with an oval, but as you can see in this example, I'm off.
> 
> \documentclass{article}
> 
> \usepackage{pstricks}
> \usepackage{pstricks-add}
> \include{pst-func}
> \begin{document}
> 
> \begin{center}
> \begin{pspicture}(-1,-1)(8,8)
> \multido{\iA=1+1}{4}{%
> 	\multido{\iB=1+1}{3}{%
> 		\rput(! \iA\space 7 \iB\space sub){%
> 			\rnode[c]{p\iA\iB}{\psframe[unit=0.75](0,0)(0.75,0.75)}}}}
> \ncbox[linearc=0.35,nodesep=0.2,linecolor=blue]{p11}{p13}

for TeX all PSTricks objects have a width of 0pt. With \phantom
you can tell TeX the width/height of the object:

    \rnode{p\iA\iB}{\psframebox{\phantom{\rule{4mm}{4mm}}}}}}}

Alternative you can define a TeX-Box

\documentclass{article}
\usepackage{pstricks-add}
\begin{document}

\def\Box{\psframebox{\rule{4mm}{0pt}\rule{0pt}{4mm}}}

\begin{center}
\begin{pspicture}(-1,-1)(8,8)
\multido{\iA=1+1}{4}{%
  \multido{\iB=1+1}{3}{%
    \rput(! \iA\space 7 \iB\space sub){%
      \rnode{p\iA\iB}{\Box}}}}
\ncbox[linearc=0.35,nodesep=0.2,linecolor=blue]{p11}{p13}
\end{pspicture}
\end{center}

\end{document}


Herbert



More information about the PSTricks mailing list