von ratte » Mi 26. Aug 2009, 15:20
Im README sind sehr wohl konkrete Beispiele, beispielsweise:
The following macros are public ones to be used in the document:
\FPeval#1#2 % #1 := eval(#2) where eval evaluates the
expression #2
ATTENTION: Do not use macro names with \. for its own
Use only the name or the macro surrounded by (, and ) instead,
i.e. do not write "\value{}" but "value" or "(\value)".
This is needed to avoid problems with a prefix "-" of numbers.
(I do not intend to write a more complex parsing routine in future.
But if you do so, just send it to me.
)
Known infix operations are
+, -, *, /, ^ for add, sub, mul, div, pow
Each other operation is a prefix one that needs
a (comma or colon seperated) list of subexpressions.
Exception: The unary prefix operation - is not known!
(Use the function neg instead.)
Example 1:
With
\edef\result{11}
and
\FPeval\result{round(root(2,sin(result + 2.5)):2)}
or
\FPeval{result}{round(root(2,sin(result + 2.5)):2)}
\result becomes the value 0.90
Example 2:
\FPeval\result{clip(2*3+5*6)} results to 36
\FPeval\result{clip(2*(3+5)*6)} results to 96
anderes Beispiel:
\documentclass{article}
\usepackage{fp}
\begin{document}
\FPeval\Var{17.5+13.8}
Current value of \verb|\Var| is \Var.
\FPeval\Var{round(Var:2)}
Current value of \verb|\Var| is \Var.
\FPeval\Var{clip(Var)}
Current value of \verb|\Var| is \Var.
\end{document}
Der Rest sollte mit dem README herauszufinden sein. Wen nicht, dann wird auf der CTAN-Seite zu fp auch noch auf ein anderes Paket verwiesen, das AFAIK eine Doku als pdf hat. Wenn Du Fragen zu einem der Pakete hast, dann solltest Du diese stellen.
Im README sind sehr wohl konkrete Beispiele, beispielsweise:
[quote] The following macros are public ones to be used in the document:
\FPeval#1#2 % #1 := eval(#2) where eval evaluates the
expression #2
ATTENTION: Do not use macro names with \. for its own
Use only the name or the macro surrounded by (, and ) instead,
i.e. do not write "\value{}" but "value" or "(\value)".
This is needed to avoid problems with a prefix "-" of numbers.
(I do not intend to write a more complex parsing routine in future.
But if you do so, just send it to me.
)
Known infix operations are
+, -, *, /, ^ for add, sub, mul, div, pow
Each other operation is a prefix one that needs
a (comma or colon seperated) list of subexpressions.
Exception: The unary prefix operation - is not known!
(Use the function neg instead.)
Example 1:
With
\edef\result{11}
and
\FPeval\result{round(root(2,sin(result + 2.5)):2)}
or
\FPeval{result}{round(root(2,sin(result + 2.5)):2)}
\result becomes the value 0.90
Example 2:
\FPeval\result{clip(2*3+5*6)} results to 36
\FPeval\result{clip(2*(3+5)*6)} results to 96
[/quote]
anderes Beispiel:[code]\documentclass{article}
\usepackage{fp}
\begin{document}
\FPeval\Var{17.5+13.8}
Current value of \verb|\Var| is \Var.
\FPeval\Var{round(Var:2)}
Current value of \verb|\Var| is \Var.
\FPeval\Var{clip(Var)}
Current value of \verb|\Var| is \Var.
\end{document}[/code]
Der Rest sollte mit dem README herauszufinden sein. Wen nicht, dann wird auf der CTAN-Seite zu fp auch noch auf ein anderes Paket verwiesen, das AFAIK eine Doku als pdf hat. Wenn Du Fragen zu einem der Pakete hast, dann solltest Du diese stellen.