summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/derivative/derivative.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-09-18 21:56:41 +0000
committerKarl Berry <karl@freefriends.org>2019-09-18 21:56:41 +0000
commit24bc2c41e40be299061ceef93ff7a5f8c74cf9c3 (patch)
treea4f783afb2bac906578e135340f31ed29e6bfc7f /Master/texmf-dist/tex/latex/derivative/derivative.sty
parent9b3a2ee50ca73ddd52fbbf5564c5b8973e6e60bd (diff)
derivative (18sep19)
git-svn-id: svn://tug.org/texlive/trunk@52116 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/derivative/derivative.sty')
-rw-r--r--Master/texmf-dist/tex/latex/derivative/derivative.sty458
1 files changed, 224 insertions, 234 deletions
diff --git a/Master/texmf-dist/tex/latex/derivative/derivative.sty b/Master/texmf-dist/tex/latex/derivative/derivative.sty
index 00341140977..de10a6dd5f1 100644
--- a/Master/texmf-dist/tex/latex/derivative/derivative.sty
+++ b/Master/texmf-dist/tex/latex/derivative/derivative.sty
@@ -16,11 +16,11 @@
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{xparse}[2018/05/09]
-\ProvidesExplPackage{derivative}{2019/07/21}{0.9}{Nice and easy derivatives}
+\ProvidesExplPackage{derivative}{2018/06/14}{1.0}{Nice and easy derivatives}
%%%%% Useful conditionals %%%%%
-\prg_new_conditional:Npnn \__if_novalue_blank:n #1 { T , F , TF }
+\prg_new_conditional:Npnn \__deriv_if_novalue:n #1 { T , F , TF }
{
\tl_if_novalue:nTF {#1}
{ \prg_return_true: }
@@ -31,18 +31,18 @@
}
}
-\prg_new_conditional:Npnn \__if_novalue_blank_or:nn #1 #2 { F, TF }
+\prg_new_conditional:Npnn \__deriv_if_novalue_and:nn #1 #2 { F, TF }
{
- \__if_novalue_blank:nTF {#1}
+ \__deriv_if_novalue:nTF {#1}
{
- \__if_novalue_blank:nTF {#2}
+ \__deriv_if_novalue:nTF {#2}
{ \prg_return_true: }
{ \prg_return_false: }
}
{ \prg_return_false: }
}
-\prg_new_conditional:Npnn \__show_order:N #1 { T, TF }
+\prg_new_conditional:Npnn \__deriv_show_order:N #1 { T, TF }
{
\quark_if_no_value:NTF #1
{ \prg_return_false: }
@@ -86,43 +86,6 @@
\cs_new:Npn \__deriv_case_end:nw #1#2#3 \q_mark #4#5 \q_stop
{ \exp_end: #1 #4 }
-%%%%% slash frac %%%%%
-
-\DeclareDocumentCommand{\slashfrac}{ o m m }
-{
- \tl_if_novalue:nTF {#1}
- { \__deriv_slashfrac_auto:nn {#2} {#3} }
- {
- \str_case:nnF {#1}
- {
- { auto } { \__deriv_slashfrac_auto:nn {#2} {#3} }
- { none } { \__deriv_slashfrac_none:nn {#2} {#3} }
- }
- { \__deriv_slashfrac_scale:nnn {#1} {#2} {#3} }
- }
-}
-% numerator , denominator
-\cs_new_protected:Npn \__deriv_slashfrac_auto:nn #1 #2
-{
- \__deriv_auto_left:n . \kern-\nulldelimiterspace
- {#1} \middle/ {#2}
- \__deriv_auto_right:n . \kern-\nulldelimiterspace
-}
-% numerator , denominator
-\cs_new_protected:Npn \__deriv_slashfrac_none:nn #1 #2
-{
- {#1} / {#2}
-}
-% scale , numerator , denominator
-\cs_new_protected:Npn \__deriv_slashfrac_scale:nnn #1 #2 #3
-{
- \cs:w #1 l \cs_end: .
- {#2}
- \cs:w #1 \cs_end: /
- {#3}
- \cs:w #1 r \cs_end: .
-}
-
%%%%% Variables for settings of odv, pdv and variants %%%%%
\cs_new_protected:Npn \__deriv_auto_left:n #1 { \left #1 }
@@ -201,7 +164,7 @@
%%%%% Key-val for odv and variants %%%%%
\cs_new:Npn \__deriv_d_define_keys:n #1
{
- \keys_define:nn { deriv-d-#1 }
+ \keys_define:nn { deriv/d/#1 }
{
style-inf .code:n = { \cs_set_eq:cN { __deriv_#1_style_inf:n } ##1 },
@@ -214,7 +177,6 @@
scale-eval .choices:nn =
{ auto, none, big, Big, bigg, Bigg }
{ \tl_set_eq:cN { l__deriv_#1_scale_eval_tl } \l_keys_choice_tl },
-
scale-eval .default:n = { auto },
scale-eval-/ .choices:nn =
@@ -285,20 +247,14 @@
misc-remove-delims .default:n = { fun, var, frac }
}
\bool_lazy_or:nnT { \sys_if_engine_luatex_p: } { \sys_if_engine_xetex_p: }
- {
- \keys_define:nn { deriv-d-#1 }
- { style-inf .default:n = { \symnormal } }
- }
+ { \keys_define:nn { deriv/d/#1 } { style-inf .default:n = { \symnormal } } }
\sys_if_engine_pdftex:T
- {
- \keys_define:nn { deriv-d-#1 }
- { style-inf .default:n = { \mathnormal } }
- }
+ { \keys_define:nn { deriv/d/#1 } { style-inf .default:n = { \mathnormal } } }
}
%%%%%% Key-val for pdv and variants %%%%%%
\cs_new:Npn \__deriv_p_define_keys:n #1
{
- \keys_define:nn { deriv-p-#1 }
+ \keys_define:nn { deriv/p/#1 }
{
style-inf .code:n = { \cs_set_eq:cN { __deriv_#1_style_inf:n } ##1 },
@@ -400,17 +356,13 @@
sort-abs-reverse .default:n = { false }
}
\bool_lazy_or:nnT { \sys_if_engine_luatex_p: } { \sys_if_engine_xetex_p: }
- {
- \keys_define:nn { deriv-p-#1 }
- { style-inf .default:n = { \symnormal } }
- }
+ { \keys_define:nn { deriv/p/#1 } { style-inf .default:n = { \symnormal } } }
\sys_if_engine_pdftex:T
- {
- \keys_define:nn { deriv-p-#1 }
- { style-inf .default:n = { \mathnormal } }
- }
+ { \keys_define:nn { deriv/p/#1 } { style-inf .default:n = { \mathnormal } } }
}
+%%%%% Setting keys %%%%%
+
\DeclareDocumentCommand{\derivset}{ m o }
{
\token_if_macro:NTF {#1}
@@ -443,7 +395,7 @@
{
\tl_if_novalue:nTF {#2}
{
- \keys_set:nn { deriv-d-#1 }
+ \keys_set:nn { deriv/d/#1 }
{
style-inf , style-frac , style-frac-/ ,
scale-eval , scale-eval-/ , scale-fun , scale-var , scale-frac , scale-frac-/ ,
@@ -453,14 +405,14 @@
misc-remove-delims
}
}
- { \keys_set:nn { deriv-d-#1 } {#2} }
+ { \keys_set:nn { deriv/d/#1 } {#2} }
}
% key=val clist
\cs_new_protected:Npn \__deriv_p_set_keys:nn #1 #2
{
\tl_if_novalue:nTF {#2}
{
- \keys_set:nn { deriv-p-#1 }
+ \keys_set:nn { deriv/p/#1 }
{
style-inf , style-frac , style-frac-/ ,
scale-eval , scale-eval-/ , scale-fun , scale-var , scale-frac , scale-frac-/ ,
@@ -471,7 +423,7 @@
misc-remove-delims
}
}
- { \keys_set:nn { deriv-p-#1 } {#2} }
+ { \keys_set:nn { deriv/p/#1 } {#2} }
}
% key=val clist
\cs_new_protected:Npn \__deriv_all_set_keys:n #1
@@ -483,49 +435,7 @@
%%%%% Declaring variants %%%%%
-\DeclareDocumentCommand{\NewOdvVariant}{ m m o }
-{
- \cs_if_exist:NTF #1
- {
- \msg_error:nnxx { deriv } { command-already-defined }
- { \token_to_str:N #1 }
- { \token_to_str:N \NewOdvVariant }
- }
- {
- \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { New } {#1} {#2}
- }
-}
-
-\DeclareDocumentCommand{\RenewOdvVariant}{ m m o }
-{
- \cs_if_exist:NTF #1
- {
- \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Renew } {#1} {#2}
- }
- {
- \msg_error:nnxx { deriv } { command-not-defined }
- { \token_to_str:N #1 }
- { \token_to_str:N \RenewOdvVariant }
- }
-}
-
-\DeclareDocumentCommand{\ProvideOdvVariant}{ m m o }
-{
- \cs_if_exist:NF #1
- {
- \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Provide } {#1} {#2}
- }
-}
-
-\DeclareDocumentCommand{\DeclareOdvVariant}{ m m o }
-{
- \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Declare } {#1} {#2}
-}
-
+% tl-dv , macro , key-value
\cs_new_protected:Npn \deriv_d_preamble:Nnn #1 #2 #3
{
\tl_set:Nx #1 { \cs_to_str:N #2 }
@@ -538,7 +448,7 @@
\__deriv_derivset:VV #1 \c_novalue_tl
\tl_if_novalue:nF {#3} { \__deriv_derivset:Vn #1 {#3} }
}
-
+% dv , new/delare/renew/provide , macro , inf
\cs_new_protected:Npn \deriv_d_define:nnnn #1 #2 #3 #4
{
\use:c { #2 DocumentCommand }{#3}{ s o m t/ m !e{\sb^} }
@@ -547,61 +457,18 @@
\exp_args:Nnc \bool_xor:nnTF {##4} { l__deriv_#1_switch_slash_bool }
{
\exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_#1_switch_star_bool }
- { \__deriv_odv_both:Nnnnnnn #4 {#1} {##2} {##3} {##5} {##6} {##7} }
- { \__deriv_odv_slash:Nnnnnnn #4 {#1} {##2} {##3} {##5} {##6} {##7} }
+ { \__deriv_odv_both:nnnnnnn {#4} {#1} {##2} {##3} {##5} {##6} {##7} }
+ { \__deriv_odv_slash:nnnnnnn {#4} {#1} {##2} {##3} {##5} {##6} {##7} }
}
{
\exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_#1_switch_star_bool }
- { \__deriv_odv_star:Nnnnnnn #4 {#1} {##2} {##3} {##5} {##6} {##7} }
- { \__deriv_odv_none:Nnnnnnn #4 {#1} {##2} {##3} {##5} {##6} {##7} }
+ { \__deriv_odv_star:nnnnnnn {#4} {#1} {##2} {##3} {##5} {##6} {##7} }
+ { \__deriv_odv_none:nnnnnnn {#4} {#1} {##2} {##3} {##5} {##6} {##7} }
}
\group_end:
}
}
-
-\DeclareDocumentCommand{\NewPdvVariant}{ m m o }
-{
- \cs_if_exist:NTF #1
- {
- \msg_error:nnxx { deriv } { command-already-defined }
- { \token_to_str:N #1 }
- { \token_to_str:N \NewPdvVariant }
- }
- {
- \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { New } {#1} {#2}
- }
-}
-
-\DeclareDocumentCommand{\RenewPdvVariant}{ m m o }
-{
- \cs_if_exist:NTF #1
- {
- \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Renew } {#1} {#2}
- }
- {
- \msg_error:nnxx { deriv } { command-already-defined }
- { \token_to_str:N #1 }
- { \token_to_str:N \RenewPdvVariant }
- }
-}
-
-\DeclareDocumentCommand{\ProvidePdvVariant}{ m m o }
-{
- \cs_if_exist:NF #1
- {
- \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Provide } {#1} {#2}
- }
-}
-
-\DeclareDocumentCommand{\DeclarePdvVariant}{ m m o }
-{
- \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Declare } {#1} {#2}
-}
-
+% tl-dv , macro , key-value
\cs_new_protected:Npn \deriv_p_preamble:Nnn #1 #2 #3
{
\tl_set:Nx #1 { \cs_to_str:N #2 }
@@ -614,7 +481,7 @@
\__deriv_derivset:VV #1 \c_novalue_tl
\tl_if_novalue:nF {#3} { \__deriv_derivset:Vn #1 {#3} }
}
-
+% dv , new/delare/renew/provide , macro , inf
\cs_new_protected:Npn \deriv_p_define:nnnn #1 #2 #3 #4
{
\use:c { #2 DocumentCommand }{#3}{ s o o m t/ m !e{\sb^} }
@@ -623,13 +490,13 @@
\exp_args:Nnc \bool_xor:nnTF {##5} { l__deriv_#1_switch_slash_bool }
{
\exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_#1_switch_star_bool }
- { \__deriv_pdv_both:Nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
- { \__deriv_pdv_slash:Nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
+ { \__deriv_pdv_both:nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
+ { \__deriv_pdv_slash:nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
}
{
\exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_#1_switch_star_bool }
- { \__deriv_pdv_star:Nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
- { \__deriv_pdv_none:Nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
+ { \__deriv_pdv_star:nnnnnnnn {#4} {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
+ { \__deriv_pdv_none:nnnnnnnn {#4} {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
}
\group_end:
}
@@ -637,36 +504,36 @@
% dv
\cs_new_protected:Npn \__deriv_d_variables:n #1
{
- \__deriv_new:nnnn {#1} { scale } { tl } { eval, eval_slash, fun, var, frac, frac_slash }
- \__deriv_new:nnnn {#1} { delims } { tl } { eval, eval_slash, fun, var, frac, frac_slash }
- \__deriv_new:nnnn {#1} { sep } { muskip } { inf_ord, inf_fun, ord_fun, var_ord, inf_var, eval_sb, eval_sp }
- \__deriv_new:nnnn {#1} { switch } { bool } { star, slash }
- \__deriv_new:nnnn {#1} { mics } { bool } { fun, var, frac }
+ \__deriv_new:nnnn { tl } {#1} { scale } { eval, eval_slash, fun, var, frac, frac_slash }
+ \__deriv_new:nnnn { tl } {#1} { delims } { eval, eval_slash, fun, var, frac, frac_slash }
+ \__deriv_new:nnnn { muskip } {#1} { sep } { inf_ord, inf_fun, ord_fun, var_ord, inf_var, eval_sb, eval_sp }
+ \__deriv_new:nnnn { bool } {#1} { switch } { star, slash }
+ \__deriv_new:nnnn { bool } {#1} { mics } { fun, var, frac }
}
% dv
\cs_new_protected:Npn \__deriv_p_variables:n #1
{
- \__deriv_new:nnnn {#1} { scale } { tl } { eval, eval_slash, fun, var, frac, frac_slash }
- \__deriv_new:nnnn {#1} { delims } { tl } { eval, eval_slash, fun, var, frac, frac_slash }
- \__deriv_new:nnnn {#1} { sep } { muskip } { inf_ord, inf_fun, ord_fun, inf_var, var_ord, var_inf, ord_inf, eval_sb, eval_sp }
- \__deriv_new:nnnn {#1} { switch } { bool } { star, slash }
- \__deriv_new:nnnn {#1} { sort } { clist } { method }
- \__deriv_new:nnnn {#1} { sort } { tl } { numerical }
- \__deriv_new:nnnn {#1} { sort } { bool } { sign_reverse, symbol_reverse, abs_reverse }
- \__deriv_new:nnnn {#1} { mics } { bool } { fun, var, frac }
+ \__deriv_new:nnnn { tl } {#1} { scale } { eval, eval_slash, fun, var, frac, frac_slash }
+ \__deriv_new:nnnn { tl } {#1} { delims } { eval, eval_slash, fun, var, frac, frac_slash }
+ \__deriv_new:nnnn { muskip } {#1} { sep } { inf_ord, inf_fun, ord_fun, inf_var, var_ord, var_inf, ord_inf, eval_sb, eval_sp }
+ \__deriv_new:nnnn { bool } {#1} { switch } { star, slash }
+ \__deriv_new:nnnn { clist } {#1} { sort } { method }
+ \__deriv_new:nnnn { tl } {#1} { sort } { numerical }
+ \__deriv_new:nnnn { bool } {#1} { sort } { sign_reverse, symbol_reverse, abs_reverse }
+ \__deriv_new:nnnn { bool } {#1} { mics } { fun, var, frac }
}
-% dv , sub-category , data-type , cs-var-list
+% data-type , dv , category , cs-var-list
\cs_new:Npn \__deriv_new:nnnn #1 #2 #3 #4
{
\seq_set_from_clist:Nn \l__deriv_var_seq {#4}
\seq_map_inline:Nn \l__deriv_var_seq
- { \cs:w #3_new:c \cs_end: { l__deriv_#1_#2_##1_#3 } }
+ { \cs:w #1_new:c \cs_end: { l__deriv_#2_#3_##1_#1 } }
}
%%%%% Ordinary derivative definition %%%%%
% inf , dv , order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_odv_both:Nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \__deriv_odv_both:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
\__deriv_set_order:Nn \l__deriv_d_order_tl {#3}
\__deriv_evaluation_slash:nnnn {#2} {#6} {#7}
@@ -674,15 +541,14 @@
\__deriv_fraction_slash:nn {#2}
{
\use:c { __deriv_#2_style_frac_slash:n }
- { \__deriv_d_numerator_nofun:Nn #1 {#2} }
- { \__deriv_d_denominator:Nnn #1 {#2} {#5} }
+ { \__deriv_d_numerator_nofun:nn {#1} {#2} }
+ { \__deriv_d_denominator:nnn {#1} {#2} {#5} }
}
-
\__deriv_function:nn {#2} {#4}
}
}
% inf , dv , order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_odv_star:Nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \__deriv_odv_star:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
\__deriv_set_order:Nn \l__deriv_d_order_tl {#3}
\__deriv_evaluation:nnnn {#2} {#6} {#7}
@@ -690,14 +556,14 @@
\__deriv_fraction:nn {#2}
{
\use:c { __deriv_#2_style_frac:n }
- { \__deriv_d_numerator_nofun:Nn #1 {#2} }
- { \__deriv_d_denominator:Nnn #1 {#2} {#5} }
+ { \__deriv_d_numerator_nofun:nn {#1} {#2} }
+ { \__deriv_d_denominator:nnn {#1} {#2} {#5} }
}
\__deriv_function:nn {#2} {#4}
}
}
% inf , dv , order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_odv_slash:Nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \__deriv_odv_slash:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
\__deriv_set_order:Nn \l__deriv_d_order_tl {#3}
\__deriv_evaluation_slash:nnnn {#2} {#6} {#7}
@@ -705,13 +571,13 @@
\__deriv_fraction_slash:nn {#2}
{
\use:c { __deriv_#2_style_frac_slash:n }
- { \__deriv_d_numerator_fun:Nnn #1 {#2} {#4} }
- { \__deriv_d_denominator:Nnn #1 {#2} {#5} }
+ { \__deriv_d_numerator_fun:nnn {#1} {#2} {#4} }
+ { \__deriv_d_denominator:nnn {#1} {#2} {#5} }
}
}
}
% inf , dv , order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_odv_none:Nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \__deriv_odv_none:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
\__deriv_set_order:Nn \l__deriv_d_order_tl {#3}
\__deriv_evaluation:nnnn {#2} {#6} {#7}
@@ -719,100 +585,100 @@
\__deriv_fraction:nn {#2}
{
\use:c { __deriv_#2_style_frac:n }
- { \__deriv_d_numerator_fun:Nnn #1 {#2} {#4} }
- { \__deriv_d_denominator:Nnn #1 {#2} {#5} }
+ { \__deriv_d_numerator_fun:nnn {#1} {#2} {#4} }
+ { \__deriv_d_denominator:nnn {#1} {#2} {#5} }
}
}
}
% inf , dv , function
-\cs_new_protected:Npn \__deriv_d_numerator_fun:Nnn #1 #2 #3
+\cs_new_protected:Npn \__deriv_d_numerator_fun:nnn #1 #2 #3
{
- \__deriv_insert_inf:Nn #1 {#2}
+ \__deriv_insert_inf:nn {#1} {#2}
\__deriv_insert_ord:Nnn \l__deriv_d_order_tl {#2} { inf_ord }
\__deriv_insert_fun:Nnn \l__deriv_d_order_tl {#2} {#3}
}
% inf , dv
-\cs_new_protected:Npn \__deriv_d_numerator_nofun:Nn #1 #2
+\cs_new_protected:Npn \__deriv_d_numerator_nofun:nn #1 #2
{
- \__deriv_insert_inf:Nn #1 {#2}
+ \__deriv_insert_inf:nn {#1} {#2}
\__deriv_insert_ord:Nnn \l__deriv_d_order_tl {#2} { inf_ord }
}
% inf , dv , variable
-\cs_new_protected:Npn \__deriv_d_denominator:Nnn #1 #2 #3
+\cs_new_protected:Npn \__deriv_d_denominator:nnn #1 #2 #3
{
- \__deriv_insert_inf:Nn #1 {#2}
+ \__deriv_insert_inf:nn {#1} {#2}
\__deriv_insert_var_ord:Nnn \l__deriv_d_order_tl {#2} {#3}
}
%%%%% Partial derivative definition %%%%%
% inf , dv , order , mixed order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_pdv_both:Nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
+\cs_new_protected:Npn \__deriv_pdv_both:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \__deriv_preparation:NNNnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl #1 {#2} {#3} {#4} {#6}
+ \__deriv_preparation:NNnnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl {#1} {#2} {#3} {#4} {#6}
\__deriv_evaluation_slash:nnnn {#2} {#7} {#8}
{
\__deriv_fraction_slash:nn {#2}
{
\use:c { __deriv_#2_style_frac_slash:n }
- { \__deriv_p_numerator_nofun:Nn #1 {#2} }
+ { \__deriv_p_numerator_nofun:nn {#1} {#2} }
{ \__deriv_p_denominator:n {#2} }
}
\__deriv_function:nn {#2} {#5}
}
}
% inf , dv , order , mixed order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_pdv_star:Nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
+\cs_new_protected:Npn \__deriv_pdv_star:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \__deriv_preparation:NNNnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl #1 {#2} {#3} {#4} {#6}
+ \__deriv_preparation:NNnnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl {#1} {#2} {#3} {#4} {#6}
\__deriv_evaluation:nnnn {#2} {#7} {#8}
{
\__deriv_fraction:nn {#2}
{
\use:c { __deriv_#2_style_frac:n }
- { \__deriv_p_numerator_nofun:Nn #1 {#2} }
+ { \__deriv_p_numerator_nofun:nn {#1} {#2} }
{ \__deriv_p_denominator:n {#2} }
}
\__deriv_function:nn {#2} {#5}
}
}
% inf , dv , order , mixed order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_pdv_slash:Nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
+\cs_new_protected:Npn \__deriv_pdv_slash:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \__deriv_preparation:NNNnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl #1 {#2} {#3} {#4} {#6}
+ \__deriv_preparation:NNnnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl {#1} {#2} {#3} {#4} {#6}
\__deriv_evaluation_slash:nnnn {#2} {#7} {#8}
{
\__deriv_fraction_slash:nn {#2}
{
\use:c { __deriv_#2_style_frac_slash:n }
- { \__deriv_p_numerator_fun:Nnn #1 {#2} {#5} }
+ { \__deriv_p_numerator_fun:nnn {#1} {#2} {#5} }
{ \__deriv_p_denominator:n {#2} }
}
}
}
% inf , dv , order , mixed order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_pdv_none:Nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
+\cs_new_protected:Npn \__deriv_pdv_none:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \__deriv_preparation:NNNnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl #1 {#2} {#3} {#4} {#6}
+ \__deriv_preparation:NNnnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl {#1} {#2} {#3} {#4} {#6}
\__deriv_evaluation:nnnn {#2} {#7} {#8}
{
\__deriv_fraction:nn {#2}
{
\use:c { __deriv_#2_style_frac:n }
- { \__deriv_p_numerator_fun:Nnn #1 {#2} {#5} }
+ { \__deriv_p_numerator_fun:nnn {#1} {#2} {#5} }
{ \__deriv_p_denominator:n {#2} }
}
}
}% inf , dv , function
-\cs_new_protected:Npn \__deriv_p_numerator_fun:Nnn #1 #2 #3
+\cs_new_protected:Npn \__deriv_p_numerator_fun:nnn #1 #2 #3
{
- \__deriv_insert_inf:Nn #1 {#2}
+ \__deriv_insert_inf:nn {#1} {#2}
\__deriv_insert_ord:Nnn \l__deriv_p_mo_tl {#2} { inf_ord }
\__deriv_insert_fun:Nnn \l__deriv_p_mo_tl {#2} {#3}
}
% inf , dv
-\cs_new_protected:Npn \__deriv_p_numerator_nofun:Nn #1 #2
+\cs_new_protected:Npn \__deriv_p_numerator_nofun:nn #1 #2
{
- \__deriv_insert_inf:Nn #1 {#2}
+ \__deriv_insert_inf:nn {#1} {#2}
\__deriv_insert_ord:Nnn \l__deriv_p_mo_tl {#2} { inf_ord }
}
% dv
@@ -821,7 +687,7 @@
\tl_use:N \l__deriv_p_denom_tl %{ \__deriv_insert_mskip:nn {#1} { var_inf } }
}
% mixed-order-tl , denom-seq , inf , dv , order , mixed order , variable
-\cs_new_protected:Npn \__deriv_preparation:NNNnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \__deriv_preparation:NNnnnnn #1 #2 #3 #4 #5 #6 #7
{
\seq_clear:N #2
\seq_set_from_clist:Nn \l__deriv_p_var_seq {#7}
@@ -835,7 +701,7 @@
}
{ \tl_set:Nn #1 {#6} }
- \__deriv_p_build_denom:NNNNn \l__deriv_p_var_seq \l__deriv_p_order_seq #2 #3 {#4}
+ \__deriv_p_build_denom:NNNnn \l__deriv_p_var_seq \l__deriv_p_order_seq #2 {#3} {#4}
}
\cs_new_protected:Npn \__deriv_adjust_mo_seq:NNN #1 #2 #3
@@ -852,7 +718,7 @@
}
}
% \l__deriv_p_var_seq \l__deriv_p_order_seq, denom-tl , inf , dv
-\cs_new_protected:Npn \__deriv_p_build_denom:NNNNn #1 #2 #3 #4 #5
+\cs_new_protected:Npn \__deriv_p_build_denom:NNNnn #1 #2 #3 #4 #5
{
\int_zero:N \l__deriv_tmpa_int
\seq_map_inline:Nn #1
@@ -863,7 +729,7 @@
{
\tl_put_right:Nx #3
{
- \__deriv_insert_inf:Nn #4 {#5}
+ \__deriv_insert_inf:nn {#4} {#5}
\int_compare:nNnTF { \l__deriv_tmpa_int } = { \seq_count:N #1 }
{ \__deriv_insert_var_ord:Nnn \l__deriv_p_tmpa_tl {#5} {##1} }
{ \__deriv_insert_var_ord_sep:Nnn \l__deriv_p_tmpa_tl {#5} {##1} }
@@ -873,12 +739,11 @@
}
%%%%% And the rest of the code %%%%%
% inf , dv
-\cs_new:Npn \__deriv_insert_inf:Nn #1 #2
+\cs_new:Npn \__deriv_insert_inf:nn #1 #2
{
\exp_not:n
{
- \use:c { __deriv_#2_style_inf:n }
- { \tl_use:N #1 }
+ \use:c { __deriv_#2_style_inf:n } {#1}
}
}
% dv , function
@@ -920,7 +785,7 @@
% order , dv , name
\cs_new:Npn \__deriv_insert_ord:Nnn #1 #2 #3
{
- \__show_order:NT #1
+ \__deriv_show_order:NT #1
{
\sp
{
@@ -932,7 +797,7 @@
% order , dv , name
\cs_new:Npn \__deriv_insert_ord:Nn #1 #2
{
- \__show_order:NTF #1
+ \__deriv_show_order:NTF #1
{
\sp
{
@@ -1003,23 +868,23 @@
% dv , sub , sup , code-for-fraction
\cs_new:Npn \__deriv_evaluation:nnnn #1 #2 #3 #4
{
- \__if_novalue_blank_or:nnTF {#2} {#3}
+ \__deriv_if_novalue_and:nnTF {#2} {#3}
{ #4 }
{
\__deriv_add_delims:nnn {#1} { eval } {#4}
- \__if_novalue_blank:nF {#2} { \sb{ \__deriv_insert_mskip:nn {#1} { eval_sb } #2 } }
- \__if_novalue_blank:nF {#3} { \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 } }
+ \__deriv_if_novalue:nF {#2} { \sb{ \__deriv_insert_mskip:nn {#1} { eval_sb } #2 } }
+ \__deriv_if_novalue:nF {#3} { \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 } }
}
}
% dv , sub , sup , code-for-fraction
\cs_new:Npn \__deriv_evaluation_slash:nnnn #1 #2 #3 #4
{
- \__if_novalue_blank_or:nnTF {#2} {#3}
+ \__deriv_if_novalue_and:nnTF {#2} {#3}
{ #4 }
{
\__deriv_add_delims:nnn {#1} { eval_slash } {#4}
- \__if_novalue_blank:nF {#2} { \sb{ \__deriv_insert_mskip:nn {#1} { eval_sb } #2 } }
- \__if_novalue_blank:nF {#3} { \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 } }
+ \__deriv_if_novalue:nF {#2} { \sb{ \__deriv_insert_mskip:nn {#1} { eval_sb } #2 } }
+ \__deriv_if_novalue:nF {#3} { \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 } }
}
}
% dv , name , value
@@ -1208,12 +1073,12 @@
{
\__deriv_case:nF
{
- { \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpb_tl - && ! \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpa_tl - } { \__deriv_sort_reverse:nnn {#1} { sign } { same } }
- { \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpa_tl - && ! \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpb_tl - } { \__deriv_sort_reverse:nnn {#1} { sign } { swapped } }
+ { \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpb_tl - && ! \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpa_tl - } { \__deriv_sort_reverse:nnn {#1} { sign } { same } }
+ { \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpa_tl - && ! \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpb_tl - } { \__deriv_sort_reverse:nnn {#1} { sign } { swapped } }
}
{
\int_compare:nNnTF { \l__deriv_sort_counter_int } = { \l__deriv_sort_max_int }
- { \sort_return_same: }
+ { \sort_return_same: }
{ \__deriv_sort_method:n {#1} }
}
}
@@ -1227,7 +1092,7 @@
}
{
\int_compare:nNnTF { \l__deriv_sort_counter_int } = { \l__deriv_sort_max_int }
- { \sort_return_same: }
+ { \sort_return_same: }
{ \__deriv_sort_method:n {#1} }
}
}
@@ -1241,7 +1106,7 @@
}
{
\int_compare:nNnTF { \l__deriv_sort_counter_int } = { \l__deriv_sort_max_int }
- { \sort_return_same: }
+ { \sort_return_same: }
{ \__deriv_sort_method:n {#1} }
}
}
@@ -1279,6 +1144,131 @@
\tl_if_empty:NT #1 { \tl_set:Nn #1 { 0 } }
}
+%%%%% Declaring Variant %%%%%
+
+\DeclareDocumentCommand{\NewOdvVariant}{ m m o }
+{
+ \cs_if_exist:NTF #1
+ {
+ \msg_error:nnxx { deriv } { command-already-defined }
+ { \token_to_str:N #1 }
+ { \token_to_str:N \NewOdvVariant }
+ }
+ {
+ \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { New } {#1} {#2}
+ }
+}
+
+\DeclareDocumentCommand{\RenewOdvVariant}{ m m o }
+{
+ \cs_if_exist:NTF #1
+ {
+ \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Renew } {#1} {#2}
+ }
+ {
+ \msg_error:nnxx { deriv } { command-not-defined }
+ { \token_to_str:N #1 }
+ { \token_to_str:N \RenewOdvVariant }
+ }
+}
+
+\DeclareDocumentCommand{\ProvideOdvVariant}{ m m o }
+{
+ \cs_if_exist:NF #1
+ {
+ \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Provide } {#1} {#2}
+ }
+}
+
+\DeclareDocumentCommand{\DeclareOdvVariant}{ m m o }
+{
+ \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Declare } {#1} {#2}
+}
+
+\DeclareDocumentCommand{\NewPdvVariant}{ m m o }
+{
+ \cs_if_exist:NTF #1
+ {
+ \msg_error:nnxx { deriv } { command-already-defined }
+ { \token_to_str:N #1 }
+ { \token_to_str:N \NewPdvVariant }
+ }
+ {
+ \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { New } {#1} {#2}
+ }
+}
+
+\DeclareDocumentCommand{\RenewPdvVariant}{ m m o }
+{
+ \cs_if_exist:NTF #1
+ {
+ \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Renew } {#1} {#2}
+ }
+ {
+ \msg_error:nnxx { deriv } { command-already-defined }
+ { \token_to_str:N #1 }
+ { \token_to_str:N \RenewPdvVariant }
+ }
+}
+
+\DeclareDocumentCommand{\ProvidePdvVariant}{ m m o }
+{
+ \cs_if_exist:NF #1
+ {
+ \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Provide } {#1} {#2}
+ }
+}
+
+\DeclareDocumentCommand{\DeclarePdvVariant}{ m m o }
+{
+ \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Declare } {#1} {#2}
+}
+
+%%%%% slash frac %%%%%
+
+\DeclareDocumentCommand{\slashfrac}{ o m m }
+{
+ \tl_if_novalue:nTF {#1}
+ { \__deriv_slashfrac_auto:nn {#2} {#3} }
+ {
+ \str_case:nnF {#1}
+ {
+ { auto } { \__deriv_slashfrac_auto:nn {#2} {#3} }
+ { none } { \__deriv_slashfrac_none:nn {#2} {#3} }
+ }
+ { \__deriv_slashfrac_scale:nnn {#1} {#2} {#3} }
+ }
+}
+% numerator , denominator
+\cs_new_protected:Npn \__deriv_slashfrac_auto:nn #1 #2
+{
+ \__deriv_auto_left:n . \kern-\nulldelimiterspace
+ {#1} \middle/ {#2}
+ \__deriv_auto_right:n . \kern-\nulldelimiterspace
+}
+% numerator , denominator
+\cs_new_protected:Npn \__deriv_slashfrac_none:nn #1 #2
+{
+ {#1} / {#2}
+}
+% scale , numerator , denominator
+\cs_new_protected:Npn \__deriv_slashfrac_scale:nnn #1 #2 #3
+{
+ \cs:w #1 l \cs_end: .
+ {#2}
+ \cs:w #1 \cs_end: /
+ {#3}
+ \cs:w #1 r \cs_end: .
+}
+
%%%%% Generate variants %%%%%
\cs_generate_variant:Nn \tl_if_head_eq_charcode_p:nN { V }
@@ -1332,6 +1322,6 @@
\DeclareOdvVariant{\jdv}{\partial}[misc-add-delims = {fun, var}]
\DeclarePdvVariant{\pdv}{\partial}[sep-inf-ord=1, sep-ord-fun=-2]
}
-%\derivset{all}
+\derivset{all}
\endinput