# [pstricks] Re: size of a psmatrix with an nccurve hanging out of it

Denis Girou Denis.Girou at idris.fr
Fri Nov 15 18:10:33 CET 2002

The following message is a courtesy copy of an article
that has been posted to comp.text.tex as well.

>>>>> "Sebastian.Miele" == Sebastian Miele <smiele at coli.uni-sb.de> writes:

Sebastian.Miele> the following piece of LaTeX+PSTrics code procuces an fbox around a
Sebastian.Miele> transition diagram of a DFA.  However, the nccurve from q1 back to q1
Sebastian.Miele> exceeds the bounds of the psmatrix and therefore goes beyond the fbox.
Sebastian.Miele> Is there any way to make LaTeX/PSTricks recognize the bounds of the
Sebastian.Miele> psmatrix *with* exceeding nccurves?  I.e. I would like to have a box
Sebastian.Miele> that contains exactly the entire graphic.

Sebastian.Miele> \fbox{%
Sebastian.Miele> \begin{psmatrix}[colsep=1]
Sebastian.Miele> \circlenode{q0}{$q_0$} &
Sebastian.Miele> \circlenode{q1}{$q_1$}
Sebastian.Miele> \nccurve[angleA=115,angleB=65,ncurv=6]{q1}{q1}\Aput{$a$}
Sebastian.Miele> \ncline{q0}{q1}\Aput{$\epsilon$}
Sebastian.Miele> \end{psmatrix}
Sebastian.Miele> }%

No, this is not possible automatically (we cannot hope that TeX can know the
maximum coordinate of a curve which will exist only at the PostScript level,
to compute the accurate bounding box of a curve).

So, you must do it by hands, as in the following example, but this is easy
to found the relevant values with few attempts.

P.S. Avoid to use the \Aput macro, declared obsolete in 1994 (see the
paragraph 12 "Obsolete put commands" pages 30-32, following the one which
describe the "psmatrix" environment).

\documentclass[a4paper]{article}

\usepackage{pst-node}

\pagestyle{empty}

\begin{document}

\fbox{%
\begin{psmatrix}[colsep=1]
\circlenode{q0}{$q_0$} & \circlenode{q1}{$q_1$}
\nccurve[angleA=115,angleB=65,ncurv=6]{q1}{q1}\naput{$a$}
\ncline{q0}{q1}\naput{$\epsilon$}
\end{psmatrix}}
\hspace{1cm}
\fbox{%
\begin{psmatrix}[colsep=1]
\\[-8mm]
\circlenode{q0}{$q_0$} & \circlenode{q1}{$q_1$}
\nccurve[angleA=115,angleB=65,ncurv=6]{q1}{q1}\naput{$a$}
\ncline{q0}{q1}\naput{$\epsilon$}
\end{psmatrix}}

\end{document}

Denis Girou
--
--------------------------------------------------------------------------
Institut du Développement et des Ressources en Informatique Scientifique |
Centre National de la Recherche Scientifique                             |
Bâtiment 506 - B.P. 167 - 91403 Orsay Cedex - France                     |
--------------------------------------------------------------------------