[latex3-commits] [latex3/latex2e] develop: Add details of fp var/fn addition (6e1d2398)

github at latex-project.org github at latex-project.org
Fri Oct 20 12:56:12 CEST 2023


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/6e1d2398a499ec35f89a894d33c2c37b0043ed31

>---------------------------------------------------------------

commit 6e1d2398a499ec35f89a894d33c2c37b0043ed31
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Oct 20 11:56:12 2023 +0100

    Add details of fp var/fn addition


>---------------------------------------------------------------

6e1d2398a499ec35f89a894d33c2c37b0043ed31
 base/doc/ltnews38.tex | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/base/doc/ltnews38.tex b/base/doc/ltnews38.tex
index 889cc6ea..4eff0033 100644
--- a/base/doc/ltnews38.tex
+++ b/base/doc/ltnews38.tex
@@ -260,6 +260,38 @@ titlecasing function to enable this to either titlecase only the first word of
 the input, or to titlecase every word. This should be transparent at the
 document level but will be useful for programmers.
 
+We have also added the ability to define variables and functions inside
+\cs{fpeval} (at the \pkg{expl3} level this is \cs{fp\_eval:n}). This allows
+programmers to create non-standard functions that can then be used inside
+\cs{fpeval}. For example, this could be used to create a a new function
+\texttt{dinner}:
+\begin{verbatim}
+\documentclass{article}
+\begin{document}
+\ExplSyntaxOn
+\fp_new_variable:n{duck}
+\fp_new_function:n{dinner}
+\fp_set_function:nnn{dinner}{duck}{duck-0.25duck}
+\fp_set_variable:nn{duck}{1}
+$\fp_eval:n{duck}
+ >\fp_eval:n{dinner(duck)}
+  \fp_set_variable:nn{duck}{dinner(duck)}
+ >\fp_eval:n{dinner(duck)}
+  \fp_set_variable:nn{duck}{dinner(duck)}
+ >\fp_eval:n{dinner(duck)}
+  \fp_set_variable:nn{duck}{dinner(duck)}
+ >\fp_eval:n{dinner(duck)}
+$
+\ExplSyntaxOff
+\end{document}
+\end{verbatim}
+
+Users will be able to access added functions without needing to use the
+\pkg{expl3} layer. It is possible that a future release of \LaTeX{} will
+add the ability to create and set floating point variables to the
+document level: this will be examined based on feedback on the
+utility of the programming layer change.
+
 \section{Bug fixes}
 
 \section{Changes to packages in the \pkg{amsmath} category}





More information about the latex3-commits mailing list.