summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/functional/functional.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/functional/functional.tex')
-rw-r--r--macros/latex/contrib/functional/functional.tex751
1 files changed, 656 insertions, 95 deletions
diff --git a/macros/latex/contrib/functional/functional.tex b/macros/latex/contrib/functional/functional.tex
index 8c8e3a5e84..2ff408082b 100644
--- a/macros/latex/contrib/functional/functional.tex
+++ b/macros/latex/contrib/functional/functional.tex
@@ -3,7 +3,7 @@
\documentclass[oneside]{book}
\usepackage[a4paper,margin=2.5cm]{geometry}
-\newcommand*{\myversion}{2022D}
+\newcommand*{\myversion}{2022E}
\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)}
\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi}
@@ -87,6 +87,8 @@
\underline{\textsl{#1}}%
}
+\usepackage{amsmath}
+
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
@@ -129,11 +131,10 @@ We will compare our first example with a similar \verb!Lua! example:
\begin{minipage}{0.55\textwidth}
\begin{codehigh}
-%% function code
\IgnoreSpacesOn
\PrgNewFunction \MathSquare { m } {
- \IntSet \lTmpaInt { \IntEval {#1 * #1} }
- \Return { \Value \lTmpaInt }
+ \IntSet \lTmpaInt {\IntEval {#1 * #1}}
+ \Return {\Value \lTmpaInt}
}
\IgnoreSpacesOff
\MathSquare{5}
@@ -193,21 +194,21 @@ you'd better put function definitions inside \verb!\IgnoreSpacesOn! and
At the end of this section,
we will compare our factorial example with a similar \verb!Lua! example:
-\begin{minipage}{0.69\textwidth}
+\begin{minipage}{0.65\textwidth}
\begin{codehigh}
\IgnoreSpacesOn
\PrgNewFunction \Fact { m } {
\IntCompareTF {#1} = {0} {
\Return {1}
}{
- \Return {\IntMathMult{#1}{\Fact{\IntMathSub{#1}{1}}}}
+ \Return {\IntEval{#1*\Fact{\IntEval{#1-1}}}}
}
}
\IgnoreSpacesOff
\Fact{4}
\end{codehigh}
\end{minipage}%
-\begin{minipage}{0.31\textwidth}
+\begin{minipage}{0.35\textwidth}
\begin{code}
-- define a function --
function Fact (n)
@@ -369,7 +370,7 @@ For example, the tracing log of the first example in this chapter will be the fo
[O] 25
[O] 25
[I] \IntSet{\lTmpaInt }{25}
- [O]
+ [O]
[I] \Value{\lTmpaInt }
[O] 25
[I] \Return{25}
@@ -383,7 +384,7 @@ For example, the tracing log of the first example in this chapter will be the fo
[O] 625
[O] 625
[I] \IntSet{\lTmpaInt }{625}
- [O]
+ [O]
[I] \Value{\lTmpaInt }
[O] 625
[I] \Return{625}
@@ -535,8 +536,8 @@ is returned. Therefore, the following two examples produce the same output:
\begin{codehigh}
\IgnoreSpacesOn
\PrgNewFunction \MathSquare { m } {
- \IntSet \lTmpaInt { \IntEval {#1 * #1} }
- \Return { \Value \lTmpaInt }
+ \IntSet \lTmpaInt {\IntEval {#1 * #1}}
+ \Return {\Value \lTmpaInt}
}
\IgnoreSpacesOff
\MathSquare{5}
@@ -544,7 +545,7 @@ is returned. Therefore, the following two examples produce the same output:
\begin{codehigh}
\IgnoreSpacesOn
\PrgNewFunction \MathSquare { m } {
- \IntSet \lTmpaInt { \IntEval {#1 * #1} }
+ \IntSet \lTmpaInt {\IntEval {#1 * #1}}
\Value \lTmpaInt
}
\IgnoreSpacesOff
@@ -700,6 +701,34 @@ function. However, they may be overwritten by other
code and so should only be used for short-term storage.
\end{variable}
+\section{Boolean Expressions}
+
+As we have a boolean datatype and predicate functions returning
+boolean \meta{true} or \meta{false} values, it seems only fitting
+that we also provide a parser for \meta{boolean expressions}.
+
+A boolean expression is an expression which given input in the form
+of predicate functions and boolean variables, return boolean
+\meta{true} or \meta{false}. It supports the logical operations And,
+Or and Not as the well-known infix operators \verb|&&| and \verb"||" and
+prefix~\verb|!| with their usual precedences (namely, \verb|&&| binds
+more tightly than \verb"||"). In addition to this, parentheses can be
+used to isolate sub-expressions. For example,
+\begin{codehigh}
+\IntCompare {1} = {1} &&
+ (
+ \IntCompare {2} = {3} ||
+ \IntCompare {4} < {4} ||
+ \StrIfEq {abc} {def}
+ ) &&
+! \IntCompare {2} = {4}
+\end{codehigh}
+is a valid boolean expression.
+
+Contrarily to some other programming languages, the operators \verb|&&| and
+\verb"||" evaluate both operands in all cases, even when the first
+operand is enough to determine the result.
+
\section{Creating and Setting Booleans}
\begin{function}{\BoolNew}
@@ -733,7 +762,11 @@ Evaluates the \meta{boolean expression} and sets the \meta{boolean} variable to
the logical truth of this evaluation.
For example
\begin{codehigh}
-\BoolSet \lTmpaBool {\IntCompare{3}<{2}}
+\BoolSet \lTmpaBool {\IntCompare{3}<{4}}
+\BoolVarLog \lTmpaBool
+\end{codehigh}
+\begin{codehigh}
+\BoolSet \lTmpaBool {\IntCompare{3}<{4} && \StrIfEq{abc}{uvw}}
\BoolVarLog \lTmpaBool
\end{codehigh}
\end{function}
@@ -855,8 +888,8 @@ For example
Implements the \enquote{And} operation between two booleans,
hence is \texttt{true} if both are \texttt{true}.
%Contrarily to the infix operator \verb|&&|,
-The \meta{boolean_2} is only evaluated if it is needed to determine the result of
-\cs{BoolVarAnd}.
+%The \meta{boolean_2} is only evaluated if it is needed to determine the result of
+%\cs{BoolVarAnd}.
For example
\begin{demohigh}
\BoolVarAndTF {\IntCompare{3}>{2}} {\IntCompare{3}>{4}} {\Return{Yes}} {\Return{No}}
@@ -873,8 +906,8 @@ For example
Implements the \enquote{Or} operation between two booleans,
hence is \texttt{true} if either one is \texttt{true}.
%Contrarily to the infix operator \verb"||",
-The \meta{boolean_2} is only evaluated if it is needed to determine the result of
-\cs{BoolVarOr}.
+%The \meta{boolean_2} is only evaluated if it is needed to determine the result of
+%\cs{BoolVarOr}.
For example
\begin{demohigh}
\BoolVarOrTF {\IntCompare{3}>{2}} {\IntCompare{3}>{4}} {\Return{Yes}} {\Return{No}}
@@ -899,9 +932,9 @@ For example
Loops using either boolean expressions or stored boolean values.
-\begin{function}{\BoolDoUntil}
+\begin{function}{\BoolVarDoUntil}
\begin{syntax}
-\cs{BoolDoUntil} \meta{boolean} \Arg{code}
+\cs{BoolVarDoUntil} \meta{boolean} \Arg{code}
\end{syntax}
Places the \meta{code} in the input stream for \TeX{} to process,
and then checks the logical value of the \meta{boolean}. If it is
@@ -923,9 +956,9 @@ stream again and the process loops until the \meta{boolean} is
\end{demohigh}
\end{function}
-\begin{function}{\BoolDoWhile}
+\begin{function}{\BoolVarDoWhile}
\begin{syntax}
-\cs{BoolDoWhile} \meta{boolean} \Arg{code}
+\cs{BoolVarDoWhile} \meta{boolean} \Arg{code}
\end{syntax}
Places the \meta{code} in the input stream for \TeX{} to process,
and then checks the logical value of the \meta{boolean}. If it is
@@ -947,9 +980,9 @@ stream again and the process loops until the \meta{boolean} is
\end{demohigh}
\end{function}
-\begin{function}{\BoolUntilDo}
+\begin{function}{\BoolVarUntilDo}
\begin{syntax}
-\cs{BoolUntilDo} \meta{boolean} \Arg{code}
+\cs{BoolVarUntilDo} \meta{boolean} \Arg{code}
\end{syntax}
This function firsts checks the logical value of the \meta{boolean}.
If it is \texttt{false} the \meta{code} is placed in the input stream
@@ -971,9 +1004,9 @@ until the \meta{boolean} is \texttt{true}.
\end{demohigh}
\end{function}
-\begin{function}{\BoolWhileDo}
+\begin{function}{\BoolVarWhileDo}
\begin{syntax}
-\cs{BoolWhileDo} \meta{boolean} \Arg{code}
+\cs{BoolVarWhileDo} \meta{boolean} \Arg{code}
\end{syntax}
This function firsts checks the logical value of the \meta{boolean}.
If it is \texttt{true} the \meta{code} is placed in the input stream
@@ -1604,17 +1637,16 @@ below remain in effect after the loop.
\end{syntax}
Applies the \meta{inline function} to every \meta{item} stored within the
\meta{token list}. The \meta{inline function} should consist of code which
-receives the \meta{item} as \verb|#1|. For example,
-\begin{codehigh}
+receives the \meta{item} as \verb|#1|.
+\begin{demohigh}
\IgnoreSpacesOn
\TlClear \lTmpaTl
\TlMapInline {one} {
\TlPutRight \lTmpaTl {[#1]}
}
-\Return{\TlUse\lTmpaTl}
+\TlUse \lTmpaTl
\IgnoreSpacesOff
-\end{codehigh}
-produces [o][n][e].
+\end{demohigh}
\end{function}
\begin{function}{\TlVarMapInline}
@@ -1623,18 +1655,17 @@ produces [o][n][e].
\end{syntax}
Applies the \meta{inline function} to every \meta{item} stored within the
\meta{tl var}. The \meta{inline function} should consist of code which
-receives the \meta{item} as \verb|#1|. For example,
-\begin{codehigh}
+receives the \meta{item} as \verb|#1|.
+\begin{demohigh}
\IgnoreSpacesOn
\TlClear \lTmpaTl
\TlSet \lTmpkTl {one}
\TlVarMapInline \lTmpkTl {
\TlPutRight \lTmpaTl {[#1]}
}
-\Return{\TlUse\lTmpaTl}
+\TlUse \lTmpaTl
\IgnoreSpacesOff
-\end{codehigh}
-produces [o][n][e].
+\end{demohigh}
\end{function}
%\begin{function}{\TlMapTokens,\TlVarMapTokens}
@@ -2522,17 +2553,15 @@ applies the \meta{inline function} to every \meta{character} in the
\meta{str var} including spaces.
The \meta{inline function} should consist of code which
receives the \meta{character} as \verb|#1|.
-For example,
-\begin{codehigh}
+\begin{demohigh}
\IgnoreSpacesOn
\StrClear \lTmpaStr
\StrMapInline {one} {
\StrPutRight \lTmpaStr {[#1]}
}
-\Return{\StrUse\lTmpaStr}
+\StrUse \lTmpaStr
\IgnoreSpacesOff
-\end{codehigh}
-produces [o][n][e].
+\end{demohigh}
\end{function}
%\begin{function}{\StrMapTokens, \StrVarMapTokens}
@@ -2566,7 +2595,7 @@ the (string or token list) \meta{variable} and applies the
\StrMapVariable {one} \lTmpiStr {
\StrPutRight \lTmpaStr {\Expand {[\lTmpiStr]}}
}
-\Return{\StrUse\lTmpaStr}
+\StrUse \lTmpaStr
\IgnoreSpacesOff
\end{demohigh}
\end{function}
@@ -2935,7 +2964,56 @@ function. However, they may be overwritten by other
code and so should only be used for short-term storage.
\end{variable}
-\section{Integer Expressions}
+\section{The Syntax of Integer Expressions}
+
+An \meta{integer expression} should consist,
+after evaluation of functions defined with \cs{PrgNewFunction}
+and expansion, of \texttt{+}, \texttt{-}, \texttt{*}, \texttt{/},
+\texttt{(}, \texttt{)} and of course integer operands. The result
+is calculated by applying standard mathematical rules with the
+following peculiarities:
+\begin{itemize}
+\item \texttt{/} denotes division rounded to the closest integer with
+ties rounded away from zero;
+\item there is an error and the overall expression evaluates to zero
+whenever the absolute value of any intermediate result exceeds
+$2^{31}-1$, except in the case of scaling operations
+$a$\texttt{*}$b$\texttt{/}$c$, for which $a$\texttt{*}$b$ may be
+arbitrarily large (but the operands $a$, $b$, $c$ are still
+constrained to an absolute value at most $2^{31}-1$);
+\item parentheses may not appear after unary \texttt{+} or
+\texttt{-}, namely placing \texttt{+(} or \texttt{-(} at the start
+of an expression or after \texttt{+}, \texttt{-}, \texttt{*},
+\texttt{/} or~\texttt{(} leads to an error.
+\end{itemize}
+Each integer operand can be either an integer variable (with no need
+for \cs{IntUse}) or an integer denotation.
+For example both of the following give the same result
+because \cs{lFooSomeTl} expands to the integer denotation~$5$
+while the integer variable \cs{lFooSomeInt} takes the value~$4$.
+\begin{demohigh}
+\IntEval {5 + 4 * 3 - (3 + 4 * 5)}
+\end{demohigh}
+\begin{demohigh}
+\TlNew \lFooSomeTl
+\TlSet \lFooSomeTl {5}
+\IntNew \lFooSomeInt
+\IntSet \lFooSomeInt {4}
+\IntEval {\lFooSomeTl + \lFooSomeInt * 3 - (3 + 4 * 5)}
+\end{demohigh}
+
+%\begin{texnote}
+%As all \TeX{} integers, integer operands can also be:
+%\tn{value}\Arg{\LaTeXe{} counter}; dimension or skip variables,
+%converted to integers in~\texttt{sp}; the character code of some
+%character given as \texttt{`}\meta{char} or
+%\texttt{`\textbackslash}\meta{char}; octal numbers given as
+%\texttt{'} followed by digits from \texttt{0} to \texttt{7}; or
+%hexadecimal numbers given as \verb|"| followed by digits and upper case
+%letters from \texttt{A} to~\texttt{F}.
+%\end{texnote}
+
+\section{Using Integer Expressions}
\begin{function}{\IntEval}
\begin{syntax}
@@ -2949,6 +3027,9 @@ for negative results \texttt{-}~followed by such a sequence, and
\begin{demohigh}
\IntEval {(1+4)*(2-3)/5}
\end{demohigh}
+\begin{demohigh}
+\IntEval {\StrCount{12\TeX34} - \TlCount{12\TeX34}}
+\end{demohigh}
\end{function}
\begin{function}{\IntMathAdd}
@@ -3223,6 +3304,17 @@ current content of the \meta{integer}. For example
\section{Integer Step Functions}
+\begin{function}{\IntReplicate}
+\begin{syntax}
+\cs{IntReplicate} \Arg{integer expression} \Arg{tokens}
+\end{syntax}
+Evaluates the \meta{integer expression} (which should be zero or positive)
+and returns the resulting number of copies of the \meta{tokens}.
+\begin{demohigh}
+\IntReplicate {4} {Hello}
+\end{demohigh}
+\end{function}
+
%\begin{function}{\IntStepFunction}
%\begin{syntax}
%\cs{IntStepFunction} \Arg{initial value} \Arg{step} \Arg{final value} \meta{function}
@@ -3262,17 +3354,37 @@ Then for each \meta{value} from the \meta{initial value} to the
\meta{value}), the \meta{code} is inserted into the input stream
with \verb|#1| replaced by the current \meta{value}. Thus the
\meta{code} should define a function of one argument~(\verb|#1|).
-For example
-\begin{codehigh}
+\begin{demohigh}
\IgnoreSpacesOn
\TlClear \lTmpaTl
\IntStepInline {1} {3} {30} {
\TlPutRight \lTmpaTl {[#1]}
}
-\Return {\Value\lTmpaTl}
+\TlUse \lTmpaTl
\IgnoreSpacesOff
-\end{codehigh}
-produces [1][4][7][10][13][16][19][22][25][28].
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntStepOneInline}
+\begin{syntax}
+\cs{IntStepOneInline} \Arg{initial value} \Arg{final value} \Arg{code}
+\end{syntax}
+This function first evaluates the \meta{initial value} and \meta{final value},
+all of which should be integer expressions.
+Then for each \meta{value} from the \meta{initial value} to the
+\meta{final value} in turn (using a fixed step of $1$ between each
+\meta{value}), the \meta{code} is inserted into the input stream
+with \verb|#1| replaced by the current \meta{value}. Thus the
+\meta{code} should define a function of one argument~(\verb|#1|).
+\begin{demohigh}
+\IgnoreSpacesOn
+\TlClear \lTmpaTl
+\IntStepOneInline {1} {10} {
+ \TlPutRight \lTmpaTl {[#1]}
+}
+\TlUse \lTmpaTl
+\IgnoreSpacesOff
+\end{demohigh}
\end{function}
\begin{function}{\IntStepVariable}
@@ -3299,6 +3411,19 @@ the \meta{code} should make use of the \meta{tl~var}.
%\end{demohigh}
\end{function}
+\begin{function}{\IntStepOneVariable}
+\begin{syntax}
+\cs{IntStepOneVariable} \Arg{initial value} \Arg{final value} \meta{tl var} \Arg{code}
+\end{syntax}
+This function first evaluates the \meta{initial value} and \meta{final value},
+all of which should be integer expressions.
+Then for each \meta{value} from the \meta{initial value} to the
+\meta{final value} in turn (using a fixed stop of $1$ between each
+\meta{value}), the \meta{code} is evaluated,
+with the \meta{tl~var} defined as the current \meta{value}. Thus
+the \meta{code} should make use of the \meta{tl~var}.
+\end{function}
+
\section{Integer Conditionals}
\begin{function}{\IntIfExist,\IntIfExistT,\IntIfExistF,\IntIfExistTF}
@@ -3413,7 +3538,7 @@ compares this in turn to each of the
\meta{integer expression cases}. If the two are equal then the
associated \meta{code} is left in the input stream
and other cases are discarded. If none
-match then the \meta{false code} is into the input stream
+match then the \meta{false code} is into the input stream
(after the code for the appropriate case).
For example
\begin{demohigh}
@@ -3499,7 +3624,112 @@ function. However, they may be overwritten by other
code and so should only be used for short-term storage.
\end{variable}
-\section{Floating Point Expressions}
+\section{The Syntax of Floating Point Expressions}
+
+A decimal floating point number is one which is stored as a significand and a
+separate exponent. The module implements expandably a wide set of
+arithmetic, trigonometric, and other operations on decimal floating point
+numbers, to be used within floating point expressions. Floating point
+expressions support the following operations with their usual
+precedence.
+\begin{itemize}
+\item Basic arithmetic: addition $x+y$, subtraction $x-y$,
+multiplication $x*y$, division $x/y$, square root $\sqrt{x}$,
+and parentheses.
+\item Comparison operators: $x\mathop{\mathtt{<}}y$,
+$x\mathop{\mathtt{<=}}y$, $x\mathop{\mathtt{>?}}y$,
+$x\mathop{\mathtt{!=}}y$ \emph{etc.}
+\item Boolean logic: sign $\operatorname{sign} x$,
+negation $\mathop{!}x$, conjunction
+$x\mathop{\&\&}y$, disjunction $x\mathop{\vert\vert}y$, ternary
+operator $x\mathop{?}y\mathop{:}z$.
+\item Exponentials: $\exp x$, $\ln x$, $x^y$, $\operatorname{logb} x$.
+\item Integer factorial: $\operatorname{fact} x$.
+\item Trigonometry: $\sin x$, $\cos x$, $\tan x$, $\cot x$, $\sec
+x$, $\csc x$ expecting their arguments in radians, and
+$\operatorname{sind} x$, $\operatorname{cosd} x$,
+$\operatorname{tand} x$, $\operatorname{cotd} x$,
+$\operatorname{secd} x$, $\operatorname{cscd} x$ expecting their
+arguments in degrees.
+\item Inverse trigonometric functions: $\operatorname{asin} x$,
+$\operatorname{acos} x$, $\operatorname{atan} x$,
+$\operatorname{acot} x$, $\operatorname{asec} x$,
+$\operatorname{acsc} x$ giving a result in radians, and
+$\operatorname{asind} x$, $\operatorname{acosd} x$,
+$\operatorname{atand} x$, $\operatorname{acotd} x$,
+$\operatorname{asecd} x$, $\operatorname{acscd} x$ giving a result
+in degrees.
+%\item [\emph{(not yet)}] Hyperbolic functions and their inverse
+%functions: $\sinh x$, $\cosh x$, $\tanh x$, $\coth x$,
+%$\operatorname{sech} x$, $\operatorname{csch}$, and
+%$\operatorname{asinh} x$, $\operatorname{acosh} x$,
+%$\operatorname{atanh} x$, $\operatorname{acoth} x$,
+%$\operatorname{asech} x$, $\operatorname{acsch} x$.
+\item Extrema: $\max(x_{1},x_{2},\ldots)$, $\min(x_{1},x_{2},\ldots)$,
+$\operatorname{abs}(x)$.
+\item Rounding functions, controlled by two optional
+values, $n$ (number of places, $0$ by default) and
+$t$ (behavior on a tie, $\nan$ by default):
+\begin{itemize}
+\item $\operatorname{trunc}(x,n)$ rounds towards zero,
+\item $\operatorname{floor}(x,n)$ rounds towards $-\infty$,
+\item $\operatorname{ceil}(x,n)$ rounds towards $+\infty$,
+\item $\operatorname{round}(x,n,t)$ rounds to the closest value, with
+ties rounded to an even value by default, towards zero if $t=0$,
+towards $+\infty$ if $t>0$ and towards $-\infty$ if $t<0$.
+\end{itemize}
+%And \emph{(not yet)} modulo, and \enquote{quantize}.
+\item Random numbers: $\mathop{rand}()$, $\mathop{randint}(m,n)$.
+\item Constants: \texttt{pi}, \texttt{deg} (one degree in radians).
+\item Dimensions, automatically expressed in points, \emph{e.g.},
+\texttt{pc} is $12$.
+\item Automatic conversion (no need for \cs{IntUse}, etc) of
+integer, dimension, and skip variables to floating point numbers,
+expressing dimensions in points and ignoring the stretch and
+shrink components of skips.
+\item Tuples: $(x_1,\ldots{},x_n)$ that can be stored in variables,
+added together, multiplied or divided by a floating point number,
+and nested.
+\end{itemize}
+Floating point numbers can be given either explicitly (in a form such
+as \verb|1.234e-34|, or \verb|-.0001|), or as a stored floating point variable,
+which is automatically replaced by its current value.
+A \enquote{floating point} is a floating point number or a tuple thereof.
+%See section \ref{sec:l3fp:fp-floats} for a description of what a floating point is,
+%section \ref{sec:l3fp:fp-precedence} for details about how an expression is
+%parsed, and section \ref{sec:l3fp:fp-operations} to know what the various
+%operations do. Some operations may raise exceptions (error messages),
+%described in section \ref{sec:l3fp:fp-exceptions}.
+
+An example of use could be the following.
+\begin{demohigh}
+\LaTeX{} can now compute: $ \frac{\sin(3.5)}{2} + 2\cdot 10^{-3}
+= \FpEval {sin(3.5)/2 + 2e-3} $.
+\end{demohigh}
+
+The operation \texttt{round} can be used to limit the result's
+precision. Adding $+0$ avoids the possibly undesirable output \verb|-0|,
+replacing it by \verb|+0|.
+
+%However, the \pkg{l3fp} module is mostly meant
+%as an underlying tool for higher-level commands. For example, one
+%could provide a function to typeset nicely the result of floating
+%point computations.
+%\begin{verbatim}
+%\documentclass{article}
+%\usepackage{xparse, siunitx}
+%\ExplSyntaxOn
+%\NewDocumentCommand { \calcnum } { m }
+%{ \num { \fp_to_scientific:n {#1} } }
+%\ExplSyntaxOff
+%\begin{document}
+%\calcnum { 2 pi * sin ( 2.3 ^ 5 ) }
+%\end{document}
+%\end{verbatim}
+%See the documentation of \pkg{siunitx} for various options of
+%\cs{num}.
+
+\section{Using Floating Point Expressions}
\begin{function}{\FpEval}
\begin{syntax}
@@ -3805,17 +4035,15 @@ Then for each \meta{value} from the \meta{initial value} to the
\meta{value}), the \meta{code} is inserted into the input stream
with \verb|#1| replaced by the current \meta{value}. Thus the
\meta{code} should define a function of one argument (\verb|#1|).
-For example
-\begin{codehigh}
+\begin{demohigh}
\IgnoreSpacesOn
\TlClear \lTmpaTl
\FpStepInline {1} {0.1} {1.5} {
\TlPutRight \lTmpaTl {[#1]}
}
-\Return {\Value\lTmpaTl}
+\TlUse \lTmpaTl
\IgnoreSpacesOff
-\end{codehigh}
-produces [1][1.1][1.2][1.3][1.4][1.5].
+\end{demohigh}
\end{function}
\begin{function}{\FpStepVariable}
@@ -4201,17 +4429,15 @@ Then for each \meta{value} from the \meta{initial value} to the
\meta{value}), the \meta{code} is inserted into the input stream
with \verb|#1| replaced by the current \meta{value}. Thus the
\meta{code} should define a function of one argument (\verb|#1|).
-For example
-\begin{codehigh}
+\begin{demohigh}
\IgnoreSpacesOn
\TlClear \lTmpaTl
\DimStepInline {1pt} {0.1pt} {1.5pt} {
\TlPutRight \lTmpaTl {[#1]}
}
-\Return {\Value\lTmpaTl}
+\TlUse \lTmpaTl
\IgnoreSpacesOff
-\end{codehigh}
-produces [1.0pt][1.1pt][1.20001pt][1.30002pt][1.40002pt].
+\end{demohigh}
\end{function}
\begin{function}{\DimStepVariable}
@@ -4422,7 +4648,7 @@ initially contains no items.
\ClistNew \lFooSomeClist
\end{codehigh}
\end{function}
-
+
\begin{function}{\ClistConst}
\begin{syntax}
\cs{ClistConst} \meta{clist var} \Arg{comma list}
@@ -4667,7 +4893,7 @@ To append some \meta{tokens} as a single \meta{item} even if the
\ClistVarJoin \lTmpaClist { and }
\end{demohigh}
\end{function}
-
+
\begin{function}{\ClistPutRight}
\begin{syntax}
\cs{ClistPutRight} \meta{comma list} \verb|{|\meta{item_1},\ldots{},\meta{item_n}\verb|}|
@@ -4685,14 +4911,14 @@ To append some \meta{tokens} as a single \meta{item} even if the
\ClistVarJoin \lTmpaClist { and }
\end{demohigh}
\end{function}
-
+
\section{Modifying Comma Lists}
-
+
While comma lists are normally used as ordered lists, it may be
necessary to modify the content. The functions here may be used
to update comma lists, while retaining the order of the unaffected
entries.
-
+
\begin{function}{\ClistVarRemoveDuplicates}
\begin{syntax}
\cs{ClistVarRemoveDuplicates} \meta{comma list}
@@ -4714,7 +4940,7 @@ comparison takes place on a token basis, as for \cs{TlIfEqTF}.
%(assuming the usual \TeX{} category codes apply).
%\end{texnote}
\end{function}
-
+
\begin{function}{\ClistVarRemoveAll}
\begin{syntax}
\cs{ClistVarRemoveAll} \meta{comma list} \Arg{item}
@@ -4732,7 +4958,7 @@ The \meta{item} comparison takes place on a token basis, as for
%(assuming the usual \TeX{} category codes apply).
%\end{texnote}
\end{function}
-
+
\begin{function}{\ClistVarReverse}
\begin{syntax}
\cs{ClistVarReverse} \meta{comma list}
@@ -4744,7 +4970,7 @@ Reverses the order of items stored in the \meta{comma list}.
\ClistVarJoin \lTmpaClist {,}
\end{demohigh}
\end{function}
-
+
%\begin{function}{\ClistVarSort}
%\begin{syntax}
%\cs{ClistVarSort} \meta{clist var} \Arg{comparison code}
@@ -4794,7 +5020,7 @@ calculated by \cs{ClistCount}) then the function returns nothing.
%or \texttt{e}-type argument expansion.
%\end{texnote}
\end{function}
-
+
\begin{function}{\ClistVarItem}
\begin{syntax}
\cs{ClistVarItem} \meta{comma list} \Arg{integer expression}
@@ -4818,7 +5044,7 @@ calculated by \cs{ClistVarCount}) then the function returns nothing.
%or \texttt{e}-type argument expansion.
%\end{texnote}
\end{function}
-
+
\begin{function}{\ClistRandItem,\ClistVarRandItem}
\begin{syntax}
\cs{ClistRandItem} \Arg{comma list}
@@ -4841,14 +5067,14 @@ If the \meta{comma list} has no item, the result is empty.
\end{function}
\section{Comma Lists as Stacks}
-
+
Comma lists can be used as stacks, where data is pushed to and popped
from the top of the comma list. (The left of a comma list is the top, for
performance reasons.) The stack functions for comma lists are not
intended to be mixed with the general ordered data functions detailed
in the previous section: a comma list should either be used as an
ordered data type or as a stack, but not in both ways.
-
+
\begin{function}{\ClistGet}
\begin{syntax}
\cs{ClistGet} \meta{comma list} \meta{token list variable}
@@ -4935,13 +5161,13 @@ Spaces are removed from both sides of each item as for any
\end{function}
\section{Mapping over Comma Lists}
-
+
%The functions described in this section apply a specified function
%to each item of a comma list.
%All mappings are done at the current group level, \emph{i.e.} any
%local assignments made by the \meta{function} or \meta{code} discussed
%below remain in effect after the loop.
-
+
When the comma list is given explicitly, %as an \texttt{n}-type argument,
spaces are trimmed around each item.
If the result of trimming spaces is empty, the item is ignored.
@@ -4950,7 +5176,7 @@ and the result is passed to the mapped function. Thus, if the
comma list that is being mapped is \verb*|{a , {{b} }, ,{}, {c},}|
then the arguments passed to the mapped function are
`\verb*|a|', `\verb*|{b} |', an empty argument, and `\verb*|c|'.
-
+
When the comma list is given as a variable, spaces
have already been trimmed on input, and items are simply stripped
of one set of braces if any. This case is more efficient than using
@@ -4977,17 +5203,15 @@ Applies \meta{inline function} to every \meta{item} stored
within the \meta{comma list}. The \meta{inline function} should
consist of code which receives the \meta{item} as \verb|#1|.
The \meta{items} are returned from left to right.
-For example
-\begin{codehigh}
+\begin{demohigh}
\IgnoreSpacesOn
\TlClear \lTmpaTl
\ClistMapInline {one,two,three} {
\TlPutRight \lTmpaTl {(#1)}
}
-\Return {\TlUse\lTmpaTl}
+\TlUse \lTmpaTl
\IgnoreSpacesOff
-\end{codehigh}
-produces (one)(two)(three).
+\end{demohigh}
\end{function}
\begin{function}{\ClistMapVariable,\ClistVarMapVariable}
@@ -5011,7 +5235,7 @@ list}, or its original value if there were no \meta{item}. The
\IgnoreSpacesOff
\end{demohigh}
\end{function}
-
+
%\begin{function}{\ClistMapTokens,\ClistVarMapTokens}
%\begin{syntax}
%\cs{ClistMapTokens} \Arg{comma list} \Arg{code}
@@ -5022,7 +5246,7 @@ list}, or its original value if there were no \meta{item}. The
%trailing brace group. If the \meta{code} consists of a single
%function this is equivalent to \cs{ClistMapFunction} or \cs{ClistVarMapFunction}.
%\end{function}
-
+
%\begin{function}{\ClistMapBreak}
%\begin{syntax}
%\cs{ClistMapBreak}
@@ -5049,7 +5273,7 @@ list}, or its original value if there were no \meta{item}. The
%function.
%\end{texnote}
%\end{function}
-%
+%
%\begin{function}{\ClistMapBreakDo}
%\begin{syntax}
%\cs{ClistMapBreakDo} \Arg{code}
@@ -5129,7 +5353,7 @@ Tests if the \meta{comma list} is empty (containing no items).
\ClistVarIfEmptyTF \lTmpaClist {\Return{Empty}} {\Return{NonEmpty}}
\end{demohigh}
\end{function}
-
+
\begin{function}{\ClistIfIn,\ClistIfInT,\ClistIfInF,\ClistIfInTF}
\begin{syntax}
\cs{ClistIfIn} \Arg{comma list} \Arg{item}
@@ -5824,18 +6048,17 @@ The \meta{token list variable} is assigned locally.
Applies \meta{inline function} to every \meta{item} stored
within the \meta{sequence}. The \meta{inline function} should
consist of code which will receive the \meta{item} as \verb|#1|.
-The \meta{items} are returned from left to right. For example,
-\begin{codehigh}
+The \meta{items} are returned from left to right.
+\begin{demohigh}
\IgnoreSpacesOn
\SeqSetFromClist \lTmpkSeq {one,two,three}
\TlClear \lTmpaTl
\SeqVarMapInline \lTmpkSeq {
\TlPutRight \lTmpaTl {(#1)}
}
-\Return {\TlUse\lTmpaTl}
+\TlUse \lTmpaTl
\IgnoreSpacesOff
-\end{codehigh}
-produces (one)(two)(three).
+\end{demohigh}
\end{function}
%\begin{function}{\SeqVarMapTokens}
@@ -5872,7 +6095,7 @@ or its original value if the \meta{sequence} is empty. The
\SeqVarMapVariable \lTmpaSeq \lTmpiTl {
\IntAdd \lTmpaInt {\lTmpiTl*\lTmpiTl}
}
-\Return {\IntUse\lTmpaInt}
+\IntUse \lTmpaInt
\IgnoreSpacesOff
\end{demohigh}
\end{function}
@@ -6443,18 +6666,16 @@ consist of code which receives the \meta{key} as \verb|#1| and the
\meta{value} as \verb|#2|.
The order in which \meta{entries} are returned is not defined and
should not be relied upon.
-For example,
-\begin{codehigh}
+\begin{demohigh}
\IgnoreSpacesOn
\PropSetFromKeyval \lTmpkProp {key1=one,key2=two,key3=three}
\TlClear \lTmpaTl
\PropVarMapInline \lTmpkProp {
\TlPutRight \lTmpaTl {(#1=#2)}
}
-\Return {\TlUse\lTmpaTl}
+\TlUse \lTmpaTl
\IgnoreSpacesOff
-\end{codehigh}
-produces (key1=one)(key2=two)(key3=three).
+\end{demohigh}
\end{function}
%\begin{function}{\PropVarMapTokens}
@@ -6582,6 +6803,347 @@ making the comparison using the method described by \cs{StrIfEqTF}.
%\end{texnote}
\end{function}
+\chapter{Token Manipulation (\texttt{Token})}
+
+\begin{function}{\CharLowercase,\CharUppercase,\CharTitlecase,\CharFoldcase}
+\begin{syntax}
+\cs{CharLowercase} \meta{char}
+\cs{CharUppercase} \meta{char}
+\cs{CharTitlecase} \meta{char}
+\cs{CharFoldcase} \meta{char}
+\end{syntax}
+Converts the \meta{char} to the equivalent case-changed character
+as detailed by the function name (see %\cs{StrFoldcase} and
+\cs{TextTitlecase} for details of these terms). The case mapping
+is carried out with no context-dependence (\emph{cf.} \cs{TextUppercase},
+\emph{etc.}) These functions generate characters with the category code
+of the \meta{char} (i.e. only the character code changes).
+\end{function}
+
+\begin{function}{\CharStrLowercase,\CharStrUppercase,\CharStrTitlecase,\CharStrFoldcase}
+\begin{syntax}
+\cs{CharStrLowercase} \meta{char}
+\cs{CharStrUppercase} \meta{char}
+\cs{CharStrTitlecase} \meta{char}
+\cs{CharStrFoldcase} \meta{char}
+\end{syntax}
+Converts the \meta{char} to the equivalent case-changed character
+as detailed by the function name (see %\cs{StrFoldcase} and
+\cs{TextTitlecase} for details of these terms). The case mapping
+is carried out with no context-dependence (\emph{cf.} \cs{TextUppercase},
+\emph{etc.}) These functions generate \enquote{other} (category code $12$)
+characters.
+\end{function}
+
+\begin{function}{\CharSetLccode}
+\begin{syntax}
+\cs{CharSetLccode} \Arg{intexpr_1} \Arg{intexpr_2}
+\end{syntax}
+Sets up the behaviour of the \meta{character} when
+found inside \cs{TextLowercase}, such that \meta{character_1}
+will be converted into \meta{character_2}. The two \meta{characters}
+may be specified using an \meta{integer expression} for the character code
+concerned. This may include the \TeX{} \verb|`|\meta{character}
+method for converting a single character into its character code:
+\begin{codehigh}
+\CharSetLccode {`\A} {`\a} % Standard behaviour
+\CharSetLccode {`\A} {`\A + 32}
+\CharSetLccode {65} {97}
+\end{codehigh}
+The setting applies within the current \TeX{} group.
+\end{function}
+
+\begin{function}{\CharSetUccode}
+\begin{syntax}
+\cs{CharSetUccode} \Arg{intexpr_1} \Arg{intexpr_2}
+\end{syntax}
+Sets up the behaviour of the \meta{character} when
+found inside \cs{TextUppercase}, such that \meta{character_1}
+will be converted into \meta{character_2}. The two \meta{characters}
+may be specified using an \meta{integer expression} for the character code
+concerned. This may include the \TeX{} \verb|`|\meta{character}
+method for converting a single character into its character code:
+\begin{codehigh}
+\CharSetUccode {`\a} {`\A} % Standard behaviour
+\CharSetUccode {`\a} {`\a - 32}
+\CharSetUccode {97} {65}
+\end{codehigh}
+The setting applies within the current \TeX{} group.
+\end{function}
+
+\begin{function}{\CharValueLccode}
+\begin{syntax}
+\cs{CharValueLccode} \Arg{integer expression}
+\end{syntax}
+Returns the current lower case code of the \meta{character} with
+character code given by the
+\meta{integer expression}.
+\end{function}
+
+\begin{function}{\CharValueUccode}
+\begin{syntax}
+\cs{CharValueUccode} \Arg{integer expression}
+\end{syntax}
+Returns the current upper case code of the \meta{character} with
+character code given by the
+\meta{integer expression}.
+\end{function}
+
+%\begin{function}{\CharShowValueLccode}
+%\begin{syntax}
+%\cs{CharShowValueLccode} \Arg{integer expression}
+%\end{syntax}
+%Displays the current lower case code of the \meta{character} with
+%character code given by the \meta{integer expression} on the
+%terminal.
+%\end{function}
+%
+%\begin{function}{\CharShowValueUccode}
+%\begin{syntax}
+%\cs{CharShowValueUccode} \Arg{integer expression}
+%\end{syntax}
+%Displays the current upper case code of the \meta{character} with
+%character code given by the \meta{integer expression} on the
+%terminal.
+%\end{function}
+
+\chapter{Text Processing (\texttt{Text})}
+
+This module deals with manipulation of (formatted) text; such material is
+comprised of a restricted set of token list content. The functions provided
+here concern conversion of textual content for example in case changing,
+%generation of bookmarks and extraction to tags.
+Begin-group and end-group tokens in the \meta{text}
+are normalized and become \verb|{| and \verb|}|, respectively.
+
+\section{Case Changing}
+
+These case changing functions are designed to work with Unicode input only.
+As such, UTF-8 input is assumed for \emph{all} engines.
+When used with XeTeX or LuaTeX a full range of Unicode transformations
+are enabled. Specifically, the standard mappings
+here follow those defined by the \href{http://www.unicode.org}
+{Unicode Consortium} in \texttt{UnicodeData.txt} and
+\texttt{SpecialCasing.txt}. In the case of $8$-bit engines, mappings
+are provided for characters which can be represented in output typeset
+using the \verb|T1|, \verb|T2| and \verb|LGR| font encodings.
+Thus for example \texttt{รค} can be
+case-changed using pdfTeX. For pTeX only the ASCII range is
+covered as the engine treats input outside of this range as east Asian.
+
+%Importantly, notice that these functions are intended for working with
+%user \emph{text for typesetting}. For case changing programmatic data see
+%the \pkg{Str} module and discussion there of \cs{StrLowercase},
+%\cs{StrUppercase} and \cs{StrFoldcase}.
+
+\begin{function}{\TextExpand}
+\begin{syntax}
+\cs{TextExpand} \Arg{text}
+\end{syntax}
+Takes user input \meta{text} and expands the content.
+Protected commands (typically formatting) are left in place,
+and no processing takes place of math mode material.
+%(as delimited by pairs given in \cs{l_text_math_delims_tl}
+%or as the argument to commands listed in \cs{l_text_math_arg_tl}).
+Commands which are neither engine- nor \LaTeX{} protected are expanded exhaustively.
+%Any commands listed in \cs{l_text_expand_exclude_tl},
+%\cs{l_text_accents_tl} and \cs{l_text_letterlike_tl} are excluded from expansion.
+\end{function}
+
+\begin{function}{\TextLowercase,\TextUppercase,\TextTitlecase,\TextTitlecaseFirst}
+\begin{syntax}
+\cs{TextLowercase} \Arg{tokens}
+\cs{TextUppercase} \Arg{tokens}
+\cs{TextTitlecase} \Arg{tokens}
+\cs{TextTitlecaseFirst} \Arg{tokens}
+\end{syntax}
+Takes user input \meta{text} first applies \cs{TextExpand}, then
+transforms the case of character tokens as specified by the
+function name. The category code of letters are not changed by this
+process (at least where they can be represented by the engine as a single
+token: $8$-bit engines may require active characters).
+\par
+Upper- and lowercase have the obvious meanings. Titlecasing may be regarded
+informally as converting the first character of the \meta{tokens} to
+uppercase and the rest to lowercase. However, the process is more complex
+than this as there are some situations where a single lowercase character
+maps to a special form, for example \texttt{ij} in Dutch which becomes
+\texttt{IJ}.
+\par
+For titlecasing, note that there are two functions available. The
+function \cs{TextTitlecase} applies (broadly) uppercasing to the first
+letter of the input, then lowercasing to the remainder. In contrast,
+\cs{TextTitlecaseFirst} \emph{only} carries out the uppercasing operation,
+and leaves the balance of the input unchanged.
+%Determining whether non-letter characters at the start of text should switch
+%from upper- to lowercasing is controllable.
+%When \cs{l_text_titlecase_check_letter_bool} is \texttt{true},
+%characters which are not letters (category code $11$) are
+%left unchanged and \enquote{skipped}: the first \emph{letter} is uppercased.
+%(With $8$-bit engines, this is extended to active characters which form
+%part of a multi-byte letter codepoint.) When
+%\cs{l_text_titlecase_check_letter_bool} is \texttt{false}, the first
+%character is uppercased, and the rest lowercased, irrespective of the nature
+%of the character.
+\par
+Case changing does not take place within math mode material. For example:
+\begin{demohigh}
+\TextUppercase {Text $y=mx+c$ with {Braces}}
+\end{demohigh}
+\begin{demohigh}
+\TextLowercase {Text $Y=mX+c$ with {Braces}}
+\end{demohigh}
+%The arguments of commands listed in \cs{l_text_case_exclude_arg_tl}
+%are excluded from case changing; the latter are entirely non-textual
+%content (such as labels).
+\end{function}
+
+\begin{function}{\TextLangLowercase,\TextLangUppercase,\TextLangTitlecase,\TextLangTitlecaseFirst}
+\begin{syntax}
+\cs{TextLangLowercase} \Arg{language} \Arg{tokens}
+\cs{TextLangUppercase} \Arg{language} \Arg{tokens}
+\cs{TextLangTitlecase} \Arg{language} \Arg{tokens}
+\cs{TextLangTitlecaseFirst} \Arg{language} \Arg{tokens}
+\end{syntax}
+Takes user input \meta{text} first applies \cs{TextExpand}, then
+transforms the case of character tokens as specified by the
+function name. The category code of letters are not changed by this
+process (at least where they can be represented by the engine as a single
+token: $8$-bit engines may require active characters).
+\par
+These conversions are language-sensitive, and follow Unicode Consortium guidelines.
+Currently, the languages recognised for special handling are as follows.
+\begin{itemize}
+\item Azeri and Turkish (\texttt{az} and \texttt{tr}).
+ The case pairs I/i-dotless and I-dot/i are activated for these
+ languages. The combining dot mark is removed when lowercasing
+ I-dot and introduced when upper casing i-dotless.
+\item German (\texttt{de-alt}).
+ An alternative mapping for German in which the lowercase
+ \emph{Eszett} maps to a \emph{gro\ss{}es Eszett}. Since there is
+ a \verb|T1| slot for the \emph{gro\ss{}es Eszett} in \verb|T1|, this
+ tailoring \emph{is} available with pdfTeX as well as in the
+ Unicode \TeX{} engines.
+\item Greek (\texttt{el}).
+ Removes accents from Greek letters when uppercasing; titlecasing
+ leaves accents in place. (At present this is implemented only
+ for Unicode engines.)
+\item Lithuanian (\texttt{lt}).
+ The lowercase letters i and j should retain a dot above when the
+ accents grave, acute or tilde are present. This is implemented for
+ lowercasing of the relevant uppercase letters both when input as
+ single Unicode codepoints and when using combining accents. The
+ combining dot is removed when uppercasing in these cases. Note that
+ \emph{only} the accents used in Lithuanian are covered: the behaviour
+ of other accents are not modified.
+\item Dutch (\texttt{nl}).
+ Capitalisation of \texttt{ij} at the beginning of titlecased
+ input produces \texttt{IJ} rather than \texttt{Ij}. The output
+ retains two separate letters, thus this transformation \emph{is}
+ available using pdfTeX.
+\end{itemize}
+\end{function}
+
+\chapter{Files (\texttt{File})}
+
+This module provides functions for working with external files.
+%Some of these functions apply to an entire file, and have prefix \cs{File},
+%while others are used to work with files on a line by line basis and have
+%prefix \cs{Ior} (reading) or \cs{Iow} (writing).
+
+It is important to remember that when reading external files \TeX{}
+attempts to locate them using both the operating system path and entries in the
+\TeX{} file database (most \TeX{} systems use such a database). Thus the
+\enquote{current path} for \TeX{} is somewhat broader than that for other
+programs.
+
+For functions which expect a \meta{file name} argument, this argument
+may contain both literal items and expandable content, which should on
+full expansion be the desired file name.
+%Active characters (as declared in \cs{l_char_active_seq}) are \emph{not}
+%expanded, allowing the direct use of these in file names.
+Quote tokens (\verb|"|) are not permitted in file names as they are reserved
+for internal use by some \TeX{} primitives.
+
+Spaces are trimmed at the beginning and end of the file name:
+this reflects the fact that some file systems do not allow or interact
+unpredictably with spaces in these positions. When no extension is given,
+this will trim spaces from the start of the name only.
+
+\section{File Operation Functions}
+
+\begin{function}{\FileInput}
+\begin{syntax}
+\cs{FileInput} \Arg{file name}
+\end{syntax}
+Searches for \meta{file name} in the path as detailed for
+\cs{FileIfExistTF}, and if found reads in the file and
+returns the contents. All files read are recorded
+for information and the file name stack is updated by this
+function. An error is raised if the file is not found.
+\end{function}
+
+\begin{function}{\FileIfExistInput,\FileIfExistInputF}
+\begin{syntax}
+\cs{FileIfExistInput} \Arg{file name}
+\cs{FileIfExistInputF} \Arg{file name} \Arg{false code}
+\end{syntax}
+Searches for \meta{file name} using the current \TeX{} search path.
+%and the additional paths included in \cs{l_file_search_path_seq}.
+If found then reads in the file and returns the contents as described
+for \cs{FileInput}, otherwise inserts the \meta{false code}.
+Note that these functions do not raise
+an error if the file is not found, in contrast to \cs{FileInput}.
+\end{function}
+
+\begin{function}{\FileGet,\FileGetT,\FileGetF,\FileGetTF}
+\begin{syntax}
+\cs{FileGet} \Arg{filename} \Arg{setup} \meta{tl}
+\cs{FileGetT} \Arg{filename} \Arg{setup} \meta{tl} \Arg{true code}
+\cs{FileGetF} \Arg{filename} \Arg{setup} \meta{tl} \Arg{false code}
+\cs{FileGetTF} \Arg{filename} \Arg{setup} \meta{tl} \Arg{true code} \Arg{false code}
+\end{syntax}
+Defines \meta{tl} to the contents of \meta{filename}.
+Category codes may need to be set appropriately via the \meta{setup}
+argument.
+The non-branching version sets the \meta{tl} to \cs{qNoValue} if the file is
+not found. The branching version runs the \meta{true code} after the
+assignment to \meta{tl} if the file is found, and \meta{false code}
+otherwise.
+\end{function}
+
+\begin{function}{\FileIfExist,\FileIfExistT,\FileIfExistF,\FileIfExistTF}
+\begin{syntax}
+\cs{FileIfExist} \Arg{file name}
+\cs{FileIfExistT} \Arg{file name} \Arg{true code}
+\cs{FileIfExistF} \Arg{file name} \Arg{false code}
+\cs{FileIfExistTF} \Arg{file name} \Arg{true code} \Arg{false code}
+\end{syntax}
+Searches for \meta{file name} using the current \TeX{} search path.
+%and the additional paths controlled by \cs{l_file_search_path_seq}.
+\end{function}
+
+%\begin{function}{\FileInputStop}
+%\begin{syntax}
+%\cs{FileInputStop}
+%\end{syntax}
+%Ends the reading of a file started by \cs{file_input:n} or similar before
+%the end of the file is reached. Where the file reading is being terminated
+%due to an error, \cs{msg_critical:nn(nn)}
+%should be preferred.
+%\begin{texnote}
+%This function must be used on a line on its own: \TeX{} reads files
+%line-by-line and so any additional tokens in the \enquote{current} line
+%will still be read.
+%\par
+%This is also true if the function is hidden inside another function
+%(which will be the normal case), i.e., all tokens on the same line
+%in the source file are still processed. Putting it on a line by itself
+%in the definition doesn't help as it is the line where it is used that
+%counts!
+%\end{texnote}
+%\end{function}
+
\chapter{Quarks (\texttt{Quark})}
%One special type of constants in \LaTeX3 is \enquote{quarks}.
@@ -6697,7 +7259,6 @@ Sets the \LaTeXe{}/plain \TeX{} conditional \verb|\if|\meta{name}
\chapter{The Source Code}
%\CodeHigh{lite}
-\setlength\parskip{0pt}
\dochighinput[language=latex/latex3]{functional.sty}
\end{document}