summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/plain/xintsession/README.md30
-rw-r--r--Master/texmf-dist/tex/plain/xintsession/xintsession.tex196
2 files changed, 108 insertions, 118 deletions
diff --git a/Master/texmf-dist/doc/plain/xintsession/README.md b/Master/texmf-dist/doc/plain/xintsession/README.md
index 9821fcd2e7b..c5bdd6b7b9f 100644
--- a/Master/texmf-dist/doc/plain/xintsession/README.md
+++ b/Master/texmf-dist/doc/plain/xintsession/README.md
@@ -1,5 +1,7 @@
# xintsession README #
+Release: 0.2 (2021-05-05)
+
## Usage ##
xintsession.tex is to be used with etex (or pdftex or the other engines
@@ -9,19 +11,24 @@ It will load [xintexpr](http://www.ctan.org/pkg/xint) and
[polexpr](http://www.ctan.org/pkg/polexpr)
(its version `0.8` or later is needed).
-The following explanations have been tested on a Unixen (Mac OS),
-please adapt to your shell environment.
+You need 2 steps to start a session:
+
+1. execute `etex xintsession`, or if available, `rlwrap etex xintsession`
+ to benefit from arrow keys navigation and other improvements such
+ as parentheses highlighting.
+ Alternatively, execute `rlwrap etex` and enter `xintsession` at the `**`
+ prompt.
+ One can also use the `-jobname` option of `etex` at this step.
+2. a welcome message is printed, hit the `RET` key at the `*` prompt.
-You need 3 small steps to start a session:
+The above explanations have been tested on a Unixen (Mac OS), and probably
+`rlwrap` is not available on all platforms, but it is not a requirement.
-1. execute `etex`, or better, `rlwrap etex` to benefit from arrow keys
- navigation and other improvements such as parentheses highlighting in
- the input (and optionally, use the `-jobname` option here)
-2. at the `**` prompt, enter `xintsession` and hit `RET`,
-3. a welcome message is printed, hit the `RET` key at the `*` prompt.
+At my locale I added `alias xs="rlwrap etex xintsession"` to my `.bashrc`
+so I only have to type `xs` at the command line.
You are now ready to make computations!
-Here is an example session (spaces do not matter):
+Here is a sample session (spaces do not matter):
(Please type a command or say `\end')
* 1+1/2+1/3+1/4+1/5;
@@ -43,8 +50,9 @@ Here is an example session (spaces do not matter):
Transcript written on xintsession.log.
As this example shows, the computational engine can work in various
-modes: exact, fp, fp16, fp24, fp32, int, and pol. One can define
-variables and functions using `:=` syntax.
+modes: exact, fp, int, and pol. Say `&fp=number` at the prompt
+to activate floating point mode with `number` as Digits (scientific
+functions implemented up to 62 digits at xint 1.4e).
If ill-formed input drops you into TeX error interaction mode, try
hitting `S` it may work to bring you back to normal session.
diff --git a/Master/texmf-dist/tex/plain/xintsession/xintsession.tex b/Master/texmf-dist/tex/plain/xintsession/xintsession.tex
index 271c6abff66..aa0e8540d21 100644
--- a/Master/texmf-dist/tex/plain/xintsession/xintsession.tex
+++ b/Master/texmf-dist/tex/plain/xintsession/xintsession.tex
@@ -1,17 +1,19 @@
-% Release 0.1 (2021/04/13) of xintsession.tex
+% Release 0.2 (2021-05-05) of xintsession.tex
% author: Jean-Francois Burnol
% License: LPPL 1.3c (author-maintained)
% Usage: execute etex or pdftex
% then enter "xintsession" at the ** prompt
\input xintexpr.sty\relax%
+% AJOUTER CHECK DE VERSION ICI
\input xintbinhex.sty\relax%
\input polexpr.sty\relax% attention will crash if < 0.8
\let\PolToExprOneTerm\PolToExprOneTermStyleB%
%\let\PolToExprTimes\empty%
% we do assume standard catcodes on loading and use
-% \XINT_restorecatcodes as a convenience facility.
+% \XINTrestorecatcodes as a convenience facility.
% It stores \endlinechar but not \newlinechar
-\edef\xsrestorecatcodes{\csname XINT_restorecatcodes\endcsname%
+% and was renamed at 1.4e
+\edef\xsrestorecatcodes{\XINTrestorecatcodes%
\newlinechar\the\newlinechar\relax}%
\endlinechar 13 %
\newlinechar 10
@@ -30,7 +32,7 @@
\expandafter\xint_gobble_i\the\numexpr100+\time-60*((\time+30)/60-1).tex}%
\immediate\openout\xs_out=\xs_name\relax
\begingroup\catcode37 12
-\gdef\xs_message#1{\message{#1}\immediate\write\xs_out{%#1}}\endgroup
+\long\gdef\xs_message#1{\message{#1}\immediate\write\xs_out{%#1}}\endgroup
{\catcode13\active\def
{""J}\catcode32\active\edef {\string }%
\catcode`?=0\catcode`\\=12\relax%
@@ -49,13 +51,13 @@
}%
?immediate?write128{%
- xintsession 0.1
+ xintsession 0.2
Copyright (c) Jean-Francois Burnol, 2021.
\jobname is ?jobname
Transcript will go to log and to ?xs_name
- ===> HIT THE <RET> KEY NOW! <===
+ ===> HIT THE <RET> KEY NOW! <===%
}}%
\def\xs_no{0}%
\XINT_expr_defvar_one{@___}{{0}}%
@@ -64,7 +66,7 @@
\def\xs_fetch{\let\xs_in\empty\xs_fetch_a}%
\begingroup
\catcode13\active%
-\gdef\xs_fetch_a#1
+\long\gdef\xs_fetch_a#1
{%
\odef\xs_firstitem{\romannumeral0\xintfirstitem{#1.}}%
\ifcat\relax\expandafter\noexpand\xs_firstitem%
@@ -82,17 +84,15 @@
\fi%
}%
\endgroup
-\def\xs_cs\if;\expandafter\noexpand\romannumeral0\xintlastitem#1#2\fi
+\long\def\xs_cs\if;\expandafter\noexpand\romannumeral0\xintlastitem#1#2\fi
{%
- \xs_message{(executing \detokenize{#1} in background)}
+ \xs_message{(executing \detokenize{#1} in background)}%
#1\xs_fetch_a
}%
-\def\xs_firstfour#1#2#3#4#5\xint_bye{#1#2#3#4}%
-\def\xs_magic\if;\expandafter\noexpand\romannumeral0\xintlastitem#1#2\fi
+\def\xs_firstfour#1#2#3#4#5\xint_bye{\edef\xs_magic_in{#1#2#3#4}\def\xs_magic_inb{#5}}%
+\long\def\xs_magic\if;\expandafter\noexpand\romannumeral0\xintlastitem#1#2\fi
{%
-% this gets rid of spaces and an inadvertent ; except for &fp which is too
-% short, but this puts a constraint on magic words, maybe I will revisit
- \edef\xs_magic_in{\xs_firstfour#1\empty\empty\empty\empty\xint_bye}%
+ \xs_firstfour#1\empty\empty\empty\empty\xint_bye
\ifcsname xs_magic@\xs_magic_in\endcsname
\csname xs_magic@\xs_magic_in\expandafter\endcsname
\else
@@ -100,7 +100,7 @@
ignored)}%
\fi\xs_fetch_a
}%
-\def\xs_fetch_b#1;^%
+\long\def\xs_fetch_b#1;^%
{%
\odef\xs_in{\xs_in#1}\expandafter\xs_fetch_c
}%
@@ -187,34 +187,16 @@
\def\xs_magic@&fp
{%
\xs_message{fp mode (\xinttheDigits\space digits)}%
- \def\xs_mode{fp}%
+ \def\xs_mode{fp (Digits=\xinttheDigits)}%
\def\xs_xintdefvar{\xintdeffloatvar}%
\def\xs_xintdeffunc{\xintdeffloatfunc}%
\def\xs_xinteval{\xintfloateval}%
}%
-\expandafter\def\csname xs_magic@&fp1\endcsname
+\expandafter\def\csname xs_magic@&fp=\endcsname
{%
- \xintDigits*:=16;%
- \xs_message{fp16 mode (trig reloaded)}%
- \def\xs_mode{fp16}%
- \def\xs_xintdefvar{\xintdeffloatvar}%
- \def\xs_xintdeffunc{\xintdeffloatfunc}%
- \def\xs_xinteval{\xintfloateval}%
-}%
-\expandafter\def\csname xs_magic@&fp2\endcsname
-{%
- \xintDigits*:=24;%
- \xs_message{fp24 mode (trig reloaded)}%
- \def\xs_mode{fp24}%
- \def\xs_xintdefvar{\xintdeffloatvar}%
- \def\xs_xintdeffunc{\xintdeffloatfunc}%
- \def\xs_xinteval{\xintfloateval}%
-}%
-\expandafter\def\csname xs_magic@&fp3\endcsname
-{%
- \xintDigits*:=32;%
- \xs_message{fp32 mode (trig reloaded)}%
- \def\xs_mode{fp32}%
+ \xintDigits*:=\xs_magic_inb\relax
+ \xs_message{fp mode (log and trig reloaded at Digits=\xinttheDigits)}%
+ \def\xs_mode{fp=\xinttheDigits}%
\def\xs_xintdefvar{\xintdeffloatvar}%
\def\xs_xintdeffunc{\xintdeffloatfunc}%
\def\xs_xinteval{\xintfloateval}%
@@ -266,44 +248,43 @@
- definitions must be done using the `:=' syntax, not `='.
Any line starting with a control sequence is executed in the
- background, interrupted numerical input resumes at next prompt.
-
- To pause, say either `;' or `&pause'.
- To quit, say `&bye'.
- For help say `&help'.
+ background, the interrupted numerical input resumes at prompt.
+ Magic words: `&pause' (or `;'), `&help', `&bye'.
+ Mode toggles: `&exact', `&fp', `&int', `&pol'. Say for example
+ `&fp=24' at the prompt to work with Digits=24 (Digits range: 1 to 62)
Starting in}\xs_magic@&exa\let
=\xs_fetch}\gdef\xintresume{\edef {\string }\xs_storecats\xs_setcats%
\message{Welcome back to xintexpr interactive mode!}\let
-=\xs_fetch}\gdef\xs_help\xs_fetch_a{\def
-{""J}\edef {\string }\message{%
+=\xs_fetch}\catcode`?0\catcode`\\12?gdef?xs_help?xs_fetch_a{?def
+{""J}?edef {?string }?message{%
- Terminate inputs using the `;' character.
- Input can extend over multiple lines (<RET> terminated).
- An empty input (`;' terminated) or the magic word `&pause' puts
- the session on hold and switches to normal TeX interaction.
- Use \string\xintresume to resume the session.
+ the session on hold and switches to normal TeX interaction. Use
+ \xintresume to resume the session.
- The numerical engine can work in various modes:
- * exact mode means using \string\xintexpr context,
- * fp mode uses \string\xintfloatexpr,
- * int mode uses integer-only \string\xintiiexpr,
- * pol mode makes function definitions using \string\poldef.
+ * exact mode means using \xintexpr context,
+ * fp mode uses \xintfloatexpr,
+ * int mode uses integer-only \xintiiexpr,
+ * pol mode makes function definitions using \poldef.
To activate a mode enter `&<mode name>' at the prompt
- Lines starting with any control sequence are handed over to
TeX, and numerical input resumes on next line.
- - To change the floating point precision enter at the prompt:
- \string\xintDigits*:= <some number>;
- then at next prompt switch to fp mode using `&fp'.
- This can be done in the midst of a computation!
+ - Say `&fp=<number>' for example `&fp=32' at the prompt to change
+ the Digits setting. This can be done in the midst of the
+ input of a multi-line computation!
(1/5) HIT <RET> KEY
-}\let
-=\xs_help_b}\gdef\xs_help_b{\def
-{""J}\message{%
- - Specific toggles `&fp16', `&fp24', `&fp32' are already predefined.
+}?let
+=?xs_help_b}?gdef?xs_help_b{?def
+{""J}?message{%
+ - Say `&exact' resp. `&fp' to go back and forth between exact
+ and floating point mode
- Issue `&mode' if you forgot in what mode you are currently in.
@@ -323,23 +304,24 @@
- Parentheses present before the `:=' trigger a function
definition, else a variable definition is done.
-(2/5) HIT <RET> KEY
-}\let
-=\xs_help_c}\gdef\xs_help_c{\def
-{""J}\message{%
- - Functions defined in one mode are not available for usage in other
- modes without further steps; check xintexpr doc.
+ - Functions defined in one mode are not available for usage in
+ other modes without further steps; check xintexpr doc.
- - Polynomial definitions (pol mode) are function definitions
- (see polexpr documentation). To use a polynomial also as a
- numerical function when back in `fp' mode, issue
- \string\PolGenFloatVariant{<polname>} at the prompt.
+(2/5) HIT <RET> KEY
+}?let
+=?xs_help_c}?gdef?xs_help_c{?def
+{""J}?message{%
+ - Polynomial definitions (pol mode) are function definitions (see
+ polexpr documentation). To use a polynomial also as a numerical
+ function when back in fp mode, issue
+ \PolGenFloatVariant{<polname>} at the prompt.
- Variables defined in any mode can be used in any mode except:
* polynomials can be used as variables only in the pol and the
exact modes,
- * integer only mode requires... integer only variables!
- One can use num() wrapper see xintexpr documentation.
+ * integer-only mode requires... integer-only variables, also
+ internally. Use in int mode num() or \xintiexpr...\relax as
+ wrapper around exact or fp variables, even integer-valued ones.
- Whenever a variable is defined, or a computation is performed,
the result is assigned a label @_<integer>. These automatic
@@ -349,65 +331,65 @@
the automatic variable @_<integer> holds the whole thing, which
may be a nutple or an ople, in addition to individual variables.
-(3/5) HIT <RET> KEY
-}\let
-=\xs_help_d}\gdef\xs_help_d{\def
-{""J}\message{%
- The special variables @_, @__, and @___ hold the last, next
to last and next to next to last evaluation results.
+(3/5) HIT <RET> KEY
+}?let
+=?xs_help_d}?gdef?xs_help_d{?def
+{""J}?message{%
Known issues:
- - The [P] optional argument of \string\xintfloateval can not
- be used because it is not recognized by \string\xintdeffloatvar,
- one can use the float() function with its second argument.
+ - The [P] optional argument of \xintfloateval can not be used
+ because it is not recognized by \xintdeffloatvar, one can use
+ the float() function with its second argument.
- - Sometimes one wishes to use \string\xintexpr...\string\relax wrapper
- inside fp mode; this is possible but can not be first in current
- input line as it would trigger control sequence execution. Start
- with 0+ or use parentheses.
+ - An \xintexpr...\relax wrapper inside fp mode or an
+ \xintiexpr...\relax one inside int mode can not start a line,
+ as it would trigger control sequence execution.
+ Start with 0+ or use parentheses.
- - The output format of the exact and fp mode is not yet decided
- at upstream xintexpr; in particular trailing zeros are not
- trimmed and floating point numbers are printed in diverging
- ways in exact vs fp modes. Besides, the exact mode does
- not do a systematic reduction to lowest terms. Use the
- reduce() function (or preduce()).
+ - The definitive default output format of the exact and fp modes
+ are not yet decided at upstream xintexpr:
+ - trailing zeros are not trimmed,
+ - exact and fp modes print out floating point numbers in
+ diverging ways,
+ - exact mode does not reduce to lowest terms, use reduce().
- - By default, the ** and ^ operators operate only with integer
+ - By default, the ** and ^ operators operate _only_ with integer
exponents in exact mode and with half-integers in fp mode.
Fractional powers are available via the pow(x,a) function.
+
(4/5) HIT <RET> KEY
-}\let
-=\xs_help_e}\gdef\xs_help_e{\def
-{""J}\message{%
+}?let
+=?xs_help_e}?gdef?xs_help_e{?def
+{""J}?message{%
Known issues (cont.):
- - Refer to xintexpr \string\poormanloghack documentation on
- how to let fractional powers be available with ** or ^,
- and check polexpr documentation for related information.
+ - Refer to xintexpr \poormanloghack documentation on how to let
+ fractional powers be available with ** or ^, and check polexpr
+ documentation for related information.
- A session transcript file is created which can be executed by
- eTeX to redo all calculations; however @_, @__, and @__
- will not be defined in this context so need to be manually
- replaced by the suitable @_<integer>.
+ eTeX to redo all calculations; however @_, @__, and @___ will
+ not be defined in this context so need to be manually replaced
+ by the suitable @_<integer>.
Future:
- a plot() function will be added at some point to export
- coordinates into a tex file for usage either with PSTricks or
+ coordinates into a .tex file for usage either with PSTricks or
TikZ/pgf.
- Caveat:
+ Miscellany:
- Misformed xintexpr input can drop you into TeX error mode.
- In that case, try escaping using `S'. It does work sometimes.
+ Misformed xintexpr input can drop you into TeX error mode. In that
+ case, try escaping using `S'. It does work sometimes.
- Use `&bye' to terminate the session and the TeX run.
-
-(5/5) You are back to the xintexpr interactive session! (mode: \xs_mode)
-}\let
-=\xs_fetch\xs_fetch_a}\endgroup
+(5/5) You are back to the xintexpr interactive session! (mode: ?xs_mode)
+ Use `&bye' to terminate the session and the TeX run.
+}?let
+=?xs_fetch?xs_fetch_a}?endgroup
\let\xs_magic@&hel\xs_help
\xsrestorecatcodes
\csname xs_storecats\endcsname