summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-04-12 20:06:05 +0000
committerKarl Berry <karl@freefriends.org>2023-04-12 20:06:05 +0000
commitbe827ad4c76a2ee7ede7c7e4cea8fcb0c277c04d (patch)
tree56afc4daad00a0151246cc64a6bb9f23d0939e7a /Master/texmf-dist/tex
parent221c69381bd44fc50af7998b2f3f36acfd7e0a95 (diff)
diffcoeff (12apr23)
git-svn-id: svn://tug.org/texlive/trunk@66834 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty149
-rw-r--r--Master/texmf-dist/tex/latex/diffcoeff/diffcoeff5.def4
2 files changed, 97 insertions, 56 deletions
diff --git a/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty b/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty
index 448911e829a..7f54ac03624 100644
--- a/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty
+++ b/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty
@@ -8,10 +8,10 @@
% Andrew Parsloe ajparsloe@gmail.com
%
\DeclareRelease{v4}{}{diffcoeff4.sty}
-\DeclareCurrentRelease{}{2023/01/24}
+\DeclareCurrentRelease{}{2023/04/12}
\RequirePackage{xtemplate,mleftright}
-\ProvidesExplPackage {diffcoeff} {2023/01/24} {5.2}
+\ProvidesExplPackage {diffcoeff} {2023/04/12} {5.3}
{Write differential coefficients easily and consistently.}
\keys_define:nn { diffcoeff }
{
@@ -40,8 +40,8 @@
{
in~the~order~spec.~[#1]~\msg_line_context:.~Calculation~of~the~
total~order~of~differentiation~fails~in~this~case.~
- Use~the~\tl_to_str:n { \difoverride }command~to~enter~the~total~order.~
- \msg_see_documentation_text:n {diffcoeff}
+ Use~the~override~option~(or~\tl_to_str:n { \difoverride }command)~
+ to~enter~the~total~order.~\msg_see_documentation_text:n {diffcoeff}
}
\cs_new:Npn \__diffcoeff_msg_style:nnn #1#2#3
{
@@ -205,11 +205,9 @@
\__diffcoeff_check_style:nn
{ \l__diffcoeff_group_int } { \l__diffcoeff_style_int }
\__diffcoeff_append:n { #1 }
- \exp_args:Nx \__diffcoeff_orders:nn
- { \int_max:nn { 1 } { \clist_count:n {#4} } } { #2 }
- \__diffcoeff_override:N \l__diffcoeff_override_tl
+ \__diffcoeff_orders_vars:nn { #2 } { #4 }
\__diffcoeff_derivand:n { #3 }
- \__diffcoeff_build:nn { #4 } { #5 }
+ \__diffcoeff_build:nn { #4 } { #5 }
}
%%%%%%%%%%
\cs_new_protected:Npn \__diffcoeff_style:nn #1#2
@@ -277,13 +275,55 @@
}
{ \bool_set_false:N \l__diffcoeff_append_bool }
}
-%%%%%%%%%
+%%%%%%%%% #1 orders, #2 vars
+\cs_new_protected:Npn \__diffcoeff_orders_vars:nn #1#2
+ {
+ \str_if_eq:nnT { #2 } { / }
+ { % v4 notation
+ \msg_error:nnnn { diffcoeff } { version-conflict } { / }
+ { Use~\difs or~\difsp instead.~ }
+ }
+ \clist_if_empty:nTF { #2 }
+ {
+ \seq_set_from_clist:Nn \l__diffcoeff_vars_seq { \prg_do_nothing: }
+ \__diffcoeff_orders:nn { 1 } { #1 }
+ }
+ {
+ \exp_args:NnV
+ \str_if_in:nnTF { #2 } \c_colon_str
+ {
+ \str_set:Nn \l_tmpa_str { #2 }
+ \clist_map_inline:Nn \l_tmpa_str
+ {
+ \exp_args:NNV
+ \seq_set_split:Nnn \l_tmpa_seq \c_colon_str { ##1 }
+ \seq_pop:NN \l_tmpa_seq \l_tmpa_tl
+ \seq_put_right:NV \l__diffcoeff_vars_seq \l_tmpa_tl
+ \seq_if_empty:NTF \l_tmpa_seq
+ { \seq_put_right:Nn \l__diffcoeff_ords_seq { 1 } }
+ {
+ \seq_pop:NN \l_tmpa_seq \l_tmpa_tl
+ \tl_set_rescan:Nno
+ \l_tmpa_tl \ExplSyntaxOn \l_tmpa_tl
+ \seq_put_right:NV \l__diffcoeff_ords_seq \l_tmpa_tl
+ }
+ }
+ }
+ {
+ \seq_set_from_clist:Nn \l__diffcoeff_vars_seq { #2 }
+ \exp_args:Nx \__diffcoeff_orders:nn
+ { \int_max:nn { 1 } { \clist_count:n {#2} } } { #1 }
+ }
+ }
+ \__diffcoeff_override:N \l__diffcoeff_override_tl
+ }
% #1(int) no. of vars; #2(clist) orders spec
\cs_new_protected:Npn \__diffcoeff_orders:nn #1#2
{
\bool_if:NTF \l__diffcoeff_exponent_bool
{
- \exp_args:NNx \seq_set_from_clist:Nn \l__diffcoeff_ords_seq
+ \exp_args:NNx
+ \seq_set_from_clist:Nn \l__diffcoeff_ords_seq
{ \prg_replicate:nn { #1 } { \l__diffcoeff_exponent_tl, } }
}
{
@@ -307,12 +347,12 @@
}
\cs_new_protected:Npn \__diffcoeff_override:N #1
{
- \tl_if_empty:NTF { #1 }
+ \tl_if_empty:NTF #1
{
\__diffcoeff_calc_tot_order:NN \l__diffcoeff_ords_seq
\l__diffcoeff_tot_ord_tl
}
- { \tl_set:Nn \l__diffcoeff_tot_ord_tl { #1 } }
+ { \tl_set_eq:NN \l__diffcoeff_tot_ord_tl #1 }
\seq_pop_right:NN \l__diffcoeff_ords_seq \l__diffcoeff_ord_tl
}
%%%%%%%%%% calc. total order %%%%%%%%%%
@@ -351,14 +391,17 @@
\tl_if_in:nnTF { 1234567890 } { #1 }
{ \int_set:Nn #2 { 1 } } % digit
{
- \str_case:nnF { #1 }
- {
- { + } { \int_set:Nn #2 { 0 } }
- { - } { \int_set:Nn #2 { 0 } }
- { ( } { \int_set:Nn #2 { 3 } }
- { ) } { \int_set:Nn #2 { 4 } }
+ \tl_if_in:nnTF { +- } { #1 }
+ { \int_set:Nn #2 { 0 } }
+ {
+ \tl_if_eq:nnTF { ( } { #1 }
+ { \int_set:Nn #2 { 3 } }
+ {
+ \tl_if_eq:nnTF { ) } { #1 }
+ { \int_set:Nn #2 { 4 } }
+ { \int_set:Nn #2 { 2 } } % var
+ }
}
- { \int_set:Nn #2 { 2 } } % var
}
}
% #1(tl) curr tok; #2(int) curr state; #3(int) curr tok ndx
@@ -565,47 +608,43 @@
}
%%%%%%%%% derivand
\cs_new_protected:Npn \__diffcoeff_derivand:n #1
- {
+ {
\tl_set:Nn \l__diffcoeff_derivand_tl { #1 }
\int_compare:nNnTF { \tl_count:N \l__diffcoeff_derivand_tl } > { 1 }
{ \bool_set_true:N \l__diffcoeff_multitok_bool }
{
- \str_if_eq:VnTF \l__diffcoeff_derivand_tl { ! }
+ \str_if_eq:VnT \l__diffcoeff_derivand_tl { ! }
{ \msg_error:nnnn { diffcoeff } { version-conflict } { #1 } {} }
- {
- \str_if_eq:VnT \l__diffcoeff_derivand_tl { [ }
- { \msg_error:nnnn { diffcoeff } { version-conflict } { the~
- order-override~argument } { Use~\difoverride instead.~ } }
- }
}
}
%%%%%%%%% build #1 vars clist; #2 trailing arg
\cs_new_protected:Npn \__diffcoeff_build:nn #1#2
{
- \str_if_eq:nnT { #1 } { / }
- {
- \msg_error:nnnn { diffcoeff } { version-conflict } { / }
- { Use~\difs or~\difsp instead.~ }
- }
- \clist_if_empty:nTF { #1 }
- { \seq_set_from_clist:Nn \l__diffcoeff_vars_seq { \prg_do_nothing: } }
- { \seq_set_from_clist:Nn \l__diffcoeff_vars_seq { #1 } }
\seq_pop_right:NN \l__diffcoeff_vars_seq \l__diffcoeff_var_tl
\tl_put_left:Nx \l__diffcoeff_derivand_tl
{ \__diffcoeff_spaced:n { \l__diffcoeff_spaced_int } }
- \tl_if_novalue:nF { #2 }
- { \__diffcoeff_delim:N l \mskip \l__diffcoeff_elbowrm_tl }
- \__diffcoeff_form_deriv:xNN
- { \__diffcoeff_build_numer:Vn \l__diffcoeff_tot_ord_tl
- { \l__diffcoeff_style_int } }
- \__diffcoeff_build_denom:
- \l__diffcoeff_derivand_tl
- \tl_if_novalue:nF { #2 }
- { \__diffcoeff_trailing_arg:n { #2 } }
+ \__diffcoeff_wrap_and_form:nn { #2 }
+ {
+ \__diffcoeff_form_deriv:xNN
+ { \__diffcoeff_build_numer:Vn \l__diffcoeff_tot_ord_tl
+ { \l__diffcoeff_style_int } }
+ \__diffcoeff_build_denom:
+ \l__diffcoeff_derivand_tl
+ }
+ }
+\cs_new:Npn \__diffcoeff_wrap_and_form:nn #1#2
+ { % extra braces for \[ \alert{\dl x} \] in beamer
+ \tl_if_novalue:nTF {#1}
+ {{ #2 }}
+ {{
+ \__diffcoeff_delim:N l \mskip \l__diffcoeff_elbowrm_tl
+ #2
+ \__diffcoeff_trailing_arg:n { #1 }
+ }}
}
\cs_new:Npn \__diffcoeff_delim:N #1
{
- \bool_if:nTF { \l__diffcoeff_innerwrap_bool && \l__diffcoeff_append_bool }
+ \bool_if:nTF { \l__diffcoeff_innerwrap_bool && \l__diffcoeff_append_bool }
{ \use:c { l__diffcoeff_#1 delimapp_tl } }
{ \use:c { l__diffcoeff_#1 delim_tl } }
}
@@ -621,7 +660,7 @@
{ \c_math_subscript_token { \mskip \__diffcoeff_subnudge: #1 } }
}
\cs_new:Npn \__diffcoeff_spaced:n #1
- {
+ {
\int_case:nn { \int_sign:n { #1 } }
{
{ 1 } { \__diffcoeff_derivsep: }
@@ -694,7 +733,7 @@
\cs_generate_variant:Nn \__diffcoeff_build_denom_difc:nnn { o }
% #1 order #2 var
\cs_new:Npn \__diffcoeff_build_denom_dif:nn #1#2
- {
+ {
\str_if_eq:nnTF { #1 } { 1 }
{ \exp_not:o { \l__diffcoeff_opii_tl #2 } }
{
@@ -867,6 +906,8 @@
\mskip \l__diffcoeff_slashsep_tl #3
\bool_if:NT #1 { \l__diffcoeff_ropwrap_tl }
}
+\NewDocumentCommand \difoverride { >{\TrimSpaces} m }
+ { \tl_set:Nn \l__diffcoeff_override_tl { #1 } }
% derivatives
% #1(tl) variant name; #2(*) append boolean; #3(*) switch #5#6 order;
% #4(clist) diff. orders; #5(tl) = derivand; #6(clist) = diff. vars;
@@ -874,26 +915,26 @@
\clist_map_inline:nn { f,s,c, fp, sp, cp }
{
\exp_args:Nc \NewDocumentCommand {dif#1}
- { >{\TrimSpaces} D..{} s s O{1} >{\TrimSpaces} m m !o }
+ { >{\TrimSpaces} D..{} s s O{1} D<>{} >{\TrimSpaces} m m !o }
{
\IfBooleanTF ##3
- { \__diffcoeff_inputs:nnnnnnn {#1}
- {##1} {##2} {##4} {##6} {##5} {##7} }
- { \__diffcoeff_inputs:nnnnnnn {#1}
- {##1} {##2} {##4} {##5} {##6} {##7} }
+ { \__diffcoeff_inputs:nnnnnnnn {#1}
+ {##1} {##2} {##4} {##7} {##6} {##8} {##5} }
+ { \__diffcoeff_inputs:nnnnnnnn {#1}
+ {##1} {##2} {##4} {##6} {##7} {##8} {##5} }
}
}
-\cs_new_protected:Npn \__diffcoeff_inputs:nnnnnnn #1#2#3#4#5#6#7
+\cs_new_protected:Npn \__diffcoeff_inputs:nnnnnnnn #1#2#3#4#5#6#7#8
{
\group_begin:
+ \tl_if_empty:nF { #8 }
+ { \tl_set:Nn \l__diffcoeff_override_tl { #8 } }
\tl_set:Nx \l__diffcoeff_instance_tl
{ dif#1 \tl_if_empty:nF { #2 } { .#2 } }
\UseInstance { diffcoeff } { \l__diffcoeff_instance_tl }
{#3} {#4} {#5} {#6} {#7}
\group_end:
}
-\NewDocumentCommand \difoverride { >{\TrimSpaces} m }
- { \tl_set:Nn \l__diffcoeff_override_tl { #1 } }
% Jacobian
\NewDocumentCommand \jacob { >{\TrimSpaces} D..{} m m }
{
diff --git a/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff5.def b/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff5.def
index d61028a4a0b..9b2f556fb77 100644
--- a/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff5.def
+++ b/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff5.def
@@ -51,7 +51,7 @@
style = auto ,
outer-Ldelim = \left [ ,
outer-Rdelim = \right ] ,
- sub-nudge = 0 mu ,
+ sub-nudge = 0 mu ,
*inner-Ldelim = \mleft ( ,
*inner-Rdelim = \mright ),
*outer-Ldelim = \left [ ,
@@ -62,7 +62,7 @@
style = big ,
outer-Ldelim = \bigl (,
outer-Rdelim = \bigr ),
- sub-nudge = -2.5 mu,
+ sub-nudge = -2 mu ,
*inner-Ldelim = \bigl (,
*inner-Rdelim = \bigr ),
*outer-Ldelim = \bigl [,