[pstricks] pstricks-add, \def\pshlabel
Alan Ristow
ristow at ece.gatech.edu
Thu Sep 9 14:50:57 CEST 2004
On Thu, 09 Sep 2004 09:03:16 +0200, Claus Behl <claus at bempf.de> wrote:
>Hi,
>I have a Problem using pstricks-add. If i try to use
>\usepackage{pstricks-add} in the following file, i get the Error
>message:
>
>! Missing number, treated as zero.
><to be read again>
> \def
>l.25 \uput
> [-90](11,0){x}
>A number should have been here; I inserted `0'.
>
>The problem vanishes, if i outcomment: \def\pshlabel#1{\XLABEL{#1}}
>Is this a known problem of pstricks-add?
No. The command \psaxes uses \pshlabel to format the tick labels on the
x axis it draws. You use \ifcase in your definition, which expects a
command that expands to a numerical value -- I suspect that this is
where the problem is. Expansion of macro parameters has some caveats
associated with it; I suggest you try something like this:
\def\XLABEL#1{%
\def\tempvariable{#1}%
\ifcase\tempvariable\or
$x_0=a$\or $x_1$\or $x_2$\or \or \or $x_\nu$\or $x_{\nu+1}$\or \or
$x_{n-1}$\or $x_n=b$\fi%
}%
I haven't tested it, so no guarantees. Also, I think you would need to
make certain that the value being passed to \XLABEL is an integer -- if
it is not, I don't think you can count on \ifcase.
>Second question, is it possible to determine the max or min of a
>Function in a given intervall?
All I can think to do is compute the value of the function at various
points, then choose the point with the max or min value. This would have
to be done in Postscript code, I think. If this is absolutely required,
you might check out Metapost -- it has some facilities that I think
would make this easier.
Alan
More information about the PSTricks
mailing list