diff options
author | Karl Berry <karl@freefriends.org> | 2022-05-15 20:41:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-05-15 20:41:35 +0000 |
commit | 468f3f2d5e21e51d77dc26d0141b245976b34bd8 (patch) | |
tree | ee99548dd8ceef0abe0eed514d0c503aeccdac92 /Master/texmf-dist/tex/generic/polexpr | |
parent | 622b49804740c998dab033ab7dfaca46062d9944 (diff) |
polexpr (15may22)
git-svn-id: svn://tug.org/texlive/trunk@63306 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/polexpr')
5 files changed, 63 insertions, 48 deletions
diff --git a/Master/texmf-dist/tex/generic/polexpr/polexpr-examples.tex b/Master/texmf-dist/tex/generic/polexpr/polexpr-examples.tex index fa2f330513b..564c1912da5 100644 --- a/Master/texmf-dist/tex/generic/polexpr/polexpr-examples.tex +++ b/Master/texmf-dist/tex/generic/polexpr/polexpr-examples.tex @@ -145,25 +145,12 @@ \makeatletter \catcode`_ 11 -\def\everbatimtop {\MacroFont\small}% default -\let\everbatimbottom\empty -\let\everbatimhook\empty - \def\everbatim {\s@everbatim\@everbatim } -\@namedef{everbatim*}{\s@everbatim\expandafter\@everbatimx\expandafter - {\the\newlinechar}} -\let\everbatimbgcolorcmd\empty -\def\everbatimeverypar{\strut - {\everbatimbgcolorcmd\vrule\@width\linewidth }% - \kern-\linewidth - \kern\everbatimindent } -\def\everbatimindent {\z@} -% voir plus loin atbegindocument +%! ancienne méthode sans doute motivé par possibilité code ferme un groupe? +%! \@namedef{everbatim*}{\s@everbatim\@everbatimx\expandafter +%! {\the\newlinechar}} +\@namedef{everbatim*}{\s@everbatim\@everbatimx } -\def\endeverbatim {\if@newlist \leavevmode\fi\endtrivlist } - -\@namedef{endeverbatim*}{\endeverbatim\aftergroup\everbatimundoparskip} -\def\everbatimundoparskip{\vbox{}\kern-\baselineskip\kern-\parskip} % Note 25 juin 2021 % On ne peut pas emboîter un everbatim à l'intérieur d'un everbatim % ou un everbatim* à l'intérieur d'un everbatim*... @@ -197,6 +184,14 @@ }% \obeylines \@vobeyspaces } +\def\everbatimtop {\MacroFont\small}% default +\let\everbatimhook\empty +\def\everbatimeverypar{\strut + {\everbatimbgcolorcmd\vrule\@width\linewidth }% + \kern-\linewidth + \kern\everbatimindent } +\let\everbatimbgcolorcmd\empty +\def\everbatimindent {\z@} \begingroup \lccode`X 13 @@ -210,31 +205,47 @@ |lowercase[|endgroup% both freezes catcodes and converts X to active ^^M |def|@everbatim #1X#2\end{everbatim}% [#2|end[everbatim]|everbatimbottom ] -|def|@everbatimx #1#2X#3\end{everbatimY}]% - {#3\end{everbatim*}% - \everbatimbottom +|def|@everbatimx #1X#2\end{everbatimY}]% + {#2\end{everbatim*}% +% refactored 2022/01/11, rather than passing \newlinechar value +% as was done formerly via everbatim* (see above) and fetching it here as #1 +% it is thus assumed executed contents will not terminate a scope + \edef\everbatimrestorenewlinechar{\newlinechar\the\newlinechar\relax}% \newlinechar 13 +% refactored 2022/01/11: +% attention, \parskip set to zero for execution of contents +% reason: avoid extra space if everbatim* is in an \item of a list +% between verbatim and output of execution, if it starts a paragraph +% \vskip-\parskip would be no good in case contents create a display + \edef\everbatimrestoreparskip{\parskip\the\parskip}% + \parskip\z@skip % execution as LaTeX code of contents \everbatimxprehook - \scantokens {#3}% - \newlinechar #1\relax + \scantokens {#2}% + \everbatimrestorenewlinechar + \everbatimrestoreparskip \everbatimxposthook }% - % L'espace venant du endofline final mis par \scantokens sera inhibé si #3 se % termine par un % ou un \x, etc... -\let\everbatimxfgcolorcmd\empty +\let\everbatimbottom\empty + +\def\endeverbatim {\if@newlist \leavevmode\fi\endtrivlist } +\@namedef{endeverbatim*}{\endeverbatim} +% \@namedef{endeverbatim*}{\endeverbatim\aftergroup\everbatimundoparskip} +% \def\everbatimundoparskip{\vbox{}\kern-\baselineskip\kern-\parskip} +% \let\everbatimundoparskip\empty + +% rationale: we do not want a group +% see xint.dtx for better way avoiding colorstack overflow problem +% with latex+dvipdfmx \def\everbatimxprehook {\colorlet{everbsavedcolor}{.}% - \everbatimxfgcolorcmd - \smallskip % pour polexpr-examples.tex - % à cause de problèmes avec les - % output en "display" - }% + \everbatimxfgcolorcmd}% +\let\everbatimxfgcolorcmd\empty % default \def\everbatimxposthook {\color{everbsavedcolor}} - \catcode`_ 8 \makeatother @@ -251,9 +262,9 @@ % \verb %\colorlet{verbcolor}{DarkCyan} -\colorlet{verbcolor}{black} +\colorlet{verbcolor}{Maroon} \colorlet{verbsoftwrapiconcolor}{DarkBlue} -\def\MicroFont{\ttfamily%\color{verbcolor} +\def\MicroFont{\ttfamily\color{verbcolor} \makestarlowast\makequotesstraight}% % everbatim/everbatim* @@ -265,11 +276,13 @@ \def\MacroFont{\ttfamily\color{everbatimfgcolor}} %\colorlet{everbatimbgcolor}{WhiteSmoke} -\colorlet{everbatimbgcolor}{Ivory} +%\colorlet{everbatimbgcolor}{Ivory} +\colorlet{everbatimbgcolor}{Beige} \def\everbatimbgcolorcmd{\color{everbatimbgcolor}} %\colorlet{everbatimxfgcolor}{MidnightBlue} -\colorlet{everbatimxfgcolor}{OliveDrab} +%\colorlet{everbatimxfgcolor}{OliveDrab} +\colorlet{everbatimxfgcolor}{Maroon} \def\everbatimxfgcolorcmd{\color{everbatimxfgcolor}} % Notice that \macrocode uses \macro@font which stores the \MacroFont meaning @@ -281,7 +294,7 @@ The package provides a parser |\poldef| of algebraic polynomial -expressions. +expressions. Once defined, a polynomial is usable by its name either as a numerical function in |\xintexpr/\xinteval|, or for additional polynomial @@ -373,11 +386,10 @@ file. \section{A first example} - In this example the polynomial is square-free. \begin{everbatim*} \poldef f(x) := x^7 - x^6 - 2x + 1; - +% \PolToSturm{f}{f} \PolSturmIsolateZeros{f} The \PolTypeset{f} polynomial has \PolSturmNbOfIsolatedZeros{f} distinct real diff --git a/Master/texmf-dist/tex/generic/polexpr/polexpr.sty b/Master/texmf-dist/tex/generic/polexpr/polexpr.sty index 7d3dbb36bda..b652675d916 100644 --- a/Master/texmf-dist/tex/generic/polexpr/polexpr.sty +++ b/Master/texmf-dist/tex/generic/polexpr/polexpr.sty @@ -2,7 +2,7 @@ % License: LPPL 1.3c (author-maintained) % Usage: \input polexpr.sty (Plain or other macro formats) % or \usepackage{polexpr} (LaTeX macro format) -% Release 0.8.6 (2022/01/09) of polexpr.sty. This file inputs +% Release 0.8.7 (2022/05/14) of polexpr.sty. This file inputs % polexprcore.tex % polexprexpr.tex % polexprsturm.tex @@ -54,7 +54,7 @@ \XINTsetupcatcodes% (does \endlinechar13 in particular) \XINT_providespackage \ProvidesPackage{polexpr}% - [2022/01/09 v0.8.6 Polynomial expressions with rational coefficients (JFB)]% + [2022/05/14 v0.8.7 Polynomial expressions with rational coefficients (JFB)]% \begingroup \def\x#1/#2/#3 #4\xint:{#1#2#3}% \ifnum\expandafter\x\expanded{\csname ver@xintexpr.sty\endcsname}\xint: @@ -199,12 +199,15 @@ %% %% \poldef %% -\def\PolDef{\POL@chkopt\POL@oPolDef[x]}% -\def\POL@oPolDef[#1]#2#3{\poldef #2(#1):={#3};}% -\def\poldef{\edef\POL@restoresemicolon{\catcode59=\the\catcode59\relax}% - \catcode59 12 \POL@defpol}% +%% Ever since 1.0, catcode sanitisation was minimal and only handled +%% the semicolon. At last 0.8.7 uses \xintexprSafeCatcodes to enhance +%% compatibility with hostile contexts such as babel+french. This +%% adds overhead but at least is coherent with \xintdefvar/\xintdeffunc +\def\PolDef{\xintexprSafeCatcodes\POL@chkopt\POL@oPolDef[x]}% +\def\POL@oPolDef[#1]#2#3{\POL@defpol #2(#1):={#3};}% +\def\poldef{\xintexprSafeCatcodes\POL@defpol}% \def\POL@defpol #1(#2)#3=#4;{% - \POL@restoresemicolon + \xintexprRestoreCatcodes \edef\POL@polname{\xint_zapspaces #1 \xint_gobble_i}% \begingroup \unless\ifxintveryverbose\xintverbosefalse\fi @@ -214,7 +217,7 @@ %% the associated macros was then deconstructed in further analysis %% via non-expandable approach. At 0.8 the polynomial algebra has %% been implemented expandably allowing direct plug-in into \xintexpr - \xintdefvar __pol = subs(#4,#2=qraw({{P1.{0/1[0]}{1/1[0]}}}));% + \xintdefvar_a __pol = subs(#4,#2=qraw({{P1.{0/1[0]}{1/1[0]}}}));% \expandafter \endgroup \expandafter\def\expandafter\POL@result\expandafter diff --git a/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex b/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex index 8dcc893844b..8bf7fe2fd0b 100644 --- a/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex +++ b/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex @@ -1,5 +1,5 @@ %% filename: polexprcore.tex -%% Part of the polexpr package (0.8.6, 2022/01/09) +%% Part of the polexpr package (0.8.7, 2022/05/14) %% %% Core routines for infix operators +, -, *, //, /:, ^, ** and functions %% diff --git a/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex b/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex index bbc860cbca4..91087bcf4df 100644 --- a/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex +++ b/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex @@ -1,5 +1,5 @@ %% filename: polexprexpr.tex -%% Part of the polexpr package (0.8.6, 2022/01/09) +%% Part of the polexpr package (0.8.7, 2022/05/14) %% %% Polynomial extensions to the \xintexpr syntax: %% diff --git a/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex b/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex index 0edc8b8f0a2..2f417c33332 100644 --- a/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex +++ b/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex @@ -1,5 +1,5 @@ %% filename: polexprsturm.tex -%% Part of the polexpr package (0.8.6, 2022/01/09) +%% Part of the polexpr package (0.8.7, 2022/05/14) %% %% Implements the Sturm localization Algorithm %% Added at polexpr 0.4 |