[pstricks] Can't use a mathematical function defined with FPeval in \psplot
Juergen Rose
rose at rz.uni-potsdam.de
Thu Apr 10 18:13:15 CEST 2014
Hi,
I used the following code:
\documentclass{article}
\usepackage[nomessages]{fp}%
\usepackage{pst-plot}
\newcommand{\myMathFunction}[1]
{\FPeval\result{trunc(((#1) * 5) - (#1)^2:0)}\result}
\begin{document}
\begin{tabular}{ r r }
$x$ & $f(x)$ \\\hline
0 & \myMathFunction{0}\\
1 & \myMathFunction{1}\\
2 & \myMathFunction{2}\\
3.3 & \myMathFunction{3.3}\\
4 & \myMathFunction{4}\\
5 & \myMathFunction{5}\\\hline
\end{tabular}
%
\pspicture[shift=*](-1,0)(6,7)
\psaxes{->}(5.5,6)
%\psplot[algebraic,linecolor=red,linewidth=1.5pt]{0}{5}{%
% \myMathFunction{x}%
%}
\endpspicture
\end{document}
It works perfectly. If I uncomment the three psplot lines, 'xelatex
define_math_function_test_2__fp_table_plot.tex' says:
(/usr/share/texmf-dist/tex/generic/pst-plot/pst-plot.tex
v1.45, 2013/04/29 (tvz,hv)))
(./define_math_function_test_2__fp_table_plot.aux
)
! Argument of \doaction has an extra }.
<inserted text>
\par
l.29 }
I have an similar code example, which use the xparse instead of the fp
package and which works with psplot. But I would like to do it with the
fp or even with plain tex, to avoid the usage of an additional package.
I will attache the files for the above and for xparse example.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: define_math_function_test_2__fp_table_plot.tex
Type: text/x-tex
Size: 655 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20140410/ca8158ce/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: define_math_function_test_2__xparse_table_plot.tex
Type: text/x-tex
Size: 649 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20140410/ca8158ce/attachment-0001.bin>
More information about the PSTricks
mailing list