summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/contrib/derivative/README.md7
-rw-r--r--macros/latex/contrib/derivative/derivative.pdfbin183631 -> 204460 bytes
-rw-r--r--macros/latex/contrib/derivative/derivative.sty742
-rw-r--r--macros/latex/contrib/derivative/derivative.tex2961
-rw-r--r--macros/latex/contrib/ibrackets/README.md6
-rw-r--r--macros/latex/contrib/ibrackets/ibrackets.dtx114
-rw-r--r--macros/latex/contrib/ibrackets/ibrackets.ins4
-rw-r--r--macros/latex/contrib/ibrackets/ibrackets.pdfbin93698 -> 93437 bytes
-rw-r--r--macros/latex/contrib/siunitx/CHANGELOG.md10
-rw-r--r--macros/latex/contrib/siunitx/siunitx-code.pdfbin643576 -> 643547 bytes
-rw-r--r--macros/latex/contrib/siunitx/siunitx-table.dtx7
-rw-r--r--macros/latex/contrib/siunitx/siunitx.dtx2
-rw-r--r--macros/latex/contrib/siunitx/siunitx.pdfbin691136 -> 691117 bytes
-rw-r--r--macros/latex/contrib/tidyres/README.md6
-rw-r--r--macros/latex/contrib/tidyres/tidyres-doc.pdfbin211638 -> 71048 bytes
-rw-r--r--macros/latex/contrib/tidyres/tidyres-doc.tex80
-rw-r--r--macros/latex/contrib/tidyres/tidyres.sty167
17 files changed, 2469 insertions, 1637 deletions
diff --git a/macros/latex/contrib/derivative/README.md b/macros/latex/contrib/derivative/README.md
index d9dc312780..72a47a64cb 100644
--- a/macros/latex/contrib/derivative/README.md
+++ b/macros/latex/contrib/derivative/README.md
@@ -1,4 +1,4 @@
-## README for derivative package v1.2 dated 2022-07-09
+## README for derivative package v1.3 dated 2023-07-26
The package provides a set of commands `\NewDerivative`, `\NewDifferential` etc. that can be used to define a derivative or a differential operator, respectively. The package have already defined several derivatives and differentials:
@@ -16,7 +16,7 @@ The package provides a set of commands `\NewDerivative`, `\NewDifferential` etc.
### Copyright and license
-Copyright 2019-2022 Simon Jensen
+Copyright 2019-2023 Simon Jensen
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
@@ -29,10 +29,11 @@ version 2005/12/01 or later.
This work has the LPPL maintenance status `maintained`.
The Current Maintainer of this work is Simon Jensen.
+Contributors: Romain Noel
The bundle contains the files:
README.md This file.
derivative.sty The package itself.
derivative.pdf The package documentation in PDF format.
- derivative.txt The master file that produced derivative.pdf. \ No newline at end of file
+ derivative.tex The master file that produced derivative.pdf. \ No newline at end of file
diff --git a/macros/latex/contrib/derivative/derivative.pdf b/macros/latex/contrib/derivative/derivative.pdf
index 9e4203f7b6..49928695f7 100644
--- a/macros/latex/contrib/derivative/derivative.pdf
+++ b/macros/latex/contrib/derivative/derivative.pdf
Binary files differ
diff --git a/macros/latex/contrib/derivative/derivative.sty b/macros/latex/contrib/derivative/derivative.sty
index 4e9a8308c2..1b475c8eb3 100644
--- a/macros/latex/contrib/derivative/derivative.sty
+++ b/macros/latex/contrib/derivative/derivative.sty
@@ -1,5 +1,5 @@
% derivative.sty
-% Copyright 2019-2022 Simon Jensen
+% Copyright 2019-2023 Simon Jensen
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -12,12 +12,14 @@
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Simon Jensen.
+% Contributors: Romain Noel
\NeedsTeXFormat{LaTeX2e}
-\RequirePackage{expl3,xparse}[2021/11/07]
+\RequirePackage{expl3}[2021/11/07]
+\RequirePackage{xparse}[2021/11/07]
\RequirePackage{l3keys2e}
-\ProvidesExplPackage{derivative}{2022/07/09}{1.2}{Nice and easy derivatives and differentials for LaTeX}
+\ProvidesExplPackage{derivative}{2023/07/26}{1.3}{Nice and easy derivatives and differentials for LaTeX}
\bool_new:N \l__deriv_pkg_italic_bool
\bool_new:N \l__deriv_pkg_upright_bool
@@ -78,6 +80,23 @@
{ \prg_return_true: }
}
+\prg_new_protected_conditional:Npnn \__deriv_if_in_two_seq:NNNN #1 #2 #3 #4 { TF }
+{
+ \int_zero:N \l__deriv_seq_pos_int
+ \seq_map_indexed_inline:Nn #1
+ {
+ \str_if_eq:VnT #3 {##2} %todo choose correct check
+ {
+ \tl_set:Nf \l__deriv_tmpa_tl { \seq_item:Nn #2 {##1} }
+ \tl_if_eq:NNT #4 \l__deriv_tmpa_tl
+ { \seq_map_break:n { \int_set:Nn \l__deriv_seq_pos_int {##1} } }
+ }
+ }
+ \int_compare:nNnTF \l__deriv_seq_pos_int = 0
+ { \prg_return_false: }
+ { \prg_return_true: }
+}
+
%%%%% Variables: derivatives %%%%%
\tl_new:N \l__deriv_dv_denom_tl
@@ -96,9 +115,14 @@
\seq_new:N \l__deriv_i_variant_seq
%%%%% Variables: other %%%%%
+
\tl_new:N \l__deriv_cs_name_tl
\tl_new:N \l__deriv_derivset_tl
+\tl_new:N \l__deriv_gcd_result_tl
+\tl_new:N \l__deriv_gcd_remain_tl
+\int_new:N \l__deriv_gcd_counter_int
+
\tl_new:N \l__deriv_tmpa_tl
\tl_new:N \l__deriv_tmpb_tl
\tl_new:N \l__deriv_tmpc_tl
@@ -110,6 +134,11 @@
\int_new:N \l__deriv_vmo_int
+\seq_new:N \l__deriv_num_tmpa_seq
+\seq_new:N \l__deriv_num_tmpb_seq
+\seq_new:N \l__deriv_sym_tmpa_seq
+\seq_new:N \l__deriv_sym_tmpb_seq
+
\tl_new:N \l__deriv_sym_tmpa_tl
\tl_new:N \l__deriv_num_tmpa_tl
\tl_new:N \l__deriv_sym_tmpb_tl
@@ -127,30 +156,38 @@
\int_new:N \l__deriv_tmpa_int
\int_new:N \l__deriv_tmpb_int
-\int_new:N \l__deriv_numerical_int
+\tl_new:N \l__deriv_numerical_tl
+\int_new:N \l__deriv_seq_pos_int
\int_new:N \l__deriv_sort_max_int
\regex_const:Nn \c__deriv_cs_numbers_regex { \A\-?\d+(?:,\d+){0,2}\Z }
-\tl_const:Nn \c__deriv_digits_tl {-1234567890}
+\tl_const:Nn \c__deriv_digits_tl {123456789-0}
%%%%% default values %%%%%
-
\prop_const_from_keyval:Nn \c__deriv_dv_pkg_keys_prop
{
- style-inf = d,
+ style-inf-num = d,
+ style-inf-den = d,
style-frac = \frac,
style-frac-/ = \slashfrac,
style-var = single,
+ style-var-/ = single,
+ style-var-! = multiple,
+ style-var-/! = single,
scale-eval = auto,
scale-eval-/ = auto,
+ scale-eval-! = auto,
scale-fun = auto,
scale-var = auto,
+ scale-var-! = auto,
scale-frac = auto,
scale-frac-/ = auto,
delims-eval = .\rvert,
delims-eval-/ = .\rvert,
+ delims-eval-! = .\rvert,
delims-fun = (),
delims-var = (),
+ delims-var-! = (),
delims-frac = (),
delims-frac-/ = (),
sep-inf-ord = 0,
@@ -161,11 +198,14 @@
sep-var-ord = 0,
sep-var-inf = \mathop{}\!,
sep-ord-inf = \mathop{}\!,
+ sep-ord-ord = {,},
+ sep-ord-var = 0,
sep-var-var = {,},
sep-eval-sb = 0,
sep-eval-sp = 0,
switch-* = false,
switch-/ = false,
+ switch-! = false,
switch-sort = true,
sort-method = {sign, symbol, abs},
sort-numerical = auto,
@@ -174,9 +214,9 @@
sort-sign-reverse = false,
sort-symbol-reverse = false,
sort-lexical-reverse = false,
- fun = false,
- frac = false,
- var = none,
+ fun = false,
+ frac = false,
+ var = none,
order = 1,
mixed-order = 1
}
@@ -184,8 +224,8 @@
\prop_const_from_keyval:Nn \c__deriv_i_pkg_keys_prop
{
style-inf = d,
- style-notation = multiple,
- style-notation-* = single,
+ style-var = multiple,
+ style-var-* = single,
scale-var = auto,
scale-var-* = auto,
delims-var = (),
@@ -219,35 +259,45 @@
},
scale-auto / mleftmright .code:n =
{
- \cs_set_nopar:Npn \__deriv_auto_left:n { \mleft }
- \cs_set_nopar:Npn \__deriv_auto_right:n { \mright }
+ \cs_set_eq:NN \__deriv_auto_left:n \mleft
+ \cs_set_eq:NN \__deriv_auto_right:n \mright
}
}
-%%%%%% Key-val: derivatives %%%%%%
+%%%%%% Key-val: Derivative %%%%%%
+% variant
\cs_new:Npn \__deriv_dv_define_keys:n #1
{
\keys_define:nn { deriv/dv/#1 }
{
- style-inf .tl_set:c = { l__deriv_dv_#1_style_inf_tl },
- style-var .code:n = { \__deriv_set_style_var:nn {#1} {##1} },
+ style-inf .meta:n = { style-inf-num={##1}, style-inf-den={##1} },
+ style-inf-num .tl_set:c = { l__deriv_dv_#1_style_inf_num_tl },
+ style-inf-den .tl_set:c = { l__deriv_dv_#1_style_inf_den_tl },
+ style-var .choices:nn = { single, multiple } { \__deriv_dv_set_style_var:nnn {dv_#1} {##1} { } },
+ style-var-/ .choices:nn = { single, multiple } { \__deriv_dv_set_style_var:nnn {dv_#1} {##1} { _slash } },
+ style-var-! .choices:nn = { single, multiple, mixed } { \__deriv_i_set_style_var:nnn {dv_#1} {##1} { _compact } },
+ style-var-/! .choices:nn = { single, multiple, mixed } { \__deriv_i_set_style_var:nnn {dv_#1} {##1} { _slash_compact } },
style-frac .cs_set:cp = { __deriv_dv_#1_style_frac:nn } {##1},
style-frac-/ .cs_set:cp = { __deriv_dv_#1_style_frac_slash:nn } {##1},
scale-eval .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {dv_#1} {##1} { eval } },
scale-eval-/ .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {dv_#1} {##1} { eval_slash } },
+ scale-eval-! .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {dv_#1} {##1} { eval_compact } },
scale-fun .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {dv_#1} {##1} { fun } },
scale-var .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {dv_#1} {##1} { var } },
+ scale-var-! .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {dv_#1} {##1} { var_compact } },
scale-frac .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {dv_#1} {##1} { frac } },
scale-frac-/ .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {dv_#1} {##1} { frac_slash } },
- delims-eval .tl_set:c = { l__deriv_dv_#1_delims_eval_tl },
- delims-eval-/ .tl_set:c = { l__deriv_dv_#1_delims_eval_slash_tl },
- delims-fun .tl_set:c = { l__deriv_dv_#1_delims_fun_tl },
- delims-var .tl_set:c = { l__deriv_dv_#1_delims_var_tl },
- delims-frac .tl_set:c = { l__deriv_dv_#1_delims_frac_tl },
- delims-frac-/ .tl_set:c = { l__deriv_dv_#1_delims_frac_slash_tl },
+ delims-eval .tl_set:c = { l__deriv_dv_#1_delims_eval_tl },
+ delims-eval-/ .tl_set:c = { l__deriv_dv_#1_delims_eval_slash_tl },
+ delims-eval-! .tl_set:c = { l__deriv_dv_#1_delims_eval_compact_tl },
+ delims-fun .tl_set:c = { l__deriv_dv_#1_delims_fun_tl },
+ delims-var .tl_set:c = { l__deriv_dv_#1_delims_var_tl },
+ delims-var-! .tl_set:c = { l__deriv_dv_#1_delims_var_compact_tl },
+ delims-frac .tl_set:c = { l__deriv_dv_#1_delims_frac_tl },
+ delims-frac-/ .tl_set:c = { l__deriv_dv_#1_delims_frac_slash_tl },
sep-inf-ord .code:n = { \__deriv_set_rubber_length:cn { l__deriv_dv_#1_sep_inf_ord_tl } {##1} },
sep-inf-fun .code:n = { \__deriv_set_rubber_length:cn { l__deriv_dv_#1_sep_inf_fun_tl } {##1} },
@@ -257,38 +307,79 @@
sep-var-ord .code:n = { \__deriv_set_rubber_length:cn { l__deriv_dv_#1_sep_var_ord_tl } {##1} },
sep-var-inf .code:n = { \__deriv_set_rubber_length:cn { l__deriv_dv_#1_sep_var_inf_tl } {##1} },
sep-ord-inf .code:n = { \__deriv_set_rubber_length:cn { l__deriv_dv_#1_sep_ord_inf_tl } {##1} },
+ sep-ord-ord .code:n = { \__deriv_set_rubber_length:cn { l__deriv_dv_#1_sep_ord_ord_tl } {##1} },
+ sep-ord-var .code:n = { \__deriv_set_rubber_length:cn { l__deriv_dv_#1_sep_ord_var_tl } {##1} },
sep-var-var .code:n = { \__deriv_set_rubber_length:cn { l__deriv_dv_#1_sep_var_var_tl } {##1} },
sep-eval-sb .code:n = { \__deriv_set_rubber_length:cn { l__deriv_dv_#1_sep_eval_sb_tl } {##1} },
sep-eval-sp .code:n = { \__deriv_set_rubber_length:cn { l__deriv_dv_#1_sep_eval_sp_tl } {##1} },
switch-* .bool_set:c = { l__deriv_dv_#1_switch_star_bool },
switch-/ .bool_set:c = { l__deriv_dv_#1_switch_slash_bool },
+ switch-! .bool_set:c = { l__deriv_dv_#1_switch_compact_bool },
switch-sort .bool_set:c = { l__deriv_dv_#1_switch_sort_bool },
+ sort-method .code:n = { \__deriv_set_sort_method:nn {#1} {##1} },
+ sort-numerical .choices:nn = { auto, first, last, symbolic } { \tl_set:cn { l__deriv_dv_#1_sort_numerical_tl } {##1} },
+ sort-abs-reverse .bool_set:c = { l__deriv_dv_#1_sort_abs_reverse_bool },
+ sort-lexical-reverse .bool_set:c = { l__deriv_dv_#1_sort_lexical_reverse_bool },
+ sort-number-reverse .bool_set:c = { l__deriv_dv_#1_sort_number_reverse_bool },
+ sort-sign-reverse .bool_set:c = { l__deriv_dv_#1_sort_sign_reverse_bool },
+ sort-symbol-reverse .bool_set:c = { l__deriv_dv_#1_sort_symbol_reverse_bool },
+
fun .bool_set:c = { l__deriv_dv_#1_misc_fun_bool },
frac .bool_set:c = { l__deriv_dv_#1_misc_frac_bool },
var .clist_set:c = { l__deriv_dv_#1_misc_var_clist },
var .default:n = {all},
order .clist_set:c = { l__deriv_dv_#1_misc_order_clist },
- ord .clist_set:c = { l__deriv_dv_#1_misc_order_clist },
+ ord .meta:n = { order={##1} },
mixed-order .tl_set:c = { l__deriv_dv_#1_misc_mixed_order_tl },
- mixord .tl_set:c = { l__deriv_dv_#1_misc_mixed_order_tl },
+ mixord .meta:n = { mixed-order={##1} },
+ }
+}
+
+%%%%%% Key-val: Differential %%%%%%
+
+% variant
+\cs_new:Npn \__deriv_i_define_keys:n #1
+{
+ \keys_define:nn { deriv/i/#1 }
+ {
+ style-inf .tl_set:c = { l__deriv_i_#1_style_inf_tl },
+ style-var .choices:nn = { single, multiple, mixed } { \__deriv_i_set_style_var:nnn {i_#1} {##1} { } },
+ style-var-* .choices:nn = { single, multiple, mixed } { \__deriv_i_set_style_var:nnn {i_#1} {##1} { _star } },
- sort-method .code:n = { \__deriv_set_sort_method:nn {#1} {##1} },
- sort-numerical .choices:nn = { auto, first, last, symbolic } { \tl_set:cn { l__deriv_dv_#1_sort_numerical_tl } {##1} },
- sort-abs-reverse .bool_set:c = { l__deriv_dv_#1_sort_abs_reverse_bool },
- sort-number-reverse .bool_set:c = { l__deriv_dv_#1_sort_number_reverse_bool },
- sort-sign-reverse .bool_set:c = { l__deriv_dv_#1_sort_sign_reverse_bool },
- sort-symbol-reverse .bool_set:c = { l__deriv_dv_#1_sort_symbol_reverse_bool },
- sort-lexical-reverse .bool_set:c = { l__deriv_dv_#1_sort_lexical_reverse_bool },
+ scale-var .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {i_#1} {##1} { var } },
+ scale-var-* .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {i_#1} {##1} { var_star } },
+
+ delims-var .tl_set:c = { l__deriv_i_#1_delims_var_tl },
+ delims-var-* .tl_set:c = { l__deriv_i_#1_delims_var_star_tl },
+
+ sep-begin .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_begin_tl } {##1} },
+ sep-inf-ord .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_inf_ord_tl } {##1} },
+ sep-inf-var .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_inf_var_tl } {##1} },
+ sep-ord-var .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_ord_var_tl } {##1} },
+ sep-var-inf .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_var_inf_tl } {##1} },
+ sep-var-var .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_var_var_tl } {##1} },
+ sep-ord-ord .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_ord_ord_tl } {##1} },
+ sep-end .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_end_tl } {##1} },
+
+ switch-* .bool_set:c = { l__deriv_i_#1_switch_star_bool },
+
+ var .clist_set:c = { l__deriv_i_#1_misc_var_clist },
+ var .default:n = {all},
+
+ order .clist_set:c = { l__deriv_i_#1_misc_order_clist },
+ ord .clist_set:c = { l__deriv_i_#1_misc_order_clist },
}
}
+
% variant, value
\cs_new:Npn \__deriv_set_sort_method:nn #1 #2
{
\seq_clear:c { l__deriv_dv_#1_sort_method_seq }
\seq_set_from_clist:Nn \l__deriv_tmpa_seq {#2}
+
\seq_map_indexed_inline:Nn \l__deriv_tmpa_seq
{
\str_case:nn {##2}
@@ -302,25 +393,13 @@
\int_compare:nNnT {##1} = { 3 } { \seq_map_break: }
}
}
-% variant, value
-\cs_new:Npn \__deriv_set_style_var:nn #1 #2
-{
- \str_case:nn {#2}
- {
- { single } { \tl_set:cn { l__deriv_dv_#1_style_var_tl } { \__deriv_dv_build_single:NNNn } }
- { multiple } { \tl_set:cn { l__deriv_dv_#1_style_var_tl } { \__deriv_dv_build_multiple:NNNn } }
- }
-}
-% varaint, value, name
-\cs_new:Npn \__deriv_set_style_notation:nnn #1 #2 #3
-{
- \str_case:nn {#2}
- {
- { single } { \tl_set:cn { l__deriv_i_#1_style_notation#3_tl } { \__deriv_i_build_single:NNNnn } }
- { multiple } { \tl_set:cn { l__deriv_i_#1_style_notation#3_tl } { \__deriv_i_build_multiple:NNNnn } }
- { mixed } { \tl_set:cn { l__deriv_i_#1_style_notation#3_tl } { \__deriv_i_build_mixed:NNNnn } }
- }
-}
+% variant, value, name
+\cs_new:Npn \__deriv_dv_set_style_var:nnn #1 #2 #3
+{ \exp_args:Nnc \tl_set:cn { l__deriv_#1_style_var#3_tl } { __deriv_dv_build_var_#2:NNNnn } }
+
+\cs_new:Npn \__deriv_i_set_style_var:nnn #1 #2 #3
+{ \exp_args:Nnc \tl_set:cn { l__deriv_#1_style_var#3_tl } { __deriv_i_build_var_#2:NNNnnn } }
+
% dv_variant, scale, name
\cs_new:Npn \__deriv_set_scale:nnn #1 #2 #3
{
@@ -351,41 +430,6 @@
{ \tl_set:Nn #1 {#2} }
}
-%%%%%% Key-val: derivatives %%%%%%
-% variant
-\cs_new:Npn \__deriv_i_define_keys:n #1
-{
- \keys_define:nn { deriv/i/#1 }
- {
- style-inf .tl_set:c = { l__deriv_i_#1_style_inf_tl },
- style-notation .code:n = { \__deriv_set_style_notation:nnn {#1} {##1} {} },
- style-notation-* .code:n = { \__deriv_set_style_notation:nnn {#1} {##1} { _star } },
-
- scale-var .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {i_#1} {##1} { var } },
- scale-var-* .choices:nn = { auto, none, big, Big, bigg, Bigg } { \__deriv_set_scale:nnn {i_#1} {##1} { var_slash } },
-
- delims-var .tl_set:c = { l__deriv_i_#1_delims_var_tl },
- delims-var-* .tl_set:c = { l__deriv_i_#1_delims_var_star_tl },
-
- sep-begin .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_begin_tl } {##1} },
- sep-inf-ord .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_inf_ord_tl } {##1} },
- sep-inf-var .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_inf_var_tl } {##1} },
- sep-ord-var .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_ord_var_tl } {##1} },
- sep-var-inf .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_var_inf_tl } {##1} },
- sep-var-var .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_var_var_tl } {##1} },
- sep-ord-ord .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_ord_ord_tl } {##1} },
- sep-end .code:n = { \__deriv_set_rubber_length:cn { l__deriv_i_#1_sep_end_tl } {##1} },
-
- switch-* .bool_set:c = { l__deriv_i_#1_switch_star_bool },
-
- var .clist_set:c = { l__deriv_i_#1_misc_var_clist },
- var .default:n = {all},
-
- order .clist_set:c = { l__deriv_i_#1_misc_order_clist },
- ord .clist_set:c = { l__deriv_i_#1_misc_order_clist },
- }
-}
-
%%%%% Setting keys %%%%%
\DeclareDocumentCommand{\derivset}{ m o }
@@ -439,6 +483,7 @@
\cs_new_protected:Npn \deriv_preamble:NNnnn #1 #2 #3 #4 #5
{
\tl_set:Nx #1 { \cs_to_str:N #2 }
+
\tl_if_novalue:nTF {#4}
{ \__deriv_preamble_aux:Vnn #1 { style-inf={#3} } {#5} }
{ \__deriv_preamble_aux:Vnn #1 { style-inf={#3}, #4} {#5} }
@@ -456,43 +501,42 @@
\__deriv_set_default:nnn {#1} {#2} {#3}
}
% data-type, variant, category, cs-var-list
-\cs_new:Npn \__deriv_new:nnnn #1 #2 #3 #4
+\cs_new:Npn \__deriv_new:nnnnn #1 #2 #3 #4 #5
{
- \seq_set_from_clist:Nn \l__deriv_new_var_seq {#4}
+ \seq_set_from_clist:Nn \l__deriv_new_var_seq {#5}
\seq_map_inline:Nn \l__deriv_new_var_seq
- { \cs:w #1_new:c \cs_end: { l__deriv_#2_#3_##1_#1 } }
+ { \use:c { #1_new:c } { l__deriv_#2_#3_#4_##1_#1 } }
}
% variant
\cs_new_protected:Npn \__deriv_dv_variables:n #1
{
- \__deriv_new:nnnn { tl } {dv_#1} { style } { inf, var, frac, frac_slash }
- \__deriv_new:nnnn { tl } {dv_#1} { scale } { eval, eval_slash, fun, var, frac, frac_slash }
- \__deriv_new:nnnn { tl } {dv_#1} { delims } { eval, eval_slash, fun, var, frac, frac_slash }
- \__deriv_new:nnnn { tl } {dv_#1} { sep } { inf_ord, inf_fun, ord_fun, frac_fun, inf_var, var_ord, var_inf, ord_inf, eval_sb, eval_sp }
- \__deriv_new:nnnn { bool } {dv_#1} { switch } { star, slash, sort }
- \__deriv_new:nnnn { seq } {dv_#1} { sort } { method }
- \__deriv_new:nnnn { tl } {dv_#1} { sort } { numerical }
- \__deriv_new:nnnn { bool } {dv_#1} { sort } { abs_reverse, sign_reverse, symbol_reverse, number_reverse, lexical_reverse }
- \__deriv_new:nnnn { bool } {dv_#1} { misc } { fun, frac }
- \__deriv_new:nnnn { clist } {dv_#1} { misc } { var }
-
- \__deriv_new:nnnn { clist } {dv_#1} { misc } { order }
- \__deriv_new:nnnn { tl } {dv_#1} { misc } { mixed_order }
- \__deriv_new:nnnn { prop } {dv_#1} { user } { keys }
- \__deriv_new:nnnn { bool } {dv_#1} { local } { keys }
+ \__deriv_new:nnnnn { tl } { dv } {#1} { style } { inf_num, inf_den, var, var_compact, var_slash_compact, frac, frac_slash }
+ \__deriv_new:nnnnn { tl } { dv } {#1} { scale } { eval, eval_slash, eval_compact, fun, var, var_compact, frac, frac_slash }
+ \__deriv_new:nnnnn { tl } { dv } {#1} { delims } { eval, eval_slash, eval_comapct, fun, var, frac, frac_slash }
+ \__deriv_new:nnnnn { tl } { dv } {#1} { sep } { inf_ord, inf_fun, ord_fun, frac_fun, inf_var, var_ord, var_inf, ord_inf, ord_ord, ord_var, var_var, eval_sb, eval_sp }
+ \__deriv_new:nnnnn { bool } { dv } {#1} { switch } { star, slash, compact, sort }
+ \__deriv_new:nnnnn { seq } { dv } {#1} { sort } { method }
+ \__deriv_new:nnnnn { tl } { dv } {#1} { sort } { numerical }
+ \__deriv_new:nnnnn { bool } { dv } {#1} { sort } { abs_reverse, sign_reverse, symbol_reverse, number_reverse, lexical_reverse }
+ \__deriv_new:nnnnn { bool } { dv } {#1} { misc } { fun, frac }
+ \__deriv_new:nnnnn { clist } { dv } {#1} { misc } { var }
+ \__deriv_new:nnnnn { clist } { dv } {#1} { misc } { order }
+ \__deriv_new:nnnnn { tl } { dv } {#1} { misc } { mixed_order }
+ \__deriv_new:nnnnn { prop } { dv } {#1} { user } { keys }
+ \__deriv_new:nnnnn { bool } { dv } {#1} { local } { keys }
}
% variant
\cs_new_protected:Npn \__deriv_i_variables:n #1
{
- \__deriv_new:nnnn { tl } {i_#1} { style } { inf, notation, notation_star }
- \__deriv_new:nnnn { tl } {i_#1} { scale } { var, var_star }
- \__deriv_new:nnnn { tl } {i_#1} { delims } { var, var_star }
- \__deriv_new:nnnn { tl } {i_#1} { sep } { begin, inf_ord, inf_var, ord_var, var_inf, var_var, ord_ord, end }
- \__deriv_new:nnnn { bool } {i_#1} { switch } { star }
- \__deriv_new:nnnn { bool } {i_#1} { mics } { fun, var, frac }
- \__deriv_new:nnnn { clist } {i_#1} { misc } { order }
- \__deriv_new:nnnn { prop } {i_#1} { user } { keys }
- \__deriv_new:nnnn { bool } {i_#1} { local } { keys }
+ \__deriv_new:nnnnn { tl } { i } {#1} { style } { inf, var, var_star }
+ \__deriv_new:nnnnn { tl } { i } {#1} { scale } { var, var_star }
+ \__deriv_new:nnnnn { tl } { i } {#1} { delims } { var, var_star }
+ \__deriv_new:nnnnn { tl } { i } {#1} { sep } { begin, inf_ord, inf_var, ord_var, var_inf, var_var, ord_ord, end }
+ \__deriv_new:nnnnn { bool } { i } {#1} { switch } { star }
+ \__deriv_new:nnnnn { bool } { i } {#1} { mics } { fun, var, frac }
+ \__deriv_new:nnnnn { clist } { i } {#1} { misc } { order }
+ \__deriv_new:nnnnn { prop } { i } {#1} { user } { keys }
+ \__deriv_new:nnnnn { bool } { i } {#1} { local } { keys }
}
% variant, keyval, dv/i
\cs_new_protected:Npn \__deriv_set_default:nnn #1 #2 #3
@@ -513,21 +557,29 @@
% new/delare/renew/provide, variant, macro
\cs_new_protected:Npn \deriv_dv_define:Nnn #1 #2 #3
{
- \exp_args:Nne #1 {#3}{ s o m t/ m !e{\char_generate:nn {`_}{8}^} }
+ \exp_args:Nne #1 {#3}{ s o m t/ t! m !e{\char_generate:nn {`_}{8}^} }
{
\group_begin:
\deriv_local_keys:nnn {##2} { dv } {#2}
- \exp_args:Nnc \bool_xor:nnTF {##4} { l__deriv_dv_#2_switch_slash_bool }
+ \exp_args:Nnc \bool_xor:nnTF {##5} { l__deriv_dv_#2_switch_compact_bool }
{
- \exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_dv_#2_switch_star_bool }
- { \__deriv_dv_both:nnnnn {dv_#2} {##3} {##5} {##6} {##7} }
- { \__deriv_dv_slash:nnnnn {dv_#2} {##3} {##5} {##6} {##7} }
+ \exp_args:Nnc \bool_xor:nnTF {##4} { l__deriv_dv_#2_switch_slash_bool }
+ { \__deriv_dv_slash_compact:nnnnn {dv_#2} {##3} {##6} {##7} {##8} }
+ { \__deriv_dv_compact:nnnnn {dv_#2} {##3} {##6} {##7} {##8} }
}
{
- \exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_dv_#2_switch_star_bool }
- { \__deriv_dv_star:nnnnn {dv_#2} {##3} {##5} {##6} {##7} }
- { \__deriv_dv_none:nnnnn {dv_#2} {##3} {##5} {##6} {##7} }
+ \exp_args:Nnc \bool_xor:nnTF {##4} { l__deriv_dv_#2_switch_slash_bool }
+ {
+ \exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_dv_#2_switch_star_bool }
+ { \__deriv_dv_star_slash:nnnnn {dv_#2} {##3} {##6} {##7} {##8} }
+ { \__deriv_dv_slash:nnnnn {dv_#2} {##3} {##6} {##7} {##8} }
+ }
+ {
+ \exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_dv_#2_switch_star_bool }
+ { \__deriv_dv_star:nnnnn {dv_#2} {##3} {##6} {##7} {##8} }
+ { \__deriv_dv_none:nnnnn {dv_#2} {##3} {##6} {##7} {##8} }
+ }
}
\group_end:
}
@@ -549,9 +601,9 @@
%%%%% derivative definition %%%%%
% variant, function, variable, sb-point, sp-point
-\cs_new_protected:Npn \__deriv_dv_both:nnnnn #1 #2 #3 #4 #5
+\cs_new_protected:Npn \__deriv_dv_star_slash:nnnnn #1 #2 #3 #4 #5
{
- \__deriv_dv_preparation:Nnn \l__deriv_dv_denom_tl {#1} {#3}
+ \__deriv_dv_preparation:Nnnn \l__deriv_dv_denom_tl {#1} {#3} { _slash }
\__deriv_evaluation_slash:nnnn {#1} {#4} {#5}
{
\__deriv_fraction_slash:nn {#1}
@@ -566,7 +618,7 @@
% variant, function, variable, sb-point, sp-point
\cs_new_protected:Npn \__deriv_dv_star:nnnnn #1 #2 #3 #4 #5
{
- \__deriv_dv_preparation:Nnn \l__deriv_dv_denom_tl {#1} {#3}
+ \__deriv_dv_preparation:Nnnn \l__deriv_dv_denom_tl {#1} {#3} { }
\__deriv_evaluation:nnnn {#1} {#4} {#5}
{
\__deriv_fraction:nn {#1}
@@ -581,7 +633,7 @@
% variant, function, variable, sb-point, sp-point
\cs_new_protected:Npn \__deriv_dv_slash:nnnnn #1 #2 #3 #4 #5
{
- \__deriv_dv_preparation:Nnn \l__deriv_dv_denom_tl {#1} {#3}
+ \__deriv_dv_preparation:Nnnn \l__deriv_dv_denom_tl {#1} {#3} { _slash }
\__deriv_evaluation_slash:nnnn {#1} {#4} {#5}
{
\__deriv_fraction_slash:nn {#1}
@@ -595,7 +647,7 @@
% variant, function, variable, sb-point, sp-point
\cs_new_protected:Npn \__deriv_dv_none:nnnnn #1 #2 #3 #4 #5
{
- \__deriv_dv_preparation:Nnn \l__deriv_dv_denom_tl {#1} {#3}
+ \__deriv_dv_preparation:Nnnn \l__deriv_dv_denom_tl {#1} {#3} { }
\__deriv_evaluation:nnnn {#1} {#4} {#5}
{
\__deriv_fraction:nn {#1}
@@ -606,10 +658,31 @@
}
}
}
+% variant, function, variable, sb-point, sp-point
+\cs_new_protected:Npn \__deriv_dv_compact:nnnnn #1 #2 #3 #4 #5
+{
+ \__deriv_i_preparation:Nnnnn \l__deriv_dv_denom_tl {#1} {#3} { _compact } { _num }
+ \__deriv_evaluation_compact:nnnn {#1} {#4} {#5}
+ {
+ \tl_use:N \l__deriv_dv_denom_tl
+ \__deriv_insert_fun:nnn {#1} {#2} { inf_fun }
+ }
+}
+% variant, function, variable, sb-point, sp-point
+\cs_new_protected:Npn \__deriv_dv_slash_compact:nnnnn #1 #2 #3 #4 #5
+{
+ \__deriv_i_preparation:Nnnnn \l__deriv_dv_denom_tl {#1} {#3} { _slash_compact } { _num }
+ \__deriv_evaluation_compact:nnnn {#1} {#4} {#5}
+ {
+ %\__deriv_i_print:Nn \l__deriv_i_denom_tl {#1}
+ \tl_use:N \l__deriv_dv_denom_tl
+ \__deriv_insert_fun:nnn {#1} {#2} { inf_fun }
+ }
+}
% variant, function
\cs_new_protected:Npn \__deriv_dv_numerator_fun:nn #1 #2
{
- \__deriv_insert_inf:n {#1}
+ \__deriv_insert_numinf:n {#1}
\__deriv_show_order:cTF { l__deriv_#1_misc_mixed_order_tl }
{
\__deriv_insert_ord:cnn { l__deriv_#1_misc_mixed_order_tl } {#1} { inf_ord }
@@ -620,24 +693,30 @@
% variant
\cs_new_protected:Npn \__deriv_dv_numerator_nofun:n #1
{
- \__deriv_insert_inf:n {#1}
+ \__deriv_insert_numinf:n {#1}
\__deriv_show_order:cT { l__deriv_#1_misc_mixed_order_tl }
{ \__deriv_insert_ord:cnn { l__deriv_#1_misc_mixed_order_tl } {#1} { inf_ord } }
}
% dv
\cs_new_protected:Npn \__deriv_dv_denominator:n #1
{ \tl_use:N \l__deriv_dv_denom_tl }
-% denom-tl, variant, variable
-\cs_new_protected:Npn \__deriv_dv_preparation:Nnn #1 #2 #3
+
+% denom-tl, variant, variable, if star
+\cs_new_protected:Npn \__deriv_dv_preparation:Nnnn #1 #2 #3 #4
{
\tl_clear:N #1
\seq_set_from_clist:Nn \l__deriv_dv_var_seq {#3}
\seq_set_from_clist:Nc \l__deriv_dv_order_seq { l__deriv_#2_misc_order_clist }
- \tl_use:c { l__deriv_#2_style_var_tl } \l__deriv_dv_var_seq \l__deriv_dv_order_seq #1 {#2}
+ \tl_use:c { l__deriv_#2_style_var#4_tl } \l__deriv_dv_var_seq \l__deriv_dv_order_seq #1 {#2} {#4}
+
+ % Legacy development code from when `style-var-/` was not available
+ %\tl_if_eq:nnTF {#4} { _slash } %TODO: Find a better solution
+ %{ \tl_use:c { l__deriv_#2_style_var_tl } \l__deriv_dv_var_seq \l__deriv_dv_order_seq #1 {#2} {#4} }
+ %{ \tl_use:c { l__deriv_#2_style_var#4_tl } \l__deriv_dv_var_seq \l__deriv_dv_order_seq #1 {#2} {#4} }
}
-% var_seq, order_seq, denom-tl, variant
-\cs_new_protected:Npn \__deriv_dv_build_multiple:NNNn #1 #2 #3 #4
+% var_seq, order_seq, denom-tl, variant, if star
+\cs_new_protected:Npn \__deriv_dv_build_var_multiple:NNNnn #1 #2 #3 #4 #5
{
\int_set:Nn \l__deriv_var_count_int { \seq_count:N #1 }
\__deriv_adjust_ord_seq:NN \l__deriv_var_count_int #2
@@ -653,7 +732,7 @@
\seq_pop_left:NN \l__deriv_tmpa_seq \l__deriv_tmpb_tl
\tl_put_right:Nx #3
{
- \__deriv_insert_inf:n {#4}
+ \__deriv_insert_deninf:n {#4}
\__deriv_insert_mskip:nn {#4} { inf_var }
\__deriv_insert_var:Nnn \l__deriv_tmpb_tl {##2} {#4}
\__deriv_show_order:NTF \l__deriv_tmpa_tl
@@ -669,19 +748,28 @@
}
}
}
-% var_seq, order_seq, denom-tl, variant
-\cs_new_protected:Npn \__deriv_dv_build_single:NNNn #1 #2 #3 #4
+% var_seq, order_seq, denom-tl, variant, if star
+\cs_new_protected:Npn \__deriv_dv_build_var_single:NNNnn #1 #2 #3 #4 #5
{
\int_set:Nn \l__deriv_var_count_int { \seq_count:N #1 }
\tl_set:Nf \l__deriv_tmpa_tl { \seq_use:Nn #1 { \__deriv_insert_mskip:nn {#4} { var_var } } }
\__deriv_var_bool_seq:cNN { l__deriv_#4_misc_var_clist } \l__deriv_tmpa_seq \l__deriv_var_count_int
+ \int_set:Nn \l__deriv_tmpa_int { \seq_count:N #2 }
- \seq_pop_left:NN #2 \l__deriv_tmpb_tl
+ \seq_map_indexed_inline:Nn #2
+ {
+ \tl_put_right:Nx \l__deriv_tmpb_tl
+ {
+ \exp_not:n {##2}
+ \int_compare:nNnF {##1} = { \l__deriv_tmpa_int }
+ { \__deriv_insert_mskip:nn {#4} { ord_ord } }
+ }
+ }
\seq_pop_left:NN \l__deriv_tmpa_seq \l__deriv_tmpc_tl
\tl_put_right:Nx #3
{
- \__deriv_insert_inf:n {#4}
+ \__deriv_insert_deninf:n {#4}
\__deriv_insert_mskip:nn {#4} { inf_var }
\__deriv_insert_var:NVn \l__deriv_tmpc_tl \l__deriv_tmpa_tl {#4}
\__deriv_show_order:NT \l__deriv_tmpb_tl
@@ -723,7 +811,6 @@
% ord-seq, var-seq
\cs_new_protected:Npn \__deriv_adjust_trailing_ord:NN #1 #2
{
- \seq_clear:N \l__deriv_tmpa_seq
\int_set:Nn \l__deriv_vmo_int { \seq_count:N #2 - \seq_count:N #1 }
\int_compare:nNnT { \l__deriv_vmo_int } < { 0 }
@@ -747,14 +834,14 @@
% variant, variable
\cs_new:Npn \__deriv_inf_none:nn #1 #2
{
- \__deriv_i_preparation:Nnnn \l__deriv_i_denom_tl {#1} {#2} { }
+ \__deriv_i_preparation:Nnnnn \l__deriv_i_denom_tl {#1} {#2} { } { }
\__deriv_i_print:Nn \l__deriv_i_denom_tl {#1}
}
% variant, variable
\cs_new:Npn \__deriv_inf_star:nn #1 #2
{
- \__deriv_i_preparation:Nnnn \l__deriv_i_denom_tl {#1} {#2} { _star }
+ \__deriv_i_preparation:Nnnnn \l__deriv_i_denom_tl {#1} {#2} { _star } { }
\__deriv_i_print:Nn \l__deriv_i_denom_tl {#1}
}
% print-tl, variant
@@ -764,17 +851,20 @@
\tl_use:N #1
\__deriv_insert_mskip:nn {#2} { end }
}
-% print-tl, variant, variable, if star
-\cs_new_protected:Npn \__deriv_i_preparation:Nnnn #1 #2 #3 #4
+% print-tl, variant, variable, if star, inf_variant
+\cs_new_protected:Npn \__deriv_i_preparation:Nnnnn #1 #2 #3 #4 #5
{
\tl_clear:N #1
\seq_set_from_clist:Nn \l__deriv_i_var_seq {#3}
\seq_set_from_clist:Nc \l__deriv_i_order_seq { l__deriv_#2_misc_order_clist }
- \tl_use:c { l__deriv_#2_style_notation#4_tl } \l__deriv_i_var_seq \l__deriv_i_order_seq #1 {#2} {#4}
+ \tl_if_eq:nnTF {#4} { _slash_compact } %TODO: Find a better solution
+ { \tl_use:c { l__deriv_#2_style_var#4_tl } \l__deriv_i_var_seq \l__deriv_i_order_seq #1 {#2} { _compact } {#5} }
+ { \tl_use:c { l__deriv_#2_style_var#4_tl } \l__deriv_i_var_seq \l__deriv_i_order_seq #1 {#2} {#4} {#5} }
+ %\tl_use:c { l__deriv_#2_style_var#4_tl } \l__deriv_i_var_seq \l__deriv_i_order_seq #1 {#2} {#4} {#5}
}
-% var-seq, order-seq, print-tl, variant, if star
-\cs_new_protected:Npn \__deriv_i_build_single:NNNnn #1 #2 #3 #4 #5
+% var-seq, order-seq, print-tl, variant, if star, inf_variant
+\cs_new_protected:Npn \__deriv_i_build_var_single:NNNnnn #1 #2 #3 #4 #5 #6
{
\int_set:Nn \l__deriv_var_count_int { \seq_count:N #1 }
\__deriv_var_bool_seq:cNN { l__deriv_#4_misc_var_clist } \l__deriv_add_var_bool_seq \l__deriv_var_count_int
@@ -803,7 +893,7 @@
}
\tl_put_right:Nx #3
{
- \__deriv_insert_inf:n {#4}
+ \__deriv_insert_inf:nn {#4} {#6}
\sb
{
\__deriv_insert_mskip:nn {#4} { inf_var }
@@ -819,8 +909,8 @@
}
}
}
-% var-seq, order-seq, print-tl, variant
-\cs_new_protected:Npn \__deriv_i_build_multiple:NNNnn #1 #2 #3 #4 #5
+% var-seq, order-seq, print-tl, variant, if star, inf_variant
+\cs_new_protected:Npn \__deriv_i_build_var_multiple:NNNnnn #1 #2 #3 #4 #5 #6
{
\int_set:Nn \l__deriv_var_count_int { \seq_count:N #1 }
\__deriv_var_bool_seq:cNN { l__deriv_#4_misc_var_clist } \l__deriv_add_var_bool_seq \l__deriv_var_count_int
@@ -832,7 +922,7 @@
\seq_pop_left:NN \l__deriv_add_var_bool_seq \l__deriv_tmpb_tl
\tl_put_right:Nx #3
{
- \__deriv_insert_inf:n {#4}
+ \__deriv_insert_inf:nn {#4} {#6}
\__deriv_show_order:NTF \l__deriv_tmpa_tl
{
\__deriv_insert_ord:Nnn \l__deriv_tmpa_tl {#4} { inf_ord }
@@ -846,8 +936,8 @@
}
}
}
-% var-seq, order-seq, print-tl, variant
-\cs_new_protected:Npn \__deriv_i_build_mixed:NNNnn #1 #2 #3 #4 #5
+% var-seq, order-seq, print-tl, variant, if star, inf_variant
+\cs_new_protected:Npn \__deriv_i_build_var_mixed:NNNnnn #1 #2 #3 #4 #5 #6
{
\int_set:Nn \l__deriv_var_count_int { \seq_count:N #1 }
\__deriv_var_bool_seq:cNN { l__deriv_#4_misc_var_clist } \l__deriv_add_var_bool_seq \l__deriv_var_count_int
@@ -859,7 +949,7 @@
\seq_pop_left:NN \l__deriv_add_var_bool_seq \l__deriv_tmpb_tl
\tl_put_right:Nx #3
{
- \__deriv_insert_inf:n {#4}
+ \__deriv_insert_inf:nn {#4} {#6}
\__deriv_show_order:NT \l__deriv_tmpa_tl
{ \__deriv_insert_ord:Nnn \l__deriv_tmpa_tl {#4} { inf_ord } }
\sb
@@ -874,8 +964,14 @@
}
%%%%% And the rest of the code %%%%%
% variant
-\cs_new:Npn \__deriv_insert_inf:n #1
-{ \exp_not:v { l__deriv_#1_style_inf_tl } }
+\cs_new:Npn \__deriv_insert_numinf:n #1
+{ \__deriv_insert_inf:nn {#1} { _num } }
+% variant
+\cs_new:Npn \__deriv_insert_deninf:n #1
+{ \__deriv_insert_inf:nn {#1} { _den } }
+% variant, name
+\cs_new:Npn \__deriv_insert_inf:nn #1 #2
+{ \exp_not:v { l__deriv_#1_style_inf#2_tl } }
% dv, function, muskip
\cs_new:Npn \__deriv_insert_fun:nnn #1 #2 #3
{
@@ -887,18 +983,18 @@
{#2}
}
}
-% if delim, variable, variant
-\cs_new:Npn \__deriv_insert_var:Nnn #1 #2 #3
+% if delim, variable, variant, if star
+\cs_new:Npn \__deriv_insert_var:Nnnn #1 #2 #3 #4
{
\bool_if:NTF #1
- { \__deriv_add_delims:nnn {#3} { var } {#2} }
+ { \__deriv_add_delims:nnn {#3} { var#4 } {#2} }
{ \__deriv_handle_double_sp:n {#2} }
}
-% if delim, variable, variant, star
-\cs_new:Npn \__deriv_insert_var:Nnnn #1 #2 #3 #4
+% if delim, variable, variant
+\cs_new:Npn \__deriv_insert_var:Nnn #1 #2 #3
{
\bool_if:NTF #1
- { \__deriv_add_delims:nnn {#3} { var#4 } {#2} }
+ { \__deriv_add_delims:nnn {#3} { var } {#2} }
{ \__deriv_handle_double_sp:n {#2} }
}
% order, variant, name
@@ -977,6 +1073,25 @@
{#4}
}
}
+% dv, sub, sup, code-for-fraction
+\cs_new:Npn \__deriv_evaluation_compact:nnnn #1 #2 #3 #4
+{
+ \__deriv_if_value:nTF {#2}
+ {
+ \__deriv_add_delims:nnn {#1} { eval_compact } {#4}
+ \sb{ \__deriv_insert_mskip:nn {#1} { eval_sb } #2 }
+ \__deriv_if_value:nT {#3}
+ { \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 } }
+ }
+ {
+ \__deriv_if_value:nTF {#3}
+ {
+ \__deriv_add_delims:nnn {#1} { eval_compact } {#4}
+ \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 }
+ }
+ {#4}
+ }
+}
% dv, name, value
\cs_new:Npn \__deriv_add_delims:nnn #1 #2 #3
{ \tl_use:c { l__deriv_#1_scale_#2_tl } {#1} {#2} {#3} }
@@ -1012,10 +1127,10 @@
\cs_new:Npn \__deriv_mixed_order:NNn #1 #2 #3
{
\__deriv_replace:NN \l__deriv_input_seq #2
- \__deriv_seq_counting:NNN \l__deriv_symbol_seq \l__deriv_number_seq \l__deriv_input_seq
+ \__deriv_seq_counting:NNNn \l__deriv_symbol_seq \l__deriv_number_seq \l__deriv_input_seq {#3}
\__deriv_sort:NNNn \l__deriv_permutation_seq \l__deriv_symbol_seq \l__deriv_number_seq {#3}
\__deriv_combine_seq:NNNNn \l__deriv_sorted_seq \l__deriv_permutation_seq \l__deriv_symbol_seq \l__deriv_number_seq {#3}
- \__deriv_output:NNNn #1 \l__deriv_sorted_seq \l__deriv_numerical_int {#3}
+ \__deriv_output:NNNn #1 \l__deriv_sorted_seq \l__deriv_numerical_tl {#3}
}
% input-seq, order-seq
\cs_new_protected:Npn \__deriv_replace:NN #1 #2
@@ -1029,20 +1144,39 @@
\seq_set_split:NnV #1 { , } \l__deriv_input_tl
\seq_remove_all:Nn #1 {}
}
+
% symbol-seq, number-seq, input-seq
-\cs_new_protected:Npn \__deriv_seq_counting:NNN #1 #2 #3
+\cs_new_protected:Npn \__deriv_seq_counting:NNNn #1 #2 #3 #4
+{ \__deriv_seq_counting:NNNNNNNn #1 #2 #3 \l__deriv_sym_tmpa_seq \l__deriv_sym_tmpb_seq \l__deriv_num_tmpa_seq \l__deriv_num_tmpb_seq {#4} }
+
+\cs_new_protected:Npn \__deriv_seq_counting:NNNNNNNn #1 #2 #3 #4 #5 #6 #7 #8
{
\seq_clear:N #1
\seq_clear:N #2
+ \seq_clear:N #4
+ \seq_clear:N #5
+ \seq_clear:N #6
+ \seq_clear:N #7
+ \tl_clear:N \l__deriv_numerical_tl
\seq_map_inline:Nn #3
{
- \__deriv_extract:NNn \l__deriv_sym_tmpa_tl \l__deriv_num_tmpa_tl {##1}
+ \str_if_in:nnTF {##1} /
+ { \__deriv_extract_frac:NNNNw \l__deriv_sym_tmpa_tl \l__deriv_sym_tmpb_tl \l__deriv_num_tmpa_tl \l__deriv_num_tmpb_tl ##1 \q_stop }
+ {
+ \__deriv_extract:NNn \l__deriv_sym_tmpa_tl \l__deriv_num_tmpa_tl {##1}
+ \tl_clear:N \l__deriv_sym_tmpb_tl
+ \tl_set:Nn \l__deriv_num_tmpb_tl { 1 }
+ }
- \seq_if_in:NVTF \l__deriv_symbol_seq \l__deriv_sym_tmpa_tl
- { \__deriv_update_seq:NNNN #1 #2 \l__deriv_sym_tmpa_tl \l__deriv_num_tmpa_tl }
- { \__deriv_add_to_seq:NNNN #1 #2 \l__deriv_sym_tmpa_tl \l__deriv_num_tmpa_tl }
+ \__deriv_if_in_two_seq:NNNNTF #4 #5 \l__deriv_sym_tmpa_tl \l__deriv_sym_tmpb_tl
+ { \__deriv_update_seq:NNNNV #6 #7 \l__deriv_num_tmpa_tl \l__deriv_num_tmpb_tl \l__deriv_seq_pos_int }
+ {
+ \__deriv_add_to_seq:NNVV #4 #6 \l__deriv_sym_tmpa_tl \l__deriv_num_tmpa_tl
+ \__deriv_add_to_seq:NNVV #5 #7 \l__deriv_sym_tmpb_tl \l__deriv_num_tmpb_tl
+ }
}
+ \__deriv_combine_frac:NNNNNNn #1 #2 #4 #5 #6 #7 {#8}
}
% sym-tl, num-tl, seq-item
\cs_new_protected:Npn \__deriv_extract:NNn #1 #2 #3
@@ -1065,31 +1199,150 @@
{ - } { \tl_set:Nn #2 { -1 } }
}
}
+
+\cs_new_protected:Npn \__deriv_extract_frac:NNNNw #1 #2 #3 #4 #5 / #6 \q_stop
+{
+ %TODO: Strip parentheses from denominator (second line) to allow input like '1/(2m)' and would be similar to writing '1/2m'.
+ % However, terms like '1/(m+n)' and '1/(2m+n)' are different and the latter must not be interpreted as '1/(2m+2n)'
+ % Currently '1/2m' is being interpreted as '1/(2m)' but technically 'm/2' is the correct way. And should ideally be changed - but not a must right now.
+ %TODO: Make code to handle the case '(m+n)/xxx' as input correctly with a loop i.e. as 'm/xxx + m/xxx'. Likely has to be done in \deriv_input:nn
+ \__deriv_extract:NNn #1 #3 {#5}
+
+ %TODO: Temporary solution to: Strip pearentheses from denominator
+ \str_if_in:nnTF {#6} (
+ {
+ \str_if_in:nnTF {#6} )
+ { \__deriv_extract_parenthesis:NNw #2 #4 #6 \q_stop }
+ { \__deriv_extract:NNn #2 #4 {#6} }
+ }
+ { \__deriv_extract:NNn #2 #4 {#6} }
+
+ \tl_if_eq:NNT #1 #2
+ {
+ \tl_clear:N #1
+ \tl_clear:N #2
+ }
+}
+
+\cs_new_protected:Npn \__deriv_extract_parenthesis:NNw #1 #2 ( #3 ) \q_stop
+{ \__deriv_extract:NNn #1 #2 {#3} }
+
+\cs_new:Npn \__deriv_combine_frac:NNNNNNn #1 #2 #3 #4 #5 #6 #7
+{
+ \int_step_inline:nn { \seq_count:N #3 }
+ {
+ \tl_set:Nx \l__deriv_tmpa_tl { \seq_item:Nn #3 {##1} }
+ \tl_set:Nx \l__deriv_tmpb_tl { \seq_item:Nn #4 {##1} }
+ \int_set:Nn \l__deriv_tmpa_int { \seq_item:Nn #5 {##1} }
+ \int_set:Nn \l__deriv_tmpb_int { \seq_item:Nn #6 {##1} }
+
+ \int_compare:nNnF \l__deriv_tmpa_int = 0
+ {
+ \__deriv_adjust_frac_integers:NN \l__deriv_tmpa_int \l__deriv_tmpb_int
+
+ \__deriv_add_frac_to_seq:NNVVVVn #1 #2 \l__deriv_tmpa_tl \l__deriv_tmpb_tl \l__deriv_tmpa_int \l__deriv_tmpb_int {#7}
+ }
+ }
+}
+
+\cs_new:Npn \__deriv_adjust_frac_integers:NN #1 #2
+{
+ \int_compare:nNnTF #1 = #2
+ {
+ \int_set:Nn #1 { 1 }
+ \int_set:Nn #2 { 1 }
+ }
+ {
+ \int_compare:nNnT \l__deriv_tmpb_int < 0
+ {
+ \int_set:Nn #1 { -1*#1 }
+ \int_set:Nn #2 { -1*#2 }
+ }
+ \deriv_gcd:NN #1 #2
+ }
+}
+% sym-tl, num-tl
+\cs_new_protected:Npn \__deriv_add_frac_to_seq:NNnnnnn #1 #2 #3 #4 #5 #6 #7
+{
+ \tl_if_empty:nTF {#3}
+ {
+ \tl_if_empty:nTF {#4}
+ {
+ \str_if_eq:vnTF { l__deriv_#7_sort_numerical_tl } { symbolic }
+ {
+ \int_compare:nNnTF {#6} = 1
+ { \__deriv_add_to_seq:NNnn #1 #2 { } {#5} }
+ { \__deriv_add_to_seq:NNnn #1 #2 { /#6 } {#5} }
+ }
+ {
+ \int_compare:nNnTF {#6} = 1
+ { \tl_set:Nn \l__deriv_numerical_tl {#5} }
+ { \tl_set:Nn \l__deriv_numerical_tl { #5/#6 } }
+ }
+ }
+ {
+ \int_compare:nNnTF {#6} = 1
+ { \__deriv_add_to_seq:NNnn #1 #2 { /#4 } {#5} }
+ { \__deriv_add_to_seq:NNnn #1 #2 { /(#6#4) } {#5} }
+ }
+ }
+ {
+ \tl_if_empty:nTF {#4}
+ {
+ \int_compare:nNnTF {#6} = 1
+ { \__deriv_add_to_seq:NNnn #1 #2 {#3} {#5} }
+ { \__deriv_add_to_seq:NNnn #1 #2 { #3/#6 } {#5} }
+ }
+ {
+ \int_compare:nNnTF {#6} = 1
+ { \__deriv_add_to_seq:NNnn #1 #2 { #3/#4 } {#5} }
+ { \__deriv_add_to_seq:NNnn #1 #2 { #3/(#6#4) } {#5} }
+ }
+ }
+}
+
% sym-tl, num-tl
-\cs_new_protected:Npn \__deriv_add_to_seq:NNNN #1 #2 #3 #4
+\cs_new_protected:Npn \__deriv_add_to_seq:NNnn #1 #2 #3 #4
{
- \seq_put_right:NV #1 #3
- \seq_put_right:NV #2 #4
+ \seq_put_right:Nn #1 {#3}
+ \seq_put_right:Nn #2 {#4}
}
% sym-tl, num-tl
-\cs_new_protected:Npn \__deriv_update_seq:NNNN #1 #2 #3 #4
+\cs_new_protected:Npn \__deriv_update_seq:NNnn #1 #2 #3 #4
{
\seq_map_indexed_inline:Nn #1
{
- \tl_if_eq:NnT #3 {##2}
+ \tl_if_eq:nnT {#3} {##2}
{
\exp_args:NNnx
- \seq_set_item:Nnn #2 {##1}
- { \int_eval:n { \seq_item:Nn #2 {##1} + #4 } }
+ \seq_set_item:Nnn #2 {##1} { \int_eval:n { \seq_item:Nn #2 {##1} + #4 } }
\seq_map_break:
}
}
}
+
+\cs_new_protected:Npn \__deriv_find_in_seq:NNn #1 #2 #3
+{
+ \int_zero:N #2
+ \seq_map_indexed_inline:Nn #1
+ { \tl_if_eq:nnT {#3} {##2} { \seq_map_break:n { \int_set:Nn #2 {##1} } } }
+}
+
+\cs_set_eq:NN \__deriv_update_seq:Nnn \seq_set_item:Nnn
+\cs_generate_variant:Nn \__deriv_update_seq:Nnn { NVV }
+
+\cs_new_protected:Npn \__deriv_update_seq:NNNNn #1 #2 #3 #4 #5
+{ \__deriv_addfrac:NNVVxxn #1 #2 #3 #4 { \seq_item:Nn #1 {#5} } { \seq_item:Nn #2 {#5} } {#5} }
+
+\cs_new:Npn \__deriv_addfrac:NNnnnnn #1 #2 #3 #4 #5 #6 #7
+{
+ \exp_args:NNnx \seq_set_item:Nnn #1 {#7} { \int_eval:n { #3*#6 + #4*#5 } }
+ \exp_args:NNnx \seq_set_item:Nnn #2 {#7} { \int_eval:n { #4*#6 } }
+}
% sorted-seq, permutation-seq, symbol-seq, number-seq, variant
\cs_new:Npn \__deriv_combine_seq:NNNNn #1 #2 #3 #4 #5
{
\seq_clear:N #1
- \int_zero:N \l__deriv_numerical_int
\seq_map_inline:Nn #2
{
\tl_set:Nx \l__deriv_sym_tmpa_tl { \seq_item:Nn #3 {##1} }
@@ -1101,28 +1354,25 @@
\cs_new_protected:Npn \__deriv_eval_term:Nnnn #1 #2 #3 #4
{
\tl_if_empty:nTF {#2}
- { \__deriv_numerical_term:Nnn #1 {#3} {#4} }
+ { \seq_put_right:Nn #1 {#3} }
{
- \int_compare:nNnTF {#3} = { 1 }
- { \seq_put_right:Nn #1 {#2} }
+ \tl_if_head_eq_charcode:nNTF {#2} /
+ { \seq_put_right:Nn #1 {#3#2} }
{
- \int_compare:nNnTF {#3} = { 0 }
- { \prg_do_nothing: }
+ \int_compare:nNnTF {#3} = { 1 }
+ { \seq_put_right:Nn #1 {#2} }
{
- \int_compare:nNnTF {#3} = { -1 }
- { \seq_put_right:Nn #1 { -#2 } }
- { \seq_put_right:Nn #1 {#3#2} }
+ \int_compare:nNnTF {#3} = { 0 }
+ { \prg_do_nothing: }
+ {
+ \int_compare:nNnTF {#3} = { -1 }
+ { \seq_put_right:Nn #1 { -#2 } }
+ { \seq_put_right:Nn #1 {#3#2} }
+ }
}
}
}
}
-% sorted-seq, num-tl, variant
-\cs_new_protected:Npn \__deriv_numerical_term:Nnn #1 #2 #3
-{
- \str_if_eq:vnTF { l__deriv_#3_sort_numerical_tl } { symbolic }
- { \seq_put_right:Nn #1 {#2} }
- { \int_set:Nn \l__deriv_numerical_int {#2} }
-}
% permutation-seq, symbol-seq, number-seq, variant
\cs_new_protected:Npn \__deriv_sort:NNNn #1 #2 #3 #4
{
@@ -1183,7 +1433,7 @@
% dv
\cs_new_protected:Npn \__deriv_sort_lexical:n #1
{ \__deriv_sort_lexical_auxi:VVn \l__deriv_sym_tmpa_tl \l__deriv_sym_tmpb_tl {#1} }
-% dv
+% symbol-str-1, symbol-str-2, dv
\cs_new_protected:Npn \__deriv_sort_lexical_auxi:nnn #1 #2 #3
{
\str_compare:nNnTF {#1} < {#2}
@@ -1229,20 +1479,20 @@
{
\tl_set:Nf #1 { \seq_use:Nn #2 { + } }
- \int_compare:nNnF {#3} = { 0 }
+ \tl_if_empty:NF #3
{
\tl_if_empty:NTF #1
{ \tl_put_left:NV #1 #3 }
{
\exp_args:Nv \str_case:nnF { l__deriv_#4_sort_numerical_tl }
{
- { last } { \tl_put_right:Nx #1 { + \int_use:N #3 } }
- { first } { \tl_put_left:Nx #1 { \int_use:N #3 + } }
+ { last } { \tl_put_right:Nx #1 { + #3 } }
+ { first } { \tl_put_left:Nx #1 { #3 + } }
}
{
\tl_if_head_eq_charcode:VNTF #1 -
{ \tl_put_left:NV #1 #3 }
- { \tl_put_right:Nx #1 { + \int_use:N #3 } }
+ { \tl_put_right:Nx #1 { + #3 } }
}
}
}
@@ -1250,6 +1500,78 @@
\tl_if_empty:NT #1 { \tl_set:Nn #1 { 0 } }
}
+%%%%% GCD (Greatest Common Divisor) %%%%%
+
+\cs_new:Npn \deriv_binary_shift_left:Nn #1 #2
+{
+ \tl_set:Nx #1
+ {
+ \tl_range:Nnn #1 { #2+1 } { -1 }
+ \prg_replicate:nn {#2} { 0 }
+ }
+}
+\cs_new:Npn \deriv_binary_shift_right:N #1
+{ \tl_set:Nx #1 { 0 \tl_range:Nnn #1 { 1 } { -2 } } }
+
+\prg_new_conditional:Npnn \deriv_binary_if_even:N #1 { p }
+{
+ \str_if_eq:eeTF { \tl_item:Nn #1 { -1 } } { 0 }
+ { \prg_return_true: }
+ { \prg_return_false: }
+}
+
+\cs_new:Npn \deriv_gcd:NN #1 #2
+{
+ % Not needed in my use case but technically correct to include
+ %\int_compare:nNnTF #1 = 0
+ %{ \int_set:Nn #2 { \int_sign:n {#2} } }
+ %{
+ \int_compare:nNnTF #2 = 0
+ { \int_set:Nn #1 { \int_sign:n {#1} } }
+ {
+ \tl_set:Nx \l__deriv_gcd_result_tl { \int_to_bin:n { \int_abs:n #1 } }
+ \tl_set:Nx \l__deriv_gcd_remain_tl { \int_to_bin:n { \int_abs:n #2 } }
+
+ \__deriv_gcd:NN \l__deriv_gcd_result_tl \l__deriv_gcd_remain_tl
+
+ \int_set:Nn #1 { #1 / \l__deriv_gcd_result_tl }
+ \int_set:Nn #2 { #2 / \l__deriv_gcd_result_tl }
+ }
+ %}
+}
+
+\cs_new:Npn \__deriv_gcd:NN #1 #2
+{
+ \int_zero:N \l__deriv_gcd_counter_int
+ \bool_while_do:nn { \deriv_binary_if_even_p:N #1 && \deriv_binary_if_even_p:N #2 }
+ {
+ \deriv_binary_shift_right:N #1
+ \deriv_binary_shift_right:N #2
+ \int_incr:N \l__deriv_gcd_counter_int
+ }
+
+ \bool_while_do:nn { \deriv_binary_if_even_p:N #1 }
+ { \deriv_binary_shift_right:N #1 }
+
+ \bool_until_do:nn { \int_compare_p:nNn #2 = 0 }
+ {
+ \bool_while_do:nn { \deriv_binary_if_even_p:N #2 }
+ { \deriv_binary_shift_right:N #2 }
+
+ \__deriv_gcd_swap_helper:NNff #1 #2 { \int_from_bin:V #1 } { \int_from_bin:V #2 }
+ }
+ \deriv_binary_shift_left:NV #1 \l__deriv_gcd_counter_int
+ \tl_set:Nx #1 { \int_from_bin:V #1 }
+}
+\cs_new:Npn \__deriv_gcd_swap_helper:NNnn #1 #2 #3 #4
+{
+ \int_compare:nNnTF {#3} > {#4}
+ {
+ \tl_set_eq:NN #1 #2
+ \tl_set:Nx #2 { \int_to_bin:n { #3 - #4 } }
+ }
+ { \tl_set:Nx #2 { \int_to_bin:n { #4 - #3 } } }
+}
%%%%% Declaring Variant %%%%%
\DeclareDocumentCommand{\NewDerivative}{ m m o }
@@ -1400,6 +1722,18 @@
\cs_generate_variant:Nn \__deriv_preamble_aux:nnn { V }
\cs_generate_variant:Nn \__deriv_var_bool_seq:NNN { c }
+\cs_generate_variant:Nn \deriv_binary_shift_left:Nn { NV }
+\cs_generate_variant:Nn \__deriv_gcd_swap_helper:NNnn { NNff }
+
+\cs_generate_variant:Nn \__deriv_add_frac_to_seq:NNnnnnn { NNVVVV }
+\cs_generate_variant:Nn \__deriv_add_to_seq:NNnn { NNVV, NNnV }
+\cs_generate_variant:Nn \__deriv_update_seq:NNnn { NNVV, NNnV }
+\cs_generate_variant:Nn \__deriv_update_seq:NNNNn { NNNNV }
+\cs_generate_variant:Nn \__deriv_addfrac:NNnnnnn { NNVVxx }
+
+\cs_generate_variant:Nn \int_to_bin:n { V }
+\cs_generate_variant:Nn \int_from_bin:n { V }
+
%%%%% Messages %%%%%
\msg_new:nnnn { deriv } { command-already-defined }
@@ -1422,13 +1756,17 @@
{ The~key~'#1'~only~accepts~the~values~'true'~and~'false'. }
\msg_new:nnnn { deriv } { derivative-option-not-defined }
-{ Derivative option~'#1'~not~yet~defined! }
+{ Derivative~option~'#1'~not~yet~defined! }
{ You~have~used~#2~with~a~derivative~option~that~was~never~defined. }
\msg_new:nnnn { deriv } { differential-option-not-defined }
-{ Differential option~'#1'~not~yet~defined! }
+{ Differential~option~'#1'~not~yet~defined! }
{ You~have~used~#2~with~a~differential~option~that~was~never~defined. }
+\msg_new:nnnn { deriv } { differential-options-incompatible }
+{ Differential~options~#1~are~not~compatible! }
+{ You~have~used~#2~options~that~are~incompatible. }
+
%%%%% Declaring derivatives %%%%%
\@ifpackageloaded{mleftright}
@@ -1441,23 +1779,23 @@
\DeclareDerivative{\odv}{\mathnormal{d}}
\DeclareDerivative{\mdv}{\mathnormal{D}}
\DeclareDifferential{\odif}{\mathnormal{d}}
- \DeclareDifferential{\mdif}{\mathnormal{D}}[style-notation=single, style-notation-*=mixed]
+ \DeclareDifferential{\mdif}{\mathnormal{D}}[style-var=mixed, style-var-*=multiple]
}
{
\DeclareDerivative{\odv}{\mathrm{d}}
\DeclareDerivative{\mdv}{\mathrm{D}}
\DeclareDifferential{\odif}{\mathrm{d}}
- \DeclareDifferential{\mdif}{\mathrm{D}}[style-notation=single, style-notation-*=mixed]
+ \DeclareDifferential{\mdif}{\mathrm{D}}[style-var=mixed, style-var-*=multiple]
}
\DeclareDerivative{\fdv}{\delta}
\DeclareDerivative{\adv}{\Delta}
\DeclareDerivative{\jdv}{\partial}[fun=true, var=1]
-\DeclareDerivative{\pdv}{\partial}[style-var=multiple, sep-inf-ord=1, delims-eval=(), delims-eval-/=()]
+\DeclareDerivative{\pdv}{\partial}[style-var=multiple, style-var-/=multiple, style-var-!=mixed, style-var-/!=multiple, delims-eval=(), delims-eval-/=(), delims-eval-!=()]
\DeclareDifferential{\fdif}{\delta}
\DeclareDifferential{\adif}{\Delta}
-\DeclareDifferential{\pdif}{\partial}[style-notation=single, style-notation-*=mixed]
+\DeclareDifferential{\pdif}{\partial}[style-var=mixed, style-var-*=multiple]
\endinput
diff --git a/macros/latex/contrib/derivative/derivative.tex b/macros/latex/contrib/derivative/derivative.tex
index 837a7695d0..92ffdcb94f 100644
--- a/macros/latex/contrib/derivative/derivative.tex
+++ b/macros/latex/contrib/derivative/derivative.tex
@@ -1,5 +1,5 @@
% derivative.tex
-% Copyright 2019-2022 Simon Jensen
+% Copyright 2019-2023 Simon Jensen
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -12,25 +12,23 @@
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Simon Jensen.
+% Contributors: Romain Noel
\begin{filecontents*}{macro.mst}
-quote '+'
headings_flag 1
-heading_prefix "\\texttt\{\\color\{RoyalBlue\}"
-heading_suffix "\}\\nopagebreak\n"
+heading_prefix "\\begingroup \\ttfamily \\color\{RoyalBlue\}"
+heading_suffix "\\endgroup \\nopagebreak\n"
item_0 "\n \\item \\begingroup \\small \\ttfamily \\upshape "
delim_0 "\\endgroup, "
-group_skip "\n\n \\bigskip\n"
+group_skip "\n\n\\par\\bigskip\n"
\end{filecontents*}
\begin{filecontents*}{option.mst}
-quote '+'
-item_0 "\n \\bigskip \\item \\begingroup \\color\{RoyalBlue\} "
-item_x1 " \\endgroup \n \\subitem \\begingroup \\small \\ttfamily \\upshape "
+item_0 "\n \\item \\begingroup \\color\{RoyalBlue\} "
+item_x1 "\\endgroup \n \\subitem \\begingroup \\small \\ttfamily \\upshape "
item_1 "\n \\subitem \\begingroup \\small \\ttfamily \\upshape "
delim_1 "\\endgroup, "
-indent_space "\t"
-indent_length "2"
+group_skip "\n\n\\par\\bigskip\n"
\end{filecontents*}
\NeedsTeXFormat{LaTeX2e}
@@ -70,12 +68,14 @@ indent_length "2"
\RequirePackage{booktabs}
\RequirePackage{tabularx}
+\RequirePackage{ragged2e}
\RequirePackage{siunitx}
\sisetup{locale = UK}
\RequirePackage{hologo}
\RequirePackage{enumitem}
\RequirePackage{listings}
\RequirePackage{imakeidx}
+\RequirePackage{calc}
\RequirePackage{mleftright}
\RequirePackage{xfrac}
@@ -83,8 +83,8 @@ indent_length "2"
\RequirePackage[unicode]{hyperref}
\RequirePackage[nameinlink]{cleveref}
-\ExplSyntaxOn
\makeatletter
+\ExplSyntaxOn
\tl_new:N \pakkenavn
\tl_new:N \titel
@@ -146,8 +146,8 @@ indent_length "2"
{
columns = fullflexible,
basicstyle = \ttfamily\upshape\small,
- alsoletter = {\\,-,*,/},
- keywords = [0]{style-inf, style-var, style-frac, style-frac-/, style-notation, style-notation-*, scale-eval, scale-eval-/, scale-fun, scale-var, scale-var-*, scale-frac, scale-frac-/, delims-eval, delims-eval-/, delims-fun, delims-var, delims-var-*, delims-frac, delims-frac-/, sep-inf-ord, sep-inf-fun, sep-ord-fun, sep-frac-fun, sep-inf-var, sep-var-ord, sep-var-inf, sep-ord-inf, sep-var-var, sep-eval-sb, sep-eval-sp, sep-begin, sep-inf-ord, sep-inf-var, sep-ord-var, sep-var-inf, sep-ord-ord, sep-end, switch-*, switch-/, switch-sort, sort-method, sort-numerical, sort-abs-reverse, sort-lexical-reverse, sort-number-reverse, sort-sign-reverse, sort-symbol-reverse, fun, frac, var, order, ord, mixed-order, mixord, scale-auto},
+ alsoletter = {\\,-,*,/,!},
+ keywords = [0]{style-inf, style-inf-num, style-inf-den, style-var, style-var-/, style-var-!, style-var-/!, style-frac, style-frac-/, style-notation, style-notation-*, scale-eval, scale-eval-/, scale-fun, scale-var, scale-var-!, scale-var-*, scale-frac, scale-frac-/, delims-eval, delims-eval-/, delims-fun, delims-var, delims-var-!, delims-var-*, delims-frac, delims-frac-/, sep-inf-ord, sep-inf-fun, sep-ord-fun, sep-frac-fun, sep-inf-var, sep-var-ord, sep-var-inf, sep-ord-inf, sep-ord-ord, sep-ord-var, sep-var-var, sep-eval-sb, sep-eval-sp, sep-begin, sep-end, switch-*, switch-/, switch-!, switch-sort, sort-method, sort-numerical, sort-abs-reverse, sort-lexical-reverse, sort-number-reverse, sort-sign-reverse, sort-symbol-reverse, fun, frac, var, order, ord, mixed-order, mixord, scale-auto},
keywordstyle = [0]\__mydoc_option_font:,
keywords = [1]{\\odv, \\pdv, \\mdv, \\fdv, \\adv, \\jdv, \\odif, \\pdif, \\mdif, \\fdif, \\adif, \\NewDerivative, \\RenewDerivative, \\ProvideDerivative, \\DeclareDerivative, \\NewDifferential, \\RenewDifferential, \\ProvideDifferential, \\DeclareDifferential, \\slashfrac, \\derivset},
keywordstyle = [1]\__mydoc_function_font:,
@@ -181,8 +181,17 @@ indent_length "2"
\setlist[consideration]{label=(\roman{considerationi}), ref=\thesubsection(\roman{considerationi})}
\crefname{considerationi}{consideration}{considerations}
-\renewcommand{\@idxitem}{\par \hangindent 0\p@ }
-\renewcommand{\subitem}{\@idxitem \hspace *{0\p@ }}
+\AtEndPreamble
+{
+ %\meaning\@idxitem\\
+ %\meaning\subitem\\
+ %\meaning\indexspace\\
+ %\meaning\hangindent
+ %\meaning\indexspace
+ \RenewDocumentCommand{\@idxitem}{}{\par \hangindent 0\p@ }
+ \RenewDocumentCommand{\subitem}{}{\@idxitem \hspace *{0\p@ }}
+ \RenewDocumentCommand{\indexspace}{}{\par \vskip 10\p@ \relax}
+}
\NewDocumentCommand{\marginnote}{ m }
{
@@ -318,18 +327,6 @@ indent_length "2"
beta .default:n = {false}
}
-\let\mydoc_item:\item
-
-\DeclareDocumentCommand{\item}{ }
-{
- \mydoc_item:
- \bool_if:NT \l__mydoc_ch_change_bool
- {
- \tl_use:N \l__mydoc_ch_change_tl
- \bool_set_false:N \l__mydoc_ch_change_bool
- }
-}
-
\DeclareDocumentEnvironment{change}{ o }
{
\IfNoValueTF{#1}
@@ -370,13 +367,26 @@ indent_length "2"
\cs_new_protected:Npn \mydoc_change_begin:
{
- \itemize
+ \let\mydoc_item:\item
+
+ \DeclareDocumentCommand{\item}{ o }
+ {
+ \tl_if_novalue:nTF {##1}
+ { \mydoc_item: }
+ { \mydoc_item: [##1] }
+ \bool_if:NT \l__mydoc_ch_change_bool
+ {
+ \tl_use:N \l__mydoc_ch_change_tl
+ \bool_set_false:N \l__mydoc_ch_change_bool
+ }
+ }
+ \itemize[itemsep=0pt]
}
\cs_new_protected:Npn \mydoc_change_end:
{
\enditemize
- \let\item\mydoc_item:
+ %\let\item\mydoc_item:
}
\NewDocumentEnvironment{changelog}{ }
@@ -395,6 +405,11 @@ indent_length "2"
{
}
+\ExplSyntaxOff
+
+
+\ExplSyntaxOn
+
\tl_new:N \l__mydoc_number_tl
\tl_new:N \l_mydoc_index_item_tl
\tl_new:N \l_mydoc_index_subitem_tl
@@ -890,15 +905,6 @@ indent_length "2"
\str_set:Nx \l__deriv_print_str \l__mydoc_print_tmp_tl
\__deriv_split_at_star:NN \l__deriv_print_seq \l__deriv_print_str
-
- \seq_indexed_map_inline:Nn \l__deriv_print_seq
- {
- \__mydoc_inlinecode:n {##2}
- \int_compare:nNnF {##1} = { \seq_count:N \l__deriv_print_seq }
- {
- \hspace{0.4pt}
- }
- }
}
\cs_new_protected:Npn \__mydoc_inlinecode:n #1
@@ -909,28 +915,37 @@ indent_length "2"
\cs_new_protected:Npn \__deriv_split_at_star:NN #1 #2
{
\seq_set_split:NnV \l_tmpa_seq {*} #2
-
+ \bool_set_false:N \l__mydoc_star_bool
+ \seq_clear:N \l__deriv_print_seq
\seq_indexed_map_inline:Nn \l_tmpa_seq
{
- \int_compare:nNnTF {##1} = { \seq_count:N \l_tmpa_seq }
+ \str_if_eq:eeTF { \tl_item:nn {##2} {-1} } { - }
{
- \tl_put_right:Nn \l_tmpb_tl {##2}
- \seq_put_right:NV #1 \l_tmpb_tl
+ \bool_set_true:N \l__mydoc_star_bool
+ \__mydoc_inlinecode:n {##2*}
}
{
- \tl_set:Nn \l_tmpa_tl {##2}
- \str_if_eq:eeTF { \tl_item:Nn \l_tmpa_tl {-1} } { - }
+ \int_compare:nNnTF {##1} = { 1 }
+ { \__mydoc_inlinecode:n {##2} }
{
- \tl_set:Nn \l_tmpb_tl {##2*}
- }
- {
- \seq_put_right:Nn #1 {##2}
- \tl_set:Nn \l_tmpb_tl {*}
+ \bool_if:NTF \l__mydoc_star_bool
+ {
+ \bool_set_false:N \l__mydoc_star_bool
+ \__mydoc_inlinecode:n {##2}
+ }
+ { \hspace{0.7pt}\__mydoc_inlinecode:n {*##2} }
}
}
}
}
+%\bool_if:NTF \l__mydoc_star_bool
+%{
+% \seq_put_right:Nn #1 {*##2}
+% \bool_set_false:N \l__mydoc_star_bool
+%}
+%{ \seq_put_right:Nn #1 {##2} }
+
\NewDocumentCommand{\inlinecode}{ m }
{
\group_begin:
@@ -1050,7 +1065,7 @@ indent_length "2"
{ #1 }
}
-\DeclareDocumentCommand{\key}{ o m }
+\DeclareDocumentCommand{\key}{ O{index=false} m }
{
\group_begin:
\tl_if_novalue:nF {#1} { \mydoc_set_keys:nn { key } {#1} }
@@ -1121,6 +1136,8 @@ indent_length "2"
\tl_set:Nf \l_mydoc_index_item_tl { \cs_to_str:N #1 }
\tl_set:Nx \l_mydoc_index_entry_tl { \cstostr{#1} }
+ \tl_set:Nf \l_mydoc_index_item_tl { \str_uppercase:f { \tl_head:N \l_mydoc_index_item_tl } }
+
\bool_if:cT { l__mydoc_#2_index_bool }
{
\bool_if:cTF { l__mydoc_#2_definition_bool }
@@ -1139,6 +1156,9 @@ indent_length "2"
\tl_set:Nx \l_mydoc_index_subitem_tl {#1}
\tl_set:Nx \l_mydoc_index_entry_tl {#1}
+ \tl_replace_all:Nnn \l_mydoc_index_subitem_tl { ! } { "! }
+ \tl_replace_all:Nnn \l_mydoc_index_entry_tl { ! } { "! }
+
\bool_if:cT { l__mydoc_#2_index_bool }
{
\bool_if:cTF { l__mydoc_#2_definition_bool }
@@ -1169,7 +1189,7 @@ indent_length "2"
\cs_new_protected:Npn \mydoc_index:nnnnn #1 #2 #3 #4 #5
{
- \index[#4]{#1!#2@\protect{#3}|#5}
+ \index[#4]{#1!#2@#3|#5}
}
\cs_generate_variant:Nn \mydoc_index:nnnnn { VVV }
\cs_generate_variant:Nn \mydoc_index:nnnn { VV }
@@ -1231,6 +1251,13 @@ indent_length "2"
\group_end:
}
+\DeclareDocumentCommand{\csverb}{ v }
+{
+ \group_begin:
+ \mydoc_csverb:n {#1}
+ \group_end:
+}
+
\cs_new:Npn \mydoc_marg:n #1
{
\__mydoc_marg_font:
@@ -1284,6 +1311,14 @@ indent_length "2"
\mydoc_arg_delim_format:n { \\#1 }
}
+\cs_new:Npn \mydoc_csverb:n #1
+{
+ \__mydoc_cs_font:
+ \group_begin:
+ \ttfamily #1
+ \group_end:
+}
+
\cs_new:Npn \mydoc_arg_delim_format:n #1
{
\group_begin:
@@ -1312,6 +1347,11 @@ indent_length "2"
{\scriptstyle\langle\texttt{#1}\rangle}
}
+\DeclareDocumentCommand{\here}{}
+{
+ {\scriptstyle\langle\texttt{here}\rangle}
+}
+
\cs_new_protected:Npn \mydoc_cs_to_str:N #1
{ \char` \\ \cs_to_str:N #1 }
@@ -1329,11 +1369,10 @@ indent_length "2"
\Titel{The \pakkenavn{} package}
\Forfatter{Simon Jensen}
\Email{sjelatex@gmail.com}
-\Dato{2022/07/09}
-\Version{1.2}
+\Dato{2023/07/26}
+\Version{1.3}
\RequirePackage{derivative}[\dato]
-% \derivset{all}[scale-auto = mleftmright]
\hypersetup
{
@@ -1352,12 +1391,10 @@ indent_length "2"
\setlength{\marginparwidth}{126pt} % 74.68849pt
\setlength{\marginparpush}{0pt} % 5.39996pt
-\makeindex[name = option, title = Index of Options, intoc=true]
-\makeindex[name = macro, title = Index of Commands, intoc=true]
+\makeindex[name=option, title=Index of Options, intoc=true]
+\makeindex[name=macro, title=Index of Commands, intoc=true]
-\indexsetup{level = \subsection*, noclearpage = true, toclevel = subsection}
-
-\def\indexspace{}
+\indexsetup{level=\subsection*, noclearpage=false, toclevel=subsection}
\directlua{
pdf.setmajorversion(2)
@@ -1373,1305 +1410,1643 @@ indent_length "2"
\clearpage
\section{Introduction}
- This package started as a personal package a few years ago that I used in various projects. Firstly, it was written in \tex{} and \latex, which gave rise to various errors as the complexity of the package grew larger and ended up as a spaghetti code. Therefore, the code was rewritten into the \latex3 language and may now be easily maintained. Originally this package was written because there did not exist any great package for derivatives. It was first much later that I discovered the \pkg{diffcoeff} package, which does a good job. However, at this time, I had already written much of the code with no documentation. So I decided to write one and make it into a package for the public.
-
- As a note on terminology, I use the wording \emph{infinitesimal} abbreviated as \texttt{inf} for the operator symbols $d, \partial, \delta$ etc. that used in derivatives like $\odv{y}{x}, \pdv{y}{x}, \fdv{y}{x}$ and in differentials like $\odif{x}, \pdif{x}, \fdif{x}$. In the description of macros and options, I often write \emph{cs-\meta{placeholder}} to denote a comma-separated list of \meta{placeholder}. For example, \oarg{cs-numbers} is used in the option section for math space keys to denote comma-separated list of numbers. It should also be noted that whenever an argument reads \meta{keyvalue list}, it means that it is a comma-separated list of keyvalue pairs.
-
- \bigskip
-
- \noindent The github respository can be found at \href{https://github.com/sjelatex/derivative}{www.github.com/sjelatex/derivative}.
-
-
-
- \clearpage
- \section{Derivative}
-
- \begin{function}*{\pdv}
- \begin{syntax}
- \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
- \end{syntax}
- The partial derivative \macro{1} is defined with a set of mandatory and optional arguments that either typeset specific parts or changing the style of the derivative. In this package, the partial derivative is defined with an italic partial differential $\partial$ as
-
- \begin{definition}
- \DeclareDerivative{\pdv}{\partial}[style-var=multiple, sep-inf-ord=1,
- delims-eval=(), delims-eval-/=()]
- \end{definition}
-
- \begin{argument}*{1}
- The first argument of \macro{1} is an optional star that determines where the function is typeset; either in the numerator of the fraction or next to the fraction. Using the option \keyval{switch-*}{false}, the function is typeset in the numerator when the star is absent, and next to the fraction when the star is present as shown below
-
- \begin{example}
- \pdv{f}{x,y} \\
- \pdv*{f}{x,y}
- \end{example}
-
- \noindent The effect of the star's presence can be switched around using \keyval{switch-*}{true} i.e. the equations in the above example are exchanged.
- \end{argument}
-
- \begin{argument}{2}[updated = v1.0]
- The second argument is optional and is written inside square brackets. This argument is used to set the options of the derivative using a \keyval[index=false]{key}{value} semantic. For example the order of differentiation can be set via the \key[cat=misc]{order} option
-
- \begin{example}
- \pdv[order={2,3}]{f}{x,y} \\
- \pdv[order={\beta,a,n+2a}]{f}{x,y,z} \\
- \pdv[order={2,n^2,n^2-1}]{f}{x,y,z} \\
- \pdv[order={2,n^2}]{f}{x,y,z}
- \end{example}
-
- \noindent The list of options that can be applied to derivatives can be found in \cref{ssec:options_dv}.
-
- %The order may be a number, a symbol and a combination hereof. Note that the total order of differentiation (i.e $\odif[order=n+2]{}$) is automatically calculated and sorted. This is particularly useful when dealing with mixed partial derivatives which is further described in \cref{ssec:DV_pdv,ssec:overall_order}
- \end{argument}
-
- \begin{argument}{3}
- This is the first mandatory argument that typeset the function that is to be differentiated
-
- \begin{example}
- \pdv{f(x,y,z)}{x,y,z} \\
- \pdv{e^x\sin(y)\ln(z)}{x,y,z}
- \end{example}
-
- \noindent The function is simply typeset in the numerator or next to the fraction.
- \end{argument}
-
- \begin{argument}{4}
- The fourth argument is an optional slash written \emph{between the function and the variable} arguments and determines which fraction style the derivative is typeset with, as described in \cref{ssec:options_dv}. Using the option \keyval{switch-/}{false} and the package's default fractions, the derivative is typeset with \cs{frac} when the slash is absent, and \cs{slashfrac}\footnote{which is a macro defined by the package, see \cref{ssec:slashfrac} for more information.\label{foot:sfrac}} when the slash is present, as shown below
-
- \begin{example}
- \pdv{f}{x,y} \\
- \pdv{f}/{x,y}
- \end{example}
-
- \noindent As for the star argument, the effect of the slash's presence can be switched around using \keyval{switch-/}{true} i.e. the equations in the above example are exchanged.
- \end{argument}
-
- \begin{argument}{5}
- This is the second and final mandatory argument, which purpose is to typeset the variable in which the function is differentiated with respect to. The variables are given in a comma-separated list e.g. \texttt{\{x, y, z\}}
-
- \begin{example}
- \pdv{f}{x} \\
- \pdv{f}{x,y}
- \end{example}
-
- %\noindent The variable is always typeset in the denominator.
- \end{argument}
-
- \begin{argument}{6}
- This is the last optional argument that specifies the point(s) of evaluation or variables held constant. It is an \emph{e-type} argument in the \pkg{xparse} language and is given by \verb|e{_^}|. This means that the subscript \verb|_| and superscript \verb|^| accepts an argument given in braces. Moreover, the order of \verb|_| and \verb|^| is independent as shown below
-
- \begin{example}
- \pdv{f}{x,y}_{(x_1,y_1)} \\
- \pdv{f}{x,y}^{(x_2,y_2)} \\
- \pdv{f}{x,y}_{(x_1,y_1)}^{(x_2,y_2)} \\
- \pdv{f}{x,y}^{(x_2,y_2)}_{(x_1,y_1)}
- \end{example}
-
- \noindent The subscript argument is commonly used as the point of evaluation or variables held constant. If needed, the superscript argument may be used for the second point of evaluation.
- \end{argument}
-
- \end{function}
-
- \subsection{Other derivatives}
- This package offers five other derivatives: Ordinary derivative \macro{\odv}, material derivative \macro{\mdv}, functional derivative \macro{\fdv}, the average rate of change \macro{\adv} and the Jacobian \macro{\jdv}. A unique feature of this package, is that you can define your own derivatives as described in \cref{ssec:defvar_dv}.
-
- \begin{function}{\odv}[updated=v1.1]
- \begin{syntax}
- \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
- \end{syntax}
- In this package, the ordinary derivative is defined with an upright lowercase d if the package option \keyval{upright}{true} is used else it will use an italic lowercase d
- \begin{definition}
- \DeclareDerivative{\odv}{\mathrm{d}}%\marginnote{\keyval{upright}{true}}%
- \DeclareDerivative{\odv}{\mathnormal{d}}%\marginnote{\keyval{italic}{true}}%
- \end{definition}
- because it is used by many nowadays books
- \begin{equation*}
- \odv{f}{x} = \lim_{h\to 0} \mleft( \frac{ f(x+h) - f(x) }{ h } \mright)
- \end{equation*}
- However it can always be changed with the \key{style-inf} key.
- \end{function}
-
- \begin{function}{\mdv}[updated=v1.1]
- \begin{syntax}
- \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
- \end{syntax}
- The material derivative is used in some branches of physics e.g. thermodynamic, fluid dynamic etc. It comes with an upright uppercase D when the package option \keyval{upright}{true} else it will use an italic uppercase D. In this package, the material derivative is defined as
-
- \begin{definition}
- \DeclareDerivative{\mdv}{\mathrm{D}}%\marginnote{\keyval{upright}{true}}%
- \DeclareDerivative{\mdv}{\mathnormal{D}}%\marginnote{\keyval{italic}{true}}%
- \end{definition}
-
- \noindent In physics, the material derivative is defined by
- \begin{equation*}
- \mdv{ \varphi(\symbf{r}, t) }{ t } \coloneq \pdv{ \varphi(\symbf{r}, t) }{ t } + \dot{\symbf{r}} \cdot \nabla \varphi(\symbf{r}, t)
- \end{equation*}
- \end{function}
-
- \begin{function}{\fdv}
- \begin{syntax}
- \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
- \end{syntax}
- The functional derivative is used in the calculus of variation and uses a lowercase delta. With the package's default settings, it will use an italic delta. In this package, the functional derivative is defined as
-
- \begin{definition}
- \DeclareDerivative{\fdv}{\delta}
- \end{definition}
-
- \noindent In physics, it is for example used in the Lagrange equation or in the derivation of the Hartree-Fock equation
- \begin{equation*}
- \fdv{I}{q_{\alpha}} = \pdv{L}{q_{\alpha}} - \odv*{ \pdv{L}{ \dot{q}_{\alpha} } } { t } = 0, \qquad \fdv{ \symcal{L} }{ \psi_{n}^* } = \hat{F} \ket{\psi_{n}} - \epsilon_{n} \ket{\psi_{n}} = 0
- ,
- \end{equation*}
- respectively.
- \end{function}
-
- \begin{function}{\adv}
- \begin{syntax}
- \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
- \end{syntax}
- The average rate of change is defined to use an upright uppercase delta with the packages default settings. In this package, the average rate of change is defined as
-
- \begin{definition}
- \DeclareDerivative{\adv}{\Delta}
- \end{definition}
-
- \noindent The average rate of change is used to determine the slope of a straight line
- \begin{equation*}
- \adv{ y }{ x } = \frac{y_2- y_1}{x_2 - x_1}
- \end{equation*}
- \end{function}
-
- \begin{function}{\jdv}[updated = v1.0]
- \begin{syntax}
- \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
- \end{syntax}
- The Jacobian is defined to use an italic partial differential with the package's default settings. Also a pair of parentheses is automatically inserted around the function and variable. In this package, the Jacobian is defined as
-
- \begin{definition}
- \DeclareDerivative{\jdv}{\partial}[fun=true, var=1]
- \end{definition}
-
- \noindent which gives
- \begin{equation*}
- \jdv{f,g,h}{x,y,z}
- \end{equation*}
- \end{function}
-
-
-
- \clearpage
- \section{Differentials}
-
- \begin{function}*{\odif}[new = v1.0, updated=v1.1]
- \begin{syntax}
- \sarg, \oarg{keyval list}, \marg{variables}
- \end{syntax}
- The differential \macro{1} is defined with a set of mandatory and optional arguments that either typeset specific parts or changing the style of the differential. It is defined with an upright lowercase d when \keyval{upright}{true} else it will be defined with an italic lowercase d
-
- \begin{definition}
- \DeclareDifferential{\odif}{\mathrm{d}}%\marginnote{\keyval{upright}{true}}%
- \DeclareDifferential{\odif}{\mathnormal{d}}%\marginnote{\keyval{italic}{true}}%
- \end{definition}
-
- \begin{argument}*{1}
- The first argument of \macro{1} is an optional star that determines the notation style of the differential. Using the option \keyval{switch-*}{false}, the variables and orders are typeset in a subscript and superscript respectively when the star is present. When the star is absent, then the macros associated infinitesimal is placed in front of each variable as shown below
-
- \begin{example}
- \odif{x,y,z} \\
- \odif*{x,y,z}
- \end{example}
-
- \noindent The effect of the star's presence can be switched around using \keyval{switch-*}{true} i.e. the equations in the above example are exchanged, as described in \cref{ssec:options_dv}.
- \end{argument}
-
- \begin{argument}{2}
- The second argument is optional and is written inside square brackets. This argument is used to set the options of the differential using a \keyval[index=false]{key}{value} semantic.
-
- \begin{example}
- \odif[order={n,3}]{x,y,z} \\
- \odif[sep-var-inf=0]{x,y,z} \\
- \odif*[sep-var-var=0]{x,y,z}
- \end{example}
-
- \noindent The list of options that can be applied to differential can be is found in \cref{ssec:options_inf}
- \end{argument}
-
- \begin{argument}{3}
- This is the mandatory argument, which purpose is to typeset the variables, as shown below
-
- \begin{example}
- \odif{x} \\
- \odif{s_1,s_2...,s_n}
- \end{example}
- \end{argument}
- \end{function}
-
- \subsection{Other differentials}
- This package offers four other differentials: partial differential \macro{\pdif}, uppercase D \macro{\mdif}, delta \macro{\fdif} and Delta \macro{\adif}. A unique feature of this package, is that you can define your own differential as described in \cref{ssec:defvar_inf}.
-
- \begin{function}{\pdif}
- \begin{syntax}
- \sarg, \oarg{keyval list}, \marg{variables}
- \end{syntax}
- The partial differential \macro{1} is typically used as a shorthand notation for the partial derivative. In this package it is defined as
-
- \begin{definition}
- \DeclareDifferential{\pdif}{\partial}[style-notation=single,
- style-notation-*=mixed]
- \end{definition}
-
- \noindent The non-star and star version gives
- \begin{align*}
- \pdif[order={i,j,k}]{x,y,z} &\coloneq \pdv[order={i,j,k}]{}{x,y,z} \\
- \pdif*[order={i,j,k}]{x,y,z} &\coloneq \pdv[order={i,j,k}]{}{x,y,z}
- \end{align*}
- respectively.
- \end{function}
-
- \begin{function}{\mdif}[updated=v1.1]
- \begin{syntax}
- \sarg, \oarg{keyval list}, \marg{variables}
- \end{syntax}
- Another commonly used shorthand notation for various derivatives is the differential with an uppercase D. In this package it is defined with a upright D when \keyval{upright}{true} else it is defined with an italic uppercase D
-
- \begin{definition}
- \DeclareDifferential{\mdif}{\mathrm{D}}[style-notation=single,
- style-notation-*=mixed]%\marginnote{\keyval{upright}{true}}%
- \DeclareDifferential{\mdif}{\mathnormal{D}}[style-notation=single,
- style-notation-*=mixed%\marginnote{\keyval{italic}{true}}%
- \end{definition}
-
- \noindent The non-star and star version gives
- \begin{align*}
- \mdif[order={i,j,k}]{x,y,z} \\
- \mdif*[order={i,j,k}]{x,y,z}
- \end{align*}
- respectively.
- \end{function}
-
- \begin{function}{\fdif}
- \begin{syntax}
- \sarg, \oarg{keyval list}, \marg{variables}
- \end{syntax}
- When working with functional derivatives another differential is frequently encountered. This differential uses a delta symbol and is defined as
-
- \begin{definition}
- \DeclareDifferential{\fdif}{\delta}
- \end{definition}
-
- \noindent For example an expression like
- \begin{align*}
- \fdif{J} = \int_{a}^{b} \pdv{L}{f} \fdif{f(x)} + \pdv{L}{f'} \odv*{ \fdif{f(x)} }{x} \odif{x}
- \end{align*}
- is frequently encountered.
- \end{function}
-
- \begin{function}{\adif}
- \begin{syntax}
- \sarg, \oarg{keyval list}, \marg{variables}
- \end{syntax}
- To wrap it up, a differential for differences is defined as
-
- \begin{definition}
- \DeclareDifferential{\adif}{\Delta}
- \end{definition}
-
- \noindent For example
- \begin{align*}
- \adif{E} = E_2 - E_1
- \end{align*}
- \end{function}
-
- \clearpage
- \section{Options}
-
- This package accepts its options using the well-known \emph{key=value} syntax. The keys are divided into categories, for which each key have its associated category as a prefix.
-
- \begin{function}{\derivset}[updated = v1.0]
- \begin{syntax}
- \marg{command}, \oarg{keyval list}
- \end{syntax}
- The \macro{1} is meant to set the default values for derivatives and differentials options in the preamble. It can be used in the document but this is what the new \oarg{keyval list} arguments are for in the derivative and differential commands.
-
- \begin{argument}{1}
- A mandatory argument that determines which command the \emph{key=value} pairs are assigned to, where the allowed \meta{commands} are the derivatives and differentials defined by the package and you, see \cref{ssec:defvar_dv,ssec:defvar_inf} for more information. The special value \texttt{all} is also allowed, which gives access to the options that applies to \textit{all} derivatives and differentials.
- \end{argument}
-
- \begin{argument}{2}
- This optional argument accepts its input as a comma-separated list of \emph{key=value} pairs. Leaving out \arg{2} sets the options to the package's default settings for the chosen \arg{1}. E.g. \macro{\derivset}[\narg{\macro{\odv}}] sets the options for the ordinary derivative to the packages default settings.
- \end{argument}
- \end{function}
-
- \subsection{Categories}
- This section seeks to give a detailed description of each category.
-
- \begin{itemize}
- \item The \key[index=false]{style-\meta{\dots}} keys sets either the font style or the fraction style of \meta{\dots}. The font styles \cs{mathnormal}/\cs{symnormal} and \cs{mathrm}/\cs{symup} are commonly used in literature. The fraction style can be either \cs{frac}, \cs{dfrac}, \cs{tfrac}, \cs{sfrac}\req{}, \cs{slashfrac}\footref{foot:sfrac} or any command with two mandatory arguments.
- \item The \key[index=false]{delims-\meta{\dots}} keys sets the delimiters used around the \meta{\dots}. The Rule of Two applies here: \enquote{Always two there are, no more, no less. A left and a right delimiter}. The allowed delimiters are those that can be scaled with \cs{left}, \cs{big} etc.
- \item The \key[index=false]{scale-\meta{\dots}} keys sets the size of the \meta{\dots}'s delimiters. The values \texttt{big}, \texttt{Big}, \texttt{bigg}, and \texttt{Bigg} are self-explanatory and internally a left and right version are used e.g. \cs{bigl} and \cs{bigr}. The value \texttt{none} inserts the delimiters (except periods) unscaled. While the value \texttt{auto} scales the delimiters automatically using \cs{left} and \cs{right}.
- \item The \key[index=false]{sep-\meta{\dots}-\meta{\dots}} keys inserts their value between \meta{\dots} and \meta{\dots}. If the value is a comma-separated list of up to three numbers (e.g. \texttt{\{x,y,z\}}) it will be converted into the syntax \texttt{\cs{muskip} x mu plus y mu minus z mu} and inserted. All other values are used as they were given.
- \item The \key[index=false]{switch-\meta{\dots}} keys serves to change an argument's behaviour by swapping the effect of an optional character's presence.
- \item The \key[index=false]{sort-\meta{\dots}} keys deals with the sorting algorithm behind the mixed order, where you can choose the sorting method that suits you best.
- \item The miscellaneous keys does not fit into any of the above categories and no longer have the prefix \key[index=false]{misc}
- \end{itemize}
-
- \begin{note}
- A value with superscripted \texttt{R} means it requires a package. Additionally, some keys have two versions; with and without \texttt{-/} at the end. These keys are related to the slash argument. If \keyval{switch-/}{false} then the keys with and without \texttt{-/} are used when the slash argument is present and absent, respectively. Setting \keyval{switch-/}{true} then these keys are used in the opposite cases of the slash argument's presence.
- \end{note}
-
- \subsection{Package options}
- The package options can be used with
- \begin{center}
- \ttfamily\small
- \cs{usepackage}\oarg{keyval list}\narg{derivative}
- \end{center}
-
- \begin{option}*{italic}[new = v1.1]
- \begin{values}[default = false]
- true, false
- \end{values}
- Sets the font-style of the infinitesimals $d$ and $D$ used in \cs{odv}, \cs{mdv}, \cs{odif} and \cs{mdif} to italic using \cs{mathnormal}. The options \key{italic} and \key{upright} are mutually exclusive.
- \end{option}
-
- \begin{option}{upright}[new = v1.1]
- \begin{values}[default = true]
- true, false
- \end{values}
- Sets the font-style of the infinitesimals $d$ and $D$ used in \cs{odv}, \cs{mdv}, \cs{odif} and \cs{mdif} to upright using \cs{mathrm}. The options \key{italic} and \key{upright} are mutually exclusive.
- \end{option}
-
- \subsection{Derivative options} \label{ssec:options_dv}
- The options in this subsection are available for derivatives defined by the package and you with the commands in \cref{ssec:defvar_dv}.
-
- \subsubsection*{Style}
-
- \begin{option}*{style-inf}[updated = v1.0]
- \begin{values}[default = d]
- \meta{math-font-style}\meta{infinitesimal}
- \end{values}
- Sets the derivative's infinitesimal including font style. This change was necessary to allow multiple font styles, e.g. \keyval{style-inf}{\cs{mathbf}\narg{\cs{mathrm}\narg{d}}}. The default infinitesimal is a plain `\default` with no associated font style.
- \end{option}
-
- \begin{option}{style-frac}
- \begin{values}[default = \cs{frac}]
- \meta{fraction}
- \end{values}
- The derivative uses the fraction set by this key whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default value is the usual fraction \cs{frac}.
- \end{option}
-
- \begin{option}{style-frac-/}
- \begin{values}[default = \cs{slashfrac}]
- \meta{fraction}
- \end{values}
- The derivative uses the fraction set by this key whenever \keyval{switch-/}{false} and the slash argument is present. The key's default value is a text-styled fraction \default\footref{foot:sfrac} i.e. on the form $\pdv[style-frac-/=\slashfrac, switch-/=false]{f}/{x,y}$.
- \end{option}
-
- \clearpage
-
- \begin{option}{style-var}[new = v1.0]
- \begin{values}[default = single]
- single, multiple
- \end{values}
- This option determines how the derivative treats its variables and some features. The variable argument is treated as a single variable when \val{single} is used. Moreover the mixed order is set equal to the first order given in \keyval[cat=misc]{order}{\meta{order}} which by default is \val{1}. The variable argument is treated as a comma separated list of variables with \val{multiple} similarly to a partial derivative. Moreover the mixed order is automatically calculated from the list of orders given in \keyval[cat=misc]{order}{\meta{order}}.
- \end{option}
-
- \subsubsection*{Scaling}
-
- \begin{option}*{scale-eval}
- \begin{values}[default = auto]
- auto, none, big, Big, bigg, Bigg
- \end{values}
- This key sets the size of the delimiters used for the point of evaluation. This scaling is used whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default value is set to scale the delimiters automatically.
- \end{option}
-
- \begin{option}{scale-eval-/}
- \begin{values}[default = auto]
- auto, none, big, Big, bigg, Bigg
- \end{values}
- This key sets the size of the delimiters used for the point of evaluation. This scaling is used whenever \keyval{switch-/}{false} and the slash argument is present. The key's default value is set to scale the delimiters automatically.
- \end{option}
-
- \begin{option}{scale-fun}
- \begin{values}[default = auto]
- auto, none, big, Big, bigg, Bigg
- \end{values}
- This key sets the size of the delimiters used around the function. The scaling is used whenever \keyval[cat=misc]{fun}{true} is used. The key's default value is set to scale the delimiters automatically.
- \end{option}
-
- \begin{option}{scale-var}
- \begin{values}[default = auto]
- auto, none, big, Big, bigg, Bigg
- \end{values}
- This key sets the size of the delimiters used around the variable. The scaling is used whenever \keyval[cat=misc]{var}{true} is used. The key's default value is set to scale the delimiters automatically.
- \end{option}
-
- \begin{option}{scale-frac}
- \begin{values}[default = auto]
- auto, none, big, Big, bigg, Bigg
- \end{values}
- This key sets the size of the delimiters used for around the fraction. This scaling is used whenever \keyval{switch-/}{false}, the slash argument is absent and \keyval[cat=misc]{frac}{true} is used. The key's default value is set to scale the delimiters automatically.
- \end{option}
-
- \begin{option}{scale-frac-/}
- \begin{values}[default = auto]
- auto, none, big, Big, bigg, Bigg
- \end{values}
- This key sets the size of the delimiters used for around the fraction. This scaling is used whenever \keyval{switch-/}{false}, the slash argument is present and \keyval[cat=misc]{frac}{true} is used. The key's default value is set to scale the delimiters automatically.
- \end{option}
-
- \subsubsection*{Delimiters}
-
- \begin{option}*{delims-eval}
- \begin{values}[default = .~\cs{rvert}]
- \meta{left delimiter}\meta{right delimiter}
- \end{values}
- This key sets the left and right delimiters used to indicate the point of evaluation. These delimiters are inserted whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default left and right delimiters are a left and a right parenthesis, respectively.
- \end{option}
-
- \clearpage
-
- \begin{option}{delims-eval-/}
- \begin{values}[default = .~\cs{rvert}]
- \meta{left delimiter}\meta{right delimiter}
- \end{values}
- This key sets the left and right delimiters used to indicate the point of evaluation. These delimiters are inserted whenever \keyval{switch-/}{false} and the slash argument is present. The key's default left and right delimiters are a left and a right parenthesis, respectively.
- \end{option}
-
- \begin{option}{delims-fun}
- \begin{values}[default = (~)]
- \meta{left delimiter}\meta{right delimiter}
- \end{values}
- This key sets the left and right delimiters used around the function and these are inserted whenever \keyval[cat=misc]{fun}{true} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
- \end{option}
-
- \begin{option}{delims-var}
- \begin{values}[default = (~)]
- \meta{left delimiter}\meta{right delimiter}
- \end{values}
- This key sets the left and right delimiters used around the variable and these are inserted whenever \keyval[cat=misc]{var}{true} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
- \end{option}
-
- \begin{option}{delims-frac}
- \begin{values}[default = (~)]
- \meta{left delimiter}\meta{right delimiter}
- \end{values}
- This key sets the left and right delimiters used around the fraction in the derivative e.g. $\pdv*[frac=true]{y}{x}$. These delimiters are inserted whenever \keyval{switch-/}{false}, the slash argument is absent and \keyval[cat=misc]{frac}{true} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
- \end{option}
-
- \begin{option}{delims-frac-/}
- \begin{values}[default = (~)]
- \meta{left delimiter}\meta{right delimiter}
- \end{values}
- This key sets the left and right delimiters used around the fraction in the derivative e.g. $\pdv*[frac=true]{y}/{x}$. These delimiters are inserted whenever \keyval{switch-/}{false}, the slash argument is present and \keyval[cat=misc]{frac}{true} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
- \end{option}
-
- \subsubsection*{Math spacing}
- The options in this subsection inserts extra horizontal math space. The below equation illustrates where the space is inserted for each option
- \begin{align*}
- \begin{gathered}
- \frac{ \partial }{ \partial x } \ms{frac-fun} f \\
- \frac{ \partial^{ \ms{inf-ord} 2 } f }{ \partial x^{ \ms{var-ord} 2 } }
- \end{gathered}
- &&
- \begin{gathered}
- \frac{ \partial \ms{inf-fun} f }{ \partial \ms{inf-var} x } \\
- \frac{ \partial^3 \ms{ord-fun} f }{ \partial x^2 \ms{ord-inf} \partial y }
- \end{gathered}
- &&
- \begin{gathered}
- \frac{ \partial^2 f }{ \partial x \ms{var-inf} \partial y } \\
- \mleft( \frac{ \partial f}{ \partial x } \mright)_{ \ms{eval-sb} x_1}^{ \ms{eval-sp} x_2}
- \end{gathered}
- \end{align*}
- where it have been split into six to give a better overview. Here $\ms{\dots}$ means the value given to the option \key[index=false]{sep-\meta{\dots}}. Some of the math spaces shown above are only used when \keyval{style-var}{multiple}. Additionally, when the option \keyval{style-var}{single} is used then the following math space is used in the denominator
- \begin{equation*}
- \frac{\partial(f, g)}{\partial(x \ms{var-var} y)}
- \end{equation*}
- where the Jacobian have been used as an example.
-
- \clearpage
-
- \begin{option}{sep-inf-ord}
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- Sets the math space that is inserted in the infinitesimal's power left to the mixed order in the numerator. It is only inserted when the mixed order is different from \num{1}. The key's default value is \default{} \texttt{mu}.
- \end{option}
-
- \begin{option}{sep-inf-fun}
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- This key sets the math space that is inserted between the infinitesimal and the function when the mixed order \emph{is equal} to \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The key's default value is \default{} \texttt{mu}.
- \end{option}
-
- \begin{option}{sep-ord-fun}
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- This key sets the math space that is inserted between the infinitesimal's order and the function when the mixed order \emph{is different} from \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The key's default value is \default{} \texttt{mu}.
- \end{option}
-
- \begin{option}{sep-frac-fun}[new = v1.0]
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- This key sets the math space that is inserted between the fractional part of the derivative and the function. The space is only inserted when a non-blank function is printed \emph{next to the derivative}. The key's default value is \default{} \texttt{mu}.
- \end{option}
-
- \begin{option}{sep-inf-var}
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- This key sets the math space that is inserted between the infinitesimal and the following variable. The space is only inserted when a non-blank variable is given. The key's default value is \default{} \texttt{mu}.
- \end{option}
-
- \begin{option}{sep-var-ord}
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- This key sets the math space that is inserted in a variable's power left to the order. The space is only inserted when the order is different from \num{1}. The key's default value is \default{} \texttt{mu}.
- \end{option}
-
- \begin{option}{sep-var-inf}
- \begin{values}[default = \cs{mathop}\{\}\cs{!}]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- They key sets the math space that is inserted between a variable and the following infinitesimal. The space is only inserted when the variable's order \emph{is equal} to \num{1}. It is only inserted when more than one non-blank variables are given. The key's default value is \val{\default}.
- \end{option}
-
- \begin{option}{sep-ord-inf}
- \begin{values}[default = \cs{mathop}\{\}\cs{!}]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- They key sets the math space that is inserted between a variable and the following infinitesimal. The space is only inserted when the variable's order \emph{is different} from \num{1}. It is only inserted when more than one non-blank variables are given. The key's default value is \val{\default}.
- \end{option}
-
- \begin{option}{sep-var-var}[new = v1.0]
- \begin{values}[default = {{,}}]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- They key sets the math space that is inserted between two variables. The space is only inserted when the \keyval{style-var}{single} is used. and when more than one non-blank variables are given. The key's default value is a comma.
- \end{option}
+This package originated as a personal package I developed several years ago for various projects. Initially written in \tex{} and \latex{}, it encountered numerous errors as its complexity grew, eventually becoming a convoluted code. Consequently, I rewrote the code using the \latex3 language, allowing for easier maintenance. Originally, I created this package due to the lack of robust derivative packages available. However, I later discovered the \pkg{diffcoeff} package, which served the purpose well. Unfortunately, by that time, I had already written a most of the code, undocumented. To address this, I decided to document the code and transform it into a publicly available package.
+
+\bigskip
+
+Regarding terminology, I use the abbreviation \texttt{inf} to represent the operator symbols $d, \partial, \delta$, etc., commonly used in derivatives (e.g., $\odv{y}{x}, \pdv{y}{x}, \fdv{y}{x}$) and differentials (e.g., $\odif{x}, \pdif{x}, \fdif{x}$). In the description of macros and options, I often use the notation \emph{cs-\meta{placeholder}} to indicate a comma-separated list of \meta{placeholder}. For instance, \oarg{cs-numbers} is used in the option section to denote a comma-separated list of numbers for math space keys. It is important to note that whenever an argument specifies \meta{keyvalue list}, it refers to a comma-separated list of key-value pairs.
+
+\bigskip
+
+\noindent The GitHub repository for this package can be accessed at:\\ \href{https://github.com/sjelatex/derivative}{www.github.com/sjelatex/derivative}.
+
+
\clearpage
-
- \begin{option}{sep-eval-sb}
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- This key sets the math space that is inserted in the evaluation subscript left to the point of evaluation. The space is only inserted when a non-blank subscript is given. The key's default value is \default{} \texttt{mu}.
- \end{option}
-
- \begin{option}{sep-eval-sp}
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- This key sets the math space that is inserted in the evaluation superscript left to the point of evaluation. The space is only inserted when a non-blank superscript is given. The key's default value is \default{} \texttt{mu}.
- \end{option}
-
- \subsubsection*{Switches}
-
- \begin{option}*{switch-*}
- \begin{values}[default = false]
- true, false
- \end{values}
- The effect of the star argument's presence can be switched with the value \val{true}. That is, the function is typeset next to the fraction when the star is absent and in the numerator when the star is present. As an example, compare below where the option is turned on (\val{true}) and off (\val{false})
-
+ \section{Derivative}\label{sec:derivative}
+
+\begin{function}*{\pdv}[updated=v1.3]
+ \begin{syntax}
+ \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \targ{!}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
+ \end{syntax}
+ The partial derivative is defined using the \macro{1} command, which has both mandatory and optional arguments. These arguments allow for the customization of specific parts and the style of the derivative.
+ \begin{definition}
+ \DeclareDerivative{\pdv}{\partial}[style-var=multiple, style-var-/=multiple,
+ style-var-!=mixed, style-var-/!=multiple, delims-eval=(), delims-eval-/=(),
+ delims-eval-!=()]
+ \end{definition}
+
+ \begin{argument}*{1}
+ The optional first argument of \macro{1} controls the placement of the function in relation to the fraction. By setting \keyval{switch-*}{false}, the function is typeset in the numerator when the star is absent, and next to the fraction when the star is present. Here is an example:
\begin{example}
- \pdv[switch-*=false]{y}{x} \\
- \pdv[switch-*=true]{y}{x}
+ \pdv{f}{x,y} \\
+ \pdv*{f}{x,y}
\end{example}
-
- \noindent respectively. The key's default value is \default.
- \end{option}
-
- \begin{option}{switch-/}
- \begin{values}[default = false]
- true, false
- \end{values}
- The effect of the slash argument's presence can be switched with the value \val{true}. That is, the derivative is typeset with the fraction set by \key{style-frac-/} when the slash is absent and with the fraction set by \key{style-frac} when the slash is present. As an example, compare below where the option is turned on (\val{true}) and off (\val{false})
-
+ The behavior of the star can be reversed by setting \keyval{switch-*}{true}. In other words, the equations in the previous example will be interchanged.
+ \end{argument}
+
+ \begin{argument}{2}[updated = v1.0]
+ The second argument of \macro{1}, enclosed in square brackets, is optional and used to specify options for the derivative using a \keyval[index=false]{key}{value} syntax. For instance, the order of differentiation can be set using the \key[cat=misc]{order} option. Here is an example:
\begin{example}
- \pdv[switch-/=false]{y}{x} \\
- \pdv[switch-/=true]{y}{x}
+ \pdv[order={2,3}]{f}{x,y,z} \\
+ \pdv[order={\beta,a,n+2a}]{f}{x,y,z} \\
+ \pdv[order={2,n^2,n^2-1}]{f}{x,y,z} \\
+ \pdv[order={3/2-n/3,n/2,1/3}]{f}{x,y,z}
\end{example}
-
- \noindent respectively. The key's default value is \default.
- \end{option}
-
- \begin{option}{switch-sort}[new = 1.2]
- \begin{values}[default = true]
- true, false
- \end{values}
- The sorting algorithm of the mixed order is turned on when given the value \val{true} i.e. the methods given in \keyval*{sort-method}{\dots} are applied. Likewise, the sorting algorithm is turned off when given the value \val{false} i.e. the terms in the mixed order are ordered by first appearance in \keyval*{order}{\dots}. As an example, compare below where the option is turned on (\val{true}) and off (\val{false})
-
+ For a comprehensive list of available options that can be applied to derivatives, please refer to \cref{ssec:options_dv}.
+ %The order may be a number, a symbol and a combination hereof. Note that the total order of differentiation (i.e $\odif[order=n+2]{}$) is automatically calculated and sorted. This is particularly useful when dealing with mixed partial derivatives which is further described in \cref{ssec:DV_pdv,ssec:overall_order}
+ \end{argument}
+
+ \begin{argument}{3}
+ The first mandatory argument of \macro{1} is used to typeset the function that will be differentiated. Here are some examples:
\begin{example}
- \pdv[switch-sort=false, order={a+b,2kn-d,2-2b}]{f}{x,y,z} \\
- \pdv[switch-sort=true, order={a+b,2kn-d,2-2b}]{f}{x,y,z}
+ \pdv{f(x,y,z)}{x,y,z} \\
+ \pdv{e^x\sin(y)\ln(z)}{x,y,z}
\end{example}
-
- \noindent respectively. The key's default value is \default.
- \end{option}
-
- \subsubsection*{Sort}
- The keys given in this subsection will be briefly described here and a in-depth description will be given in \cref{ssec:overall_order}.
+ The function is displayed either in the numerator or to the right of the derivative, depending on the presence or absence of the star argument.
+ \end{argument}
- \begin{option}{sort-method}[updated = v1.2]
- \begin{values}[default = {sign, symbol, abs}]
- abs, lexical, number, sign, symbol
- \end{values}
- This key sets the sorting method behind the mixed order using build-in algorithms. The symbolic terms in the mixed order are sorted by their sign, symbolic length, numerical value and absolute value by the \val{sign}, \val{symbol}, \val{number} and \val{abs} algorithms, respectively. The value \val{lexical} sorts the terms by lexicographical order i.e. alphabetically. The key takes its input as a comma-separated list of values, accepting up to three values e.g.
+ \begin{argument}{4}[updated = v1.3]
+ The fourth argument of \macro{1} is an optional slash that appears between the function and the variable arguments, indicating an alternative style. Its behaviour depends on the presence or absence of the exclamation mark argument.
+ When the exclamation mark is absent, the slash determines the fraction style in which the derivative is typeset. By default, when the slash is absent, the derivative is typeset with \cs{frac}, and when the slash is present, it is typeset with \cs{slashfrac}\footnote{Note that \cs{slashfrac} is a macro defined by the package, please refer to \cref{ssec:slashfrac} for more details.\label{foot:sfrac}}, as shown in the following example:
\begin{example}
- \pdv[sort-method=abs, order={c+kn,-b+2a}]{f}{x,y} \\
- \pdv[sort-method=lexical, order={c+kn,-b+2a}]{f}{x,y} \\
- \pdv[sort-method=number, order={c+kn,-b+2a}]{f}{x,y} \\
- \pdv[sort-method=symbol, order={c+kn,-b+2a}]{f}{x,y} \\
- \pdv[sort-method=sign, order={c+kn,-b+2a}]{f}{x,y} \\
- \pdv[sort-method={sign,symbol}, order={c+kn,-b+2a}]{f}{x,y} \\
- \pdv[sort-method={sign,symbol,abs}, order={c+kn,-b+2a}]{f}{x,y}
+ \pdv{f}{x,y} \\
+ \pdv{f}/{x,y}
\end{example}
+ However, when the exclamation mark argument is present, the slash argument switches between shorthand styles rather than fraction styles.
- \noindent are all valid inputs. Note how the terms are ordered differently with different methods. This key is further described in \cref{ssec:sort-method}. The key's default value uses the three algorithms \val{\default}.
- \end{option}
-
- \begin{option}{sort-numerical}[updated = v1.0]
- \begin{values}[default = auto]
- auto, first, last, symbolic
- \end{values}
- This key determines where the numerical term\footnote{The numerical term is the sum of all the orders that does not contain any symbols but solely consist of numbers.\label{foot:numerical-term}} is placed in the mixed order. The numerical term will \emph{always} be placed as the first with \val{first} and as the last term with \val{last} in the mixed order. While \val{auto} will automatically determine where to place the numerical term depending on the sign of the first symbolic term. This is shown below
+ Similar to the star argument, the effect of the slash's presence can be reversed by setting \keyval{switch-/}{true}. In other words, the equations in the previous example will be interchanged.
+ \end{argument}
+
+ \begin{argument}{5}[new = v1.3]
+ The fifth argument of \macro{1} is an optional exclamation mark that appears between the function and the variable arguments. It allows switching the derivative into shorthand style, as described in \cref{ssec:options_dv}.
+ When \keyval{switch-!}{false} is used, along with the \macro{1}'s default shorthand styles, the derivative is typeset as shown in the example below:
\begin{example}
- \pdv[sort-numerical=first, order={n,2}]{f}{x,y} \\
- \pdv[sort-numerical=last, order={-n,2}]{f}{x,y}
+ \pdv{f}!{x,y} \\
+ \pdv{f}/!{x,y}
\end{example}
-
- \noindent where the value \val{auto} would have placed the numerical term opposite in both equations. The value \val{symbolic} treats the numerical term as a symbolic term with symbolic length equal zero and is thus sorted alongside with all other terms
+ The effect of the exclamation mark's presence can be reversed by setting \keyval{switch-!}{true}. In other words, the equations in the previous example will be interchanged.
+ \begin{note}
+ The order of the slash and exclamation mark is important. For example, \cs{pdv}\narg{f}\targ{!}\targ{/}\narg{x,y} will give $\pdv{f}!/{x,y}$ and not the indented output $\pdv{f}/!{x,y}$.
+ \end{note}
+ \end{argument}
+
+ \begin{argument}{6}
+ This is the second and final mandatory argument is used to typeset the variable in which the function is differentiated with respect to. The variables should be provided as a comma-separated list
\begin{example}
- \pdv[sort-numerical=symbolic, order={2+n,-a}]{f}{x,y}
+ \pdv{f}{x} \\
+ \pdv{f}{x,y}
\end{example}
- The key is further described in \cref{ssec:sort-numerical}, and its default value is \default.
- \end{option}
-
- \begin{option}{sort-abs-reverse}
- \begin{values}[default = false]
- true, false
- \end{values}
- The sorting algorithm \val{abs} sorts the terms by their absolute value in a descending manner. If the value \val{true} is used, then the terms will be sorted in an ascending manner instead. See \cref{ssec:sort-reverse} for more information.
- \end{option}
-
- \begin{option}{sort-lexical-reverse}[new = v1.2]
- \begin{values}[default = false]
- true, false
- \end{values}
- The sorting algorithm \val{lexical} sorts the terms in lexicographical order according to their character code i.e. alphabetically. If the value \val{true} is used, then the terms will be sorted in reverse lexicographical order instead. See \cref{ssec:sort-reverse} for more information.
- \end{option}
-
- \begin{option}{sort-number-reverse}[new = v1.0]
- \begin{values}[default = false]
- true, false
- \end{values}
- The sorting algorithm \val{number} sorts the terms by their numerical value in a descending manner. If the value \val{true} is used, then the terms will be sorted in an ascending manner instead. See \cref{ssec:sort-reverse} for more information.
- \end{option}
-
- \begin{option}{sort-sign-reverse}
- \begin{values}[default = false]
- true, false
- \end{values}
- The sorting algorithm \val{sign} sorts the terms by their numerical sign where the positive terms are placed before the negative terms. The value \val{true} will reverse this ordering such that the negative terms are placed before the positive terms. See \cref{ssec:sort-reverse} for more information.
- \end{option}
-
- \begin{option}{sort-symbol-reverse}
- \begin{values}[default = false]
- true, false
- \end{values}
- The sorting algorithm \val{symbol} sorts the terms by their symbolic length in a descending manner. If the value \val{true} is used, then the terms will sorted in an ascending manner instead. See \cref{ssec:sort-reverse} for more information.
- \end{option}
-
- \subsubsection*{Miscellaneous}
-
- \begin{option}*{fun}[cat=misc, new = v1.0]
- \begin{values}[default = false]
- true, false
- \end{values}
- Adds or remove delimiters around the function.
+ \end{argument}
+
+ \clearpage
+ \begin{argument}{7}
+ The last optional argument specifies the point(s) of evaluation or variables held constant. It is an \emph{e-type} argument from the \pkg{xparse} package, denoted as \verb|e{_^}|. This means that the subscript \verb|_| and superscript \verb|^| accepts an argument given within braces. The order of the subscript and superscript is independent, as shown in the following examples:
\begin{example}
- \pdv[fun=false]{f}{x,y,z} \\
- \pdv[fun=true]{f}{x,y,z} \\
- \pdv[fun]{f}{x,y,z}
+ \pdv{f}{x,y}_{(x_1,y_1)} \\
+ \pdv{f}{x,y}^{(x_2,y_2)} \\
+ \pdv{f}{x,y}_{(x_1,y_1)}^{(x_2,y_2)} \\
+ \pdv{f}{x,y}^{(x_2,y_2)}_{(x_1,y_1)}
\end{example}
- Without setting the option to a value is equivalent to setting it to \val{true} as seen above.
- \end{option}
-
- \begin{option}{frac}[cat=misc, new = v1.0]
- \begin{values}[default = false]
- true, false
- \end{values}
- Adds or remove delimiters around the fractional part of the derivative.
+ The subscript argument is commonly used to indicate the point of evaluation or the variables held constant. If needed, the superscript argument can be used to denote a second point of evaluation.
+ \end{argument}
+\end{function}
+
+\subsection{Other derivatives}
+In addition to the partial derivative, the package also provides five other derivative commands:
+\begin{itemize}
+ \item Ordinary derivative: \macro{\odv} - Used to represent the rate of change of a single-variable function with respect to its independent variable.
+ \item Material derivative: \macro{\mdv} - Applied in fluid mechanics and continuum mechanics to describe the rate of change of a quantity attached to a moving fluid particle.
+ \item Functional derivative: \macro{\fdv} - Used in functional analysis, calculus of variations, and quantum mechanics to express the derivative of a functional.
+ \item Average rate of change: \macro{\adv} - Used to denote the average rate of change of a quantity over a given interval.
+ \item Jacobian: \macro{\jdv} - Significant in multivariable calculus and linear algebra for representing the derivative of a vector-valued function.
+\end{itemize}
+A unique feature of this package is that it allows you to define your own derivatives, as described in \cref{ssec:defvar_dv}. This means you can create custom derivative commands tailored to your specific needs.
+
+If you require more information on the usage and customization of these derivative commands, please refer to the documentation in \cref{ssec:defvar_dv}.
+
+\clearpage
+\begin{function}{\odv}[updated=v1.1]
+ \begin{syntax}
+ \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
+ \end{syntax}
+ In this package, the ordinary derivative is defined with an upright lowercase d if the package option \keyval[cat=misc]{upright}{true} is used. Otherwise, it is defined with an italic lowercase \textit{d}. This choice was made to align with the convention used in many modern books.
+ \begin{definition}
+ \DeclareDerivative{\odv}{\mathrm{d}}%\marginnote{\keyval[cat=misc]{upright}{true}}%
+ \DeclareDerivative{\odv}{\mathnormal{d}}%\marginnote{\keyval[cat=misc]{italic}{true}}%
+ \end{definition}
+
+ \noindent The ordinary derivative can then be typeset as:
+ \begin{equation*}
+ \odv{f}{x} = \lim_{h\to 0} \mleft( \frac{ f(x+h) - f(x) }{ h } \mright)
+ \end{equation*}
+ By adjusting the \key{style-inf} or \key{style-inf-num} and \key{style-inf-den} keys, the operator d can be customized to personal preference or specific formatting requirements.
+\end{function}
+
+\begin{function}{\mdv}[updated=v1.1]
+ \begin{syntax}
+ \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
+ \end{syntax}
+ The material derivative is defined with an upright uppercase D when the package option \keyval[cat=misc]{upright}{true}. Otherwise, it is defined with an italic uppercase D.
+ \begin{definition}
+ \DeclareDerivative{\mdv}{\mathrm{D}}%\marginnote{\keyval[cat=misc]{upright}{true}}%
+ \DeclareDerivative{\mdv}{\mathnormal{D}}%\marginnote{\keyval[cat=misc]{italic}{true}}%
+ \end{definition}
+
+ \noindent In physics, the material derivative is defined by
+ \begin{equation*}
+ \mdv{ \varphi(\symbf{r}, t) }{ t } \coloneq \pdv{ \varphi(\symbf{r}, t) }{ t } + \dot{\symbf{r}} \cdot \nabla \varphi(\symbf{r}, t)
+ \end{equation*}
+ By adjusting the \key{style-inf} or \key{style-inf-num} and \key{style-inf-den} keys, the operator D can be customized to personal preference or specific formatting requirements.
+\end{function}
+
+\begin{function}{\fdv}
+ \begin{syntax}
+ \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
+ \end{syntax}
+ In this package, the functional derivative is defined with a lowercase delta. By default, it is represented in italic form. The functional derivative can be defined as follows:
+ \begin{definition}
+ \DeclareDerivative{\fdv}{\delta}
+ \end{definition}
+
+ \noindent In physics, the functional derivative is commonly employed in various equations, such as the Lagrange equation and the derivation of the Hartree-Fock equation. Examples of its usage include:
+ \begin{equation*}
+ \fdv{I}{q_{\alpha}} = \pdv{L}{q_{\alpha}} - \odv*{ \pdv{L}{ \dot{q}_{\alpha} } } { t } = 0, \qquad \fdv{ \symcal{L} }{ \psi_{n}^* } = \hat{F} \ket{\psi_{n}} - \epsilon_{n} \ket{\psi_{n}} = 0
+ ,
+ \end{equation*}
+\end{function}
+
+\begin{function}{\adv}
+ \begin{syntax}
+ \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
+ \end{syntax}
+ The average rate of change is defined to use an upright uppercase delta with the default settings. In this package, the average rate of change is defined as
+ \begin{definition}
+ \DeclareDerivative{\adv}{\Delta}
+ \end{definition}
+
+ \noindent The average rate of change can be expressed as
+ \begin{equation*}
+ \adv{ y }{ x } = \frac{y_2- y_1}{x_2 - x_1}
+ \end{equation*}
+\end{function}
+
+\begin{function}{\jdv}[updated = v1.0]
+ \begin{syntax}
+ \sarg, \oarg{keyval list}, \marg{function}, \targ{/}, \marg{variables}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
+ \end{syntax}
+ In this package, the Jacobian is defined with an italic partial differential by default. Additionally, a pair of parentheses is automatically inserted around the function and variable.
+ \begin{definition}
+ \DeclareDerivative{\jdv}{\partial}[fun=true, var=1]
+ \end{definition}
+
+ \noindent which gives
+ \begin{equation*}
+ \jdv{f,g,h}{x,y,z}
+ \end{equation*}
+\end{function}
+
+
+
+ \clearpage
+ \section{Differentials}\label{sec:differential}
+
+\begin{function}*{\odif}[new = v1.0, updated=v1.1]
+ \begin{syntax}
+ \sarg, \oarg{keyval list}, \marg{variables}
+ \end{syntax}
+ The differential \macro{1} is defined with both mandatory and optional arguments that allow for customizing its typesetting and style. It is defined with an upright lowercase d when \keyval[cat=misc]{upright}{true} is used. Otherwise, it will be defined with an italic lowercase d.
+ \begin{definition}
+ \DeclareDifferential{\odif}{\mathrm{d}}%\marginnote{\keyval[cat=misc]{upright}{true}}%
+ \DeclareDifferential{\odif}{\mathnormal{d}}%\marginnote{\keyval[cat=misc]{italic}{true}}%
+ \end{definition}
+
+ \begin{argument}*{1}
+ The first argument of \macro{1} is an optional star that determines the notation style of the differential. With the \keyval{switch-*}{false} option, the variables and orders are typeset as subscript and superscript, respectively, when the star is present. When the star is absent, the infinitesimal is placed in front of each variable, as illustrated below:
\begin{example}
- \pdv[frac=false]{f}{x,y,z} \\
- \pdv[frac=true]{f}{x,y,z} \\
- \pdv*[frac=true]{f}{x,y,z} \\
- \pdv[frac]{f}{x,y,z}
+ \odif{x,y,z} \\
+ \odif*{x,y,z}
\end{example}
- Without setting the option to a value is equivalent to setting it to \val{true} as seen above.
- \end{option}
-
- \begin{option}{var}[cat=misc, new = v1.0]
- \begin{values}[default=none]
- none, all, \meta{cs-numbers}
- \end{values}
- Adds or remove delimiters around the variable. The value \val{all} adds delimiters around all variables and \val{none} removed all delimiters. However, if only some variables needs delimiters then \meta{cs-numbers} can be used e.g. \keyval*[cat=misc]{var}{1,3} adds delimiters around the first and third variable
+ The behavior of the star can be reversed by setting \keyval{switch-*}{true}. In other words, the equations in the previous example will be interchanged.
+ \end{argument}
+
+ \begin{argument}{2}
+ The second argument, enclosed in square brackets, is optional and is used to specify options for the differential using the \keyval[index=false]{key}{value} syntax. Here are some examples:
\begin{example}
- \pdv[var=none]{f}{x,y,z,t} \\
- \pdv[var={1,3}]{f}{x,y,z,t} \\
- \pdv[var=all]{f}{x,y,z,t} \\
- \pdv[var]{f}{x,y,z,t}
+ \odif[order={n,3}]{x,y,z} \\
+ \odif[sep-var-inf=0]{x,y,z} \\
+ \odif*[sep-var-var=0]{x,y,z}
\end{example}
- Without setting the option to a value is equivalent to setting it to \val{all} as seen above.
- \end{option}
-
- \begin{option}{order, ord}[cat=misc, new = v1.0]
- \begin{values}[default = 1]
- \marg{cs-orders}
- \end{values}
- Sets the order of differentiation for each variable as a comma separated list of values.
- \end{option}
+ The available options for the differential can be found in \cref{ssec:options_inf}
+ \end{argument}
- \clearpage
-
- \begin{option}{mixed-order, mixord}[cat=misc, new = v1.0]
- \begin{values}[default = 1]
- \marg{mixed order}
- \end{values}
- The mixed order is automatically calculated from the orders of differentiation set by \keyval[cat=misc]{order}{\marg{orders}}.
- In cases where it fails or another form is preferred, the calculated mixed order can be overwritten with this option.
- \end{option}
-
- \subsection{Differential options} \label{ssec:options_inf}
- The options in this subsection are available for differentials defined by the package and you with the commands in \cref{ssec:defvar_inf}. All options in this section were introduced in \texttt{v1.0}.
-
- \subsubsection*{Style}
-
- \begin{option}*{style-inf}[updated = v1.0]
- \begin{values}[default = d]
- \meta{math-font-style}\meta{infinitesimal}
- \end{values}
- Sets the differential's infinitesimal including font style. This change was necessary to allow multiple font styles, e.g. \keyval{style-inf}{\cs{mathbf}\narg{\cs{mathrm}\narg{d}}}. The default infinitesimal is a plain `\default` with no associated font style.
- \end{option}
-
- \begin{option}{style-notation}
- \begin{values}[default = multiple]
- single, multiple, mixed
- \end{values}
- Sets the differential's notation when the star argument is absent (given \keyval{switch-*}{false}). The key's default value is \val{\default}. The value \val{single} creates a single differential with the variables and orders in a subscript and superscript, respectively. The value \val{multiple} creates a differentials for each variable. The value \val{mixed} creates multiple differentials with the variables and orders in a subscript and superscript, respectively.
-
+ \begin{argument}{3}
+ The mandatory argument is used to typeset the variables in the differential. Here are some examples:
\begin{example}
- \odif[style-notation=multiple, order={n,1,2}]{x,y,z,t} \\
- \odif[style-notation=single, order={n,1,2}]{x,y,z,t} \\
- \odif[style-notation=mixed, order={n,1,2}]{x,y,z,t}
+ \odif{x} \\
+ \odif{s_1,s_2...,s_n}
\end{example}
- \end{option}
-
- \begin{option}{style-notation-*}
- \begin{values}[default = single]
- single, multiple, mixed
- \end{values}
- Sets the differential's notation when the star argument is present (given \keyval{switch-*}{false}). The key's default value is \val{\default}.
- \end{option}
-
- \subsubsection*{Scaling}
-
- \begin{option}{scale-var}
- \begin{values}[default = auto]
- auto, none, big, Big, bigg, Bigg
- \end{values}
- Sets the size of the delimiters used around the variable when the star argument is absent (given \keyval{switch-*}{false}). The scaling is used whenever \keyval[cat=misc]{var}{true} is used. The key's default value is set to scale the delimiters automatically.
- \end{option}
-
- \begin{option}{scale-var-*}
- \begin{values}[default = auto]
- auto, none, big, Big, bigg, Bigg
- \end{values}
- Sets the size of the delimiters used around the variable when the star argument is present (given \keyval{switch-*}{false}). The scaling is used whenever \keyval[cat=misc]{var}{true} is used. The key's default value is set to scale the delimiters automatically.
- \end{option}
-
- \subsubsection*{Delimiters}
-
- \begin{option}{delims-var}
- \begin{values}[default = (~)]
- \meta{left delimiter}\meta{right delimiter}
- \end{values}
- Sets the left and right delimiters used around the variable when the star argument is absent (given \keyval{switch-*}{false}). The delimiters are inserted when \keyval[cat=misc]{var}{true} is used. The key's default delimiters are a left and right parenthesis, respectively.
- \end{option}
-
- \begin{option}{delims-var-*}
- \begin{values}[default = (~)]
- \meta{left delimiter}\meta{right delimiter}
- \end{values}
- Sets the left and right delimiters used around the variable when the star argument is present (given \keyval{switch-*}{false}). The delimiters are inserted when \keyval[cat=misc]{var}{true} is used. The key's default delimiters are a left and right parenthesis, respectively.
- \end{option}
-
- \subsubsection*{Math spacing}
- The options in this subsection inserts extra horizontal math space. Below, illustrates where the space is inserted for each option
+ \end{argument}
+\end{function}
+
+\subsection{Other differentials}
+In addition to the regular differential, the package also provides four other differential commands:
+\begin{itemize}
+ \item Partial differential: \macro{\pdif} - This command is used to typeset partial differentials.
+ \item Uppercase D: \macro{\mdif} - It is used to typeset differentials with an uppercase "D".
+ \item Lowercase delta: \macro{\fdif} - This command is used to typeset differentials with a lowercase delta symbol.
+ \item Uppercase delta: \macro{\adif} - It is used to typeset differentials with an uppercase Delta symbol.
+\end{itemize}
+A unique feature of this package is that it allows you to define your own differentials, as described in \cref{ssec:defvar_inf}. This means you can create custom differential commands tailored to your specific needs.
+
+If you require more information on the usage and customization of these differential commands, please refer to the documentation in \cref{ssec:defvar_inf}.
+
+%This package offers four other differentials: partial differential \macro{\pdif}, uppercase D \macro{\mdif}, delta \macro{\fdif} and Delta \macro{\adif}. A unique feature of this package, is that you can define your own differential as described in \cref{ssec:defvar_inf}.
+
+\begin{function}{\pdif}
+ \begin{syntax}
+ \sarg, \oarg{keyval list}, \marg{variables}
+ \end{syntax}
+ The partial differential \macro{1} is commonly used as a shorthand notation for the partial derivative. In this package, it is defined as follows:
+ \begin{definition}
+ \DeclareDifferential{\pdif}{\partial}[style-notation=single,
+ style-notation-*=mixed]
+ \end{definition}
+
+ \noindent The non-star and star versions are represented on the left side as:
\begin{align*}
- \begin{gathered}
- \partial \ms{inf-var} x \ms{var-inf} \partial y \\
- \partial^{ \ms{inf-ord} 2 } \ms{ord-var} x
- \end{gathered}
- &&
- \begin{gathered}
- \ms{begin} \partial x \ms{end} \\
- \partial^{ 2\ms{ord-ord} 2 }_{ x \ms{var-var} y }
- \end{gathered}
+ \pdif[order={i,j,k}]{x,y,z} &\coloneq \pdv[order={i,j,k}]{}{x,y,z} \\
+ \pdif*[order={i,j,k}]{x,y,z} &\coloneq \pdv[order={i,j,k}]{}{x,y,z}
\end{align*}
- where it have been split into four to give a better overview.
-
- \begin{option}{sep-begin}
- \begin{values}[default = \cs{mathop}\{\}\cs{!}]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- Sets the math space that is inserted to the left of the first differential. The key's default value is \val{\default}.
- \end{option}
-
- \begin{option}{sep-inf-ord}
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- This key sets the math space that is inserted in the infinitesimal's power left to the order. It is only inserted when the mixed order is different from \num{1}. The key's default value is \default{} \texttt{mu}.
- \end{option}
-
- \begin{option}{sep-inf-var}
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- This key sets the math space that is inserted between the infinitesimal and the following variable. The space is only inserted when the order \emph{is equal} to \num{1}when a non-blank variable is given. The key's default value is \default{} \texttt{mu}.
- \end{option}
-
- \begin{option}{sep-ord-var}
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- This key sets the math space that is inserted between the infinitesimal's power and the following variable. The space is only inserted when the order \emph{is different} from \num{1} and a non-blank variable is given. The key's default value is \default{} \texttt{mu}.
- \end{option}
-
- \begin{option}{sep-var-inf}
- \begin{values}[default = \cs{mathop}\{\}\cs{!}]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- They key sets the math space that is inserted between a variable and the following infinitesimal. It is only inserted when more than one non-blank variables are given. The key's default value is \val{\default}.
- \end{option}
-
- \begin{option}{sep-var-var}
- \begin{values}[default = {{,}}]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- Sets the math space that is inserted between two variables. The space is only inserted when \keyval{style-var}{single} and more than one non-blank variables are given. The key's default value is a comma.
- \end{option}
-
- \begin{option}{sep-ord-ord}
- \begin{values}[default = {{,}}]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- Sets the math space that is inserted between two orders. The space is only inserted when \keyval{style-var}{single} and more than one non-blank orders are given. The key's default value is a comma.
- \end{option}
-
- \begin{option}{sep-end}
- \begin{values}[default = 0]
- \meta{cs-number}, \marg{mspace}, \marg{delimiter}
- \end{values}
- Sets the math space that is inserted to the right of the last differential. The key's default value is \val{\default}.
- \end{option}
-
- \subsubsection*{Switches}
-
- \begin{option}*{switch-*}
- \begin{values}[default = false]
- true, false
- \end{values}
- The effect of the star argument's presence can be switched with the value \val{true}. As an example, compare below where the option is turned on (\val{true}) and off (\val{false}),
-
- \begin{example}
- \odif[switch-*=false]{x,y,z,t} \\
- \odif[switch-*=true]{x,y,z,t}
- \end{example}
-
- \noindent The key's default value is \default.
- \end{option}
+ respectively.
+\end{function}
+
+\begin{function}{\mdif}[updated=v1.1]
+ \begin{syntax}
+ \sarg, \oarg{keyval list}, \marg{variables}
+ \end{syntax}
+ Another commonly used shorthand notation for derivatives is the differential with an uppercase D. In this package it is defined with a upright D when \keyval[cat=misc]{upright}{true}. Otherwise, it is defined with an italic D.
+ \begin{definition}
+ \DeclareDifferential{\mdif}{\mathrm{D}}[style-notation=single,
+ style-notation-*=mixed]%\marginnote{\keyval[cat=misc]{upright}{true}}%
+ \DeclareDifferential{\mdif}{\mathnormal{D}}[style-notation=single,
+ style-notation-*=mixed%\marginnote{\keyval[cat=misc]{italic}{true}}%
+ \end{definition}
+
+ \noindent The non-star and star version gives
+ \begin{align*}
+ \mdif[order={i,j,k}]{x,y,z} \\
+ \mdif*[order={i,j,k}]{x,y,z}
+ \end{align*}
+ respectively.
+\end{function}
+
+\begin{function}{\fdif}
+ \begin{syntax}
+ \sarg, \oarg{keyval list}, \marg{variables}
+ \end{syntax}
+ When working with functional derivatives, another commonly used differential is one that uses a delta symbol. It is defined as follows:
+ \begin{definition}
+ \DeclareDifferential{\fdif}{\delta}
+ \end{definition}
+
+ \noindent For example, in expression like:
+ \begin{align*}
+ \fdif{J} = \int_{a}^{b} \pdv{L}{f} \fdif{f(x)} + \pdv{L}{f'} \odv*{ \fdif{f(x)} }{x} \odif{x}
+ \end{align*}
+ this differential is frequently encountered.
+\end{function}
+
+\begin{function}{\adif}
+ \begin{syntax}
+ \sarg, \oarg{keyval list}, \marg{variables}
+ \end{syntax}
+ A differential for differences that uses a uppercase delta is defined as
+ \begin{definition}
+ \DeclareDifferential{\adif}{\Delta}
+ \end{definition}
+
+ \noindent For example, the difference between two energy levels can be written as:
+ \begin{align*}
+ \adif{E} = E_2 - E_1
+ \end{align*}
+\end{function}
- \subsubsection*{Miscellaneous}
+ \clearpage
+ \section{Options}
+This package accepts its options using the familiar \emph{key=value} syntax. The keys are divided into categories, with each key having its associated category as a prefix.
+
+\begin{function}{\derivset}[updated = v1.0]
+ \begin{syntax}
+ \marg{command}, \oarg{keyval list}
+ \end{syntax}
+ The \macro{1} command is used to set default values for derivative and differential options in the preamble. While it can be used within the document, the new \oarg{keyval list} arguments in the derivative and differential commands allow for more flexibility in specifying options on a per-use basis.
- \begin{option}*{var}[cat=misc]
- \begin{values}[default=none]
- none, all, \meta{cs-numbers}
- \end{values}
- Adds or remove delimiters around the variable. The value \val{all} adds delimiters around all variables and \val{none} removed all delimiters. However, if only some variables needs delimiters then \meta{cs-numbers} can be used e.g. \keyval*[cat=misc]{var}{1,3} adds delimiters around the first and third variable
+ \begin{argument}{1}
+ The mandatory argument determines which command the \emph{key=value} pairs are assigned to. The allowed \meta{commands} are the derivatives and differentials defined by the package, as well as any additional derivatives and differentials you have defined (see \cref{ssec:defvar_dv,ssec:defvar_inf} for more information). Additionally, the special value \texttt{all} is allowed, which provides access to the options that apply to all derivatives and differentials.
\begin{example}
- \odif[var=none]{x,y,z,t} \\
- \odif[var={1,3}]{x,y,z,t} \\
- \odif[var=all]{x,y,z,t} \\
- \odif[var]{x,y,z,t}
+ \derivset{\odv}[switch-*=true] \odv{y}{x} \\
+ \derivset{\odif}[switch-*=true] \odif{y}{x}
\end{example}
- Without setting the option to a value is equivalent to setting it to \val{all} as seen above.
- \end{option}
-
- \begin{option}{order, ord}[cat=misc]
- \begin{values}[default = 1]
- \marg{cs-orders}
- \end{values}
- Sets the differentiation order of each variable.
- \end{option}
-
- \subsection{All derivatives and differentials} \label{ssec:both_options}
- The options in this subsection are applied to all derivatives and differential because some options should be consisting regardless of the derivative and differential. The options are accessed using \macro{\derivset}[\narg{all},\oarg{key=value}].
-
- \begin{option}{scale-auto}[updated = v1.1]
- \begin{values}[default = {leftright, mleftmright\req}]
- leftright, mleftmright\req
- \end{values}
- Sets the dynamic scaling methods of delimiters. The value \val{leftright} sets the method to use \cs{left} and \cs{right}. The value \val{mleftmright} requires the \pkg{mleftright} package and sets the method to use \cs{mleft} and \cs{mright} instead. The default value is \val{leftright} unless \pkg{mleftright} have been loaded then it is \val{mleftmright}.
- \end{option}
+ \end{argument}
+ \begin{argument}{2}
+ The optional argument accepts input as a comma-separated list of \emph{key=value} pairs. If \arg{2} is omitted, the options will be set to the package's default settings for the chosen \arg{1}. For example, using the \macro{\derivset}[\narg{\macro{\odv}}] command will set the options for the ordinary derivative to the default settings defined by the package.
+ \begin{example}
+ \derivset{\odv}[switch-*=false] \odv{y}{x} \odv*{y}{x} \\
+ \derivset{\odv}[switch-*=true] \odv{y}{x} \odv*{y}{x} \\
+ \derivset{\odv} \odv{y}{x} \odv*{y}{x}
+ \end{example}
+ \end{argument}
+\end{function}
+
+\subsection{Categories}
+This section seeks to give a detailed description of each category.
+
+\begin{itemize}
+ \item The \key[index=false]{style-\meta{\dots}} keys allow you to customize the style of derivatives or differentials by specifying options such as the fraction command, infinitesimal notation (e.g., $d$, $\partial$) and its font, and variable treatment.
+ \item The \key[index=false]{delims-\meta{\dots}} keys sets the delimiters used around the \meta{\dots}. The Rule of Two applies: \enquote{Always two there are, no more, no less. A left and a right delimiter}. Only delimiters that can be scaled with commands like \cs{left}, \cs{big}, etc., are allowed.
+ \item The \key[index=false]{scale-\meta{\dots}} keys sets the size of the \meta{\dots}'s delimiters. The values \val{big}, \val{Big}, \val{bigg}, and \val{Bigg} are self-explanatory. The value \val{none} leaves the delimiters unscaled (except for periods, which are removed). The value \val{auto} automatically scales the delimiters using \cs{left} and \cs{right}.
+ \item The \key[index=false]{sep-\meta{\dots}-\meta{\dots}} keys inserts their value between \meta{\dots} and \meta{\dots}. If the value is a comma-separated list of up to three numbers (e.g. \texttt{\{1,2,3\}}) it is converted into the syntax \texttt{\cs{muskip} 1 mu plus 2 mu minus 3 mu} and used accordingly. For other values, they are used as given without any conversion.
+ \item The \key[index=false]{switch-\meta{\dots}} keys allow you to change the behaviour of an argument by swapping the effect of the presence or absence of an optional character argument.
+ \item The \key[index=false]{sort-\meta{\dots}} keys handle the sorting algorithm used for the mixed order. These keys allow you to choose the sorting method that best suits your preferences.
+ \item The miscellaneous keys do not fall into any of the previously mentioned categories and does not have a prefix.
+\end{itemize}
+
+\begin{note}
+ A value with a superscripted \texttt{R} indicates that it requires a specific package to be loaded. Additionally, some keys have multiple versions, denoted by \texttt{-/}, \texttt{-!}, and \texttt{-/!} at the end. These keys are specifically related to the slash and exclamation mark arguments.
+\end{note}
+
+\subsection{Package options}
+The package options can be used with the following syntax when loading the package in the preamble:
+\begin{center}
+ \ttfamily\small
+ \cs{usepackage}\oarg{keyval list}\narg{derivative}
+\end{center}
+
+\begin{option}*{italic}[cat=misc, new = v1.1]
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ Sets the font style of the infinitesimals $d$ and $D$ used in \cs{odv}, \cs{mdv}, \cs{odif} and \cs{mdif} to italic using \cs{mathnormal}. The \key[cat=misc,index=false]{italic} and \key[cat=misc,index=false]{upright} options are mutually exclusive.
+\end{option}
+
+\begin{option}{upright}[cat=misc, new = v1.1]
+ \begin{values}[default = true]
+ true, false
+ \end{values}
+ Sets the font style of the infinitesimals $d$ and $D$ used in \cs{odv}, \cs{mdv}, \cs{odif} and \cs{mdif} to upright using \cs{mathrm}. The \key[cat=misc,index=false]{italic} and \key[cat=misc,index=false]{upright} options are mutually exclusive.
+\end{option}
+
+\subsection{Derivative options} \label{ssec:options_dv}
+The options in this subsection are available fo customizing the behaviour of derivatives defined by the package and you.% using the commands described in \cref{ssec:defvar_dv}.
+
+\subsubsection*{Style}
+
+\begin{option}*{style-inf}[updated = {v1.0, v1.3}]
+ \begin{values}[default = ]
+ \meta{math-font-style}\meta{infinitesimal}
+ \end{values}
+ Sets the infinitesimal used in the derivative. This is a meta key, which means it sets the value of both \key{style-inf-num} and \key{style-inf-den} at the same time.
+ \begin{example}
+ \odv[style-inf=\symbf{d}]{f}{x}
+ \end{example}
+\end{option}
+
+\begin{option}{style-inf-num}[new = v1.3]
+ \begin{values}[default = d]
+ \meta{math-font-style}\meta{infinitesimal}
+ \end{values}
+ Sets the infinitesimal used in the numerator of the derivative. This option is also used in the shorthand versions, i.e., when the exclamation mark argument is used. The default infinitesimal is a plain \default.
+ \begin{example}
+ \odv[style-inf-num=\mathbf{d}]{f}{x} \\
+ \odv[style-inf-num=\mathbf{d}]{f}!{x}
+ \end{example}
+\end{option}
+
+\begin{option}{style-inf-den}[new = v1.3]
+ \begin{values}[default = d]
+ \meta{math-font-style}\meta{infinitesimal}
+ \end{values}
+ Sets the infinitesimal used in the denominator of the derivative. The default infinitesimal is a plain \default.
+ \begin{example}
+ \odv[style-inf-den=\mathbf{d}]{f}{x}
+ \end{example}
+\end{option}
+
+\begin{option}{style-frac}
+ \begin{values}[default = \cs{frac}]
+ \meta{fraction}
+ \end{values}
+ The derivative uses the fraction set by this key when the slash argument is absent. If \keyval{switch-/}{true}, the derivative uses this fraction when the slash argument is present. The key's default value is the usual fraction \cs{frac}.
+ \begin{example}
+ \odv[style-frac=\tfrac]{f}{x} \\
+ \odv[switch-/=true, style-frac=\tfrac]{f}/{x}
+ \end{example}
+\end{option}
+
+\begin{option}{style-frac-/}
+ \begin{values}[default = \cs{slashfrac}]
+ \meta{fraction}
+ \end{values}
+ The derivative uses the fraction set by this key when the slash argument is present. If \keyval{switch-/}{true}, the derivative uses this fraction when the slash argument is absent. The key's default value is a text-styled fraction \val{\default}\footref{foot:sfrac} on the form $\odv[style-frac-/=\slashfrac, switch-/=false]{f}/{x}$.
+ \begin{example}
+ \odv[style-frac-/=\sfrac]{f}/{x}
+ \end{example}
+\end{option}
+
+\begin{option}{style-var}[new = v1.0]
+ \begin{values}[default = single]
+ single, multiple
+ \end{values}
+ This option determines how the derivative treats its variables and orders when both the slash argument and the exclamation mark are absent assuming \keyval{switch-/}{false} and \keyval{switch-!}{false}
+ \begin{itemize}[widest = {\val{multiple}}, leftmargin =*]
+ \item[\val{single}] The derivative behaves like a ordinary derivative, treating the variable argument and order as single entities.
+ \item[\val{multiple}] The derivative behaves like a partial derivative, treating the variable argument as a list of comma-separated variables. The mixed order is automatically calculated and sorted based on the \keyval[cat=misc]{order}{\meta{cs-orders}} key. See \cref{ssec:overall_order} for limitations on the automatic calculation.
+ \end{itemize}
+ %This option determines how the derivative treats its variables. The variable argument is treated as a single variable and the order is treated as a single order when \val{single} is used. The variable argument is treated as a comma separated list of variables with \val{multiple} similarly to a partial derivative. Moreover the mixed order is automatically calculated from the list of orders given in \keyval[cat=misc]{order}{\meta{order}}.
+ \begin{example}
+ \pdv[style-var=single, order={1,2,3}]{f}{x,y,z} \\
+ \pdv[style-var=multiple]{f}{x,y,z}
+ \end{example}
+\end{option}
+
+\begin{option}{style-var-/}[new = v1.3]
+ \begin{values}[default = single]
+ single, multiple
+ \end{values}
+ This option behaves identically to \key{style-var}, however it is used when the slash argument is present and the exclamation mark is absent assuming \keyval{switch-/}{false} and \keyval{switch-!}{false}.
+ \begin{example}
+ \pdv[style-var-/=single, order={1,2,3}]{f}/{x,y,z} \\
+ \pdv[style-var-/=multiple]{f}/{x,y,z}
+ \end{example}
+\end{option}
+
+\begin{option}{style-var-!}[new = v1.3]
+ \begin{values}[default = multiple]
+ single, multiple, mixed
+ \end{values}
+ This options determines the shorthand notation of the derivative when the slash argument is absent and the exclamation mark is present assuming \keyval{switch-/}{false} and \keyval{switch-!}{false}.
+ \begin{itemize}[widest = {\val{multiple}}, leftmargin =*]
+ \item[\val{single}] Creates a single differential with variables as subscripts and orders as superscripts.
+ \item[\val{multiple}] Creates a separate differential for each variable.
+ \item[\val{mixed}] Creates a separate differential for each variable but with variables as subscripts and orders as superscripts.
+ \end{itemize}
+ %When \val{single} is used, a single differential is created with the variables and orders in a subscript and superscript, respectively. The value \val{multiple} creates a differential for each variable. While the value \val{mixed} creates differentials their variable and order in a subscript and superscript, respectively.
+ \begin{example}
+ \pdv[style-var-!=single]{f}!{x,y,z} \\
+ \pdv[style-var-!=multiple]{f}!{x,y,z} \\
+ \pdv[style-var-!=mixed]{f}!{x,y,z}
+ \end{example}
+\end{option}
+
+\begin{option}{style-var-/!}[new = v1.3]
+ \begin{values}[default = single]
+ single, multiple, mixed
+ \end{values}
+ This option behaves identical to \key{style-var-!}, however it is used when both the exclamation mark and slash arguments are present assuming \keyval{switch-/}{false} and \keyval{switch-!}{false}.
+ \begin{example}
+ \pdv[style-var-/!=single]{f}/!{x,y,z} \\
+ \pdv[style-var-/!=multiple]{f}/!{x,y,z} \\
+ \pdv[style-var-/!=mixed]{f}/!{x,y,z}
+ \end{example}
+\end{option}
+
+\subsubsection*{Scaling}
+
+\begin{option}*{scale-eval}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ Sets the size of the delimiters used for the point of evaluation. It is applied when the slash argument is absent, assuming \keyval{switch-/}{false}. The default behaviour is to automatically scale the delimiters.
+ \begin{example}
+ \pdv[scale-eval=auto]{f}{x,y}_{(x_0,y_0)}\\
+ \pdv[scale-eval=auto]{f}!{x,y}_{(x_0,y_0)}
+ \end{example}
+\end{option}
+
+\begin{option}{scale-eval-/}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ Sets the size of the delimiters used for the point of evaluation. It is applied when the slash argument is present, assuming \keyval{switch-/}{false}. The default behaviour is to automatically scale the delimiters.
+ \begin{example}
+ \pdv[scale-eval-/=none]{f}/{x,y}_{(x_0,y_0)}
+ \end{example}
+\end{option}
+
+\begin{option}{scale-eval-!}[new = v1.3]
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ Sets the size of the delimiters used for the point of evaluation. It is applied when the exclamation mark argument is present, assuming \keyval{switch-!}{false}. The default behaviour is to automatically scale the delimiters. This option takes priority over \key{scale-eval-/} when the slash argument is also present.
+ \begin{example}
+ \pdv[scale-eval-!=Big]{f}!{x,y}_{(x_0,y_0)}
+ \end{example}
+\end{option}
+
+\begin{option}{scale-fun}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ Sets the size of the delimiters used around the function. It is applied when \keyval[cat=misc]{fun}{true}. The default behaviour is to automatically scale the delimiters.
+ \begin{example}
+ \pdv[scale-fun=big, fun]{f}{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{scale-var}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ Sets the size of the delimiters used around the variables specified by the \keyval*[cat=misc,index=false]{var}{\dots} option when the exclamation mark argument is absent assuming \keyval{switch-!}{false}. The default behaviour is to automatically scale the delimiters.
+ \begin{example}
+ \pdv[scale-var=Big, var]{f}{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{scale-var-!}[new = v1.3]
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ Sets the size of the delimiters used around the variables specified by the \keyval*[cat=misc,index=false]{var}{\dots} option when the exclamation mark argument is present assuming \keyval{switch-!}{false}. The default behaviour is to automatically scale the delimiters.
+ \begin{example}
+ \pdv[scale-var-!=big, var]{f}!{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{scale-frac}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ Sets the size of the delimiters used for around the fraction. It is applied when the slash argument is absent and \keyval[cat=misc]{frac}{true}, assuming \keyval{switch-/}{false}. The default behaviour is to automatically scale the delimiters.
+ \begin{example}
+ \pdv[scale-frac=bigg, frac]{f}{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{scale-frac-/}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ Sets the size of the delimiters used for around the fraction. It is applied when the slash argument is present and \keyval[cat=misc]{frac}{true}, assuming \keyval{switch-/}{false}. The default behaviour is to automatically scale the delimiters.
+ \begin{example}
+ \pdv[scale-frac-/=Bigg, frac]{f}/{x,y}
+ \end{example}
+\end{option}
+
+\subsubsection*{Delimiters}
+
+\begin{option}*{delims-eval}
+ \begin{values}[default = .~\cs{rvert}]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ Sets the delimiters used to indicate the point of evaluation. These delimiters are used when the slash argument is absent, assuming \keyval{switch-/}{false}. The key's default delimiters are a period and a vertical line.
+ \begin{example}
+ \pdv[delims-eval=.|]{f}{x,y}_{(x_0,y_0)}
+ \end{example}
+\end{option}
+
+\begin{option}{delims-eval-/}
+ \begin{values}[default = .~\cs{rvert}]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ Sets the delimiters used to indicate the point of evaluation. These delimiters are used when the slash argument is present, assuming \keyval{switch-/}{false}. The key's default delimiters are a period and a vertical line.
+ \begin{example}
+ \pdv[delims-eval-/=[]]{f}/{x,y}_{(x_0,y_0)}
+ \end{example}
+\end{option}
+
+\begin{option}{delims-eval-!}[new = v1.3]
+ \begin{values}[default = .~\cs{rvert}]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ Sets the delimiters used to indicate the point of evaluation. These delimiters are used when the slash argument is present, assuming \keyval{switch-!}{false}. The key's default delimiters are a period and a vertical line. This option takes priority over \key{delims-eval-/} when the slash argument is also present.
+ \begin{example}
+ \pdv[delims-eval-!=[]]{f}!{x,y}_{(x_0,y_0)}
+ \end{example}
+\end{option}
+
+\begin{option}{delims-fun}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ Sets the delimiters used around the function. These delimiters are used when \keyval[cat=misc]{fun}{true}. The key's default delimiters are parentheses.
+ \begin{example}
+ \pdv[delims-fun=\langle\rangle, fun]{f}{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{delims-var}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ Sets the delimiters used around the variables specified by the \keyval*[cat=misc,index=false]{var}{\dots} option when the exclamation mark argument is absent assuming \keyval{switch-!}{false}. The key's default delimiters are parentheses.
+ \begin{example}
+ \pdv[delims-var=\{\}, var]{f}{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{delims-var-!}[new = v1.3]
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ Sets the delimiters used around the variables specified by the \keyval*[cat=misc,index=false]{var}{\dots} option when the exclamation mark argument is present assuming \keyval{switch-!}{false}. The key's default delimiters are parentheses.
+ \begin{example}
+ \pdv[delims-var-!=\lceil\rceil, var]{f}!{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{delims-frac}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ Sets delimiters used around the fraction in the derivative. These delimiters are used when the slash argument is absent and \keyval[cat=misc]{frac}{true}, assuming \keyval{switch-/}{false}. The key's default delimiters are parentheses.
+ \begin{example}
+ \pdv[delims-frac=||, frac]{f}{x,y} \\
+ \pdv*[delims-frac=||, frac=true]{y}{x}
+ \end{example}
+\end{option}
+
+\begin{option}{delims-frac-/}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ Sets delimiters used around the fraction in the derivative. These delimiters are used when the slash argument is present and \keyval[cat=misc]{frac}{true}, assuming \keyval{switch-/}{false}. The key's default delimiters are parentheses.
+ \begin{example}
+ \pdv[delims-frac-/=\|\|, frac]{f}/{x,y} \\
+ \pdv*[delims-frac-/=\|\|, frac]{f}/{x,y}
+ \end{example}
+\end{option}
+
+\subsubsection*{Math spacing and separators}
+%The options in this subsection insert additional horizontal math space or separators in specific positions. The equations below illustrates where the space is inserted for each option:%TODO - math space should probably be seperator instead
+%\begin{align*}
+% \begin{gathered}
+% \frac{ \partial }{ \partial x } \ms{frac-fun} f \\
+% \frac{ \partial^{ \ms{inf-ord} 2 } f }{ \partial x^{ \ms{var-ord} 2 } }
+% \end{gathered}
+% &&
+% \begin{gathered}
+% \frac{ \partial \ms{inf-fun} f }{ \partial \ms{inf-var} x } \\
+% \frac{ \partial^3 \ms{ord-fun} f }{ \partial x^2 \ms{ord-inf} \partial y }
+% \end{gathered}
+% &&
+% \begin{gathered}
+% \frac{ \partial^2 f }{ \partial x \ms{var-inf} \partial y } \\
+% \mleft( \frac{ \partial f}{ \partial x } \mright)_{ \ms{eval-sb} x_1}^{ \ms{eval-sp} x_2}
+% \end{gathered}
+%\end{align*}
+%where it have been split into six to give a better overview. Here $\ms{\dots}$ means the value given to the option \key[index=false]{sep-\meta{\dots}}. Some of the math spaces shown above are only used when \keyval[index=false]{style-var}{multiple}. Additionally, when the option \keyval[index=false]{style-var}{single} is used then the following math space is used in the denominator
+%%Please note that some of the math spaces shown above are only used when \key[index=false]{style-var} is set to \val{multiple}. Additionally, when \key[index=false]{style-var} is set to \val{single}, the following math space is used in the denominator:
+%\begin{equation*}
+% \frac{\partial(f, g)}{\partial(x \ms{var-var} y)}
+%\end{equation*}
+%where the Jacobian is used as an example.
+
+\begin{option}{sep-inf-ord}
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted to the left of the infinitesimal's power when the (mixed) order \emph{is different} from \num{1}. The default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \pdv[sep-inf-ord=\here]{f}{x,y} \\
+ \pdv[sep-inf-ord=\here, order=2]{f}!{x,y} \\
+ \pdv[sep-inf-ord=\here, order=2]{f}/!{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-inf-fun}
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between the infinitesimal and the function when the (mixed) order \emph{is equal} to \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \pdv[sep-inf-fun=\here]{f}{x}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-ord-fun}
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between the function and the infinitesimal's order when the order \emph{is different} from \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \pdv[sep-ord-fun=\here]{f}{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-frac-fun}[new = v1.0]
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between the fractional part of the derivative and the function when a non-blank function is printed \emph{next to the derivative}. The default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \pdv*[sep-frac-fun=\here]{f}{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-inf-var}
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between the infinitesimal and the following non-blank variable. In shorthand mode, the order must also \emph{be different} from \num{1}. The default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \pdv[sep-inf-var=\here, order=2]{f}{x,y} \\
+ \pdv[sep-inf-var=\here, order=2]{f}!{x,y} \\
+ \pdv[sep-inf-var=\here, order=2]{f}/!{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-var-ord}
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted to the left of the variable's power when its order \emph{is different} from \num{1}. The default value corresponds to \val{\default} \texttt{mu}.
+ %This key sets the separator that is inserted in a variable's power left to the order. The space is only inserted when the order \emph{is different} from \num{1}. The key's default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \pdv[sep-var-ord=\here, order=n]{f}{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-var-inf}
+ \begin{values}[default = \cs{mathop}\{\}\cs{!}]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between a variable and the following infinitesimal when more than one \emph{non-blank} variables are given. In fraction mode, it is also required that the variable's order \emph{is equal} to \num{1}. The default value is \val{\default}.
+ \begin{example}
+ \pdv[sep-var-inf=\here, order=n]{f}{x,y,z}\\
+ \pdv[sep-var-inf=\here, order=n]{f}!{x,y,z}\\
+ \pdv[sep-var-inf=\here, order=n]{f}/!{x,y,z}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-ord-inf}
+ \begin{values}[default = \cs{mathop}\{\}\cs{!}]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between an order and the following infinitesimal when more than one \emph{non-blank} variables are given. In fraction mode, it is also required that the variable's order \emph{is different} from \num{1}. The default value is \val{\default}.
+ \begin{example}
+ \pdv[sep-ord-inf=\here, order=n]{f}{x,y,z}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-ord-ord}[new = v1.3]
+ \begin{values}[default = {{,}}]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between two orders when more than one \emph{non-blank} variables are given in shorthand notation when it is set to \val{single}. The default value is a comma.
+ \begin{example}
+ \odv[sep-ord-ord=\here, order={n,2}]{f}/!{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-ord-var}[new = v1.3]
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between an order and the following variable in shorthand notation when it is set to \val{multiple}. The default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \odv[sep-ord-var=\here, order=n]{f}!{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-var-var}[new = v1.0]
+ \begin{values}[default = {{,}}]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between two variables when more than one \emph{non-blank} variables are given in shorthand notation when it is set to \val{single}. The default value is a comma.
+ \begin{example}
+ \odv[sep-var-var=\here]{f}{x,y} \\
+ \odv[sep-var-var=\here]{f}/!{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-eval-sb}
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted in the evaluation subscript left to the point of evaluation when a \emph{non-blank} subscript is given. The default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \pdv[sep-eval-sb=\here]{f}{x,y}_{(x_1,y_1)}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-eval-sp}
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted in the evaluation superscript left to the point of evaluation when a \emph{non-blank} superscript is given. The default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \pdv[sep-eval-sp=\here]{f}{x,y}^{(x_2,y_2)}
+ \end{example}
+\end{option}
+
+\subsubsection*{Switches}
+
+\begin{option}*{switch-*}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ The effect of the star argument can be toggled with the value \val{true}.
+ %That is, the function is typeset next to the fraction when the star is absent and in the numerator when the star is present.
+ For example, compare below where the option is disabled (\val{false}) and enabled (\val{true}). The default value is \val{\default}.
+ \begin{example}
+ \pdv[switch-*=false]{f}{x,y} \\
+ \pdv[switch-*=true]{f}{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{switch-/}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ The effect of the slash argument can be toggled with the value \val{true}.
+ %That is, the derivative is typeset with the fraction set by \key{style-frac-/} when the slash is absent and with the fraction set by \key{style-frac} when the slash is present.
+ For example, compare below where the option is disabled (\val{false}) and enabled (\val{true}). The default value is \val{\default}.
+ \begin{example}
+ \pdv[switch-/=false]{f}{x,y} \\
+ \pdv[switch-/=true]{f}{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{switch-!}[new = 1.3]
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ The effect of the exclamation mark argument can be toggled with the value \val{true}.
+ %That is, the derivative is in shorthand mode the exclamation mark is absent and in fraction mode when the exclamation is present.
+ For example, compare below where the option is disabled (\val{false}) and enabled (\val{true}). The default value is \val{\default}.
+ \begin{example}
+ \pdv[switch-!=false]{f}{x,y} \\
+ \pdv[switch-!=true]{f}{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{switch-sort}[new = 1.2]
+ \begin{values}[default = true]
+ true, false
+ \end{values}
+ This options disables (\val{false}) and enables (\val{true}) the sorting algorithm behind the mixed order. The sorting algorithm is only used/available in fraction mode when it is \val{multiple}. When disabled, the terms in the mixed order are arranged according to their first appearance in \keyval*[cat=misc,index=false]{order}{\dots}. Compare below where the option is disabled (\val{false}) and enabled (\val{true}). The default value is \val{\default}.
+ %When the value \val{true} is given, the mixed order sorting algorithm is activated, applying the methods specified in \keyval*{sort-method}{\dots}. Conversely, when the value \val{false} is given, the sorting algorithm is deactivated, and the terms in the mixed order are arranged according to their first appearance in \keyval*{order}{\dots}. Here's a comparison example with the option enabled (\val{true}) and disabled (\val{false}).
+ \begin{example}
+ \pdv[switch-sort=false, order={a+b,2kn-d,2-2b}]{f}{x,y,z} \\
+ \pdv[switch-sort=true, order={a+b,2kn-d,2-2b}]{f}{x,y,z}
+ \end{example}
+\end{option}
+
+\subsubsection*{Sort}
+The keys mentioned in this subsection will be briefly described here, with a more detailed explanation provided in \cref{ssec:overall_order}.
+
+\begin{option}{sort-method}[updated = v1.2]
+ \begin{values}[default = {sign, symbol, abs}]
+ abs, lexical, number, sign, symbol
+ \end{values}
+ Sets the sorting method for the mixed order using build-in algorithms.
+ \begin{itemize}[widest = {\val{lexical}}, leftmargin =*]
+ \item[\val{abs}] Sorts terms in descending order based on their absolute value.
+ \item[\val{lexical}] Sorts terms alphabetically in lexicographical ascending order.
+ \item[\val{number}] Sorts terms in descending order based on their numerical value.
+ \item[\val{sign}] Sorts terms by their sign, placing positive terms before the negative terms.
+ \item[\val{symbol}] Sorts terms in descending order based on their symbolic length.
+ \end{itemize}
+ This option accepts a comma-separated list of values, allowing up to three values. For example:
+ \begin{example}
+ \pdv[sort-method=abs, order={kn-c,2a-3b}]{f}{x,y} \\
+ \pdv[sort-method=lexical, order={kn-c,2a-3b}]{f}{x,y} \\
+ \pdv[sort-method=number, order={kn-c,2a-3b}]{f}{x,y} \\
+ \pdv[sort-method=symbol, order={kn-c,2a-3b}]{f}{x,y} \\
+ \pdv[sort-method=sign, order={kn-c,2a-3b}]{f}{x,y} \\
+ \pdv[sort-method={sign,abs}, order={kn-c,2a-3b}]{f}{x,y} \\
+ \pdv[sort-method={sign,symbol,abs}, order={kn-c,2a-3b}]{f}{x,y}
+ \end{example}
+ Notice the different term ordering achieved with each method. For a more detailed explanation of this key, see \cref{ssec:sort-method} for more information. The default value uses the three algorithms \val{\default}.
+\end{option}
+
+\begin{option}{sort-numerical}[updated = v1.0]
+ \begin{values}[default = auto]
+ auto, first, last, symbolic
+ \end{values}
+ Determines the placement of the numerical term\footnote{The numerical term refers to the sum of all orders that consist solely of numbers and do not include any symbols.\label{foot:numerical-term}} in the mixed order. The placement options are as follows:
+ \begin{itemize}[widest=\val{symbolic}, leftmargin=*]
+ \item[\val{first}] Always places the numerical term as the first term in the mixed order.
+ \item[\val{last}] Always places the numerical term as the last term in the mixed order.
+ \item[\val{auto}] After sorting, the numerical term is automatically positioned based on the sign of the first symbolic term. If positive, the numerical term is placed last. If negative, the numerical term is placed first.
+ \item[\val{symbolic}] Treats the numerical term as a symbolic term with a symbolic length of zero and sorts it alongside all other terms.
+ \end{itemize}
+ Here are some examples to illustrate the different placements of the numerical term:
+ \begin{example}
+ \pdv[sort-numerical=first, order={n,2}]{f}{x,y} \\
+ \pdv[sort-numerical=last, order={-n,2}]{f}{x,y} \\
+ \pdv[sort-numerical=auto, order={n,2}]{f}{x,y} \\
+ \pdv[sort-numerical=auto, order={-n,2}]{f}{x,y} \\
+ \pdv[sort-numerical=symbolic, order={2+n,-a}]{f}{x,y}
+ \end{example}
+ This key is further described in \cref{ssec:sort-numerical}. The default value is \val{\default}.
+\end{option}
+
+\begin{option}{sort-abs-reverse}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ When the value \val{true} is used with this option, the sorting order is reversed to ascending order. See \cref{ssec:sort-reverse} for more information.
+ \begin{example}
+ \pdv[sort-abs-reverse=false, sort-method=abs, order=2a-3b]{f}{x} \\
+ \pdv[sort-abs-reverse=true, sort-method=abs, order=2a-3b]{f}{x}
+ \end{example}
+\end{option}
+
+\begin{option}{sort-lexical-reverse}[new = v1.2]
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ When the value \val{true} is used with this option, the sorting order is reversed to lexicographical descending order. See \cref{ssec:sort-reverse} for more information.
+ \begin{example}
+ \pdv[sort-lexical-reverse=false, sort-method=lexical, order=a+b]{f}{x} \\
+ \pdv[sort-lexical-reverse=true, sort-method=lexical, order=a+b]{f}{x}
+ \end{example}
+\end{option}
+
+\begin{option}{sort-number-reverse}[new = v1.0]
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ When the value \val{true} is used with this option, the sorting order is reversed to ascending order. See \cref{ssec:sort-reverse} for more information.
+ \begin{example}
+ \pdv[sort-number-reverse=false, sort-method=number, order=2a-3b]{f}{x} \\
+ \pdv[sort-number-reverse=true, sort-method=number, order=2a-3b]{f}{x}
+ \end{example}
+\end{option}
+
+\begin{option}{sort-sign-reverse}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ When the value \val{true} is used with this option, the sorting order is reversed, placing negative terms before the positive terms. See \cref{ssec:sort-reverse} for more information.
+ \begin{example}
+ \pdv[sort-sign-reverse=false, sort-method=sign, order=a-b]{f}{x} \\
+ \pdv[sort-sign-reverse=true, sort-method=sign, order=a-b]{f}{x}
+ \end{example}
+\end{option}
+
+\begin{option}{sort-symbol-reverse}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ When the value \val{true} is used with this option, the sorting order is reversed to ascending order. See \cref{ssec:sort-reverse} for more information.
+ \begin{example}
+ \pdv[sort-symbol-reverse=false, sort-method=symbol, order=ab+c]{f}{x} \\
+ \pdv[sort-symbol-reverse=true, sort-method=symbol, order=ab+c]{f}{x}
+ \end{example}
+\end{option}
+
+\subsubsection*{Miscellaneous}
+
+\begin{option}*{fun}[cat=misc, new = v1.0]
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ This option allows you to add (\val{true}) or remove (\val{false}) delimiters around the function. Note that if the option is not explicitly set, it is considered equivalent to \keyval[cat=misc,index=false]{fun}{true}. By default, the value is \val{\default}.
+ \begin{example}
+ \pdv[fun=false]{f}{x} \\
+ \pdv[fun=true]{f}{x} \\
+ \pdv[fun]{f}{x}
+ \end{example}
+ %Without setting the option to a value is equivalent to setting it to \val{true} as seen above.
+\end{option}
+
+\begin{option}{frac}[cat=misc, new = v1.0]
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ This option allows you to add (\val{true}) or remove (\val{false}) delimiters around the fractional part of the derivative. Note that if the option is not explicitly set, it is considered equivalent to \keyval[cat=misc,index=false]{frac}{true}. By default, the value is \val{\default}.
+ \begin{example}
+ \pdv[frac=false]{f}{x} \\
+ \pdv[frac=true]{f}{x} \\
+ \pdv*[frac=true]{f}{x} \\
+ \pdv[frac]{f}{x}
+ \end{example}
+\end{option}
+
+\begin{option}{var}[cat=misc, new = v1.0]
+ \begin{values}[default=none]
+ none, all, \meta{cs-numbers}
+ \end{values}
+ This option allows you to add or remove delimiters around the variables. The value \val{all} adds delimiters around all variables and \val{none} removed all delimiters. If only specific variables require delimiters, you can use \meta{cs-numbers}. For example, \keyval*[cat=misc,index=false]{var}{1,3} adds delimiters around the first and third variables. Note that if the option is not explicitly set, it is considered equivalent to \keyval[cat=misc,index=false]{var}{all}. By default, the value is \val{\default}.
+ \begin{example}
+ \pdv[var=none]{f}{x,y,z,t} \\
+ \pdv[var={1,3}]{f}{x,y,z,t} \\
+ \pdv[var=all]{f}{x,y,z,t} \\
+ \pdv[var]{f}{x,y,z,t}
+ \end{example}
+\end{option}
+
+\begin{option}{order, ord}[cat=misc, new = v1.0]
+ \begin{values}[default = 1]
+ \marg{cs-orders}
+ \end{values}
+ Sets the order of differentiation for each variable as a comma separated list of values.
+ \begin{example}
+ \pdv[order={2,3}]{f}{x,y,z} \\
+ \pdv[order={\beta,a,n+2a}]{f}{x,y,z} \\
+ \pdv[order={2,n^2,n^2-1}]{f}{x,y,z} \\
+ \pdv[order={3/2-n/3,n/2,1/3}]{f}{x,y,z}
+ \end{example}
+\end{option}
+
+\begin{option}{mixed-order, mixord}[cat=misc, new = v1.0]
+ \begin{values}[default = 1]
+ \marg{mixed order}
+ \end{values}
+ This option allows you to manually specify the mixed order of differentiation, overriding the automatically calculated value based on the orders set by \keyval[cat=misc]{order}{\marg{orders}}. In cases where the automatic calculation fails or when a different form is preferred, you can use this option to set the desired mixed order.
+ \begin{example}
+ \pdv[order={n+3k, n-k}]{f}{x,y} \\
+ \pdv[order={n+3k, n-k}, mixed-order={2(n+k)}]{f}{x,y}
+ \end{example}
+\end{option}
+
+\subsection{Differential options} \label{ssec:options_inf}
+The options in this subsection are available for customizing the behaviour of differentials defined by the package and you.
+
+\subsubsection*{Style}
+
+\begin{option}*{style-inf}
+ \begin{values}[default = d]
+ \meta{math-font-style}\meta{infinitesimal}
+ \end{values}
+ Sets the infinitesimal used in the differential. The default infinitesimal is a plain \default.
+ \begin{example}
+ \odif[style-inf=\mathbf{d}]{x_1,x_2,x_3}
+ \end{example}
+\end{option}
+
+\begin{option}{style-var}[updated=1.3]
+ \begin{values}[default = multiple]
+ single, multiple, mixed
+ \end{values}
+ This options determines the shorthand notation of the differential when the star argument is absent assuming \keyval{switch-*}{false}.
+ \begin{itemize}[widest = {\val{multiple}}, leftmargin =*]
+ \item[\val{single}] Creates a single differential with variables as subscripts and orders as superscripts.
+ \item[\val{multiple}] Creates a separate differential for each variable.
+ \item[\val{mixed}] Creates a separate differential for each variable but with variables as subscripts and orders as superscripts.
+ \end{itemize}
+ \begin{example}
+ \odif[style-var=multiple, order={n,1,2}]{x,y,z,t} \\
+ \odif[style-var=single, order={n,1,2}]{x,y,z,t} \\
+ \odif[style-var=mixed, order={n,1,2}]{x,y,z,t}
+ \end{example}
+\end{option}
+
+\begin{option}{style-var-*}[updated=1.3]
+ \begin{values}[default = single]
+ single, multiple, mixed
+ \end{values}
+ This option behaves identically to \key{style-var}, however it is used when the star argument is present assuming \keyval{switch-*}{false}.
+\end{option}
+
+\subsubsection*{Scaling}
+
+\begin{option}{scale-var}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ Sets the size of the delimiters used around the variables specified by the \keyval*[cat=misc,index=false]{var}{\dots} option when the star argument is absent assuming \keyval{switch-*}{false}. The default behaviour is to automatically scale the delimiters.
+ \begin{example}
+ \odif[scale-var=none, var]{r,\theta,\varphi}\\
+ \odif[scale-var=Big, var]{r,\theta,\varphi}
+ \end{example}
+\end{option}
+
+\begin{option}{scale-var-*}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ Sets the size of the delimiters used around the variables specified by the \keyval*[cat=misc,index=false]{var}{\dots} option when the star argument is present assuming \keyval{switch-*}{false}. The default behaviour is to automatically scale the delimiters.
+ \begin{example}
+ \odif*[scale-var-*=auto, var]{r,\theta,\varphi}\\
+ \odif*[scale-var-*=big, var]{r,\theta,\varphi}
+ \end{example}
+\end{option}
+
+\subsubsection*{Delimiters}
+
+\begin{option}{delims-var}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ Sets the delimiters used around the variables specified by the \keyval*[cat=misc,index=false]{var}{\dots} option when the star argument is absent assuming \keyval{switch-*}{false}. The default delimiters are parentheses.
+ \begin{example}
+ \odif[delims-var=\{\}, var]{x,y}\\
+ \odif[delims-var=[], var]{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{delims-var-*}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ Sets the delimiters used around the variables specified by the \keyval*[cat=misc,index=false]{var}{\dots} option when the star argument is present assuming \keyval{switch-*}{false}. The default delimiters are parentheses.
+ \begin{example}
+ \odif*[delims-var-*=\|\|, var]{x,y}\\
+ \odif*[delims-var-*=\langle\rangle, var]{x,y}
+ \end{example}
+\end{option}
+
+\subsubsection*{Math spacing and separators}
+%The options in this subsection inserts additional horizontal math space in specific positions. The equations below illustrates where the space is inserted for each option:%TODO - math space should probably be seperator instead
+%\begin{align*}
+% \begin{gathered}
+% \partial \ms{inf-var} x \ms{var-inf} \partial y \\
+% \partial^{ \ms{inf-ord} 2 } \ms{ord-var} x
+% \end{gathered}
+% &&
+% \begin{gathered}
+% \ms{begin} \partial x \ms{end} \\
+% \partial^{ 2\ms{ord-ord} 2 }_{ x \ms{var-var} y }
+% \end{gathered}
+%\end{align*}
+
+\begin{option}{sep-begin}
+ \begin{values}[default = \cs{mathop}\{\}\cs{!}]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted at the beginning of the expression. The default value is \val{\default}.
+ \begin{example}
+ \odif[sep-begin=\here]{x,y,z}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-inf-ord}
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted to the left of the infinitesimal's power when the order \emph{is different} from \num{1}. The default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \odif[sep-inf-ord=\here, order=2]{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-inf-var}
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between the infinitesimal and the following non-blank variable when the associated order \emph{is equal} to \num{1}. The key's default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \odif[sep-inf-var=\here, order=2]{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-ord-var}
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between an order and the following non-blank variable when the order \emph{is different} from \num{1}. This option is only available when the style is set to \val{multiple}. The default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \odif[sep-ord-var=\here, order=2]{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-var-inf}
+ \begin{values}[default = \cs{mathop}\{\}\cs{!}]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between a non-blank variable and the following infinitesimal when more than one non-blank variables are given. The default value is \val{\default}.
+ \begin{example}
+ \odif[sep-var-inf=\here]{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-var-var}
+ \begin{values}[default = {{,}}]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between two variables when more than one non-blank variables are given. This option is only available when the style is set to \val{single}. The default value is a comma.
+ \begin{example}
+ \odif*[sep-var-var=\here]{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-ord-ord}
+ \begin{values}[default = {{,}}]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted between two orders that are both not equal to \num{1}. This option is only available when the style is set to \val{single}. The default value is a comma.
+ \begin{example}
+ \odif*[sep-ord-ord=\here, order={2,n}]{x,y}
+ \end{example}
+\end{option}
+
+\begin{option}{sep-end}
+ \begin{values}[default = 0]
+ \meta{cs-number}, \marg{mspace}, \marg{delimiter}
+ \end{values}
+ Sets the separator that is inserted at the end of the expression. The default value corresponds to \val{\default} \texttt{mu}.
+ \begin{example}
+ \odif[sep-end=\here]{x,y}
+ \end{example}
+\end{option}
+
+\subsubsection*{Switches}
+
+\begin{option}*{switch-*}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ The effect of the star argument can be toggled with the value \val{true}. For example, compare below where the option is disabled (\val{false}) and enabled (\val{true}). The default value is \val{\default}.
+ \begin{example}
+ \odif[switch-*=false]{x,y,z,t} \\
+ \odif[switch-*=true]{x,y,z,t}
+ \end{example}
+\end{option}
+
+\subsubsection*{Miscellaneous}
+
+\begin{option}*{var}[cat=misc]
+ \begin{values}[default=none]
+ none, all, \meta{cs-numbers}
+ \end{values}
+ This option allows you to add or remove delimiters around the variables. The value \val{all} adds delimiters around all variables and \val{none} removed all delimiters. If only specific variables require delimiters, you can use \meta{cs-numbers}. For example, \keyval*[cat=misc,index=false]{var}{1,3} adds delimiters around the first and third variables. Note that if the option is not explicitly set, it is considered equivalent to \val{all}. By default, the value is \val{\default}.
+ \begin{example}
+ \odif[var=none]{x,y,z,t} \\
+ \odif[var={1,3}]{x,y,z,t} \\
+ \odif[var=all]{x,y,z,t} \\
+ \odif[var]{x,y,z,t}
+ \end{example}
+\end{option}
+
+\begin{option}{order, ord}[cat=misc]
+ \begin{values}[default = 1]
+ \marg{cs-orders}
+ \end{values}
+ Sets the order of differentiation for each variable as a comma separated list of values.
+ \begin{example}
+ \odif[order={2,3}]{x,y,z} \\
+ \odif[order={\beta,a,n+2a}]{x,y,z}
+ \end{example}
+\end{option}
+
+\subsection{All derivatives and differentials} \label{ssec:both_options}
+The options in this subsection are applied to all derivatives and differentials because they define settings that should be consistent regardless of the specific derivative or differential. These options can be accessed using the command \macro{\derivset}[\narg{all},\oarg{key=value}].
+
+The options in this subsection are applied to all derivatives and differential because some options should be consisting regardless of the derivative and differential. The options are accessed using \macro{\derivset}[\narg{all},\oarg{key=value}].
+\begin{example}[result=false]
+ \derivset{all}[key=value]
+\end{example}
+
+\begin{option}{scale-auto}[updated = v1.1]
+ \begin{values}[default = {leftright or mleftmright\req}]
+ leftright, mleftmright\req
+ \end{values}
+ Sets the automatic delimiter scaling commands. The value \val{leftright} sets them as \cs{left} and \cs{right} while \val{mleftmright} sets them as \cs{mleft} and \cs{mright} from the \pkg{mleftrigth} package. The default value is \val{leftright} unless \pkg{mleftright} is loaded, in which case it is \val{mleftmright}.
+ \begin{example}
+ \derivset{all}[scale-auto=leftright] a \pdv[frac]{f}{x} a\\
+ \derivset{all}[scale-auto=mleftmright] a \pdv[frac]{f}{x} a
+ \end{example}
+ Notice the space difference between the a's and the parentheses in the two equations.
+\end{option}
+
\clearpage
\section{Defining variants} \label{sec:defvar}
- This section goes into detail with how to define derivative and differential variants based on the package's internal commands, as mentioned earlier. The \mypackage{} package provides a \latex2 way of defining the derivatives.
-
- \subsection{Derivative variant} \label{ssec:defvar_dv}
-
- \begin{function}*{\NewDerivative, \RenewDerivative, \ProvideDerivative, \DeclareDerivative}
- \begin{syntax}
- \meta{control-sequence}, \marg{infinitesimal}, \oarg{key=value}
- \end{syntax}
- This family of commands are used to define a derivative variant with the macro name \arg{1}. Moreover, the new derivative will use \arg{2} as its infinitesimal and inherit the package's default settings given in \cref{ssec:options_dv}, but they may be overwritten with \arg{3}. The difference between them is as follows:
- \begin{itemize}
- \item \macro{1} is similar to \cs{NewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has already been defined.
- \item \macro{2} is similar to \cs{RenewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has not previously been defined.
- \item \macro{3} is similar to \cs{ProvideDocumentCommand} of the \pkg{xparse} package and will define \arg{1} if it does not have an existing definition. It will not issue any errors.
- \item \macro{4} is similar to \cs{DeclareDocumentCommand} of the \pkg{xparse} package and will always define the \arg{1} with the new definition regardless of whether it already exists.
- \end{itemize}
-
- \begin{argument}{1}
- The first argument is the macro name of the derivative that is to be defined.
- \end{argument}
-
- \begin{argument}{2}
- The second argument makes the derivative \arg{1} use \arg{2} as its infinitesimal. It is equivalent to setting \keyval{style-inf}{\arg{2}}.
- \end{argument}
-
- \begin{argument}{3}
- The optional argument accepts its input as a comma-separated list of \emph{key=value} pairs, which overrides the package's default options for the keys given. The derivative \arg{1} will use the package's default settings if the argument is left out.
- \end{argument}
- \end{function}
-
- \subsection{Differential variant} \label{ssec:defvar_inf}
-
- \begin{function}*{\NewDifferential, \RenewDifferential, \ProvideDifferential, \DeclareDifferential}
- \begin{syntax}
- \meta{control-sequence}, \marg{infinitesimal}, \oarg{key=value}
- \end{syntax}
- This family of commands are used to define a differential variant with the macro name \arg{1}. Moreover, the new derivative will use \arg{2} as its infinitesimal and inherit the package's default options given in \cref{ssec:options_inf}, but they may be overwritten with \arg{3}. The difference between them is as follows:
-
- \begin{itemize}
- \item \macro{1} is similar to \cs{NewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has already been defined.
- \item \macro{2} is similar to \cs{RenewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has not previously been defined.
- \item \macro{3} is similar to \cs{ProvideDocumentCommand} of the \pkg{xparse} package and will define \arg{1} if it does not have an existing definition. It will not issue any errors.
- \item \macro{4} is similar to \cs{DeclareDocumentCommand} of the \pkg{xparse} package and will always define the \arg{1} with the new definition regardless of whether it already exists.
- \end{itemize}
-
- \begin{argument}{1}
- The first argument is the macro name of the differential that is to be defined.
- \end{argument}
-
- \begin{argument}{2}
- While the second argument makes the differential \arg{1} use \arg{2} as its infinitesimal. It is equivalent to setting \keyval{style-inf}{\arg{2}}.
- \end{argument}
-
- \begin{argument}{3}
- The optional argument accepts its input as a comma-separated list of \emph{key=value} pairs, which overrides the package's default options for the keys given. The derivative \arg{1} will use the package's default settings if the argument is left out.
- \end{argument}
- \end{function}
-
+This section goes into detail on how to define derivative and differential variants based on the package's internal commands. The \mypackage{} package provides a \latex2-based approach to defining derivatives and differentials.
+
+\subsection{Derivative variant} \label{ssec:defvar_dv}
+
+\begin{function}*{\NewDerivative, \RenewDerivative, \ProvideDerivative, \DeclareDerivative}
+ \begin{syntax}
+ \meta{control-sequence}, \marg{infinitesimal}, \oarg{key=value}
+ \end{syntax}
+ This family of commands is used to define a derivative variant with the macro name \arg{1}. %The new derivative will use the infinitesimal \arg{2} and inherit the package's default settings given in \cref{ssec:options_dv}, which can be overwritten with \arg{3}. The difference between the commands is as follows:
+ \begin{itemize}
+ \item \macro{1} will issue an error if \arg{1} has already been defined.
+ \item \macro{2} will issue an error if \arg{1} has not previously been defined.
+ \item \macro{3} will define \arg{1} if it does not have an existing definition. It will not issue any errors.
+ \item \macro{4} will always define the \arg{1} with the new definition regardless of whether it already exists.
+ \end{itemize}
+ Examples of their use can be found in \cref{sec:derivative}.
+ \begin{argument}{1}
+ The first argument specifies the macro name of the derivative being defined.
+ \end{argument}
- \clearpage
- \section{The mixed order} \label{ssec:overall_order}
+ \begin{argument}{2}
+ The second argument sets the infinitesimal of the derivative \arg{1}. It is equivalent to setting \keyval{style-inf}{\arg{2}}.
+ \end{argument}
- \subsection{Sorting algorithms} \label{ssec:sort-method}
- A unique feature of this package is that the sorting method behind the mixed order may be changed using built-in algorithms and there are currently four available: \val{abs}, \val{number}, \val{sign} and \val{symbol}. The algorithms have been chosen such that it the terms in the mixed order may be arranged in many ways with as few algorithms as possible to suit your liking. A sorting method may consist of up to three algorithms which are applied in layers.
+ \begin{argument}{3}
+ The optional argument accepts a comma-separated list of \emph{key=value} pairs, allowing you to override the package's default values for the keys given. If the optional argument is omitted, the derivative will use the package's default settings.
+ \end{argument}
+\end{function}
+
+\subsection{Differential variant} \label{ssec:defvar_inf}
+
+\begin{function}*{\NewDifferential, \RenewDifferential, \ProvideDifferential, \DeclareDifferential}
+ \begin{syntax}
+ \meta{control-sequence}, \marg{infinitesimal}, \oarg{key=value}
+ \end{syntax}
+ This family of commands is used to define a differential variant with the macro name \arg{1}. %The new differential will use the infinitesimal \arg{2} and inherit the package's default settings given in \cref{ssec:options_inf}, which can be overwritten with \arg{3}. The difference between the commands is as follows:
\begin{itemize}
- \item The sorting algorithm \val{sign} separates the positive and negative terms, and puts the positive terms before the negative terms in the mixed order. The option \keyval{sort-sign-reverse}{true} reverses ordering such that the negative terms appear before the positive terms.
- \item The sorting algorithm \val{symbol} sorts the terms in a descending manner according to their length. The option \keyval{sort-symbol-reverse}{true} sorts the terms in a ascending manner instead.
- \item The sorting by \val{abs} sorts the terms in a descending manner. The option \keyval{sort-abs-reverse}{true} sorts the terms in an ascending manner instead.
- \item The sorting by \val{number} sorts the terms in a descending manner. The option \keyval{sort-number-reverse}{true} sort the terms in an ascending manner instead.
- \item The sorting by \val{lexical} sorts the terms in a lexicographical order that is alphabetically. The option \keyval{sort-number-reverse}{true} sort the terms in reverse lexicographical ordering.
+ \item \macro{1} will issue an error if \arg{1} has already been defined.
+ \item \macro{2} will issue an error if \arg{1} has not previously been defined.
+ \item \macro{3} will define \arg{1} if it does not have an existing definition. It will not issue any errors.
+ \item \macro{4} will always define the \arg{1} with the new definition regardless of whether it already exists.
\end{itemize}
+ Examples of their use can be found in \cref{sec:differential}.
- When using the option \keyval{sort-method}{\{...\}}, the number of algorithms determines the number of layers e.g. \keyval*{sort-method}{sign,symbol} is a sorting method with two layers, where the algorithms \val{sign} and \val{symbol} are applied in layer \num{1} and layer \num{2}, respectively. E.i the \val{sign} algorithm splits the terms into two groups, one with positive terms and one with negative terms. Then the \val{symbol} algorithm will sorts the terms within each groups according to the terms symbolic length. The mixed order is then formed by combining these two groups.
+ \begin{argument}{1}
+ The first argument specifies the macro name of the differential being defined.
+ \end{argument}
- \subsubsection{Examples}
- The examples below are uses partial derivatives with \keyval*[cat=misc]{order}{3a-3hh-2b, 4c+4gg+2ff, -5d-5ee} and a close up view of the mixed order. Square brackets are used to indicate grouping of terms and the text below a group refers to the algorithm applied. Here the words positive and negative, long and short, and big and low refers to the \val{sign}, \val{symbol}, and \val{abs} algorithms, respectively. A row of square brackets represents a layer.
+ \begin{argument}{2}
+ The second argument sets the infinitesimal of the differential \arg{1}. It is equivalent to setting \keyval{style-inf}{\arg{2}}.
+ \end{argument}
- The packages default sorting method is \keyval*{sort-method}{sign,symbol,abs} which is used below. The \val{sign} algorithm separate the positive and negative terms in the first layer. While in the second layer, the terms are separated by symbol length etc.
- \begin{equation*}
- \pdv[sort-method = {sign,symbol,abs}, order={3a-3hh-2b, 4c+4gg+2ff, -5d-5ee}]{f}{x,y,z}
- \end{equation*}
- \begin{equation*}
- \low{
- \low{
- \low{4gg}{big} +
- \low[2,2]{2ff}{low}
- }{long} +
- \low{
- \low[1,2]{4c}{big} +
- \low[1,1]{3a}{low}
- }{short}
- }{positve} -
- \low{
- \low{
- \low[3,3]{5ee}{big} -
- \low[2,2]{3hh}{low}
- }{long} -
- \low{
- \low[1,1]{5d}{big} -
- \low[2,2]{2b}{low}
- }{short}
- }{negative}
- \end{equation*}
- as expected. Interchanging \val{sign} and \val{symbol} from the previous example i.e \keyval*{sort-method}{symbol,sign,abs}, then the \val{symbol} and \val{sign} algorithms are now applied in the first and second layer, respectively. The result is shown below
- \begin{equation*}
- \pdv[sort-method = {symbol,sign,abs}, order={3a-3hh-2b, 4c+4gg+2ff, -5d-5ee}]{f}{x,y,z}
- \end{equation*}
- \begin{equation*}
+ \begin{argument}{3}
+ The optional argument accepts a comma-separated list of \narg{key=value} pairs, allowing you to override the package's default values for the keys given. If the optional argument is omitted, the derivative will use the package's default settings.
+ \end{argument}
+\end{function}
+
+
+
+ \clearpage
+ \section{The mixed order} \label{ssec:overall_order}
+The algorithm used to calculate the mixed order is advanced and can handle a wide range of inputs, including numbers, symbols and fractions. It accurately parses the orders to generate the appropriate mixed order. Let's consider some examples to illustrate its capabilities:
+\begin{example}
+ \pdv[order={n+1,2}]{f}{x,y}\\
+ \pdv[order={n+1,2n}]{f}{x,y}\\
+ \pdv[order={n^2,n^2}]{f}{x,y}\\
+ \pdv[order={2/n-1/2, 3/n+m/3}]{f}{x,y,z}
+\end{example}
+The algorithm handles these cases and calculates the mixed order correctly. However, there are certain limitations when dealing with parentheses, except for a specific case where there is a single term in the denominator.
+\begin{example}
+ \pdv[order={2/n-1/2, 3/(2n)+m/3}]{f}{x,y}\\
+ \pdv[order={(2n+m)/3, 3n+m/3}]{f}{x,y}\\
+ \pdv[order={2/(2n+m), 1/(2(2n+m))}]{f}{x,y}
+\end{example}
+In the third equation, the mixed order doesn't make sense because the algorithm splits up the orders at $+$ and $-$ within parentheses without evaluating them correctly. For example, $2/(2n+m), 1/(2(2n+m))$ is incorrectly split into $2/(2n, m), 1/(2(2n, m))$. The same happens in the second equation. To address this limitation, the package provides the \key[cat=misc]{mixed-order} option, which overrides the incorrect output. You can specify the desired mixed order manually.
+\begin{example}
+ \pdv[order={(2n+m)/3, 3n+m/3}, mixord=8n/3+2m/3]{f}{x,y}\\
+ \pdv[order={2/(2n+m), 1/(2(2n+m))}, mixord=5/(2(2n+m))]{f}{x,y}
+\end{example}
+By using the \key[cat=misc]{mixed-order} option, you can ensure that the mixed order is displayed correctly, even when the algorithm's output may be incorrect or when a different form is preferred.
+
+\subsection{Sorting algorithms} \label{ssec:sort-method}
+A unique feature of this package is that the sorting method behind the mixed order may be changed using built-in algorithms. These algorithms are designed to offer variety of ways to sort the mixed order according to ones preferences.
+\begin{itemize}[widest = {\val{lexical}}, leftmargin =*]
+ \item[\val{abs}] Sorts terms based on their absolute value in descending order. By setting \keyval{sort-abs-reverse}{true}, terms are sorted in ascending order instead.
+ \item[\val{lexical}] Sorts the terms alphabetically in lexicographical order. By setting \keyval{sort-lexical-reverse}{true}, terms are sorted in reverse lexicographical order.
+ \item[\val{number}] Sorts terms based on their numerical value in descending order. By setting \keyval{sort-number-reverse}{true}, terms are sorted in ascending order instead.
+ \item[\val{sign}] Sorts terms by their sign, placing positive terms before negative terms. By setting, \keyval{sort-sign-reverse}{true}, places negative terms before positive terms.
+ \item[\val{symbol}] Sorts terms in descending order based on their symbolic length. By setting \keyval{sort-symbol-reverse}{true}, terms are sorted in ascending order instead.
+\end{itemize}
+
+The sorting method allows up to three algorithms given by \keyval*{sort-method}{algorithm1, algorithm2, algorithm3}. The list of orders is primarily sorted based on algorithm 1's condition. In case of ties, algorithm 2 is used for further sorting, and so on.
+
+Consider the list \texttt{\{a,-c,-b,d\}} and the sorting method \keyval*{sort-method}{sign,lexical}. Initially, the \val{sign} algorithm sorts the list as \texttt{\{a,d,-c,-b\}}. However, due to ties, other valid orderings exist like \texttt{\{d,a,-c,-b\}}, \texttt{\{a,d,-b,-c\}} and \texttt{\{d,a,-b,-c\}}. Subsequently, the \val{lexical} algorithm sorts the tied values alphabetically as \texttt{\{a,d,-b,-c\}}.
+
+\subsubsection{Examples}
+The examples below use partial derivatives with \keyval*[cat=misc]{order}{3a-3hh-2b, 4c+4gg+2ff, -5d-5ee}, along with a close-up view of the mixed order. Square brackets indicate how the terms was sorted by the applied algorithm. `Positive' and `negative', `long' and `short', and `big' and `low' refer to the \val{sign}, \val{symbol}, and \val{abs} algorithms, respectively.
+
+The default sorting method is \keyval*{sort-method}{sign,symbol,abs} which is used below. The \val{sign} algorithm separate the positive and negative terms. Within each group, the \val{symbol} algorithm sorts the terms based on symbolic length. Finally, In the resulting four groups, the \val{abs} algorithm sorts the terms based on absolute value.
+\begin{gather*}
+ \pdv[sort-method = {sign,symbol,abs}, order={3a-3hh-2b, 4c+4gg+2ff, -5d-5ee}]{f}{x,y,z} \\
+ \low{
\low{
- \low{
- \low{4gg}{big} +
- \low[2,2]{2ff}{low}
- }{positive} -
- \low{
- \low[3,3]{5ee}{big} -
- \low[2,2]{3hh}{low}
- }{negative}
+ \low{4gg}{big} +
+ \low[2,2]{2ff}{low}
}{long} +
+ \low{
+ \low[1,2]{4c}{big} +
+ \low[1,1]{3a}{low}
+ }{short}
+ }{positve} -
+ \low{
+ \low{
+ \low[3,3]{5ee}{big} -
+ \low[2,2]{3hh}{low}
+ }{long} -
\low{
- \low{
- \low[1,2]{4c}{big} +
- \low[1,1]{3a}{low}
- }{positive} -
- \low{
- \low[1,1]{5d}{big} -
- \low[2,2]{2b}{low}
- }{negative}
+ \low[1,1]{5d}{big} -
+ \low[2,2]{2b}{low}
}{short}
- \end{equation*}
- where a clear difference is seen between the above two examples.
-
- The above two examples used 3-layer sorting methods but as mentioned earlier, the sorting method can also be constructed with one and two algorithms i.e. 1-layer and 2-layer sorting methods. A sorting method with two layers could be constructed as \keyval*{sort-method}{sign,symbol} and the terms are ordered by sign and then symbolic length. In this case, there is not a third layer
- \begin{equation*}
- \pdv[sort-method = {sign,symbol}, order={3a-3hh-2b, 4c+4gg+2ff, -5d-5ee}]{f}{x,y,z}
- \end{equation*}
- \begin{equation*}
+ }{negative}
+\end{gather*}
+By interchanging the \val{sign} and \val{symbol} algorithm in the previous example, then the \val{symbol} algorithm will be applied first and the \val{sign} algorithm handles the symbolic ties.
+\begin{gather*}
+ \pdv[sort-method = {symbol,sign,abs}, order={3a-3hh-2b, 4c+4gg+2ff, -5d-5ee}]{f}{x,y,z} \\
+ \low{
\low{
- \low{ 4gg + 2ff }{long} +
- \low{ 3a + 4c }{short}
+ \low{4gg}{big} +
+ \low[2,2]{2ff}{low}
}{positive} -
\low{
- \low{ 3hh - 5ee }{long} -
- \low{ 2b - 5d }{short}
+ \low[3,3]{5ee}{big} -
+ \low[2,2]{3hh}{low}
}{negative}
- \end{equation*}
- The last example shows a 1-layer sorting method given as \keyval{sort-method}{symbol} which gives the result
- \begin{equation*}
- \pdv[sort-method = symbol, order={3a-3hh-2b, 4c+4gg+2ff, -5d-5ee}]{f}{x,y,z}
- \end{equation*}
- \begin{equation*}
- \low{ - 3hh + 4gg + 2ff - 5ee }{long} +
- \low{ 3a - 2b + 4c - 5d }{short}
- \end{equation*}
- as expected.
-
- \subsection{The numerical term} \label{ssec:sort-numerical}
- With the symbolic part of the mixed order treated, it is time to look at the numerical term\footref{foot:numerical-term} which have a symbolic of zero. For this reason it is treated differently than the symbolic terms. The numerical term can be placed either at the beginning or at the end of the mixed order with the values \val{first} and \val{last}, respectively. The package can also determine where to place the numerical term with the value \val{auto}. Compare below
- \begin{align*}
- \text{\inlinecode{sort-numerical=auto:}} &&
- \pdv[order={\beta, 2}, sort-numerical=auto]{f}{x,y} &&
- \pdv[order={\beta, -2}, sort-numerical=auto]{f}{x,y} &&
- \pdv[order={-\beta, 2}, sort-numerical=auto]{f}{x,y} &&
- \pdv[order={-\beta, -2}, sort-numerical=auto]{f}{x,y} \\
- \text{\inlinecode{sort-numerical=first:}} &&
- \pdv[order={\beta, 2}, sort-numerical=first]{f}{x,y} && \pdv[order={\beta, -2}, sort-numerical=first]{f}{x,y} && \pdv[order={-\beta, 2}, sort-numerical=first]{f}{x,y} && \pdv[order={-\beta, -2}, sort-numerical=first]{f}{x,y} \\
- \text{\inlinecode{sort-numerical=last:}} &&
- \pdv[order={\beta, 2}, sort-numerical=last]{f}{x,y} && \pdv[order={\beta, -2}, sort-numerical=last]{f}{x,y} && \pdv[order={-\beta, 2}, sort-numerical=last]{f}{x,y} && \pdv[order={-\beta, -2}, sort-numerical=last]{f}{x,y} \\
- \text{\inlinecode{sort-numerical=symbolic:}} &&
- \pdv[order={\beta, 2}, sort-numerical=symbolic]{f}{x,y} && \pdv[order={\beta, -2}, sort-numerical=symbolic]{f}{x,y} && \pdv[order={-\beta, 2}, sort-numerical=symbolic]{f}{x,y} && \pdv[order={-\beta, -2}, sort-numerical=symbolic]{f}{x,y}
- \end{align*}
- These four options should satisfy every needs.
-
- \subsection{Reversing the sort algorithm} \label{ssec:sort-reverse}
- The reverse keys serves to reverse the ordering of the sorting algorithms. This allows for even greater flexibility over the sorting method. So if the default ordering of an algorithm is not wished it may be reversed with the corresponding reverse key. The reverse keys in action are shown below (\keyval[index=false]{sort-method}{\meta{1 algorithm only}} is also used to better show off the reverse functionality)
- \begin{align*}
- \text{\inlinecode{sort-abs-reverse=false:}} && \pdv[sort-method={abs}, sort-abs-reverse=false, order={2a, -3b}]{f}{x,y} &&
- \text{\inlinecode{sort-abs-reverse=true:}} && \pdv[sort-method={abs}, sort-abs-reverse=true, order={2a, -3b}]{f}{x,y} \\
- \text{\inlinecode{sort-number-reverse=false:}} && \pdv[sort-method={number}, sort-number-reverse=false, order={2a, -3b}]{f}{x,y} &&
- \text{\inlinecode{sort-number-reverse=true:}} && \pdv[sort-method={number}, sort-number-reverse=true, order={2a, -3b}]{f}{x,y} \\
- \text{\inlinecode{sort-sign-reverse=false:}} && \pdv[sort-method={sign}, sort-sign-reverse=false, order={a, -b}]{f}{x,y} &&
- \text{\inlinecode{sort-sign-reverse=true:}} && \pdv[sort-method={sign}, sort-sign-reverse=true, order={a, -b}]{f}{x,y} \\
- \text{\inlinecode{sort-symbol-reverse=false:}} && \pdv[sort-method={symbol}, sort-symbol-reverse=false, order={ab, c}]{f}{x,y} &&
- \text{\inlinecode{sort-symbol-reverse=true:}} && \pdv[sort-method={symbol}, sort-symbol-reverse=true, order={ab, c}]{f}{x,y} \\
- \text{\inlinecode{sort-lexical-reverse=false:}} && \pdv[sort-method={lexical}, sort-lexical-reverse=false, order={a, c, b}]{f}{x,y,z} &&
- \text{\inlinecode{sort-lexical-reverse=true:}} && \pdv[sort-method={lexical}, sort-lexical-reverse=true, order={a, c, b}]{f}{x,y,z} \\
- \end{align*}
-
- \subsection{Mixed order override}
- In cases where the mixed order fails to be calculated or another form is preferred, then the mixed order override can be used
- \begin{example}
- \pdv[order={n+3k, n-k}]{f}{x,y} \\
- \pdv[order={n+3k, n-k}, mixed-order={2(n+k)}]{f}{x,y}
- \end{example}
-
-
+ }{long} +
+ \low{
+ \low{
+ \low[1,2]{4c}{big} +
+ \low[1,1]{3a}{low}
+ }{positive} -
+ \low{
+ \low[1,1]{5d}{big} -
+ \low[2,2]{2b}{low}
+ }{negative}
+ }{short}
+\end{gather*}
+
+In contrast to the previous two examples with three algorithms, this example uses a sorting method with two algorithms: \keyval*{sort-method}{sign,symbol}. The terms are first sorted by sign and then by symbolic length.
+\begin{gather*}
+ \pdv[sort-method = {sign,symbol}, order={3a-3hh-2b, 4c+4gg+2ff, -5d-5ee}]{f}{x,y,z} \\
+ \low{
+ \low{ 4gg + 2ff }{long} +
+ \low{ 3a + 4c }{short}
+ }{positive} -
+ \low{
+ \low{ 3hh - 5ee }{long} -
+ \low{ 2b - 5d }{short}
+ }{negative}
+\end{gather*}
+In the last example, a sorting method with a single algorithm, \keyval{sort-method}{symbol}, is used.
+\begin{gather*}
+ \pdv[sort-method = symbol, order={3a-3hh-2b, 4c+4gg+2ff, -5d-5ee}]{f}{x,y,z} \\
+ \low{ - 3hh + 4gg + 2ff - 5ee }{long} +
+ \low{ 3a - 2b + 4c - 5d }{short}
+\end{gather*}
+
+\subsection{Treating the numerical term} \label{ssec:sort-numerical}
+After handling the symbolic part of the mixed order, we now turn our attention to the numerical term\footref{foot:numerical-term}, which has a symbolic length of zero. For this reason it is treated differently than the symbolic terms. It can be placed either at the beginning or at the end of the mixed order by \val{first} and \val{last}, respectively. Alternatively, it is automatically positioned in the mixed order using \val{auto}. Setting \keyval{sort-numerical}{symbolic}, treats the numerical term as a symbolic term. Its behaviour is determined by the chosen algorithms in \keyval*{sort-method}{\dots}. In this example the sort method is the default value of the package.
+\begin{align*}
+ \text{\inlinecode{sort-numerical=auto:}} &&
+ \pdv[order={\beta, 2}, sort-numerical=auto]{f}{x,y} &&
+ \pdv[order={\beta, -2}, sort-numerical=auto]{f}{x,y} &&
+ \pdv[order={-\beta, 2}, sort-numerical=auto]{f}{x,y} &&
+ \pdv[order={-\beta, -2}, sort-numerical=auto]{f}{x,y} \\
+ \text{\inlinecode{sort-numerical=first:}} &&
+ \pdv[order={\beta, 2}, sort-numerical=first]{f}{x,y} && \pdv[order={\beta, -2}, sort-numerical=first]{f}{x,y} && \pdv[order={-\beta, 2}, sort-numerical=first]{f}{x,y} && \pdv[order={-\beta, -2}, sort-numerical=first]{f}{x,y} \\
+ \text{\inlinecode{sort-numerical=last:}} &&
+ \pdv[order={\beta, 2}, sort-numerical=last]{f}{x,y} && \pdv[order={\beta, -2}, sort-numerical=last]{f}{x,y} && \pdv[order={-\beta, 2}, sort-numerical=last]{f}{x,y} && \pdv[order={-\beta, -2}, sort-numerical=last]{f}{x,y} \\
+ \text{\inlinecode{sort-numerical=symbolic:}} &&
+ \pdv[order={\beta, 2}, sort-numerical=symbolic]{f}{x,y} && \pdv[order={\beta, -2}, sort-numerical=symbolic]{f}{x,y} && \pdv[order={-\beta, 2}, sort-numerical=symbolic]{f}{x,y} && \pdv[order={-\beta, -2}, sort-numerical=symbolic]{f}{x,y}
+\end{align*}
+
+\subsection{Reversing the sort algorithm} \label{ssec:sort-reverse}
+The reverse keys serves to reverse the sorting algorithms' ordering, providing more flexibility over the sorting method. If the default ordering of an algorithm is not preferred it may be reversed with the corresponding reverse key. The examples below showcase the reverse functionality. Note that \keyval*[index=false]{sort-method}{1 algorithm only} is also used to better demonstrate the reverse feature, where the algorithm is the one used in the reverse key.
+\begin{align*}
+ \text{\inlinecode{sort-abs-reverse=false:}} && \pdv[sort-method={abs}, sort-abs-reverse=false, order={2a, -3b}]{f}{x,y} &&
+ \text{\inlinecode{sort-abs-reverse=true:}} && \pdv[sort-method={abs}, sort-abs-reverse=true, order={2a, -3b}]{f}{x,y} \\
+ \text{\inlinecode{sort-number-reverse=false:}} && \pdv[sort-method={number}, sort-number-reverse=false, order={2a, -3b}]{f}{x,y} &&
+ \text{\inlinecode{sort-number-reverse=true:}} && \pdv[sort-method={number}, sort-number-reverse=true, order={2a, -3b}]{f}{x,y} \\
+ \text{\inlinecode{sort-sign-reverse=false:}} && \pdv[sort-method={sign}, sort-sign-reverse=false, order={a, -b}]{f}{x,y} &&
+ \text{\inlinecode{sort-sign-reverse=true:}} && \pdv[sort-method={sign}, sort-sign-reverse=true, order={a, -b}]{f}{x,y} \\
+ \text{\inlinecode{sort-symbol-reverse=false:}} && \pdv[sort-method={symbol}, sort-symbol-reverse=false, order={ab, c}]{f}{x,y} &&
+ \text{\inlinecode{sort-symbol-reverse=true:}} && \pdv[sort-method={symbol}, sort-symbol-reverse=true, order={ab, c}]{f}{x,y} \\
+ \text{\inlinecode{sort-lexical-reverse=false:}} && \pdv[sort-method={lexical}, sort-lexical-reverse=false, order={a, c, b}]{f}{x,y,z} &&
+ \text{\inlinecode{sort-lexical-reverse=true:}} && \pdv[sort-method={lexical}, sort-lexical-reverse=true, order={a, c, b}]{f}{x,y,z} \\
+\end{align*}
+
+%\subsection{Mixed order override}
+%In cases where the mixed order fails to be calculated or another form is preferred, then the mixed order override can be used
+%\begin{example}
+% \pdv[order={n+3k, n-k}]{f}{x,y} \\
+% \pdv[order={n+3k, n-k}, mixed-order={2(n+k)}]{f}{x,y}
+%\end{example}
+
+
\clearpage
\section{Miscellaneous}
+
+\subsection{Slashfrac}\label{ssec:slashfrac}
+\begin{function}*{\slashfrac}
+ \begin{syntax}
+ \oarg{scale}, \marg{numerator}, \marg{denominator}
+ \end{syntax}
+ The text-styled fraction, $\slashfrac{a}{b}$, is commonly used in text-mode. While \macro{\slashfrac}[\narg{a},\narg{b}] requires more keystrokes to write than \texttt{a/b}, a macro is needed for implementing text-styled derivatives.
- \subsection{Slashfrac}\label{ssec:slashfrac}
- \begin{function}*{\slashfrac}
- \begin{syntax}
- \oarg{scale}, \marg{numerator}, \marg{denominator}
- \end{syntax}
- A text-styled fraction i.e. $\slashfrac{a}{b}$, is commonly used in text-mode. While \macro{\slashfrac}[\narg{a},\narg{b}] is certainly longer to write than \texttt{a/b}, which only requires three keystrokes, but for the implementation of text-styled derivatives a macro for it is needed.
-
- \begin{argument}{1}
- The optional argument is the scaling parameter for the slash and takes the inputs as shown below. Leaving out \arg{1} sets the scaling parameter to \val{auto}
- \begin{example}
- \slashfrac[auto]{y_f}{x} \\
- \slashfrac[none]{y_f}{x} \\
- \slashfrac[big]{y_f}{x} \\
- \slashfrac[Big]{y_f}{x} \\
- \slashfrac[bigg]{y_f}{x} \\
- \slashfrac[Bigg]{y_f}{x}
- \end{example}
- This argument is subject to change, see \cref{consid:slashfrac_opt} for more information.
- \end{argument}
-
- \begin{argument}{2}
- Typesets the fraction's numerator.
- \end{argument}
-
- \begin{argument}{3}
- Typesets the fraction's denominator.
- \end{argument}
- \end{function}
-
-
- \clearpage
- \section{To do}\label{sec:todo}
-
- Entries marked with \cmark{} will be implemented in a future release specified in the entry. Entries marked with \xmark{} will not be implemented.
-
- \subsection{Future implementation}
- The list describes what \emph{will be added} to the package in a later release.
- \begin{todo}
- \item Implement the option to turn off the sorting of the terms in the mixed order. This could be made as a \val{draft} / \val{final} option. \\
- \answer{\cmark\xmark}{There could be an draft/final option for the package. But what is should turn off/on is harder to say.}
- \end{todo}
-
- %\subsection{Future changes}
- %The list describes what \emph{will be changed} in the package in a later release.
- %\begin{changes}
- % \item
- %\end{changes}
+ \begin{argument}{1}
+ The optional argument serves as the scaling parameter for the solidus and accepts the following inputs:
+ \begin{example}
+ \slashfrac{y_f}{x} \\
+ \slashfrac[auto]{y_f}{x} \\
+ \slashfrac[none]{y_f}{x} \\
+ \slashfrac[big]{y_f}{x} \\
+ \slashfrac[Big]{y_f}{x} \\
+ \slashfrac[bigg]{y_f}{x} \\
+ \slashfrac[Bigg]{y_f}{x}
+ \end{example}
+ Omitting \arg{1} sets the scaling parameter to \val{auto}.
+ %This argument is subject to change, see \cref{consid:slashfrac_opt} for more information.
+ \end{argument}
- \subsection{Future considerations}
- The list describes what \emph{might be changed or added} to the package in a later release.
- \begin{consideration}
- \item It can become rather cumbersome to read a derivative with a very long function. To ease this up, I am considering to add a switch that exchange the variable and the function arguments. But this might be against the \latex{} way of using arguments, which is the reason it have not been done and I would like feedback on it. \label{consid:Fun_Var_switch}
- %
- \item I am considering making the optional argument of \macro[index=false]{\slashfrac} into a \oarg{key=value} argument with something like \keyval[index=false]{scale}{\marg{scaling}}. \label{consid:slashfrac_opt} \\
- \answer{\cmark}{I want an key-value implementation like this in the future, but it will not be added in the next release.}
- \end{consideration}
+ \begin{argument}{2}
+ Typesets the fraction's numerator.
+ \end{argument}
+ \begin{argument}{3}
+ Typesets the fraction's denominator.
+ \end{argument}
+\end{function}
+
\clearpage
\addsec{Index}
- Numbers in bold refer to the page where the entry is defined.
-
- \printindex[option]
-
- \clearpage
-
- \printindex[macro]
+Numbers in bold refer to the page where the entry is defined.
+
+\printindex[option]
+
+\clearpage
+
+\printindex[macro]
\clearpage
\addsec{Change history}
+
+\setlength{\marginparwidth}{75pt}
+
+\begin{changelog}
+ \begin{change}[version=0.9, date=2019-07-21, beta=true]
+ \item First release of the package. The package is currently in a beta version.
+ \end{change}
+ \bigskip
+ \begin{change}[version=0.95, date=2019-09-18, beta=true]
+ \item \emph{Please ignore this version, since it contained the wrong \pkg{.sty} and \pkg{.pdf} files} \texttt{:(}.
+ %\item Second beta release of the package.
+ \item Removed the single token restriction on the infinitesimal since it was unnecessary.
+ \item Fixed documentation errors and typos.
+ \item Made minor fixes to the code.
+ \end{change}
+ \begin{change}[version=0.95b, date=2019-09-21, beta=true]
+ \item Contains the correct \pkg{.sty} and \pkg{.pdf} files \texttt{:)}.
+ \item Made one minor code fix.
+ \end{change}
+ \smallskip
+ \begin{change}[version=0.96, date=2019-12-22, beta=true]
+ \item Fixed the issue with double superscript for higher-order derivatives when the variable contained a superscript.
+ \end{change}
+ \smallskip
+ \begin{change}[version=0.97, date=2020-02-03, beta=true]
+ \item Fixed the argument specifier of \csverb{\__deriv_scale_big:nnnn} when it was used (it was used with \texttt{:nnnm}).
+ \end{change}
+ \smallskip
+ \begin{change}[version=0.98, date=2020-07-20, beta=true]
+ \item Fixed a bug related to the subscript argument caused by recent changes to the \pkg{xparse} package dated 2020-05-14 (the fix also works with earlier versions of \pkg{xparse}).
+ \end{change}
+ \smallskip
+ \begin{change}[version=1.0, date=2021-05-25, beta=false]
+ \item Added new options for derivatives.
+ \item Added new values for existing options.
+ \item Added new commands for writing differentials.
+ \item Changed the usage of \key[index=false]{style-inf}.
+ \item Changed the order argument to an option argument.
+ \item Adjusted default values for certain options.
+ \item Expanded math space keys to accept more general inputs.
+ \item Changed \cs{derivset} to define default options.
+ \item Merged the codes for ordinary and partial derivatives.
+ \item Removed the mixed order argument.
+ \item Removed the options \key[index=false]{misc-add-delims} and \key[index=false]{misc-remove-delims}.
+ \item Replaced the commands in \cref{sec:defvar} with new ones, as the old ones are deprecated.
+ \item Code clean-up and optimization.
+ \item Fixed code errors.
+ \item Fixed documentation errors.
+ \item Improved support for preventing options affecting nested derivatives/differentials.
+ \end{change}
+ \begin{change}[version=1.01, date=2021-05-28, beta=false]
+ \item Changed the default value of the option \key[index=false]{sep-end} due to issues.
+ \item Fixed code errors due to changes introduced in version 1.0 to the option \key[index=false]{style-inf}.
+ \item Fixed documentation errors.
+ \end{change}
+ \begin{change}[version=1.1, date=2021-06-03, beta=false]
+ \item Added package options to be used with \cs{usepackage}\oarg{options}\narg{derivative}.
+ \item Removed the hidden dependency on \pkg{unicode-math} when using \xetex{} or \luatex.
+ \item Replaced \cs{symup} with \cs{mathrm} for simplicity.
+ \item If \pkg{mleftright} is loaded, the default value of \key[index=false]{scale-auto} is set to \val{mleftmright}.
+ \end{change}
+ \begin{change}[version=1.2, date=2022-07-09, beta=false]
+ \item Code clean-up and optimisation that significantly speeds up usage of the package.
+ \item Added new a sorting algorithm \keyval[index=false]{sort-method}{lexical}, which sorts terms alphabetically.
+ \item Added the option \key[index=false]{sort-lexical-reverse} to reverse the alphabetical sorting order.
+ \item Added the option \key[index=false]{switch-sort} to enable/disable the sorting algorithm for the mixed order.
+ \item Fixed a bug related to \keyval[index=false]{scale-\meta{\dots}}{none} when the corresponding delimiter option contained a period.
+ \item Fixed documentation errors.
+ \end{change}
+ \begin{change}[version=1.3, date=2023-07-26, beta=false]
+ \item Code clean-up and minor optimisation.
+ \item Fixed documentation errors.
+ \item Updated documentation to include more examples.
+ \item Enhanced the algorithm that automatically calculates the mixed order to support fractional calculus.
+ \item Introduced a new argument, \targ{!}, for derivatives to enable shorthand notation.
+ \item Added new options \key[index=false]{style-inf-den}.
+ and \key[index=false]{style-inf-num} to set the infinitesimals in the denominator and numerator, respectively.
+ \item Added new options \key{style-var-/}, \key{style-var-!} and \key{style-var-/!} to set the style of the derivatives.
+ \item Added new options \key{scale-var-!} and \key{delims-var-!} for variable delimiters in shorthand mode.
+ \item Added new options \key{scale-eval-!} and \key{delims-eval-!} for evaluation delimiters in shorthand mode.
+ \end{change}
+\end{changelog}
+
- \setlength{\marginparwidth}{75pt}
-
- \begin{changelog}
- \begin{change}[version = 0.9, date = 2019-07-21, beta = true]
- \item First release of the package. The package is currently in a beta version.
- \end{change}
- \bigskip
- \begin{change}[version = 0.95, date = 2019-09-18, beta = true]
- \item \emph{Please ignore this version, since it contained the wrong \pkg{.sty} and \pkg{.pdf} files} \texttt{:(}.
- %\item Second beta release of the package.
- \item Removed the single token restriction of the infinitesimal since it made no sense.
- \item Fixed the documentation errors and typos.
- \item Minor fixes to the code.
- \end{change}
- \begin{change}[version = 0.95b, date = 2019-09-21, beta = true]
- \item Contains the correct \pkg{.sty} and \pkg{.pdf} files \texttt{:)}.
- \item One minor code fix.
- \end{change}
- \begin{change}[version = 0.96, date = 2019-12-22, beta = true]
- \item Fixed the double superscript issue for higher order derivative when the variable contained a superscript.
- \end{change}
- \smallskip
- \begin{change}[version = 0.97, date = 2020-02-03, beta = true]
- \item Fixed the argument specifier of {\small\verb|\__deriv_scale_big:nnnn|} when it was used (it was used with \texttt{:nnnm}).
- \end{change}
- \smallskip
- \begin{change}[version = 0.98, date = 2020-07-20, beta = true]
- \item Fixed a bug concerning the subscript argument due to recent changes to the \pkg{xparse} package dated 2020-05-14 (the fix works with earlier versions of \pkg{xparse} as well).
- \end{change}
- \begin{change}[version = 1.0, date = 2021-05-25, beta = false]
- \item Added new options for derivatives
- \item Added new values for existing options
- \item Added new commands to write differentials
- \item Changed usage of \key[index=false]{style-inf}
- \item Changed the order argument to an option argument
- \item Changed default values for some options
- \item Changed math space keys to accept more general inputs
- \item Changed \cs{derivset} to define default options
- \item Merged the codes for ordinary and partial derivatives
- \item Removed the mixed order argument
- \item Removed the options \key[index=false]{misc-add-delims} and \key[index=false]{misc-remove-delims}
- \item Replaced the commands in section 5 with new ones. Old ones no longer works.
- \item Code clean-up and optimization
- \item Fixed code errors
- \item Fixed documentation errors
- \item Enhanced support for preventing options effecting nested derivatives/differentials
- \end{change}
- \begin{change}[version = 1.01, date = 2021-05-28, beta = false]
- \item Changed the option \key[index=false]{sep-end} default value because it caused issues
- \item Fixed code errors due to changes introduced in version 1.0 to the option \key[index=false]{style-inf}
- \item Fixed documentation errors
- \end{change}
- \begin{change}[version = 1.1, date = 2021-06-03, beta = false]
- \item Added package options to be used in \cs{usepackage}\oarg{options}\narg{derivative}
- \item No longer secretly depends on \pkg{unicode-math} when using \xetex{} or \luatex
- \item The package no longer uses \cs{symup} which have been replaced with \cs{mathrm} for simplicity
- \item If \pkg{mleftright} is loaded then the default value of \key[index=false]{scale-auto} is \val{mleftmright}
- \end{change}
- \begin{change}[version = 1.2, date = 2022-07-09, beta = false]
- \item Code clean-up and optimisation that significantly speeds up usage of the package
- \item Added new sorting algorithm \keyval[index=false]{sort-method}{lexical} that sorts terms alphabetically
- \item Added the option \key[index=false]{sort-lexical-reverse}
- \item Added the option \key[index=false]{switch-sort} that turns on/off the sorting algorithm of the mixed order
- \item Fixed bug concerning \keyval[index=false]{scale-\meta{\dots}}{none} when the corresponding delimiter option contained a period.
- \item Fixed documentation errors
- \end{change}
- \end{changelog}
\end{document} \ No newline at end of file
diff --git a/macros/latex/contrib/ibrackets/README.md b/macros/latex/contrib/ibrackets/README.md
index 87ee53c951..edce0059f6 100644
--- a/macros/latex/contrib/ibrackets/README.md
+++ b/macros/latex/contrib/ibrackets/README.md
@@ -3,9 +3,9 @@
## Presentation
-This small package provides a new definition of brackets [ and ] as active characters
-to get correct blank spaces in mathematical mode when using for open intervals
-instead of parenthesis: ]-\infty, 0[ is equivalent to (-\infty, 0).
+This small package provides a new definition of square brackets `[` and `]` as active characters
+to get correct blank spaces in mathematical mode when using them for open intervals
+instead of parenthesis: `]-\infty, 0[` is equivalent to `(-\infty, 0)`.
## Installation
diff --git a/macros/latex/contrib/ibrackets/ibrackets.dtx b/macros/latex/contrib/ibrackets/ibrackets.dtx
index 8e78228310..15a3e050eb 100644
--- a/macros/latex/contrib/ibrackets/ibrackets.dtx
+++ b/macros/latex/contrib/ibrackets/ibrackets.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2022 by Antoine Missier <antoine.missier@ac-toulouse.fr>
+% Copyright (C) 2022-2023 by Antoine Missier <antoine.missier@ac-toulouse.fr>
%
% This file may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3 of this license
@@ -20,7 +20,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{ibrackets}
- [2022/12/26 v1.1 .dtx ibrackets file]
+ [2023/07/26 v1.2 .dtx ibrackets file]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -28,6 +28,7 @@
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[charter]{mathdesign}
+\usepackage{amsmath}
\usepackage{ibrackets}
\usepackage{sectsty}
\usepackage{xcolor}
@@ -81,6 +82,8 @@
% - A bug correction in the README.md file
% - Tiny changes in documentation}
%
+% \changes{v1.2}{2023/07/26}{Minor changes in the documentation}
+%
% \GetFileInfo{ibrackets.sty}
%
% \title{Intelligent brackets \\ The \textsf{ibrackets} package}
@@ -90,12 +93,12 @@
%
% \section{Introduction}
%
-% Open intervals are usually represented with parenthesis $(0, +\infty)$
-% but sometimes we find also
-% square brackets $]0, +\infty[$, for example in French mathematics.
-% When using these, spacing is often unsuitable,
-% e.g.\@ $x \in \mathclose{]} 0, +\infty\mathopen{[}$.
-% This small package redefines brackets symbols $[$ and $]$ for mathematical mode
+% Open intervals are commonly represented with parenthesis, e.g.\@ $(0, +\infty)$
+% but sometimes square brackets are used, especially in French mathematics: $]0, +\infty[$.
+% In that specific case, the space around the square brackets is often inappropriate,
+% as in the expression $x \in \mathclose{]} 0, +\infty\mathopen{[}$.
+% This small package address this issue and
+% redefines brackets symbols $[$ and $]$ for mathematical mode
% to get correct spacing: $x \in ]0, +\infty[$.
%
% \medskip
@@ -103,62 +106,65 @@
% and also in \textsf{frenchmath}~\cite{FR}
% since version 2.1, our previous redefinitions produce however incorrect spacing
% when the left bound of the interval begins with a sign - or +,
-% which was then interpreted as a binary operation. Thus blank
+% which was then interpreted as a binary operation. As a result, blank
% spaces surrounding the sign would have been too large.
-% This problem was pointed out by Jean-François Burnol, and
-% an easy solution, that has been documented, consisted to nest the operator
+% This issue was pointed out by Jean-François Burnol, and
+% an easy solution, that has been documented, consists of nesting the operator
% or the left bound within a pair of braces,
-% e.g.\@ |$x \in ]{-}\infty, 0]$|, or use |\left| and |\right|
+% e.g.\@ |$x \in ]{-}\infty, 0]$|, or using |\left| and |\right|
% or even |\mathopen{]}|.
%
% \medskip
-% Inspired by the \textsf{icomma} package~\cite{ICOMMA} of Walter Schmidt, we now provide
-% an improved bracket definition that works correctly without
-% these pairs of curly brackets.
+% Inspired by Walter Schmidt's \textsf{icomma} package~\cite{ICOMMA}, we now provide
+% an improved bracket definition that works correctly without the need for
+% these pairs of braces.
%
% \medskip
-% Let's also mention other approaches e.g.\@ |\DeclarePairedDelimiters|, a macro from
+% Let's also mention other approaches, such as the |\DeclarePairedDelimiters| macro from
% the \textsf{mathtools} package~\cite{TOOL}, or
-% the \textsf{interval} package~\cite{INT} with his
-% |\interval| macro. Nevertheless our solution is lighter.
+% the \textsf{interval} package~\cite{INT} with its
+% |\interval| macro. However our solution is more lightweight.
%
% \section{Usage}
-% You just have to type intervals in an easy way:
-% |$x\in]0,\pi[\cup]2\pi, 3\pi[$|
-% produce
-% \[ x\in]0, \pi[\cup]2\pi, 3\pi[ \mbox{\quad with \textsf{ibrackets}}, \]
-% instead of
-% \[ x\in\mathclose{]} 0,\pi \mathopen{[}\cup\mathclose{]} 2\pi, 3\pi\mathopen{[}
-% \mbox{\quad without \textsf{ibrackets}}.
-% \]
-%
-% Generally $[$ and $]$ symbols are not defined anymore as delimiters,
-% but as ordinary characters.
-% Thereby a line break could occur between the two square brackets, but
-% it is always possible to transform them
-% into delimiters with |\left| and |\right|.
+% With the \textsf{ibrackets} package, you can easily type intervals. For example the code
+% |$x\in]0,\pi[\cup]2\pi, 3\pi[$| yields
+% \begin{align*}
+% x\in]0, \pi[\cup]2\pi, 3\pi[ &\mbox{\quad with \textsf{ibrackets}}, \\
+% \text{instead of \quad}
+% x\in\mathclose{]} 0,\pi \mathopen{[}\cup\mathclose{]} 2\pi, 3\pi\mathopen{[}
+% &\mbox{\quad without \textsf{ibrackets}}.
+% \end{align*}
+%
+% For the example in the introduction the spacing is now correct with the following simple code:
+% |$x \in ]-\infty, 0]$|, which gives $x \in ]-\infty, 0]$.
%
% \medskip
-% The problem of a sign following the first bracket is solved with this package,
-% so the example in the introduction is simply obtained with |$x \in ]-\infty, 0]$|
-% which gives $x \in ]-\infty, 0]$.
+% In \textsf{ibrackets}, the symbols $[$ and $]$
+% and are not defined by default as delimiters.
+% Therefore, a line break could occur between the two brackets. However,
+% it is always possible to transform them
+% into delimiters using |\left| and |\right|.
%
% \medskip
-% \emph{However, you don't have to leave a space between the first bracket and the sign}: e.g.\@
-% |$x \in ] -\infty, 0]$| yields $x \in ] -\infty, 0]$ with bad spacing around the
-% minus sign.
-% Contrariwise, when you want to write algebra on intervals then
-% \emph{you must leave a blank space between the second bracket and the} +/- \emph{operations},
-% e.g.\@ |$[a, b] + [c, d]$| yields $[a, b] + [c, d]$
-% but |$[a, b]+ [c, d]$| yields $[a, b]+ [c, d]$.
-% To summarize the new behavior of a bracket: it is an ordinary character,
-% but an open delimiter when it is immediately followed by a + or - character.
+% Actually, brackets are set as ``active'' characters,
+% behaving like ordinary characters in most cases.
+% However, when a bracket is \emph{immediately} followed by a + or - character,
+% it becomes an open delimiter. Therefore, when the left bound contains an operator sign,
+% \emph{you don't have to leave a space between the first bracket and the sign},
+% otherwise, the spaces surrounding the operator will be too large.
+% For example if you write |$x \in ] -\infty, 0]$| it yields $x \in ] -\infty, 0]$
+% instead of $x \in ]-\infty, 0]$.
+% Conversely, when dealing with algebraic expressions involving intervals,
+% \emph{you must leave a space between the second bracket and the} +/- \emph{operations}
+% to maintain proper spacing.
+% For instance |$[a, b] + [c, d]$| yields $[a, b] + [c, d]$
+% while |$[a, b]+ [c, d]$| would yield $[a, b]+ [c, d]$.
%
% \StopEventually{}
%
% \section{Implementation}
-% At |\begin{document}|, we memorize the "\mathcode" of the original brackets,
-% in the |\math...bracket| macros, and we make the brackets in math mode active:
+% At |\begin{document}|, we store the original "\mathcode" of the brackets,
+% in the |\math...bracket| macros, and then we make the brackets active in math mode.
% \begin{macrocode}
\AtBeginDocument{%
\mathchardef\mathopenbracket\mathcode`[%
@@ -168,10 +174,10 @@
}
% \end{macrocode}
-% The active brackets check the next input character. If this is a - or a +,
-% the active brackets return |\mathopen| with the saved |\math...bracket|
-% so that no space will be added after the bracket;
-% otherwise, |\mathord\math...bracket| is returned :
+% The active brackets check the next input character. If the next character is a - or a +,
+% the active brackets return |\mathopen| with the saved |\math...bracket|,
+% so that no space will be added after the bracket.
+% Otherwise, |\mathord\math...bracket| is returned.
% \begin{macrocode}
{\catcode`[=\active
\gdef[{\futurelet\@next\sm@rtopenbracket}}
@@ -188,18 +194,18 @@
\mathord\fi\fi \mathclosebracket}
% \end{macrocode}
% We could have use the internal \TeX\ command |\@ifnextchar|
-% to skip blank spaces after the bracket, and look if there is a + or - after,
-% but then it would become tricky when you really want
+% to skip blank spaces after the bracket and look if there is a + or - after,
+% but then it would become tricky when you really want
% to follow an interval with an operation plus or minus.
%
% \begin{thebibliography}{5}
% % \begin{raggedright}
-% \bibitem{MIS} \emph{\textsf{mismath} -- Miscellaneus mathematical macros}.
+% \bibitem{MIS} \emph{\textsf{mismath} -- Miscellaneous mathematical macros}.
% Antoine Missier, CTAN, v2.0 2022/11/11.
% \bibitem{FR} \emph{L'extension \textsf{frenchmath}}. Antoine Missier, CTAN, v2.2 2022/12/15.
% \bibitem{ICOMMA} \emph{The \textsf{icomma} package for \LaTeXe}.
% Walter Schmidt, CTAN, v2.0 2002/03/10.
-% \bibitem{TOOL} \emph{The \textsf{mathtool} package}. Morten Høgholm, Lars Madsen, CTAN,
+% \bibitem{TOOL} \emph{The \textsf{mathtools} package}. Morten Høgholm, Lars Madsen, CTAN,
% v1.21 2018/01/08.
% \bibitem{INT} \emph{The \textsf{interval} package}. Lars Madsen, CTAN,
% v0.4 2019/03/06.
diff --git a/macros/latex/contrib/ibrackets/ibrackets.ins b/macros/latex/contrib/ibrackets/ibrackets.ins
index 05e63feb5b..4f386997ef 100644
--- a/macros/latex/contrib/ibrackets/ibrackets.ins
+++ b/macros/latex/contrib/ibrackets/ibrackets.ins
@@ -1,5 +1,5 @@
%%
-%% Copyright (C) 2022 by Antoine Missier <antoine.missier@ac-toulouse.fr>
+%% Copyright (C) 2022-2023 by Antoine Missier <antoine.missier@ac-toulouse.fr>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3 of this license
@@ -21,7 +21,7 @@
This is a generated file.
-Copyright (C) 2022 by Antoine Missier <antoine.missier@ac-toulouse.fr>
+Copyright (C) 2022-2023 by Antoine Missier <antoine.missier@ac-toulouse.fr>
This file may be distributed and/or modified under the conditions of
the LaTeX Project Public License, either version 1.3 of this license
diff --git a/macros/latex/contrib/ibrackets/ibrackets.pdf b/macros/latex/contrib/ibrackets/ibrackets.pdf
index 4fa49c35e9..7d81f70f29 100644
--- a/macros/latex/contrib/ibrackets/ibrackets.pdf
+++ b/macros/latex/contrib/ibrackets/ibrackets.pdf
Binary files differ
diff --git a/macros/latex/contrib/siunitx/CHANGELOG.md b/macros/latex/contrib/siunitx/CHANGELOG.md
index cbd19e3d0d..003c810d2b 100644
--- a/macros/latex/contrib/siunitx/CHANGELOG.md
+++ b/macros/latex/contrib/siunitx/CHANGELOG.md
@@ -7,6 +7,13 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
## [Unreleased]
+## [v3.2.9] - 2023-07-26
+
+### Fixed
+
+- Correct alignment of uncertainties in tables (see issue
+ [\#678](https://github.com/josephwright/siunitx/issues/678))
+
## [v3.2.8] - 2023-07-25
### Fixed
@@ -1921,7 +1928,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
### Added
- First public testing release (as `si`)
-[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.2.8...HEAD
+[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.2.9...HEAD
+[v3.2.9]: https://github.com/josephwright/siunitx/compare/v3.2.8...v3.2.9
[v3.2.8]: https://github.com/josephwright/siunitx/compare/v3.2.7...v3.2.8
[v3.2.7]: https://github.com/josephwright/siunitx/compare/v3.2.6...v3.2.7
[v3.2.6]: https://github.com/josephwright/siunitx/compare/v3.2.5...v3.2.6
diff --git a/macros/latex/contrib/siunitx/siunitx-code.pdf b/macros/latex/contrib/siunitx/siunitx-code.pdf
index bdd6dfe01a..8a2b8e5992 100644
--- a/macros/latex/contrib/siunitx/siunitx-code.pdf
+++ b/macros/latex/contrib/siunitx/siunitx-code.pdf
Binary files differ
diff --git a/macros/latex/contrib/siunitx/siunitx-table.dtx b/macros/latex/contrib/siunitx/siunitx-table.dtx
index 6e81d1b7c5..823a20edef 100644
--- a/macros/latex/contrib/siunitx/siunitx-table.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-table.dtx
@@ -1493,10 +1493,9 @@
\hbox_set_to_wd:Nnn \l_@@_uncert_box
{ \box_wd:N \l_@@_tmp_box }
{
- \siunitx_print_number:n { { } #4 }
+ \siunitx_print_number:n { { } #4 { } }
\@@_fil:
- \tl_if_blank:nTF {#5}
- { { } }
+ \tl_if_blank:nF {#5}
{ \siunitx_print_number:n {#5} }
}
\@@_print_format_auxix:w
@@ -1513,7 +1512,7 @@
+ \box_wd:N \l_@@_tmp_box
}
{
- \hbox_unpack:N \l_@@_uncert_box
+ \box_use:N \l_@@_uncert_box
\tl_if_blank:nF {#2#5}
{ \siunitx_print_number:n {#4#5} }
\@@_fil:
diff --git a/macros/latex/contrib/siunitx/siunitx.dtx b/macros/latex/contrib/siunitx/siunitx.dtx
index 75b83bf182..d33a8c24b2 100644
--- a/macros/latex/contrib/siunitx/siunitx.dtx
+++ b/macros/latex/contrib/siunitx/siunitx.dtx
@@ -122,7 +122,7 @@
%
% Identify the package and give the over all version information.
% \begin{macrocode}
-\ProvidesExplPackage {siunitx} {2023-07-25} {3.2.8}
+\ProvidesExplPackage {siunitx} {2023-07-26} {3.2.9}
{A comprehensive (SI) units package}
% \end{macrocode}
%
diff --git a/macros/latex/contrib/siunitx/siunitx.pdf b/macros/latex/contrib/siunitx/siunitx.pdf
index 3d9dd8b90c..5b832eb7e1 100644
--- a/macros/latex/contrib/siunitx/siunitx.pdf
+++ b/macros/latex/contrib/siunitx/siunitx.pdf
Binary files differ
diff --git a/macros/latex/contrib/tidyres/README.md b/macros/latex/contrib/tidyres/README.md
index d9a29c957c..93d7fb3c17 100644
--- a/macros/latex/contrib/tidyres/README.md
+++ b/macros/latex/contrib/tidyres/README.md
@@ -11,6 +11,12 @@ You may contact me via Github.
+#### Version
+
+``Version 2.0.0`` (July 27, 2023)
+
+
+
#### Basic Functions
This `tidyres` package aims to provide users with a simple interface to create multi-column formal resume.
diff --git a/macros/latex/contrib/tidyres/tidyres-doc.pdf b/macros/latex/contrib/tidyres/tidyres-doc.pdf
index 9fa4ac0ed0..a15f8c83be 100644
--- a/macros/latex/contrib/tidyres/tidyres-doc.pdf
+++ b/macros/latex/contrib/tidyres/tidyres-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/tidyres/tidyres-doc.tex b/macros/latex/contrib/tidyres/tidyres-doc.tex
index 0fad9a2a69..711efcbad2 100644
--- a/macros/latex/contrib/tidyres/tidyres-doc.tex
+++ b/macros/latex/contrib/tidyres/tidyres-doc.tex
@@ -1,45 +1,16 @@
\documentclass[a4paper,10pt]{article}
% packages %
+\usepackage{tidyres}
\usepackage[margin=1in]{geometry}
-\usepackage{amsmath,amssymb}
-\usepackage[dvipsnames]{xcolor}
-\usepackage{hologo}
-\usepackage[hidelinks]{hyperref}
\usepackage[type={CC},modifier={by},version={4.0}]{doclicense}
-\usepackage{tidyres}
\usepackage{cprotect}
-\usepackage{listings}
-\usepackage[most]{tcolorbox}
\usepackage{changepage}
\hypersetup{colorlinks=True,allcolors=cyan}
\renewcommand{\contentsname}{\centering Table of Contents}
% info %
\title{{\tt tidyres} for Tidy Formal Resume}
\author{\itshape Yifan Liang}
-\date{v1.0.0 2023-02-10}
-
-\definecolor{codegreen}{rgb}{0,0.6,0}
-\definecolor{codegray}{rgb}{0.5,0.5,0.5}
-\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
-\lstdefinestyle{mystyle}{
- language=[LaTeX]{TeX},
- backgroundcolor=\color{backcolour},
- commentstyle=\color{codegreen},
- numberstyle=\small\color{codegray},
- basicstyle=\ttfamily\normalsize,
- breakatwhitespace=false,
- breaklines=true,
- keepspaces=true,
- numbers=left,
- numbersep=5pt,
- showspaces=false,
- showstringspaces=false,
- showtabs=false,
- tabsize=2,
- texcsstyle=*\color{blue},
-}
-\lstset{style=mystyle}
-
+\date{v2.0.0 2023-07-27}
% document %
\begin{document}
@@ -64,7 +35,10 @@ This {\tt tidyres} package aims to provide users with a simple interface to crea
Users can also incorporate other packages such as \verb+enumitem+ to make bullet point in the resume.
-\vspace{1cm}
+\subsection{Notes for v2.0.0}
+As of July 27, 2023, {\tt tidyres} requires the users to use \hologo{XeLaTeX} or \hologo{LuaLaTeX} to compile as the additional customization feature on font is added, which loads the {\tt fontspec} package.\\
+\\
+Additionally, the \verb+\restitle+ command now accepts key values to make the title for your resume.
\subsection{License}
This work is licensed under \href{https://creativecommons.org/licenses/by/4.0/}{Creative Commons "Attribution 4.0 International" license}.\\
@@ -82,9 +56,9 @@ For detailed information about the license, please visit the Creative Commons' w
For a typical resume, depending on the font style and font size you use, it is suggested that you set the page margin between {\bf 0.5 inch} to {\bf 1 inch}.\\
~\\
You can set the margin with the {\tt geometry} package using the following code:
-\begin{lstlisting}
+\begin{codebox}[title=Page Margin]
\usepackage[margin=0.5in]{geometry}
-\end{lstlisting}
+\end{codebox}
\vspace{1cm}
@@ -93,10 +67,10 @@ Typically, a resume would use {\bf 9pt} to {\bf 11pt} font.\\
~\\
I would suggest using the {\tt extarticle} class to set the font size globally:
-\begin{lstlisting}
+\begin{codebox}[title=Font Size]
\documentclass[9pt]{extarticle}
% The extarticle class supports at least 8pt font size.
-\end{lstlisting}
+\end{codebox}
\newpage
\section{Resume Title}
@@ -105,9 +79,16 @@ I would suggest using the {\tt extarticle} class to set the font size globally:
The \verb+\restitle+ command helps user to print the title of the resume, which contains key information such as name, location, email, phone, and Linkedin ID.\\
\subsection{Example Code}
-\begin{lstlisting}
-\restitle{My Name}{Location}{Email}{Phone}{LinkedinID}{http://linkedin.com}
-\end{lstlisting}
+\begin{codebox}[title=Resume Title Example Code]
+\restitle{
+ name=John Doe,
+ location=New York,
+ email=john.doe@gmail.com,
+ phone=(646) 111-1234,
+ linkedinid=johndoe,
+ linkedinurl=http://linkedin.com
+}
+\end{codebox}
\vspace{1cm}
@@ -116,7 +97,14 @@ The \verb+\restitle+ command helps user to print the title of the resume, which
\vspace{1cm}
\begin{tcolorbox}[standard jigsaw,opacityback=0.1,colback=gray,boxrule=0.5pt]
-\restitle{My Name}{Location}{Email}{Phone}{ID}{http://linkedin.com}
+\restitle{
+ name=John Doe,
+ location=New York,
+ email=john.doe@gmail.com,
+ phone=(646) 111-1234,
+ linkedinid=johndoe,
+ linkedinurl=http://linkedin.com
+}
\end{tcolorbox}
\vspace{1cm}
@@ -124,9 +112,9 @@ The \verb+\restitle+ command helps user to print the title of the resume, which
\subsection{Note}
The hyperlink color of Linkedin can be set via {\tt hyperref} package. If you wish to set it in black, you may use the following code:
-\begin{lstlisting}
+\begin{codebox}[title=Color of Hyperlink]
\usepackage[hidelinks]{hyperref}
-\end{lstlisting}
+\end{codebox}
\newpage
@@ -142,7 +130,7 @@ The \verb+\ressep+ command separates the experience/event within a section.
\newpage
\subsection{Example Code}
-\begin{lstlisting}
+\begin{codebox}[title=Resume Section Example Code]
\begin{ressection}[Education]
{\bf ABC University}, {\sl College of Arts \& Science}, New York, NY
\hfill
@@ -167,7 +155,7 @@ The \verb+\ressep+ command separates the experience/event within a section.
\item Honors \& Societies: XYZ Poem Society
\end{enumerate}
\end{ressection}
-\end{lstlisting}
+\end{codebox}
\vspace{1cm}
@@ -207,4 +195,6 @@ The \verb+\ressep+ command separates the experience/event within a section.
\end{tcolorbox}
\end{adjustwidth}
-\end{document} \ No newline at end of file
+\end{document}
+
+%%% Last Update: 2023-07-27 %%% \ No newline at end of file
diff --git a/macros/latex/contrib/tidyres/tidyres.sty b/macros/latex/contrib/tidyres/tidyres.sty
index 45860b3f4a..b38f12ed9b 100644
--- a/macros/latex/contrib/tidyres/tidyres.sty
+++ b/macros/latex/contrib/tidyres/tidyres.sty
@@ -1,17 +1,20 @@
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tidyres}[2023-02-10 v1.0.0]
+\ProvidesPackage{tidyres}[2023-07-27 v2.0.0]
% packages %
\RequirePackage{paracol}
\RequirePackage{tabularray}
-\RequirePackage{enumitem}
-\RequirePackage{amsmath}
-\RequirePackage{amssymb}
\RequirePackage[dvipsnames]{xcolor}
-\RequirePackage{hologo}
\RequirePackage{setspace}
\RequirePackage[hidelinks]{hyperref}
+\RequirePackage{minted}
+\RequirePackage[most]{tcolorbox}
+\RequirePackage{enumitem}
+\RequirePackage{amsmath,amssymb}
+\RequirePackage{hologo}
\RequirePackage{fontawesome}
+\RequirePackage{expkv-def,expkv-cs}
+
% format %
\setlength{\parindent}{0pt}
@@ -21,33 +24,139 @@
\linespread{1.25}
\pagestyle{empty}
-% font %
-% \newfontfamily\textcm{CMU Serif}
+%%% font %%%
+\RequirePackage{fontspec}
+\RequirePackage{unicode-math}
+\setmainfont{TeX Gyre Termes}
+\setsansfont{TeX Gyre Heros}
+\setmonofont{NewComputerModernMono10}
+\setmathfont{NewComputerModernMath}
+\newfontfamily\textcm{NewComputerModern10}
+\newfontfamily\texttm{TeX Gyre Termes}
+\newfontfamily\texthr{TeX Gyre Heros}
+\unimathsetup{math-style=TeX, bold-style=TeX}
% definition %
-\newcommand{\restitle}[6]
-{\begin{spacing}{1.15}
+\ekvdefinekeys{restitlekey}{
+ store name=\restitlekey@name,
+ initial name={Name},
+ store location=\restitlekey@location,
+ initial location={Location},
+ store email=\restitlekey@email,
+ initial email={Email},
+ store phone=\restitlekey@phone,
+ initial phone={Phone},
+ store linkedinid=\restitlekey@linkedinid,
+ initial linkedinid={Linkedin ID},
+ store linkedinurl=\restitlekey@linkedinurl,
+ initial linkedinurl={http://linkedin.com},
+}
+\ekvsetdef\restitlekeyset{restitlekey}
+\newcommand{\restitle}[1]
+{
+\restitlekeyset{#1}
+\begin{spacing}{1.15}
\begin{tblr}{
- column{1} = {l},
- column{2} = {r},
- column{3} = {l},
- cell{1}{1} = {r=4}{},
- colspec = {X[5]X[2.8]X[2.2]}
-}
-\hspace{6mm}{\fontsize{22}{22}\selectfont \sc #1}
-& \faLocationArrow
-& #2 \\
-& \faAt
-& {\sl #3} \\
-& \faPhone
-& #4 \\
-& \faLinkedinSquare
-& \href{#6}{Linkedin - {\sl #5}}\\
-\hline
-\end{tblr}\end{spacing}\vspace{7mm}}
+ column{1} = {l},
+ column{2} = {r},
+ column{3} = {l},
+ cell{1}{1} = {r=4}{},
+ colspec = {X[5]X[2.5]X[2.5]},
+ hline{Z} = {1}{1-Z}{0em},
+ hline{Z} = {2}{1-Z}{0.05em}
+}
+ \hspace{6mm}{\fontsize{22}{22}\selectfont \sc \restitlekey@name}
+ & \faLocationArrow
+ & \restitlekey@location \\
+ & \faAt
+ & {\sl \restitlekey@email} \\
+ & \faPhone
+ & \restitlekey@phone \\
+ & \faLinkedinSquare
+ & \href{\restitlekey@linkedinurl}{Linkedin - {\sl \restitlekey@linkedinid}}
+\end{tblr}
+\end{spacing}
+\vspace{5mm}
+}
\newenvironment{ressection}[2][Section]
-{\begin{paracol}{2} {\sc #1} \switchcolumn {#2}}
-{\end{paracol}\vspace{5mm}}
+{
+ \begin{paracol}{2}
+ {\sc #1}
+ \switchcolumn
+ {#2}
+}
+{
+ \end{paracol}
+ \vspace{5mm}
+}
+
+\newcommand{\ressep}[0]{\vspace{2mm}}
+
+
+
+
+
+%%% tcolorbox for documentation purposes %%%
+\newtcbox{\boxedtitle}[1][gray]{
+ on line,
+ arc=3pt,
+ colback=#1!95!white,
+ colframe=#1!95!white,
+ boxrule=1pt,
+ boxsep=0pt,
+ left=3pt,
+ right=3pt,
+ top=3pt,
+ bottom=3pt
+}
+\renewcommand{\theFancyVerbLine}{\rmfamily\textcolor{gray}{\arabic{FancyVerbLine}}}
+\tcbuselibrary{minted}
+\ekvdefinekeys{codeboxkey}{
+ store title=\codeboxkey@title,
+ initial title={},
+ store color=\codeboxkey@color,
+ initial color=LimeGreen
+}
+\ekvsetdef\codeboxkeyset{codeboxkey}
+\newenvironment{codebox}[1][]{
+ \codeboxkeyset{#1}
+ \tcblisting{
+ listing engine=minted,
+ minted style=manni,
+ minted language=tex,
+ minted options={
+ fontsize=\small,
+ breaklines,
+ autogobble,
+ linenos,
+ numbersep=0.25cm,
+ escapeinside=||
+ },
+ enhanced jigsaw,
+ breakable,
+ listing only,
+ left=0.75cm,
+ lefttitle=0.3cm,
+ arc=5pt,
+ boxrule=1pt,
+ colback=\codeboxkey@color!1!white,
+ colframe=\codeboxkey@color!95!black,
+ top=0cm,
+ bottom=0cm,
+ title={\texthr \boxedtitle[\codeboxkey@color]{\bfseries\textcolor{white}{CODE}} \textcolor{\codeboxkey@color}{\codeboxkey@title}},
+ toptitle=0.5ex,
+ bottomtitle=0.5ex,
+ titlerule=0ex,
+ colbacktitle=\codeboxkey@color!10!white,
+ overlay={\begin{tcbclipinterior}
+ \fill[\codeboxkey@color!5!white] (frame.south west) rectangle ([xshift=0.75cm]frame.north west);
+ \end{tcbclipinterior}
+ }
+ }
+}
+{
+ \endtcblisting
+}
-\newcommand{\ressep}[0]{\vspace{2mm}} \ No newline at end of file
+%%% Last Update: 2023-07-27 %%%