Arithmetic overflow?

Denis Girou Denis.Girou at idris.fr
Tue Dec 14 12:00:05 CET 1999


-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------

>>>>> "Christophe.Jorssen" == Christophe JORSSEN <Christophe.JORSSEN at wanadoo.fr> writes:

    Christophe.Jorssen> I have a strange problem here with \scaleboxto.

    Christophe.Jorssen> \documentclass{article}
    Christophe.Jorssen> \usepackage{pstricks}
    Christophe.Jorssen> \def\AND{\scaleboxto(1,1){\psline(0,0)(0,1)\psarc(0,.5){.5}{270}{90}}}
    Christophe.Jorssen> \begin{document}
    Christophe.Jorssen> \begin{pspicture}(15,15)
    Christophe.Jorssen>    \rput[bl](4,9){\AND}
    Christophe.Jorssen> \end{pspicture}
    Christophe.Jorssen> \end{document}

    Christophe.Jorssen> ! Arithmetic overflow.

    Julian Visch> The problem does not lie with the scaleboxto, but with the psline etc.,
    Julian Visch> as psline as far as latex is concerned has dimensions 0x0 making
    Julian Visch> scaling impossible, the way around it is to enclose the graphic object
    Julian Visch> with the minimal pspicture box and scale that instead.

  Yes, this is the explanation. See the first paragraph of the manual page 41.
But this is true that the description of \scaleboxto and other related macros
doesn't give a link to this (it is clear that paragraphs 28 an 29 are not
limited to text manipulations, as the label of the chapter VI "Text Tricks"
give the wrong feeling, and that such comment about 0-dimensional objects
must be reminded).

  P.S. To obtain the exact dimension of a 0-dimensional object, so to be able
to give the correct values to a "pspicture" environment, just enclose it
inside a \psframebox using a value of 0 for the "framesep" parameter, and
adjust the values of the "pspicture" until you visually obtain the expected
behaviour (even for complex and composite objects, usually 4 or 5 attempts are
enough):

\documentclass{article}

\usepackage{pstricks}

\newcommand{\ANDa}{%
\psline(0,0)(0,1)
\psarc(0,.5){.5}{270}{90}}

\newcommand{\ANDb}{%
\psframebox[framesep=0,linecolor=red]{%
\begin{pspicture}(0.5,1)
  \psline(0,1)
  \psarc(0,.5){.5}{270}{90}
\end{pspicture}}}

\pagestyle{empty}

\begin{document}

\psset{subgriddiv=0}

\begin{pspicture}(4,4)\psgrid
  %\rput[bl](1,1){\scaleboxto(1,1){\ANDa}} % Generate an arithmetic overflow
  \rput[bl](1,2){\scaleboxto(1,1){\ANDb}}
\end{pspicture}

\end{document}

D.G.

-----------------------------------------------------------------------------
The list interface (subscription, information, access to the archives) is on:
http://www.tug.org/cgi-bin/lwgate/pstricks
Otherway to unsubscribe, send mail to pstricks-request at mail.tug.org
with a blank subject and in body the line unsubscribe <email-address>
-----------------------------------------------------------------------------



More information about the PSTricks mailing list