Skip to content

Commit

Permalink
Add details of fp var/fn addition
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Oct 20, 2023
1 parent 86e5652 commit 6e1d239
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions base/doc/ltnews38.tex
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,38 @@ \subsection{In the programming layer}
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

This comment has been minimized.

Copy link
@muzimuzhi

muzimuzhi Oct 20, 2023

Contributor

"a a new function" -> "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}
Expand Down

0 comments on commit 6e1d239

Please sign in to comment.