diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-algorithms.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-algorithms.tex | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-algorithms.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-algorithms.tex index 64332eca3ed..c4cf989f55e 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-algorithms.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-math-algorithms.tex @@ -17,8 +17,10 @@ Perhaps you are not satisfied with the Maclaurin series for $e^x$. Perhaps you have a fantastically more accurate and efficient way of calculating the sine or cosine of angles. Perhaps you would like the library to interface with a package such as |fp| - for fixed-point arithmetic (but note that |fp| is \emph{very} slow). -In these case you will want to replace the current implementations of + for fixed-point arithmetic (but you may find that exclusively + using |fp| can cause a significant increase in compile time for + documents involving many hundreds of calculations). +In these cases you will want to replace the current implementations of the computations done by the mathematical engine by your own code. The mathematical engine was designed with such a replacement in @@ -40,7 +42,12 @@ are implemented in the following manner: rather than the ``public'' one). Arguments passed to this macro are expected to be numbers \emph{without units}. This is the macro which should be rewritten with your prize-winning new algorithm. - + + Note, furthermore, that if the function takes more than one + argument, the second argument should not involve the dimensions + |\pgfmath@x| nor |\pgfmath@xa| nor |\pgf@x| nor |\pgf@xa| since + these may be set to the value of the first argument when the + second argument is parsed. \end{itemize} The effect of |\pgfmath|\meta{function name}|@| should be to set the @@ -52,23 +59,23 @@ values. One way to achieve this is to use the following code: \begin{codeexample}[code only] \def\pgfmath...@#1#2...{% \begingroup% - ... code for algorithm XXX ... + ... code for algorithm ... \pgfmath@returnone\pgfmath@x% \endgroup% } \end{codeexample} -The macro |\pgfmath@returnone<macro>| uses some |\aftergroup| magic to -save result of the algorithm, by defining |\pgfmathresult| as the -expansion of |<macro>| \emph{without units}. |<macro>| can be a macro -containing a number (with or without units), or a dimension or count -(or possibly a skip) register. By performing the algorithm within a +The macro |\pgfmath@returnone|\meta{code} must be directly followed by an +|\endgroup| and will save result of the algorithm, by defining +|\pgfmathresult| as the expansion of \meta{code} \emph{without units} +outside the group. The \meta{code} should expand to a dimension +register or to a dimension. By performing the algorithm within a \TeX{} group, \pgfname{} registers such as |\pgf@x|, |\pgf@y| and -|\c@pgf@counta|, |\c@pgfcountb|, and so forth can be used at will. -Note that current the implementation uses |\pgfmath@x|, |\pgfmath@y|, -and |\c@pgfmath@counta|, |\c@pgfmath@countb| throughout, so for -consistency these should be employed. Whilst they are currently |\let| -to their \pgfname{} equivalents (see |pgfmathutil.code.tex|), this -could change (as could the \pgfname{} registers), so keeping things -consistent is probably a good idea.
\ No newline at end of file +|\c@pgf@counta|, |\c@pgfcountb|, and so forth, can be used at will. + +\pgfname{} uses the last known definition of a function within the +prevailing scope, so it is possible for a function to be redefined +or |\let| to an alternative definition locally. +You should also remember that any |.sty| or |.tex| file contatining any +re-implementions should be loaded \emph{after} \pgfname-Math.
\ No newline at end of file |