summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/contrib/derivative/README.md4
-rw-r--r--macros/latex/contrib/derivative/derivative.pdfbin180462 -> 183631 bytes
-rw-r--r--macros/latex/contrib/derivative/derivative.sty770
-rw-r--r--macros/latex/contrib/derivative/derivative.tex114
-rw-r--r--macros/latex/contrib/fixdif/fixdif.dtx78
-rw-r--r--macros/latex/contrib/fixdif/fixdif.pdfbin324100 -> 314029 bytes
-rw-r--r--macros/latex/contrib/flexipage/README.txt20
-rw-r--r--macros/latex/contrib/flexipage/Test-flexipage.pdfbin0 -> 57617 bytes
-rw-r--r--macros/latex/contrib/flexipage/Test-flexipage.tex141
-rw-r--r--macros/latex/contrib/flexipage/flexipage.dtx818
-rw-r--r--macros/latex/contrib/flexipage/flexipage.ins64
-rw-r--r--macros/latex/contrib/flexipage/flexipage.pdfbin0 -> 267815 bytes
-rw-r--r--macros/latex/contrib/inlinelabel/README.md5
-rw-r--r--macros/latex/contrib/inlinelabel/inlinelabel.pdfbin159832 -> 159742 bytes
-rw-r--r--macros/latex/contrib/inlinelabel/inlinelabel.sty2
-rw-r--r--macros/latex/contrib/inlinelabel/inlinelabel.tex373
-rw-r--r--macros/latex/contrib/jpneduenumerate/README.md25
-rw-r--r--macros/latex/contrib/jpneduenumerate/jpneduenumerate-en.md114
-rw-r--r--macros/latex/contrib/jpneduenumerate/jpneduenumerate-ja.md114
-rw-r--r--macros/latex/contrib/jpneduenumerate/jpneduenumerate.pdfbin0 -> 153607 bytes
-rw-r--r--macros/latex/contrib/jpneduenumerate/jpneduenumerate.sty177
-rw-r--r--macros/latex/contrib/jpneduenumerate/jpneduenumerate.tex599
-rw-r--r--macros/latex/contrib/rescansync/README24
-rw-r--r--macros/latex/contrib/rescansync/rescansync.pdfbin0 -> 378207 bytes
-rw-r--r--macros/latex/contrib/rescansync/rescansync.sty145
-rw-r--r--macros/latex/contrib/rescansync/rescansync.tex162
-rw-r--r--macros/latex/contrib/sidenotesplus/README.txt5
-rw-r--r--macros/latex/contrib/sidenotesplus/sidenotesplus.dtx55
-rw-r--r--macros/latex/contrib/sidenotesplus/sidenotesplus.pdfbin213799 -> 233491 bytes
-rw-r--r--macros/latex/contrib/sidenotesplus/tests-sidenoteplus.pdfbin218699 -> 218822 bytes
30 files changed, 3034 insertions, 775 deletions
diff --git a/macros/latex/contrib/derivative/README.md b/macros/latex/contrib/derivative/README.md
index 9b8aec07fe..d9dc312780 100644
--- a/macros/latex/contrib/derivative/README.md
+++ b/macros/latex/contrib/derivative/README.md
@@ -1,4 +1,4 @@
-## README for derivative package v1.1 dated 2021-06-03
+## README for derivative package v1.2 dated 2022-07-09
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-2021 Simon Jensen
+Copyright 2019-2022 Simon Jensen
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/derivative/derivative.pdf b/macros/latex/contrib/derivative/derivative.pdf
index 606ae17783..9e4203f7b6 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 a26080b431..4e9a8308c2 100644
--- a/macros/latex/contrib/derivative/derivative.sty
+++ b/macros/latex/contrib/derivative/derivative.sty
@@ -1,5 +1,5 @@
% derivative.sty
-% Copyright 2019-2021 Simon Jensen
+% Copyright 2019-2022 Simon Jensen
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -15,9 +15,9 @@
\NeedsTeXFormat{LaTeX2e}
-\RequirePackage{expl3,xparse}[2018/05/09]
+\RequirePackage{expl3,xparse}[2021/11/07]
\RequirePackage{l3keys2e}
-\ProvidesExplPackage{derivative}{2021/06/03}{1.1}{Nice and easy derivatives and differentials for LaTeX}
+\ProvidesExplPackage{derivative}{2022/07/09}{1.2}{Nice and easy derivatives and differentials for LaTeX}
\bool_new:N \l__deriv_pkg_italic_bool
\bool_new:N \l__deriv_pkg_upright_bool
@@ -25,34 +25,34 @@
\keys_define:nn { deriv/pkg }
{
italic .choice:,
+ italic .usage:n = { load },
italic .default:n = { true },
italic / true .code:n =
- {
- \bool_set_true:N \l__deriv_pkg_italic_bool
- \bool_set_false:N \l__deriv_pkg_upright_bool
- },
+ {
+ \bool_set_true:N \l__deriv_pkg_italic_bool
+ \bool_set_false:N \l__deriv_pkg_upright_bool
+ },
italic / false .code:n =
- {
- \bool_set_false:N \l__deriv_pkg_italic_bool
- \bool_set_true:N \l__deriv_pkg_upright_bool
- },
- italic / unknown .code:n =
- { \msg_error:nnx { deriv } { boolean-values-only } \l_keys_key_str },
-
+ {
+ \bool_set_false:N \l__deriv_pkg_italic_bool
+ \bool_set_true:N \l__deriv_pkg_upright_bool
+ },
+ italic / unknown .code:n = { \msg_error:nnx { deriv } { boolean-values-only } \l_keys_key_str },
+
upright .choice:,
+ upright .usage:n = { load },
upright .default:n = { true },
upright / true .code:n =
- {
- \bool_set_true:N \l__deriv_pkg_upright_bool
- \bool_set_false:N \l__deriv_pkg_italic_bool
- },
+ {
+ \bool_set_true:N \l__deriv_pkg_upright_bool
+ \bool_set_false:N \l__deriv_pkg_italic_bool
+ },
upright / false .code:n =
- {
- \bool_set_false:N \l__deriv_pkg_upright_bool
- \bool_set_true:N \l__deriv_pkg_italic_bool
- },
- upright / unknown .code:n =
- { \msg_error:nnx { deriv } { boolean-values-only } \l_keys_key_str },
+ {
+ \bool_set_false:N \l__deriv_pkg_upright_bool
+ \bool_set_true:N \l__deriv_pkg_italic_bool
+ },
+ upright / unknown .code:n = { \msg_error:nnx { deriv } { boolean-values-only } \l_keys_key_str },
upright .initial:n = true,
}
@@ -60,33 +60,15 @@
%%%%% Useful conditionals %%%%%
-\prg_new_conditional:Npnn \__deriv_if_pkg:n #1 { p, TF }
-{
- \@ifpackageloaded{unicode-math}
- { \prg_return_true: }
- { \prg_return_false: }
-}
-
-\prg_new_conditional:Npnn \__deriv_if_novalue:n #1 { T , F , TF }
+\prg_new_conditional:Npnn \__deriv_if_value:n #1 { T, TF }
{
\tl_if_novalue:nTF {#1}
- { \prg_return_true: }
+ { \prg_return_false: }
{
\tl_if_blank:nTF {#1}
- { \prg_return_true: }
- { \prg_return_false: }
- }
-}
-
-\prg_new_conditional:Npnn \__deriv_if_novalue_and:nn #1 #2 { F, TF }
-{
- \__deriv_if_novalue:nTF {#1}
- {
- \__deriv_if_novalue:nTF {#2}
- { \prg_return_true: }
- { \prg_return_false: }
+ { \prg_return_false: }
+ { \prg_return_true: }
}
- { \prg_return_false: }
}
\prg_new_conditional:Npnn \__deriv_show_order:N #1 { T, TF }
@@ -96,67 +78,35 @@
{ \prg_return_true: }
}
-\cs_new:Npn \__deriv_case:n #1
-{ \exp:w \__deriv_case_begin:nTF {#1} { } { } }
-
-\cs_new:Npn \__deriv_case:nT #1#2
-{ \exp:w \__deriv_case_begin:nTF {#1} {#2} { } }
-
-\cs_new:Npn \__deriv_case:nF #1#2
-{ \exp:w \__deriv_case_begin:nTF {#1} { } {#2} }
-
-\cs_new:Npn \__deriv_case:nTF #1
-{ \exp:w \__deriv_case_begin:nTF {#1} }
-
-\cs_new:Npn \__deriv_case_begin:nTF #1#2#3
-{ \__deriv_case:w #1 \c_true_bool { } \q_mark {#2} \q_mark {#3} \q_stop }
-
-\cs_new:Npn \__deriv_case:w #1#2
-{
- \bool_if:nTF {#1}
- { \__deriv_case_end:nw {#2} }
- { \__deriv_case:w }
-}
-
-\cs_new:Npn \__deriv_case_end:nw #1#2#3 \q_mark #4#5 \q_stop
-{ \exp_end: #1 #4 }
-
%%%%% Variables: derivatives %%%%%
-\tl_new:N \l__deriv_cs_name_tl
-\tl_new:N \l__deriv_derivset_tl
+\tl_new:N \l__deriv_dv_denom_tl
-\seq_new:N \l__deriv_new_var_seq
-\seq_new:N \l__deriv_rubber_seq
+\seq_new:N \l__deriv_dv_var_seq
+\seq_new:N \l__deriv_dv_order_seq
-\prop_new:N \l__deriv_tmp_keys_prop
-\seq_new:N \l__deriv_tmp_keys_seq
-\tl_new:N \l__deriv_tmp_keys_tl
+\seq_new:N \l__deriv_dv_variant_seq
%%%%% Variables: differential %%%%%
\seq_new:N \l__deriv_i_var_seq
-\seq_new:N \l__deriv_i_orders_seq
-\tl_new:N \l__deriv_i_tmpa_tl
+\seq_new:N \l__deriv_i_order_seq
\tl_new:N \l__deriv_i_denom_tl
\seq_new:N \l__deriv_i_variant_seq
%%%%% Variables: other %%%%%
-
-\seq_new:N \l__deriv_dv_variant_seq
-\seq_new:N \l__deriv_add_var_bool_seq
+\tl_new:N \l__deriv_cs_name_tl
+\tl_new:N \l__deriv_derivset_tl
\tl_new:N \l__deriv_tmpa_tl
\tl_new:N \l__deriv_tmpb_tl
\tl_new:N \l__deriv_tmpc_tl
\seq_new:N \l__deriv_tmpa_seq
-\tl_new:N \l__deriv_dv_denom_tl
-
-\seq_new:N \l__deriv_dv_var_seq
-\seq_new:N \l__deriv_dv_order_seq
-\seq_new:N \l__deriv_dv_mo_seq
+\seq_new:N \l__deriv_new_var_seq
+\seq_new:N \l__deriv_rubber_seq
+\seq_new:N \l__deriv_add_var_bool_seq
\int_new:N \l__deriv_vmo_int
@@ -168,27 +118,20 @@
\seq_new:N \l__deriv_input_seq
\seq_new:N \l__deriv_extract_seq
-\seq_new:N \l__deriv_unsorted_seq
+\seq_new:N \l__deriv_permutation_seq
\seq_new:N \l__deriv_sorted_seq
-
\seq_new:N \l__deriv_symbol_seq
\seq_new:N \l__deriv_number_seq
-\seq_new:N \l__deriv_rebuild_seq
+\int_new:N \l__deriv_var_count_int
\int_new:N \l__deriv_tmpa_int
\int_new:N \l__deriv_tmpb_int
\int_new:N \l__deriv_numerical_int
-\int_new:N \l__deriv_sort_counter_int
\int_new:N \l__deriv_sort_max_int
-\int_new:N \l__deriv_position_int
-\int_new:N \l__deriv_rebuild_int
-
-\bool_new:N \l__deriv_tmpa_bool
-
-\regex_const:Nn \c__deriv_pattern_regex { \A([\+\-]?\d*)(.*) }
\regex_const:Nn \c__deriv_cs_numbers_regex { \A\-?\d+(?:,\d+){0,2}\Z }
+\tl_const:Nn \c__deriv_digits_tl {-1234567890}
%%%%% default values %%%%%
@@ -223,12 +166,14 @@
sep-eval-sp = 0,
switch-* = false,
switch-/ = false,
+ switch-sort = true,
sort-method = {sign, symbol, abs},
sort-numerical = auto,
sort-abs-reverse = false,
sort-number-reverse = false,
sort-sign-reverse = false,
sort-symbol-reverse = false,
+ sort-lexical-reverse = false,
fun = false,
frac = false,
var = none,
@@ -286,16 +231,16 @@
\keys_define:nn { deriv/dv/#1 }
{
style-inf .tl_set:c = { l__deriv_dv_#1_style_inf_tl },
- style-var .tl_set:c = { l__deriv_dv_#1_style_var_tl },
+ style-var .code:n = { \__deriv_set_style_var:nn {#1} {##1} },
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 } { \tl_set:cn { l__deriv_dv_#1_scale_eval_tl } {##1} },
- scale-eval-/ .choices:nn = { auto, none, big, Big, bigg, Bigg } { \tl_set:cn { l__deriv_dv_#1_scale_eval_slash_tl } {##1} },
- scale-fun .choices:nn = { auto, none, big, Big, bigg, Bigg } { \tl_set:cn { l__deriv_dv_#1_scale_fun_tl } {##1} },
- scale-var .choices:nn = { auto, none, big, Big, bigg, Bigg } { \tl_set:cn { l__deriv_dv_#1_scale_var_tl } {##1} },
- scale-frac .choices:nn = { auto, none, big, Big, bigg, Bigg } { \tl_set:cn { l__deriv_dv_#1_scale_frac_tl } {##1} },
- scale-frac-/ .choices:nn = { auto, none, big, Big, bigg, Bigg } { \tl_set:cn { l__deriv_dv_#1_scale_frac_slash_tl } {##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-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-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 },
@@ -318,6 +263,7 @@
switch-* .bool_set:c = { l__deriv_dv_#1_switch_star_bool },
switch-/ .bool_set:c = { l__deriv_dv_#1_switch_slash_bool },
+ switch-sort .bool_set:c = { l__deriv_dv_#1_switch_sort_bool },
fun .bool_set:c = { l__deriv_dv_#1_misc_fun_bool },
frac .bool_set:c = { l__deriv_dv_#1_misc_frac_bool },
@@ -329,27 +275,94 @@
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 },
- sort-method .clist_set:c = { l__deriv_dv_#1_sort_method_clist },
+ 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-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 },
+ }
+}
+% 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}
+ {
+ { sign } { \seq_put_right:cn { l__deriv_dv_#1_sort_method_seq } { \__deriv_sort_sign:n } }
+ { symbol } { \seq_put_right:cn { l__deriv_dv_#1_sort_method_seq } { \__deriv_sort_symbol:n } }
+ { abs } { \seq_put_right:cn { l__deriv_dv_#1_sort_method_seq } { \__deriv_sort_abs:n } }
+ { number } { \seq_put_right:cn { l__deriv_dv_#1_sort_method_seq } { \__deriv_sort_number:n } }
+ { lexical } { \seq_put_right:cn { l__deriv_dv_#1_sort_method_seq } { \__deriv_sort_lexical:n } }
+ }
+ \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 } }
+ }
+}
+% dv_variant, scale, name
+\cs_new:Npn \__deriv_set_scale:nnn #1 #2 #3
+{
+ \str_case:nnF {#2}
+ {
+ { auto } { \tl_set:cn { l__deriv_#1_scale_#3_tl } { \__deriv_scale_auto:nnn } }
+ { none } { \tl_set:cn { l__deriv_#1_scale_#3_tl } { \__deriv_scale_none:nnn } }
+ }
+ { \tl_set:cn { l__deriv_#1_scale_#3_tl } { \__deriv_scale_big:nnnn {#2} } }
+}
+% muskip, tl
+\cs_new:Npn \__deriv_set_rubber_length:Nn #1 #2
+{
+ \regex_match:NnTF \c__deriv_cs_numbers_regex {#2}
+ {
+ \str_case:nnF {#2}
+ {
+ { 0 } { \tl_clear:N #1 }
+ { 0,0 } { \tl_clear:N #1 }
+ { 0,0,0 } { \tl_clear:N #1 }
+ }
+ {
+ \seq_set_split:Nnn \l__deriv_rubber_seq { , } {#2}
+ \tl_set:Nf #1 { \seq_use:Nnnn \l__deriv_rubber_seq { mu plus } { mu plus } { mu minus } mu }
+ \tl_put_left:Nn #1 { \mskip }
+ }
}
+ { \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 .tl_set:c = { l__deriv_i_#1_style_notation_tl },
- style-notation-* .tl_set:c = { l__deriv_i_#1_style_notation_star_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 } { \tl_set:cn { l__deriv_i_#1_scale_var_tl } {##1} },
- scale-var-* .choices:nn = { auto, none, big, Big, bigg, Bigg } { \tl_set:cn { l__deriv_i_#1_scale_var_star_tl } {##1} },
+ 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 },
@@ -430,9 +443,6 @@
{ \__deriv_preamble_aux:Vnn #1 { style-inf={#3} } {#5} }
{ \__deriv_preamble_aux:Vnn #1 { style-inf={#3}, #4} {#5} }
}
-% variant, inf, dv/i
-\cs_new_protected:Npn \deriv_set_style_inf:nnn #1 #2 #3
-{ \__deriv_set_default:nnn {#1} { style-inf = {#2} } {#3} }
% variant, key-value, dv/i
\cs_new_protected:Npn \__deriv_preamble_aux:nnn #1 #2 #3
{
@@ -459,10 +469,10 @@
\__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 }
- \__deriv_new:nnnn { clist } {dv_#1} { sort } { method }
+ \__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 }
+ \__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 }
@@ -489,30 +499,17 @@
{
\tl_if_novalue:nTF {#2}
{ \prop_set_eq:cc { l__deriv_#3_#1_user_keys_prop } { c__deriv_#3_pkg_keys_prop } }
- { \__deriv_update_prop:cn { l__deriv_#3_#1_user_keys_prop } {#2} }
+ { \prop_put_from_keyval:cn { l__deriv_#3_#1_user_keys_prop } {#2} }
- \__deriv_set_default_from_prop:Nc \l__deriv_tmp_keys_tl { l__deriv_#3_#1_user_keys_prop }
- \__deriv_set_default_aux:Vnn \l__deriv_tmp_keys_tl {#1} {#3}
-}
-% user-prop, key-val
-\cs_new_protected:Npn \__deriv_update_prop:Nn #1 #2
-{
- \prop_set_from_keyval:Nn \l__deriv_tmp_keys_prop {#2}
- \prop_map_inline:Nn \l__deriv_tmp_keys_prop { \prop_put:Nnn #1 {##1} {##2} }
-}
-% user-prop
-\cs_new_protected:Npn \__deriv_set_default_from_prop:NN #1 #2
-{
- \seq_clear:N \l__deriv_tmp_keys_seq
- \prop_map_inline:Nn #2 { \seq_put_right:Nn \l__deriv_tmp_keys_seq { ##1 = {##2} } }
- \tl_set:Nx #1 { \seq_use:Nn \l__deriv_tmp_keys_seq { , } }
+ \__deriv_set_default_auxi:cnn { l__deriv_#3_#1_user_keys_prop } {#1} {#3}
+ \keys_set:nn { deriv/#3/#1 } { default }
}
+% prop-key-val, variant, dv/i
+\cs_new_protected:Npn \__deriv_set_default_auxi:Nnn #1 #2 #3
+{ \__deriv_set_default_auxii:fnn { \prop_to_keyval:N #1 } {#2} {#3} }
% key-val, variant, dv/i
-\cs_new_protected:Npn \__deriv_set_default_aux:nnn #1 #2 #3
-{
- \keys_define:nn { deriv/#3/#2 } { default .meta:n = {#1} }
- \keys_set:nn { deriv/#3/#2 } { default }
-}
+\cs_new_protected:Npn \__deriv_set_default_auxii:nnn #1 #2 #3
+{ \keys_define:nn { deriv/#3/#2 } { default .meta:n = {#1} } }
% new/delare/renew/provide, variant, macro
\cs_new_protected:Npn \deriv_dv_define:Nnn #1 #2 #3
{
@@ -608,7 +605,8 @@
{ \__deriv_dv_denominator:n {#1} }
}
}
-}% variant, function
+}
+% variant, function
\cs_new_protected:Npn \__deriv_dv_numerator_fun:nn #1 #2
{
\__deriv_insert_inf:n {#1}
@@ -636,28 +634,18 @@
\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 }
- \__deriv_dv_choose_var:NNNn \l__deriv_dv_var_seq \l__deriv_dv_order_seq #1 {#2}
-}
-% var-seq, order-seq, denom-tl, variant
-\cs_new_protected:Npn \__deriv_dv_choose_var:NNNn #1 #2 #3 #4
-{
- \exp_args:Nv
- \str_case:nn { l__deriv_#4_style_var_tl }
- {
- { single } { \__deriv_dv_build_single:NNNn #1 #2 #3 {#4} }
- { multiple } { \__deriv_dv_build_multiple:NNNn #1 #2 #3 {#4} }
- }
+ \tl_use:c { l__deriv_#2_style_var_tl } \l__deriv_dv_var_seq \l__deriv_dv_order_seq #1 {#2}
}
% var_seq, order_seq, denom-tl, variant
\cs_new_protected:Npn \__deriv_dv_build_multiple:NNNn #1 #2 #3 #4
{
- \int_set:Nn \l__deriv_tmpa_int { \seq_count:N #1 }
- \__deriv_adjust_ord_seq:NN #1 #2
+ \int_set:Nn \l__deriv_var_count_int { \seq_count:N #1 }
+ \__deriv_adjust_ord_seq:NN \l__deriv_var_count_int #2
\str_if_eq:cNT { l__deriv_#4_misc_mixed_order_tl } 1
{ \__deriv_mixed_order:cNn { l__deriv_#4_misc_mixed_order_tl } #2 {#4} }
- \__deriv_var_bool_seq:cNN { l__deriv_#4_misc_var_clist } \l__deriv_tmpa_seq \l__deriv_tmpa_int
+ \__deriv_var_bool_seq:cNN { l__deriv_#4_misc_var_clist } \l__deriv_tmpa_seq \l__deriv_var_count_int
\seq_map_indexed_inline:Nn #1
{
@@ -671,11 +659,11 @@
\__deriv_show_order:NTF \l__deriv_tmpa_tl
{
\__deriv_insert_ord:Nnn \l__deriv_tmpa_tl {#4} { var_ord }
- \int_compare:nNnF {##1} = { \l__deriv_tmpa_int }
+ \int_compare:nNnF {##1} = { \l__deriv_var_count_int }
{ \__deriv_insert_mskip:nn {#4} { ord_inf } }
}
{
- \int_compare:nNnF {##1} = { \l__deriv_tmpa_int }
+ \int_compare:nNnF {##1} = { \l__deriv_var_count_int }
{ \__deriv_insert_mskip:nn {#4} { var_inf } }
}
}
@@ -684,10 +672,10 @@
% var_seq, order_seq, denom-tl, variant
\cs_new_protected:Npn \__deriv_dv_build_single:NNNn #1 #2 #3 #4
{
- \int_set:Nn \l__deriv_tmpa_int { \seq_count:N #1 }
- \tl_set:Nx \l__deriv_tmpa_tl { \seq_use:Nn #1 { \__deriv_insert_mskip:nn {#4} { var_var } } }
+ \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_tmpa_int
+ \__deriv_var_bool_seq:cNN { l__deriv_#4_misc_var_clist } \l__deriv_tmpa_seq \l__deriv_var_count_int
\seq_pop_left:NN #2 \l__deriv_tmpb_tl
\seq_pop_left:NN \l__deriv_tmpa_seq \l__deriv_tmpc_tl
@@ -705,19 +693,12 @@
% var_seq, order_seq
\cs_new_protected:Npn \__deriv_adjust_ord_seq:NN #1 #2
{
- \int_set:Nn \l__deriv_vmo_int { \seq_count:N #1 - \seq_count:N #2 }
-
+ \int_set:Nn \l__deriv_vmo_int { #1 - \seq_count:N #2 }
\int_compare:nNnF { \l__deriv_vmo_int } = { 0 }
{
\int_compare:nNnTF { \l__deriv_vmo_int } < { 0 }
- {
- \int_step_inline:nn { -1 * \l__deriv_vmo_int }
- { \seq_pop_right:NN #2 \l__deriv_tmpa_tl }
- }
- {
- \int_step_inline:nn { \l__deriv_vmo_int }
- { \seq_put_right:Nn #2 { 1 } }
- }
+ { \int_step_inline:nn { -1*\l__deriv_vmo_int } { \seq_pop_right:NN #2 \l__deriv_tmpa_tl } }
+ { \int_step_inline:nn { \l__deriv_vmo_int } { \seq_put_right:Nn #2 { 1 } } }
}
}
% avd-clist, bool-seq, count
@@ -725,16 +706,10 @@
{
\seq_clear:N #2
\clist_if_in:NnTF #1 { all }
- {
- \exp_args:NNx
- \seq_set_from_clist:Nn #2 { \prg_replicate:nn {#3} { \c_true_bool , } }
- }
+ { \exp_args:NNf \seq_set_from_clist:Nn #2 { \prg_replicate:nn {#3} { \c_true_bool , } } }
{
\clist_if_in:NnTF #1 { none }
- {
- \exp_args:NNx
- \seq_set_from_clist:Nn #2 { \prg_replicate:nn {#3} { \c_false_bool , } }
- }
+ { \exp_args:NNf \seq_set_from_clist:Nn #2 { \prg_replicate:nn {#3} { \c_false_bool , } } }
{
\int_step_inline:nn {#3}
{
@@ -749,7 +724,6 @@
\cs_new_protected:Npn \__deriv_adjust_trailing_ord:NN #1 #2
{
\seq_clear:N \l__deriv_tmpa_seq
- \bool_set_false:N \l__deriv_tmpa_bool
\int_set:Nn \l__deriv_vmo_int { \seq_count:N #2 - \seq_count:N #1 }
\int_compare:nNnT { \l__deriv_vmo_int } < { 0 }
@@ -758,21 +732,15 @@
{ \seq_pop_right:NN #1 \l__deriv_tmpa_tl }
}
- \seq_reverse:N #1
- \seq_map_inline:Nn #1
+ \int_step_inline:nn { \seq_count:N #1 }
{
- \bool_if:NTF \l__deriv_tmpa_bool
- { \seq_put_right:Nn \l__deriv_tmpa_seq {##1} }
+ \seq_pop_right:NN #1 \l__deriv_tmpa_tl
+ \str_if_eq:VnF \l__deriv_tmpa_tl { 1 }
{
- \str_if_eq:nnF {##1} { 1 }
- {
- \seq_put_right:Nn \l__deriv_tmpa_seq {##1}
- \bool_set_true:N \l__deriv_tmpa_bool
- }
+ \seq_put_right:NV #1 \l__deriv_tmpa_tl
+ \prg_break:
}
}
- \seq_set_eq:NN #1 \l__deriv_tmpa_seq
- \seq_reverse:N #1
}
%%%%% infinisimal definition %%%%%
@@ -803,27 +771,16 @@
\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 }
- \__deriv_i_choose_build:NNNnn \l__deriv_i_var_seq \l__deriv_i_order_seq #1 {#2} {#4}
-}
-% var-seq, order-seq, print-tl, variant, if star
-\cs_new_protected:Npn \__deriv_i_choose_build:NNNnn #1 #2 #3 #4 #5
-{
- \exp_args:Nv
- \str_case:nn { l__deriv_#4_style_notation#5_tl }
- {
- { single } { \__deriv_i_build_single:NNNnn #1 #2 #3 {#4} {#5} }
- { multiple } { \__deriv_i_build_multiple:NNNnn #1 #2 #3 {#4} {#5} }
- { mixed } { \__deriv_i_build_mixed:NNNnn #1 #2 #3 {#4} {#5} }
- }
+ \tl_use:c { l__deriv_#2_style_notation#4_tl } \l__deriv_i_var_seq \l__deriv_i_order_seq #1 {#2} {#4}
}
% var-seq, order-seq, print-tl, variant, if star
\cs_new_protected:Npn \__deriv_i_build_single:NNNnn #1 #2 #3 #4 #5
{
- \int_set:Nn \l__deriv_tmpa_int { \seq_count:N #1 }
- \__deriv_var_bool_seq:cNN { l__deriv_#4_misc_var_clist } \l__deriv_add_var_bool_seq \l__deriv_tmpa_int
+ \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
\__deriv_adjust_trailing_ord:NN #2 #1
- \int_set:Nn \l__deriv_tmpb_int { \seq_count:N #2 }
+ \int_set:Nn \l__deriv_tmpa_int { \seq_count:N #2 }
\seq_map_indexed_inline:Nn #1
{
@@ -831,7 +788,7 @@
\tl_put_right:Nx \l__deriv_tmpb_tl
{
\__deriv_insert_var:Nnnn \l__deriv_tmpa_tl {##2} {#4} {#5}
- \int_compare:nNnF {##1} = { \l__deriv_tmpa_int }
+ \int_compare:nNnF {##1} = { \l__deriv_var_count_int }
{ \__deriv_insert_mskip:nn {#4} { var_var } }
}
}
@@ -840,7 +797,7 @@
\tl_put_right:Nx \l__deriv_tmpc_tl
{
\exp_not:n {##2}
- \int_compare:nNnF {##1} = { \l__deriv_tmpb_int }
+ \int_compare:nNnF {##1} = { \l__deriv_tmpa_int }
{ \__deriv_insert_mskip:nn {#4} { ord_ord } }
}
}
@@ -865,9 +822,9 @@
% var-seq, order-seq, print-tl, variant
\cs_new_protected:Npn \__deriv_i_build_multiple:NNNnn #1 #2 #3 #4 #5
{
- \int_set:Nn \l__deriv_tmpa_int { \seq_count:N #1 }
- \__deriv_var_bool_seq:cNN { l__deriv_#4_misc_var_clist } \l__deriv_add_var_bool_seq \l__deriv_tmpa_int
- \__deriv_adjust_ord_seq:NN #1 #2
+ \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
+ \__deriv_adjust_ord_seq:NN \l__deriv_var_count_int #2
\seq_map_indexed_inline:Nn #1
{
@@ -884,7 +841,7 @@
{ \__deriv_insert_mskip:nn {#4} { inf_var } }
\__deriv_insert_var:Nnnn \l__deriv_tmpb_tl {##2} {#4} {#5}
- \int_compare:nNnF {##1} = { \l__deriv_tmpa_int }
+ \int_compare:nNnF {##1} = { \l__deriv_var_count_int }
{ \__deriv_insert_mskip:nn {#4} { var_inf } }
}
}
@@ -892,9 +849,9 @@
% var-seq, order-seq, print-tl, variant
\cs_new_protected:Npn \__deriv_i_build_mixed:NNNnn #1 #2 #3 #4 #5
{
- \int_set:Nn \l__deriv_tmpa_int { \seq_count:N #1 }
- \__deriv_var_bool_seq:cNN { l__deriv_#4_misc_var_clist } \l__deriv_add_var_bool_seq \l__deriv_tmpa_int
- \__deriv_adjust_ord_seq:NN #1 #2
+ \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
+ \__deriv_adjust_ord_seq:NN \l__deriv_var_count_int #2
\seq_map_indexed_inline:Nn #1
{
@@ -910,7 +867,7 @@
\__deriv_insert_mskip:nn {#4} { inf_var }
\__deriv_insert_var:Nnnn \l__deriv_tmpb_tl {##2} {#4} {#5}
}
- \int_compare:nNnF {##1} = { \l__deriv_tmpa_int }
+ \int_compare:nNnF {##1} = { \l__deriv_var_count_int }
{ \__deriv_insert_mskip:nn {#4} { var_inf } }
}
}
@@ -955,31 +912,7 @@
}
% dv, name
\cs_new:Npn \__deriv_insert_mskip:nn #1 #2
-{
- %[#2]
- \tl_if_empty:cF { l__deriv_#1_sep_#2_tl }
- { \exp_not:v { l__deriv_#1_sep_#2_tl } }
- %\exp_not:v { l__deriv_#1_sep_#2_tl }
-}
-% muskip, length
-\cs_new:Npn \__deriv_set_rubber_length:Nn #1 #2
-{
- \regex_match:NnTF \c__deriv_cs_numbers_regex {#2}
- {
- \str_case_e:nnF {#2}
- {
- { 0 } { \tl_clear:N #1 }
- { 0,0 } { \tl_clear:N #1 }
- { 0,0,0 } { \tl_clear:N #1 }
- }
- {
- \seq_set_split:Nnn \l__deriv_rubber_seq { , } {#2}
- \tl_set:Nf #1 { \seq_use:Nnnn \l__deriv_rubber_seq { mu plus } { mu plus } { mu minus } mu }
- \tl_put_left:Nn #1 { \mskip }
- }
- }
- { \tl_set:Nn #1 {#2} }
-}
+{ \exp_not:v { l__deriv_#1_sep_#2_tl } }
%%%%% Scale, delimiters, evaluation %%%%%
% variable
@@ -1009,63 +942,82 @@
% dv, sub, sup, code-for-fraction
\cs_new:Npn \__deriv_evaluation:nnnn #1 #2 #3 #4
{
- \__deriv_if_novalue_and:nnTF {#2} {#3}
- {#4}
+ \__deriv_if_value:nTF {#2}
{
\__deriv_add_delims:nnn {#1} { eval } {#4}
- \__deriv_if_novalue:nF {#2} { \sb{ \__deriv_insert_mskip:nn {#1} { eval_sb } #2 } }
- \__deriv_if_novalue:nF {#3} { \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 } }
+ \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 } {#4}
+ \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 }
+ }
+ {#4}
}
}
% dv, sub, sup, code-for-fraction
\cs_new:Npn \__deriv_evaluation_slash:nnnn #1 #2 #3 #4
{
- \__deriv_if_novalue_and:nnTF {#2} {#3}
- {#4}
+ \__deriv_if_value:nTF {#2}
{
\__deriv_add_delims:nnn {#1} { eval_slash } {#4}
- \__deriv_if_novalue:nF {#2} { \sb{ \__deriv_insert_mskip:nn {#1} { eval_sb } #2 } }
- \__deriv_if_novalue:nF {#3} { \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 } }
+ \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_slash } {#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} }
+% dv, name, code
+\cs_new:Npn \__deriv_scale_auto:nnn #1 #2 #3
{
- \__deriv_scale:Nnnnn \__deriv_auto_left:n {#1} {#2} { 1 } { l }
+ \__deriv_auto_left:n \tl_item:cn { l__deriv_#1_delims_#2_tl } { 1 }
#3
- \__deriv_scale:Nnnnn \__deriv_auto_right:n {#1} {#2} { 2 } { r }
+ \__deriv_auto_right:n \tl_item:cn { l__deriv_#1_delims_#2_tl } { 2 }
}
-% dv, name
-\cs_new:Npn \__deriv_scale:Nnnnn #1 #2 #3 #4 #5
+% dv, name, code
+\cs_new:Npn \__deriv_scale_none:nnn #1 #2 #3
{
- \exp_args:Nv \str_case:nnF { l__deriv_#2_scale_#3_tl }
- {
- { auto } { \__deriv_scale_auto:Nnnn #1 {#2} {#3} {#4} }
- { none } { \__deriv_scale_none:nnn {#2} {#3} {#4} }
- }
- { \__deriv_scale_big:nnnn {#2} {#3} {#4} {#5} }
+ \__deriv_dont_use_dot:x { \tl_item:cn { l__deriv_#1_delims_#2_tl } { 1 } }
+ #3
+ \__deriv_dont_use_dot:x { \tl_item:cn { l__deriv_#1_delims_#2_tl } { 2 } }
}
-% left/right, variant, name, number
-\cs_new:Npn \__deriv_scale_auto:Nnnn #1 #2 #3 #4
-{ #1 \tl_item:cn { l__deriv_#2_delims_#3_tl } {#4} }
-% dv, name, number
-\cs_new:Npn \__deriv_scale_none:nnn #1 #2 #3
-{ \str_if_eq:cNF { l__deriv_#1_delims_#2_tl } . { \tl_item:cn { l__deriv_#1_delims_#2_tl } {#3} } }
-% dv, name, number, l/r
+% item
+\cs_new:Npn \__deriv_dont_use_dot:n #1
+{ \str_if_eq:nnF {#1} { . } {#1} }
+% dv, name, code
\cs_new:Npn \__deriv_scale_big:nnnn #1 #2 #3 #4
-{ \tl_use:c { \tl_use:c { l__deriv_#1_scale_#2_tl } #4 } { \tl_item:cn { l__deriv_#1_delims_#2_tl } {#3} } }
-
+{ \__deriv_scale_big_auxi:ncn {#1} { l__deriv_#2_delims_#3_tl } {#4} }
+% scaling, delims, code
+\cs_new:Npn \__deriv_scale_big_auxi:nNn #1 #2 #3
+{
+ \tl_use:c { #1 l } { \tl_item:Nn #2 { 1 } }
+ #3
+ \tl_use:c { #1 r } { \tl_item:Nn #2 { 2 } }
+}
%%%%% Calculation of mixed order %%%%%
-% mixed-order-tl, mixed-order-seq, variant
+% mixed-order-tl, order-seq, variant
\cs_new:Npn \__deriv_mixed_order:NNn #1 #2 #3
{
\__deriv_replace:NN \l__deriv_input_seq #2
- \__deriv_seq_counting:N \l__deriv_input_seq
- \__deriv_combine_seq:Nn \l__deriv_unsorted_seq {#3}
- \__deriv_sort:NNn \l__deriv_sorted_seq \l__deriv_unsorted_seq {#3}
+ \__deriv_seq_counting:NNN \l__deriv_symbol_seq \l__deriv_number_seq \l__deriv_input_seq
+ \__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}
}
-% input-seq, mixed-order-seq
+% input-seq, order-seq
\cs_new_protected:Npn \__deriv_replace:NN #1 #2
{
\tl_set:Nf \l__deriv_input_tl { \seq_use:Nn #2 { , } }
@@ -1074,29 +1026,38 @@
\tl_replace_all:Nnn \l__deriv_input_tl { - } { ,- }
\tl_replace_all:Nnn \l__deriv_input_tl { + } { , }
- \exp_args:NNV \seq_set_from_clist:Nn #1 \l__deriv_input_tl
+ \seq_set_split:NnV #1 { , } \l__deriv_input_tl
+ \seq_remove_all:Nn #1 {}
}
-% input-seq
-\cs_new_protected:Npn \__deriv_seq_counting:N #1
+% symbol-seq, number-seq, input-seq
+\cs_new_protected:Npn \__deriv_seq_counting:NNN #1 #2 #3
{
- \seq_clear:N \l__deriv_symbol_seq
- \seq_clear:N \l__deriv_number_seq
+ \seq_clear:N #1
+ \seq_clear:N #2
- \seq_map_inline:Nn #1
+ \seq_map_inline:Nn #3
{
\__deriv_extract:NNn \l__deriv_sym_tmpa_tl \l__deriv_num_tmpa_tl {##1}
\seq_if_in:NVTF \l__deriv_symbol_seq \l__deriv_sym_tmpa_tl
- { \__deriv_update_seq:NN \l__deriv_sym_tmpa_tl \l__deriv_num_tmpa_tl }
- { \__deriv_add_to_seq:NN \l__deriv_sym_tmpa_tl \l__deriv_num_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 }
}
}
% sym-tl, num-tl, seq-item
\cs_new_protected:Npn \__deriv_extract:NNn #1 #2 #3
{
- \regex_extract_once:NnN \c__deriv_pattern_regex {#3} \l__deriv_extract_seq
- \seq_pop_right:NN \l__deriv_extract_seq #1
- \seq_pop_right:NN \l__deriv_extract_seq #2
+ \int_zero:N \l__deriv_tmpa_int
+ \tl_map_inline:nn {#3}
+ {
+ \tl_if_in:NnTF \c__deriv_digits_tl {##1}
+ { \int_incr:N \l__deriv_tmpa_int }
+ { \tl_map_break: }
+ }
+
+ \tl_set:Nx #2 { \tl_range:nnn {#3} { 1 } \l__deriv_tmpa_int }
+ \int_incr:N \l__deriv_tmpa_int
+ \tl_set:Nx #1 { \tl_range:nnn {#3} \l__deriv_tmpa_int { -1 } }
\exp_args:NV \str_case:nn #2
{
@@ -1104,167 +1065,164 @@
{ - } { \tl_set:Nn #2 { -1 } }
}
}
-% unsorted-seq, variant
-\cs_new:Npn \__deriv_combine_seq:Nn #1 #2
+% sym-tl, num-tl
+\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
+}
+% sym-tl, num-tl
+\cs_new_protected:Npn \__deriv_update_seq:NNNN #1 #2 #3 #4
+{
+ \seq_map_indexed_inline:Nn #1
+ {
+ \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_map_break:
+ }
+ }
+}
+% 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 \l__deriv_symbol_seq
+ \seq_map_inline:Nn #2
{
- \seq_pop_left:NN \l__deriv_number_seq \l__deriv_num_tmpa_tl
- \__deriv_eval_term:NVnn #1 \l__deriv_num_tmpa_tl {##1} {#2}
+ \tl_set:Nx \l__deriv_sym_tmpa_tl { \seq_item:Nn #3 {##1} }
+ \tl_set:Nx \l__deriv_num_tmpa_tl { \seq_item:Nn #4 {##1} }
+ \__deriv_eval_term:NVVn #1 \l__deriv_sym_tmpa_tl \l__deriv_num_tmpa_tl {#5}
}
}
-% unsorted-seq, num-tl, seq-item (sym), variant
+% sorted-seq, sym-tl, num-tl, variant
\cs_new_protected:Npn \__deriv_eval_term:Nnnn #1 #2 #3 #4
{
- \__deriv_case:nF
+ \tl_if_empty:nTF {#2}
+ { \__deriv_numerical_term:Nnn #1 {#3} {#4} }
{
- { \tl_if_empty_p:n {#3} } { \__deriv_numerical_term:Nnn #1 {#2} {#4} }
- { \int_compare_p:nNn {#2} = { 1 } } { \seq_put_left:Nn #1 {#3} }
- { \int_compare_p:nNn {#2} = { 0 } } { \prg_do_nothing: }
- { \int_compare_p:nNn {#2} = { -1 } } { \seq_put_left:Nn #1 { -#3 } }
+ \int_compare:nNnTF {#3} = { 1 }
+ { \seq_put_right:Nn #1 {#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} }
+ }
+ }
}
- { \seq_put_left:Nn #1 {#2#3} }
}
-% unsorted-seq, num-tl, variant
+% 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_left:Nn #1 {#2} }
+ { \seq_put_right:Nn #1 {#2} }
{ \int_set:Nn \l__deriv_numerical_int {#2} }
}
-% sym-tl, num-tl
-\cs_new_protected:Npn \__deriv_add_to_seq:NN #1 #2
+% permutation-seq, symbol-seq, number-seq, variant
+\cs_new_protected:Npn \__deriv_sort:NNNn #1 #2 #3 #4
{
- \seq_put_left:NV \l__deriv_symbol_seq #1
- \seq_put_left:NV \l__deriv_number_seq #2
-}
-% sym-tl, num-tl
-\cs_new_protected:Npn \__deriv_update_seq:NN #1 #2
-{
- \__deriv_get_position:NN \l__deriv_position_int #1
- \__deriv_rebuild_seq:NNN \l__deriv_number_seq \l__deriv_position_int #2
-}
-% position-int, sym-tl
-\cs_new:Npn \__deriv_get_position:NN #1 #2
-{
- \int_zero:N #1
- \seq_map_inline:Nn \l__deriv_symbol_seq
- {
- \int_incr:N #1
- \exp_args:NV \tl_if_eq:nnT #2 {##1} { \seq_map_break: }
- }
-}
-% num-seq, position-int, num-tl
-\cs_new_protected:Npn \__deriv_rebuild_seq:NNN #1 #2 #3
-{
- \int_zero:N \l__deriv_rebuild_int
- \seq_clear:N \l__deriv_rebuild_seq
+ \seq_clear:N #1
+ \int_step_inline:nn { \seq_count:N #2 }
+ { \seq_put_right:Nn #1 {##1} }
- \seq_map_inline:Nn #1
+ \bool_if:cT { l__deriv_#4_switch_sort_bool }
{
- \int_incr:N \l__deriv_rebuild_int
- \int_compare:nNnTF \l__deriv_rebuild_int = #2
+ \int_set:Nn \l__deriv_sort_max_int { \seq_count:c { l__deriv_#4_sort_method_seq } }
+ \seq_sort:Nn #1
{
- \tl_set:Nf \l__deriv_num_tmpb_tl { \int_eval:n { ##1 + #3 } }
- \seq_put_right:NV \l__deriv_rebuild_seq \l__deriv_num_tmpb_tl
+ \tl_set:Nx \l__deriv_sym_tmpa_tl { \seq_item:Nn #2 {##1} }
+ \tl_set:Nx \l__deriv_sym_tmpb_tl { \seq_item:Nn #2 {##2} }
+ \tl_set:Nx \l__deriv_num_tmpa_tl { \seq_item:Nn #3 {##1} }
+ \tl_set:Nx \l__deriv_num_tmpb_tl { \seq_item:Nn #3 {##2} }
+
+ \__deriv_sort_method:cn { l__deriv_#4_sort_method_seq } {#4}
}
- { \seq_put_right:Nn \l__deriv_rebuild_seq {##1} }
- }
- \seq_set_eq:NN #1 \l__deriv_rebuild_seq
-}
-% sorted-seq, unsorted-seq, variant
-\cs_new_protected:Npn \__deriv_sort:NNn #1 #2 #3
-{
- \int_set:Nn \l__deriv_sort_max_int { \int_min:nn { 3 } { \clist_count:c { l__deriv_#3_sort_method_clist } } }
-
- \seq_sort:Nn #2
- {
- \__deriv_extract:NNn \l__deriv_sym_tmpa_tl \l__deriv_num_tmpa_tl {##1}
- \__deriv_extract:NNn \l__deriv_sym_tmpb_tl \l__deriv_num_tmpb_tl {##2}
- \int_zero:N \l__deriv_sort_counter_int
- \__deriv_sort_method:n {#3}
}
- \seq_set_eq:NN #1 #2
}
-% dv
-\cs_new_protected:Npn \__deriv_sort_method:n #1
+% method-seq, dv
+\cs_new_protected:Npn \__deriv_sort_method:Nn #1 #2
{
- \int_incr:N \l__deriv_sort_counter_int
-
- \exp_args:Nf
- \str_case:nn { \clist_item:cn { l__deriv_#1_sort_method_clist } { \l__deriv_sort_counter_int } }
+ \seq_map_indexed_inline:Nn #1
{
- { sign } { \__deriv_sort_sign:n {#1} }
- { symbol } { \__deriv_sort_symbol:n {#1} }
- { abs } { \__deriv_sort_abs:n {#1} }
- { number } { \__deriv_sort_number:n {#1} }
+ ##2 {#2}
+ \int_compare:nNnT {##1} = { \l__deriv_sort_max_int }
+ { \seq_map_break:n { \sort_return_same: } }
}
}
% dv
\cs_new_protected:Npn \__deriv_sort_sign:n #1
{
- \__deriv_case:nF
+ \tl_if_head_eq_charcode:VNTF \l__deriv_num_tmpb_tl -
{
- { \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpb_tl - && ! \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpa_tl - } { \__deriv_sort_reverse:nnn {#1} { sign } { same } }
- { \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpa_tl - && ! \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpb_tl - } { \__deriv_sort_reverse:nnn {#1} { sign } { swapped } }
+ \tl_if_head_eq_charcode:VNF \l__deriv_num_tmpa_tl -
+ { \__deriv_sort_reverse:Nnn \c_false_bool {#1} { sign } }
}
{
- \int_compare:nNnTF { \l__deriv_sort_counter_int } = { \l__deriv_sort_max_int }
- { \sort_return_same: }
- { \__deriv_sort_method:n {#1} }
+ \tl_if_head_eq_charcode:VNT \l__deriv_num_tmpa_tl -
+ { \__deriv_sort_reverse:Nnn \c_true_bool {#1} { sign } }
}
}
% dv
\cs_new_protected:Npn \__deriv_sort_symbol:n #1
{
- \__deriv_case:nF
+ \int_set:Nn \l__deriv_tmpa_int { \tl_count:N \l__deriv_sym_tmpa_tl }
+ \int_set:Nn \l__deriv_tmpb_int { \tl_count:N \l__deriv_sym_tmpb_tl }
+
+ \int_compare:nNnTF \l__deriv_tmpa_int > \l__deriv_tmpb_int
+ { \__deriv_sort_reverse:Nnn \c_false_bool {#1} { symbol } }
{
- { \int_compare_p:nNn { \tl_count:N \l__deriv_sym_tmpa_tl } > { \tl_count:N \l__deriv_sym_tmpb_tl } } { \__deriv_sort_reverse:nnn {#1} { symbol } { same } }
- { \int_compare_p:nNn { \tl_count:N \l__deriv_sym_tmpa_tl } < { \tl_count:N \l__deriv_sym_tmpb_tl } } { \__deriv_sort_reverse:nnn {#1} { symbol } { swapped } }
+ \int_compare:nNnT \l__deriv_tmpa_int < \l__deriv_tmpb_int
+ { \__deriv_sort_reverse:Nnn \c_true_bool {#1} { symbol } }
}
+}
+% 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
+\cs_new_protected:Npn \__deriv_sort_lexical_auxi:nnn #1 #2 #3
+{
+ \str_compare:nNnTF {#1} < {#2}
+ { \__deriv_sort_reverse:Nnn \c_false_bool {#3} { lexical } }
{
- \int_compare:nNnTF { \l__deriv_sort_counter_int } = { \l__deriv_sort_max_int }
- { \sort_return_same: }
- { \__deriv_sort_method:n {#1} }
+ \str_compare:nNnT {#1} > {#2}
+ { \__deriv_sort_reverse:Nnn \c_true_bool {#3} { lexical } }
}
}
% dv
\cs_new_protected:Npn \__deriv_sort_abs:n #1
{
- \__deriv_case:nF
- {
- { \int_compare_p:nNn { \int_abs:n \l__deriv_num_tmpa_tl } > { \int_abs:n \l__deriv_num_tmpb_tl } } { \__deriv_sort_reverse:nnn {#1} { abs } { same } }
- { \int_compare_p:nNn { \int_abs:n \l__deriv_num_tmpa_tl } < { \int_abs:n \l__deriv_num_tmpb_tl } } { \__deriv_sort_reverse:nnn {#1} { abs } { swapped } }
- }
+ \int_set:Nn \l__deriv_tmpa_int { \int_abs:n \l__deriv_num_tmpa_tl }
+ \int_set:Nn \l__deriv_tmpb_int { \int_abs:n \l__deriv_num_tmpb_tl }
+
+ \int_compare:nNnTF \l__deriv_tmpa_int > \l__deriv_tmpb_int
+ { \__deriv_sort_reverse:Nnn \c_false_bool {#1} { abs } }
{
- \int_compare:nNnTF { \l__deriv_sort_counter_int } = { \l__deriv_sort_max_int }
- { \sort_return_same: }
- { \__deriv_sort_method:n {#1} }
+ \int_compare:nNnT \l__deriv_tmpa_int < \l__deriv_tmpb_int
+ { \__deriv_sort_reverse:Nnn \c_true_bool {#1} { abs } }
}
}
% dv
\cs_new_protected:Npn \__deriv_sort_number:n #1
{
- \__deriv_case:nF
+ \int_compare:nNnTF \l__deriv_num_tmpa_tl > \l__deriv_num_tmpb_tl
+ { \__deriv_sort_reverse:Nnn \c_false_bool {#1} { number } }
{
- { \int_compare_p:nNn { \l__deriv_num_tmpa_tl } > { \l__deriv_num_tmpb_tl } } { \__deriv_sort_reverse:nnn {#1} { number } { same } }
- { \int_compare_p:nNn { \l__deriv_num_tmpa_tl } < { \l__deriv_num_tmpb_tl } } { \__deriv_sort_reverse:nnn {#1} { number } { swapped } }
- }
- {
- \int_compare:nNnTF { \l__deriv_sort_counter_int } = { \l__deriv_sort_max_int }
- { \sort_return_same: }
- { \__deriv_sort_method:n {#1} }
+ \int_compare:nNnT \l__deriv_num_tmpa_tl < \l__deriv_num_tmpb_tl
+ { \__deriv_sort_reverse:Nnn \c_true_bool {#1} { number } }
}
}
-% dv, sort-method, same/swapped
-\cs_new_protected:Npn \__deriv_sort_reverse:nnn #1 #2 #3
+% true/false, dv, sort-method
+\cs_new_protected:Npn \__deriv_sort_reverse:Nnn #1 #2 #3
{
- \exp_args:Nc
- \bool_xor:nnTF { l__deriv_#1_sort_#2_reverse_bool } { \str_if_eq_p:nn {#3} { same } }
- { \sort_return_same: }
- { \sort_return_swapped: }
+ \exp_args:NNc
+ \bool_xor:nnTF #1 { l__deriv_#2_sort_#3_reverse_bool }
+ { \seq_map_break:n { \sort_return_swapped: } }
+ { \seq_map_break:n { \sort_return_same: } }
}
% mixed-order-tl, sorted-seq, numerical-term, variant
\cs_new_protected:Npn \__deriv_output:NNNn #1 #2 #3 #4
@@ -1282,7 +1240,7 @@
{ first } { \tl_put_left:Nx #1 { \int_use:N #3 + } }
}
{
- \bool_if:nTF { \tl_if_head_eq_charcode_p:VN #1 - }
+ \tl_if_head_eq_charcode:VNTF #1 -
{ \tl_put_left:NV #1 #3 }
{ \tl_put_right:Nx #1 { + \int_use:N #3 } }
}
@@ -1420,28 +1378,25 @@
%%%%% Generate variants %%%%%
\prg_generate_conditional_variant:Nnn \__deriv_show_order:N { c } { T, TF }
+\prg_generate_conditional_variant:Nnn \tl_if_head_eq_charcode:nN { V } { T, F, TF }
-\cs_generate_variant:Nn \tl_if_head_eq_charcode_p:nN { V }
\cs_generate_variant:Nn \__deriv_set_rubber_length:Nn { c }
-\cs_generate_variant:Nn \__deriv_dv_variables:n { V }
-\cs_generate_variant:Nn \__deriv_dv_define_keys:n { V }
\cs_generate_variant:Nn \deriv_dv_define:Nnn { NV }
-\cs_generate_variant:Nn \__deriv_i_variables:n { V }
-\cs_generate_variant:Nn \__deriv_i_define_keys:n { V }
\cs_generate_variant:Nn \deriv_i_define:Nnn { NV }
\cs_generate_variant:Nn \deriv_set_keys:nn { V }
+\cs_generate_variant:Nn \__deriv_dont_use_dot:n { x }
+\cs_generate_variant:Nn \__deriv_scale_big_auxi:nNn { nc }
\cs_generate_variant:Nn \__deriv_insert_ord:Nnn { c }
\cs_generate_variant:Nn \__deriv_insert_var:Nnn { NV }
-\prg_generate_conditional_variant:Nnn \__deriv_if_novalue:n { f } { T }
-\prg_generate_conditional_variant:Nnn \__deriv_if_novalue:n { V } { TF }
\cs_generate_variant:Nn \__deriv_mixed_order:NNn { c }
-\cs_generate_variant:Nn \__deriv_eval_term:Nnnn { NV }
+\cs_generate_variant:Nn \__deriv_sort_method:Nn { c }
+\cs_generate_variant:Nn \__deriv_eval_term:Nnnn { NVV }
+\cs_generate_variant:Nn \__deriv_sort_lexical_auxi:nnn { VV }
-\cs_generate_variant:Nn \__deriv_set_default_aux:nnn { V }
-\cs_generate_variant:Nn \__deriv_set_default_from_prop:NN { Nc }
-\cs_generate_variant:Nn \__deriv_update_prop:Nn { c }
+\cs_generate_variant:Nn \__deriv_set_default_auxi:Nnn { c }
+\cs_generate_variant:Nn \__deriv_set_default_auxii:nnn { f }
\cs_generate_variant:Nn \__deriv_preamble_aux:nnn { V }
\cs_generate_variant:Nn \__deriv_var_bool_seq:NNN { c }
@@ -1480,15 +1435,14 @@
{ \derivset{all}[scale-auto = mleftmright] }
{ \derivset{all}[scale-auto = leftright] }
-\cs_new_protected:Npn \deriv_define_legacy_italic_cs:
+
+\bool_if:NTF \l__deriv_pkg_italic_bool
{
\DeclareDerivative{\odv}{\mathnormal{d}}
\DeclareDerivative{\mdv}{\mathnormal{D}}
\DeclareDifferential{\odif}{\mathnormal{d}}
\DeclareDifferential{\mdif}{\mathnormal{D}}[style-notation=single, style-notation-*=mixed]
}
-
-\cs_new_protected:Npn \deriv_define_legacy_upright_cs:
{
\DeclareDerivative{\odv}{\mathrm{d}}
\DeclareDerivative{\mdv}{\mathrm{D}}
@@ -1496,12 +1450,6 @@
\DeclareDifferential{\mdif}{\mathrm{D}}[style-notation=single, style-notation-*=mixed]
}
-\__deriv_case:n
-{
- { \l__deriv_pkg_italic_bool } { \deriv_define_legacy_italic_cs: }
- { \l__deriv_pkg_upright_bool } { \deriv_define_legacy_upright_cs: }
-}
-
\DeclareDerivative{\fdv}{\delta}
\DeclareDerivative{\adv}{\Delta}
\DeclareDerivative{\jdv}{\partial}[fun=true, var=1]
diff --git a/macros/latex/contrib/derivative/derivative.tex b/macros/latex/contrib/derivative/derivative.tex
index d7c50df7b8..837a7695d0 100644
--- a/macros/latex/contrib/derivative/derivative.tex
+++ b/macros/latex/contrib/derivative/derivative.tex
@@ -1,5 +1,5 @@
% derivative.tex
-% Copyright 2019-2021 Simon Jensen
+% Copyright 2019-2022 Simon Jensen
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -83,8 +83,8 @@ indent_length "2"
\RequirePackage[unicode]{hyperref}
\RequirePackage[nameinlink]{cleveref}
-\makeatletter
\ExplSyntaxOn
+\makeatletter
\tl_new:N \pakkenavn
\tl_new:N \titel
@@ -147,7 +147,7 @@ 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-frac, scale-frac-/, scale-var, scale-var-*, delims-eval, delims-eval-/, delims-fun, delims-var, delims-frac, delims-var-*, 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-var-var, sep-ord-ord, sep-end, switch-*, switch-/, add-delims, remove-delims, add-var-delims, order, morder, sort-method, sort-numerical, sort-abs-reverse, sort-number-reverse, sort-sign-reverse, sort-symbol-reverse, fun, frac, var, order, ord, mixed-order, mixord, scale-auto},
+ 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},
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:,
@@ -395,7 +395,6 @@ indent_length "2"
{
}
-
\tl_new:N \l__mydoc_number_tl
\tl_new:N \l_mydoc_index_item_tl
\tl_new:N \l_mydoc_index_subitem_tl
@@ -659,7 +658,10 @@ indent_length "2"
\group_begin:
\small \ttfamily
New: \tl_use:N \c_space_tl
- \tl_use:N #1
+
+ \tl_if_head_eq_charcode:fNTF {#1} v
+ { \tl_use:N #1 }
+ { v\tl_use:N #1 }
\group_end:
}
@@ -668,7 +670,10 @@ indent_length "2"
\group_begin:
\small \ttfamily
Updated: \tl_use:N \c_space_tl
- \tl_use:N #1
+
+ \tl_if_head_eq_charcode:fNTF {#1} v
+ { \tl_use:N #1 }
+ { v\tl_use:N #1 }
\group_end:
}
@@ -1318,15 +1323,16 @@ indent_length "2"
{ \mydoc_cs_to_str:N #1 }
\ExplSyntaxOff
+\makeatother
\Pakkenavn{derivative}
\Titel{The \pakkenavn{} package}
\Forfatter{Simon Jensen}
\Email{sjelatex@gmail.com}
-\Dato{2021/06/03}
-\Version{1.1}
+\Dato{2022/07/09}
+\Version{1.2}
-\RequirePackage[upright]{derivative}[\dato]
+\RequirePackage{derivative}[\dato]
% \derivset{all}[scale-auto = mleftmright]
\hypersetup
@@ -1360,17 +1366,21 @@ indent_length "2"
\begin{document}
- \forside{%
- The \mypackage{} package provides a set of commands which makes writing ordinary and partial derivatives of arbitrary order in a straight forward manner. Additionally, this package provides a set of commands to define variants of the aforementioned derivatives. A set of optional arguments along with lots of package options allow for easy and great flexibility over the derivative's format, such as where the function is positioned, point of evaluation, and switching between fraction styles. Moreover, the mixed order of the partial derivative and variants hereof is automatically computed. This package is written in the \pkg{expl3} language and requires therefore the \LaTeX3 package bundles \pkg{l3kernel} and \pkg{l3package}. Additionally, the \pkg{mleftright} package is optional and provides the improved automatically scaling \cs{mleft} and \cs{mright}.}
+ \forside{The \mypackage{} package provides a set of commands which makes writing ordinary and partial derivatives of arbitrary order in a straight forward manner. Additionally, this package provides a set of commands to define variants of the aforementioned derivatives. A set of optional arguments along with lots of package options allow for easy and great flexibility over the derivative's format, such as where the function is positioned, point of evaluation, and switching between fraction styles. Moreover, the mixed order of the partial derivative and variants hereof is automatically computed. This package is written in the \pkg{expl3} language and requires therefore the \LaTeX3 package bundles \pkg{l3kernel} and \pkg{l3package}. Additionally, the \pkg{mleftright} package is optional and provides the improved automatically scaling \cs{mleft} and \cs{mright}.}
\clearpage
\tableofcontents
\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
@@ -1477,7 +1487,7 @@ indent_length "2"
\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.
+ However it can always be changed with the \key{style-inf} key.
\end{function}
\begin{function}{\mdv}[updated=v1.1]
@@ -1990,16 +2000,34 @@ indent_length "2"
\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})
+
+ \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}
+
+ \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}.
- \begin{option}{sort-method}[updated = v1.0]
+ \begin{option}{sort-method}[updated = v1.2]
\begin{values}[default = {sign, symbol, abs}]
- abs, number, sign, symbol
+ 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 key takes its input as a comma-separated list of values, accepting up to three values e.g.
+ 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{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}
@@ -2033,6 +2061,13 @@ indent_length "2"
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
@@ -2104,7 +2139,7 @@ indent_length "2"
Sets the order of differentiation for each variable as a comma separated list of values.
\end{option}
- \bigskip\bigskip
+ \clearpage
\begin{option}{mixed-order, mixord}[cat=misc, new = v1.0]
\begin{values}[default = 1]
@@ -2137,7 +2172,6 @@ indent_length "2"
\odif[style-notation=single, order={n,1,2}]{x,y,z,t} \\
\odif[style-notation=mixed, order={n,1,2}]{x,y,z,t}
\end{example}
-
\end{option}
\begin{option}{style-notation-*}
@@ -2208,8 +2242,6 @@ indent_length "2"
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}
- \clearpage
-
\begin{option}{sep-inf-var}
\begin{values}[default = 0]
\meta{cs-number}, \marg{mspace}, \marg{delimiter}
@@ -2370,10 +2402,11 @@ indent_length "2"
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{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 is reversed such that the negative terms appear before the positive terms.
- \item The sorting algorithm \val{symbol} separates the terms by their symbolic length, where the terms are sorted 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} separates the terms by their absolute value, where the terms are ordered 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} separates the terms by their numerical value, where the terms are ordered in a descending manner. The option \keyval{sort-number-reverse}{true} sort the terms in an ascending manner instead.
+ \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.
\end{itemize}
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.
@@ -2460,9 +2493,7 @@ indent_length "2"
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
+ 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} &&
@@ -2476,19 +2507,21 @@ indent_length "2"
\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 three options should satisfy every needs.
+ 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 terms by 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. For example, the \val{sign} algorithm places the positive terms before the negative terms, but is opposite with \keyval{sort-sign-reverse}{true}. 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)
+ 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-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}
@@ -2632,6 +2665,13 @@ indent_length "2"
\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/fixdif/fixdif.dtx b/macros/latex/contrib/fixdif/fixdif.dtx
index 9e06f1067a..bced2e43bf 100644
--- a/macros/latex/contrib/fixdif/fixdif.dtx
+++ b/macros/latex/contrib/fixdif/fixdif.dtx
@@ -126,7 +126,7 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
%</internal>
%
%<*driver>
-\ProvidesFile{fixdif.dtx}[2022/05/29 (c) Copyright 2022 by Zhang Tingxuan]
+\ProvidesFile{fixdif.dtx}[2022/07/09 (c) Copyright 2022 by Zhang Tingxuan]
\documentclass{ltxdoc}
\usepackage{xcolor}
@@ -145,7 +145,7 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
\title{The \pkg{fixdif} Package}
\author{Zhang Tingxuan}
-\date{2022/05/29\quad Version 1.1\thanks{\url{https://github.com/AlphaZTX/fixdif}}}
+\date{2022/07/09\quad Version 1.2\thanks{\url{https://github.com/AlphaZTX/fixdif}}}
\usepackage{hyperref}
\hypersetup{
@@ -329,7 +329,7 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
% can be used in preamble only!}
%
% \subsection{Define commands with a single command name}
-% \noindent\textbf{\cs{letdif}\marg{cmd}\marg{csname}}\DescribeMacro{\letdif}
+% \noindent\textcolor{titlecolor}{\cs{letdif}\marg{cmd}\marg{csname}}\DescribeMacro{\letdif}
% \hfill(preamble only)
%
% The \cs{letdif} command has two arguments~--- the first is the newly-defined
@@ -351,7 +351,7 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
% The second argument \meta{csname} of \cs{letdif} command can be used
% repeatedly.
%
-% \noindent\textbf{\cs{letdif*}\marg{cmd}\marg{csname}}\DescribeMacro{\letdif*}
+% \noindent\textcolor{titlecolor}{\cs{letdif*}\marg{cmd}\marg{csname}}\DescribeMacro{\letdif*}
% \hfill(preamble only)
%
% This command is basically the same as \cs{letdif}, but this command will
@@ -372,14 +372,14 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
%
% \subsection{Define commands with multi commands or a string}
%
-% \noindent\textbf{\cs{newdif}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif}
+% \noindent\textcolor{titlecolor}{\cs{newdif}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif}
% \hfill(without correction, preamble only)\\
-% \noindent\textbf{\cs{newdif*}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif*}
+% \noindent\textcolor{titlecolor}{\cs{newdif*}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif*}
% \hfill(with correction, preamble only)
%
% The first argument of these commands is the newly-defined command; and the
-% second argument should contain \emph{more than one commands} or
-% \emph{a string}. For example, if you have loaded the \pkg{xcolor} package,
+% second argument should contain \emph{more than one} tokens.
+% For example, if you have loaded the \pkg{xcolor} package,
% you can use the following line:
% \begin{Verbatim}
% \newdif{\redsfd}{\textsf{\color{red}d}}
@@ -396,9 +396,9 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
% These two commands will check whether \meta{cmd} has been defined already.
% If so, an error message will be given.
%
-% \noindent\textbf{\cs{renewdif}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif}
+% \noindent\textcolor{titlecolor}{\cs{renewdif}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif}
% \hfill(without correction, preamble only)\\
-% \noindent\textbf{\cs{renewdif*}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif*}
+% \noindent\textcolor{titlecolor}{\cs{renewdif*}\marg{cmd}\marg{multi-cmd}}\DescribeMacro{\newdif*}
% \hfill(with correction, preamble only)
%
% These two commands are basically the same as \cs{newdif} and \cs{newdif*}.
@@ -497,7 +497,7 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
% \DescribeMacro{\d}
% Redefine the \cs{d} command. In text, we need to expand the stuffs after \cs{d}
% \begin{macrocode}
-\gdef\d{\relax\ifmmode\@dif\else\expandafter\d@accent\fi}
+\DeclareRobustCommand\d{\ifmmode\@dif\else\expandafter\d@accent\fi}
% \end{macrocode}
%
% \subsection{User's interface for defining new differential operators}
@@ -505,71 +505,71 @@ Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>.
% Define the \cs{letdif} and \cs{letdif*} command. The internal version of \cs{letdif}
% is \cs{@letdif}, of \cs{letdif*} is \cs{s@letdif}.
% \begin{macrocode}
-\def\@letdif#1#2{\AtBeginDocument{
+\def\@letdif#1#2{\AtBeginDocument{%
% \end{macrocode}
% |#1| is the final command; |#2| is the ``control sequence name'' of |#1|'s initial definition.
% Here we create a command (\cs{csname}|#2@old|\cs{endcsname}) to restore |#2|.
% \begin{macrocode}
- \ifcsname #2@old\endcsname\else
- \expandafter\let\csname #2@old\expandafter\endcsname%
- \csname #2\endcsname
- \fi
+ \ifcsname #2@old\endcsname\else%
+ \expandafter\let\csname #2@old\expandafter\endcsname
+ \csname #2\endcsname%
+ \fi%
% \end{macrocode}
% Finally let |#1| be the new command.
% \begin{macrocode}
- \gdef#1{\mathinner{\csname #2@old\endcsname}\mup@tch}
+ \gdef#1{\mathinner{\csname #2@old\endcsname}\mup@tch}%
}}
% \end{macrocode}
% The definition of \cs{s@letdif} is similar, but with the patch for negative skips.
% \begin{macrocode}
-\def\s@letdif#1#2{\AtBeginDocument{
- \ifcsname #2@old\endcsname\else
- \expandafter\let\csname #2@old\expandafter\endcsname%
- \csname #2\endcsname
- \fi
- \gdef#1{\mathinner{\s@beforep@tch\csname #2@old\endcsname\mbox{}}\mup@tch}
+\def\s@letdif#1#2{\AtBeginDocument{%
+ \ifcsname #2@old\endcsname\else%
+ \expandafter\let\csname #2@old\expandafter\endcsname
+ \csname #2\endcsname%
+ \fi%
+ \gdef#1{\mathinner{\s@beforep@tch\csname #2@old\endcsname\mbox{}}\mup@tch}%
}}
\def\letdif{\@ifstar\s@letdif\@letdif}
% \end{macrocode}
% \DescribeMacro{\newdif}\DescribeMacro{\newdif*}
% Define the \cs{newdif} and \cs{newdif*} commands. |#1| is the final command; |#2| is the ``long'' argument.
% \begin{macrocode}
-\long\def\@newdif#1#2{\AtBeginDocument{
+\long\def\@newdif#1#2{\AtBeginDocument{%
\ifdefined#1
\PackageError{fixdif}{\string#1 is already defined.}
- {Try another command instead of \string#1.}
+ {Try another command instead of \string#1.}%
\else
- \long\gdef#1{\mathinner{#2}\mup@tch}
- \fi
+ \long\gdef#1{\mathinner{#2}\mup@tch}%
+ \fi%
}}
-\long\def\s@newdif#1#2{\AtBeginDocument{
+\long\def\s@newdif#1#2{\AtBeginDocument{%
\ifdefined#1
\PackageError{fixdif}{\string#1 is already defined.}
- {Try another command instead of \string#1.}
+ {Try another command instead of \string#1.}%
\else
- \long\gdef#1{\s@beforep@tch\mathinner{#2\mbox{}}\mup@tch}
- \fi
+ \long\gdef#1{\s@beforep@tch\mathinner{#2\mbox{}}\mup@tch}%
+ \fi%
}}
\def\newdif{\@ifstar\s@newdif\@newdif}
% \end{macrocode}
% \DescribeMacro{\renewdif}\DescribeMacro{\renewdif*}
% Define the \cs{renewdif} and \cs{renewdif*} commands.
% \begin{macrocode}
-\long\def\@renewdif#1#2{\AtBeginDocument{
+\long\def\@renewdif#1#2{\AtBeginDocument{%
\ifdefined#1
- \long\gdef#1{\mathinner{#2}\mup@tch}
+ \long\gdef#1{\mathinner{#2}\mup@tch}%
\else
\PackageError{fixdif}{\string#1 has not been defined yet.}
- {You should use \string\newdif instead of \string\renewdif.}
- \fi
+ {You should use \string\newdif instead of \string\renewdif.}%
+ \fi%
}}
-\long\def\s@renewdif#1#2{\AtBeginDocument{
+\long\def\s@renewdif#1#2{\AtBeginDocument{%
\ifdefined#1
- \long\gdef#1{\s@beforep@tch\mathinner{#2\mbox{}}\mup@tch}
+ \long\gdef#1{\s@beforep@tch\mathinner{#2\mbox{}}\mup@tch}%
\else
\PackageError{fixdif}{\string#1 has not been defined yet.}
- {You should use \string\newdif instead of \string\renewdif.}
- \fi
+ {You should use \string\newdif instead of \string\renewdif.}%
+ \fi%
}}
\def\renewdif{\@ifstar\s@renewdif\@renewdif}
%</package>
diff --git a/macros/latex/contrib/fixdif/fixdif.pdf b/macros/latex/contrib/fixdif/fixdif.pdf
index dd066756f0..e83fd2d10d 100644
--- a/macros/latex/contrib/fixdif/fixdif.pdf
+++ b/macros/latex/contrib/fixdif/fixdif.pdf
Binary files differ
diff --git a/macros/latex/contrib/flexipage/README.txt b/macros/latex/contrib/flexipage/README.txt
new file mode 100644
index 0000000000..92a9499b93
--- /dev/null
+++ b/macros/latex/contrib/flexipage/README.txt
@@ -0,0 +1,20 @@
+LaTeX package flexipage
+Copyright (c) Anton Vrba, 2022
+-------------------------------------------------------------------
+Version:
+ 2022/07/09 1.00 Initial release
+Licence:
+ This work may be distributed and/or modified under the conditions
+ of the LaTeX Project Public License, version 1.3c of the license.
+ The latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+ and version 1.3c or later is part of all distributions of LaTeX
+ version 2008-05-04 or later.
+Abstract:
+ The package flexipage allows easy page layout if marginalia is
+ required. Mid document changes are possible such as: new marginal
+ width, full width text, and landscape text without marginal.
+ Partners well with the package sidenotesplus. The package also
+ aids the layout for book printing, adding binding corrections
+ and adding page bleed, if required by the printers
+------------------------------------------------------------------- \ No newline at end of file
diff --git a/macros/latex/contrib/flexipage/Test-flexipage.pdf b/macros/latex/contrib/flexipage/Test-flexipage.pdf
new file mode 100644
index 0000000000..05cb03349f
--- /dev/null
+++ b/macros/latex/contrib/flexipage/Test-flexipage.pdf
Binary files differ
diff --git a/macros/latex/contrib/flexipage/Test-flexipage.tex b/macros/latex/contrib/flexipage/Test-flexipage.tex
new file mode 100644
index 0000000000..be69577405
--- /dev/null
+++ b/macros/latex/contrib/flexipage/Test-flexipage.tex
@@ -0,0 +1,141 @@
+\documentclass[twoside,8pt]{extarticle}
+\PassOptionsToPackage{
+ paperheight =5in, % inherits from class
+ paperwidth = 4in, % inherits from class
+% inner = , % default 36pt or 0.5in
+% outer = , % 36pt or 0.5in
+% top = , % 36pt or 0.5in
+% bot = , % 36pt or 0.5in
+% binding = 9pt, % 9pt or 0.125in
+ outerbleed = 9pt, % 0pt, but check with your printer
+ innerbleed = 4pt, % 0pt, but check with your printer
+% grid , % 12 it is just a number
+% marginalgrid = , % 3 it is just a number
+% marginparsep = , % 3ex, if using sidenotesplus change to 4 or 5ex
+% headsep = , % inherits from class
+% headheight = , % inherits from class
+% footskip= , % inherits from class
+ show, % a switch to show frames around the printable areas.
+% fancyhdrOff
+}{flexipage}
+\usepackage{flexipage}
+\usepackage[]{lucimatx}
+\linespread{1.06}
+\usepackage{lipsum}
+\setlipsum{%
+ par-before = \begingroup\color{gray},
+ par-after = \endgroup,
+ sentence-before = \begingroup\color{gray},
+ sentence-after = \endgroup
+}
+
+\usepackage{fancyhdr}
+\pagestyle{fancy}
+\fancyhead[EL,OR]{\thepage}
+\fancyhead[ER]{My New Book}
+\fancyhead[OL]{Chapter 1}
+\renewcommand{\headrulewidth}{0pt}
+
+\usepackage{microtype}
+
+\begin{document}
+
+
+\begin{verbatim}
+\documentclass[twoside,8pt]{extbook}
+\PassOptionsToPackage{
+ paperheight = 5in, % inherits from class
+ paperwidth = 4in , % inherits from class
+% inner = , % default 36pt or 0.5in
+ outer = , % 36pt or 0.5in
+% top = , % 36pt or 0.5in
+% bot = , % 36pt or 0.5in
+% binding = , % 9pt or 0.125in
+ outerbleed = 9pt, % 0pt,
+ innerbleed = 4pt, % 0pt,
+% grid = , % 12
+% marginalgrid = , % 3
+% marginparsep = , % 3ex,
+% headsep = , % inherits from class
+% headheight = , % inherits from class
+% footskip= , % inherits from class
+ show , % a switch to show frames
+% fancyhdrOff % not using fancyhdr
+}{flexipage}
+\end{verbatim}
+\footnotesize
+
+ \lipsum[10][1-3] \marginpar[{\itshape\tiny\lipsum[1][1-4]}]{\itshape\tiny\lipsum[8]}
+
+ \lipsum[2] \marginpar[{\itshape\tiny\lipsum[1][1-4]}]{\itshape\tiny\lipsum[8][1-5]}
+
+ \lipsum[2][1-6]
+
+~
+
+{\normalsize
+\noindent\verb"\NewMarginPage<6ex>{4}" increases marginal and \verb"\parsep" on next page}
+\NewMarginPage<6ex>{4} % Increase margin size
+
+ \lipsum[3][1-3] \marginpar[{\itshape\tiny\lipsum[1][1-4]}]{\itshape\tiny\lipsum[10][1-4]}
+
+ \lipsum[1][1-8]
+
+ \lipsum[2][1-7]
+
+~
+
+{\normalsize
+\noindent\verb"\ResetFlexiPage" to original page setup with the narrower margin}
+\ResetFlexiPage
+
+ \lipsum[10][1-5] \marginpar[{\itshape\tiny\lipsum[1][1-4]}]{\itshape\tiny\lipsum[1][1-3]} \lipsum[2]
+
+~
+
+{\normalsize
+\noindent\verb"\Lanscape" enters landscape mode}
+\begin{Landscape} % enter lanscape mode,
+
+ \lipsum[1-4]
+
+~
+
+{\normalsize
+\noindent\verb"\endLandscape" exits landscape mode }
+\end{Landscape} % exit lanscape mode,
+ \lipsum[2][1-5] \marginpar[{\itshape\tiny\lipsum[1][1-4]}]{\itshape\tiny\lipsum[1][1-3]} \lipsum[11]
+
+~
+
+{\normalsize
+\noindent\verb"\begin{landscape}" enters landscape environment}
+ \begin{landscape}
+ \lipsum[2-5]
+ \end{landscape}
+{\normalsize
+\noindent\verb"\end{landscape}" exits landscape environment}
+
+~
+
+ \marginpar[{\itshape\tiny\lipsum[1][1-4]}]{\itshape\tiny\lipsum[1][1-3]} \lipsum[17]
+
+~
+
+{\normalsize
+\noindent\verb"\NewFullPage" enters full page mode}
+\NewFullPage
+
+ \lipsum[1-4]
+
+~
+
+{\normalsize
+\noindent\verb"\OldMarginPage " restores the previous page format}
+\OldMarginPage
+
+ \marginpar[{\itshape\tiny\lipsum[1][1-4]}]{\itshape\tiny\lipsum[1][1-3]} \lipsum[17]
+
+
+
+\end{document} \ No newline at end of file
diff --git a/macros/latex/contrib/flexipage/flexipage.dtx b/macros/latex/contrib/flexipage/flexipage.dtx
new file mode 100644
index 0000000000..2188b2790f
--- /dev/null
+++ b/macros/latex/contrib/flexipage/flexipage.dtx
@@ -0,0 +1,818 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2022 by <+author+> <<+email+>>
+% ---------------------------------------------------------------------------
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is <+maintainer+>.
+%
+% This work consists of the files flexipage.dtx and flexipage.ins
+% and the derived filebase flexipage.sty.
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{flexipage.dtx}
+%</driver>
+%<package>\NeedsTeXFormat{LaTeX2e}[2020/10/01]
+%<package>\ProvidesPackage{flexipage}
+%<*package>
+ [2022/07/09 1.00 Easy page geometry]
+%</package>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{xspace}
+\usepackage{tikz,amsmath, amssymb,bm,color}
+\usetikzlibrary{shapes,arrows}
+\usetikzlibrary{calc}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+ \voffset = -45pt
+ \textheight=210mm
+ \DocInput{flexipage.dtx}
+ \PrintChanges
+% \PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+%
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+% \changes{<+version+>}{<+date+>}{Converted to DTX file}
+%
+% \DoNotIndex{\newcommand,\newenvironment}
+%
+%
+% \providecommand*{\url}{\texttt}
+% \providecommand\lgtarg[1]{{\ttfamily<}\meta{#1}{\ttfamily>}}
+% \GetFileInfo{flexipage.dtx}
+%
+% \title{The \textsf{flexipage} package}
+% \author{Anton Vrba\\\small%
+% Home Page: \url{https://github.com/anton-vrba/flexipage} }
+% \date{\fileversion~from \filedate\\}
+%
+%
+% \maketitle
+%
+% \begin{abstract}
+% \noindent The package flexipage allows easy page layout if marginalia is required.
+% Mid document changes are possible such as: new marginal width, full width text,
+% and landscape text without marginal. Partners well with the package \textsf{sidenotesplus}.
+% The package also aids the layout for book printing, allowing for binding corrections
+% and adding page bleed, if required,
+% \end{abstract}
+%
+%
+%
+% \noindent The aim is an easy to use the page geometry setup,
+% and allow mid-document changes such as from portrait
+% to landscape, or change the text body width to marginalia width ratio.
+% The philosophy is simple, easy to understand options quickly set up the page geometry:
+% \begin{enumerate}
+% \item |pageheight| and |pagewidth| of final document, default inherited.
+% \item Defines page margins |inner|, |outer|, |top| and |bot|. Inner refers to the binding
+% that is the left side margin of on odd pages in |twoside| documents, or
+% of pages in |oneside| documents. Page margins surround the printable area.
+% Default for all |36pt|, or |0.5in|.
+% \item Add a |binding| correction, default |9pt|.
+% \item Add an |outerbleed|, increases the papersize by adding a bleed area to the
+% non bound margins. For the seldom requirement an |innerbleed| adds to the
+% paperwidth on the inner side.
+% Refer to your publisher. Default for both |0pt|.
+% \item Divide the remaining printable area into a vertical |grid|, default |12|.
+% \item Insert a |marginparsep| (default |3ex|) at the |margingrid| position
+% counting from the outer edge; 0 is for no
+% marginalia, 1 is a narrow marginal note area, and 4 is a marginal note area
+% of one halve the width of the text body area's width when |grid=12|.
+% The marginal area is placed by the outer edge.
+% \item The \LaTeX\xspace |headsep|, |headheight| and |footskip| dimension
+% can also be passed as options, otherwise default to class values.
+% \item As a visual guide, the option |show| frames the page geometry in the output
+% \end{enumerate}
+%
+% \footnotesize
+% \noindent \begin{tikzpicture}
+%
+% \draw [fill=yellow!30] (-4,4.4) node (v1) {} rectangle (3,-4.2);
+% \draw[fill=white] (-3.8,4.2) rectangle (2.8,-4);
+% \draw [color=green, fill=green!20 ] (-2.8,3.6) rectangle (2.2,-3.4);%
+% \draw [fill=orange!10] (-2.8,3.6) rectangle (0.8,3.4);
+% \draw [fill=orange!10] (1,3) rectangle (2.2,-2.8);
+% \draw [fill=orange!10](-2.8,3) rectangle (0.8,-2.8);
+% \draw [fill=violet!10] (-3.8,-4.2) rectangle (v1);
+
+% \draw [loosely dashed, blue] (-3.4,4.2) -- (-3.4,-4);
+% \draw (-2.8,-3.4) -- (0.8,-3.4);
+% \draw [loosely dashed] (1.8,3) -- (1.8,-2.8);
+% \draw [loosely dashed] (1.4,3) -- (1.4,-2.8);
+% \draw [loosely dashed] (0.4,3) -- (0.4,-2.8);
+% \draw [loosely dashed] (0,3) -- (0,-2.8);
+% \draw [loosely dashed] (-0.4,3) -- (-0.4,-2.8);
+% \draw [loosely dashed] (-0.8,3) -- (-0.8,-2.8);
+% \draw [loosely dashed] (-1.2,3) -- (-1.2,-2.8);
+% \draw [loosely dashed] (-1.6,3) -- (-1.6,-2.8);
+% \draw [loosely dashed](-2,3) -- (-2,-2.8);
+% \draw [loosely dashed](-2.4,3) -- (-2.4,-2.8);
+% \node at (-1.2,3.5) {Header};
+% \node at (-0.9,0.3) {Text Body};
+% \node [rotate=90] at (1.6,0.3) {Marginal};
+% \node [text width=65mm, right ] at (3.5,0.1)
+% {\small The basic paper geometry for book printing is illustrated to the left.
+% This for odd page numbers, the recto page. The even pages mirror this geometry
+% to maintain verso--recto symmetry.
+% The final page size is the white area. The yellow outer coloured area is the
+% |outerbleed| and the violet colored area on the left is the |innerbleed|, these
+% are trimmed and discarded. Please refer to your publisher if needed.
+%
+% ~~~The green area is the text block containing the text body, the marginal,
+% the header and footer and is defined by the margins |top|,
+% |outer| and |bottom| to the trimmed paper's edge.
+% The inner side (left) vertical dot-dashed line represents the |binding| correction and the |inner|
+% margin is defined from this line.
+%
+% ~~~Here the illustrated text width plus the marginal width are divided into 12 equal |grid=12| divisions
+% with the marginal takin 3 of them, defined by |marginalgrid=3|.
+% .};
+% \node at (-1.2,-3.3) {Footer};
+% \end{tikzpicture}\small
+% \\ Also refer to:
+% \url{https://www.overleaf.com/learn/latex/Single\_sided\_and\_double\_sided\_documents}
+% \normalsize
+%
+% \section{Usage}
+% \subsection{Document preamble}
+% \small
+% \begin{verbatim}
+% \PassOptionsToPackage{
+% % a4paper , % or another recognised paper size
+% % paperheight = , % inherits from class
+% % paperwidth = , % inherits from class
+% % inner = , % default 36pt or 0.5in
+% % outer = , % 36pt or 0.5in
+% % top = , % 36pt or 0.5in
+% % bot = , % 36pt or 0.5in
+% % binding = , % 9pt or 0.125in
+% % outerbleed = , % 0pt, but check with your printer
+% % innerbleed = , % 0pt, but check with your printer
+% % grid = , % 12 it is just a number
+% % marginalgrid = , % 3 it is just a number
+% % marginparsep = , % 3ex, if using sidenotesplus change to 4 or 5ex
+% % headsep = , % inherits from class
+% % headheight = , % inherits from class
+% % footskip= , % inherits from class
+% % show , % a switch to show frames around the printable areas.
+% % fancyhdrOff , % Do not use the fancyhdr package
+% % NoFixMargin % a possible future requirement
+% }{flexipage}
+% \usepackage{flexipage}
+% \end{verbatim}
+% \normalsize\vspace{-20pt}
+%
+% \paragraph{Known Issue:} If using the option |show| and the package \textsf{xcolor}
+% is loaded later with options, an error will occur. The reason
+% is that when option |show| is specified the package \textsf{eso-pic} is loaded
+% whch in turns loads \textsf{xcolor} without options.
+%
+% \paragraph{Marginalia Position Issue:} When doing mid document changes to |\textwidth|
+% and |\marginparwidth| then |\marginpar{content}| renders the marginalia to the correct
+% width but places it at the old position. A patch is provided here
+% to correct this issue. Should this ever be fixed in the
+% latex base software then the |NoFixMargin| option would be required.
+%
+% \paragraph{Using \textsf{fancyhdr} package} By default the \textsf{fancyhdr} package
+% is loaded and the |\headerlength| is set to span the page, that is it overhangs the
+% text body. The advantage here is that the header has the same format throughout
+% the document if mid-document layout changes are made. If no such changes are
+% made then use the |fancyhdrOff| and load \textsf{fancyhdr} in your preamble. Now
+% the header does not overhang the text body and is as shown in the previous illustration.
+%
+%
+% The following paper sizes are recognised:
+%
+% ~
+%
+% \begin{tabular}{rlp{2ex}rl}
+% \multicolumn{2}{c}{Standard Paper} & &\multicolumn{2}{c}{Standard Book} \\
+% a4paper &210$\times$297mm & & US-Trade &6$\times$9in \\
+% a5paper &148$\times$210mm & & UK-B-Format &135$\times$210mm \\
+% b4paper &250$\times$353mm & & US-B-Format &129$\times$198mm \\
+% b5paper &176$\times$250mm & & UK-Royal &156$\times$234mm \\
+% c4paper &229$\times$324mm & & Quarto &9.5$\times$12in \\
+% c5paper &162$\times$229mm & & Octavo &6$\times$9in \\
+% b4jpaper &257$\times$364mm & & CrownQuarto &189$\times$246mm \\
+% b5jpaper &182$\times$257mm & & Demi &138$\times$216mm \\
+% letterpaper &8.5$\times$11in \\
+% legalpaper &8.5$\times$14in \\
+% executivepaper &7.25$\times$10.5in \\
+% \end{tabular}
+
+%
+%\subsection{User Interfaces}
+%
+%
+% \DescribeMacro{\NewMarginPage} Changes text--marginal ratio.
+% |\NewMarginPage|\oarg{g}\lgtarg{parsep}\marg{m}
+% where optionally the grid count is reset to |grid|=\textit{g}, and marginal width is
+% determined by |marginalgrid|=\textit{m}. The ratio of the lengths |\textwidth|
+% to |\marginparwidth| is $g-m$ to $n$. The second option changes the |\parsep| length.
+%
+%
+% \DescribeMacro{\NewFullPage} Continues the document with a new page without margins,
+% and is equivalent to |\NewMarginPage|\marg{0}
+%
+%
+%
+% \DescribeMacro{\OldMarginPage}
+% \DescribeMacro{\ResetFlexiPage} After |\NewMarginPage| or |\NewFullPage| revert to
+% the previous page geometry, these are not stacked. |\ResetFlexiPage| reverts to the layout specified in
+% the initial options
+%
+%
+%
+%
+% \DescribeEnv{Landscape}
+% \DescribeEnv{landscape}
+% These two environments provide landscape layouts. The big |Landscape| provides
+% full text block landscape. The small |landscape| environments respects the
+% portrait orientated marginal space which now is white space. Do not use
+% marginalia in landscape mode.
+%
+% \DescribeMacro{\Landscape}
+% \DescribeMacro{\endLandscape}
+% \DescribeMacro{\landscape}
+% \DescribeMacro{\endlandscape} Alternatives to |\begin{Landscape}| $\cdots$ $\cdots$ |\end{Landscape}|
+% %
+%
+% \section{Implementation}
+%
+% \iffalse
+%<*package>
+% \fi
+%
+% \begin{macrocode}
+\RequirePackage{xparse} % new LaTeX3 syntax to define macros and environments
+\RequirePackage{l3keys2e} % nice way for option processing
+\RequirePackage{calc} % length manipulation
+\RequirePackage{fp} % floating point calculation
+\RequirePackage{ifoddpage}
+\RequirePackage{graphics} % provides landscaping
+\RequirePackage{mparhack} % not needed here, but the user certainly needs it.
+\RequirePackage{etoolbox} % provides \patchcmd
+% ****** \RequirePackage{eso-pic} only loaded later if option show is specified
+\newlength{\fleximarginparsep}
+\newlength{\flx@paperheight}
+\newlength{\flx@paperwidth}
+\newlength{\flx@temp}
+\newlength{\flx@LSfix}
+\setlength{\flx@LSfix}{0pt}
+\newlength{\flx@lsfix}
+\setlength{\flx@lsfix}{0pt}
+\newlength{\flx@textheigt}
+\newlength{\flx@orgtextwidth}
+\newlength{\flx@oldparsep}
+\newlength{\flx@oparsep}
+\newlength{\flx@binding}
+\newlength{\marginparsepodd}
+\newlength{\marginparsepeven}
+\newlength{\flx@inner}
+\newlength{\flx@outer}
+\newlength{\flx@top}
+\newlength{\flx@bot}
+\newlength{\flx@parsep}
+\newlength{\flx@printarea}
+\newlength{\flx@outerbleed}
+\newlength{\flx@innerbleed}
+\setlength{\flx@binding} {9pt}
+\setlength{\flx@inner} {36pt}
+\setlength{\flx@outer} {36pt}
+\setlength{\flx@top} {36pt}
+\setlength{\flx@bot} {45pt}
+\setlength{\flx@parsep}{3ex}
+\setlength{\flx@outerbleed} {0pt}
+\setlength{\flx@innerbleed} {0pt}
+\FPset\flx@m{3}
+\FPset\flx@g{12}
+\newif\ifSF@frame\SF@framefalse
+\newif\ifFix@Margin\Fix@Margintrue
+\newif\ifUse@fancyhdr\Use@fancyhdrtrue
+% \end{macrocode}
+%
+%
+%
+% \begin{macrocode}
+\setlength{\flx@paperheight}{\paperheight}
+\setlength{\flx@paperwidth}{\paperwidth}
+
+\NewDocumentCommand \flx@setpapersize {o o m}{
+\setlength{\flx@paperheight}{#2#3}
+\setlength{\flx@paperwidth}{#2#3}
+}
+
+
+\ExplSyntaxOn
+\keys_define:nn { flexiprint }
+{
+ binding .code:n = \setlength{\flx@binding}{#1},
+ inner .code:n = \setlength{\flx@inner}{#1},
+ outer .code:n = \setlength{\flx@outer}{#1},
+ top .code:n = \setlength{\flx@top}{#1},
+ bot .code:n = \setlength{\flx@bot}{#1},
+ marginparsep .code:n = \setlength{\flx@parsep}{#1},
+ paperheight .code:n = \setlength{\flx@paperheight}{#1},
+ paperwidth .code:n = \setlength{\flx@paperwidth}{#1},
+ outerbleed .code:n = \setlength{\flx@outerbleed}{#1},
+ innerbleed .code:n = \setlength{\flx@innerbleed}{#1},
+ grid .code:n = \FPset\flx@g{#1},
+ marginalgrid .code:n = \FPset\flx@m{#1} ,
+ show .code:n = \SF@frametrue ,
+ NoFixMargin .code:n = \Fix@Marginfalse ,
+ headsep .code:n = \setlength{\headsep}{#1},
+ headheight .code:n = \setlength{\headheight}{#1},
+ footskip .code:n = \setlength{\footskip}{#1},
+ fancyhdrOff .code:n = \Use@fancyhdrfalse,
+ a4paper .code:n = \flx@setpapersize[210][297]{mm},
+ a5paper .code:n = \flx@setpapersize[148][210]{mm},
+ b4paper .code:n = \flx@setpapersize[250][353]{mm},
+ b5paper .code:n = \flx@setpapersize[176][250]{mm},
+ c4paper .code:n = \flx@setpapersize[229][324]{mm},
+ c5paper .code:n = \flx@setpapersize[162][229]{mm},
+ b4jpaper .code:n = \flx@setpapersize[257][364]{mm},
+ b5jpaper .code:n = \flx@setpapersize[182][257]{mm},
+ letterpaper .code:n = \flx@setpapersize[8.5][11]{in},
+ legalpaper .code:n = \flx@setpapersize[8.5][14]{in},
+ executivepaper .code:n = \flx@setpapersize[7.25][10.5]{in},
+ 10x8paper .code:n = \flx@setpapersize[8][10]{in},
+ US-Trade .code:n = \flx@setpapersize[6][9]{in},
+ UK-B-Format .code:n = \flx@setpapersize[135][210]{mm},
+ US-B-Format .code:n = \flx@setpapersize[129][198]{mm},
+ UK-Royal .code:n = \flx@setpapersize[156][234]{mm},
+ Quarto .code:n = \flx@setpapersize[9.5][12]{in},
+ Octavo .code:n = \flx@setpapersize[6][9]{in},
+ CrownQuarto .code:n = \flx@setpapersize[189][246]{mm},
+ Demi .code:n = \flx@setpapersize[138][216]{mm},
+}
+\ProcessKeysOptions { flexiprint }
+
+\DeclareExpandableDocumentCommand{\IfNoValueOrEmptyTF}{ m m m }
+{
+ \IfNoValueTF{#1}
+ {#2}
+ {\tl_if_empty:nTF {#1} {#2} {#3}}
+}
+\ExplSyntaxOff
+
+\FPset\flx@oldg{\flx@g}
+\FPset\flx@oldm{\flx@m}
+\FPset\flx@og{\flx@g}
+\FPset\flx@om{\flx@m}
+\setlength{\flx@oparsep}{\flx@parsep}
+\ifUse@fancyhdr
+ \RequirePackage{fancyhdr}
+ \pagestyle{fancy}
+\fi
+
+\setlength{\flx@oldparsep}{\flx@parsep}
+\setlength{\flx@oparsep}{\flx@parsep}
+\addtolength{\flx@binding}{\flx@innerbleed}
+\global\hoffset=0pt
+\global\voffset=0pt
+
+% \end{macrocode}
+%
+% \begin{macro}{\flx@setpagevertical}
+% \begin{macrocode}
+\NewDocumentCommand \flx@setpagevertical {} {
+ \setlength{\flx@temp}{\flx@paperwidth+\flx@innerbleed+\flx@outerbleed}
+ \global\paperwidth=\flx@temp
+
+ \setlength{\flx@temp}{\flx@paperheight+2\flx@outerbleed}
+ \global\paperheight=\flx@temp
+
+ \setlength{\flx@temp}{\flx@top+\flx@outerbleed-72pt}
+ \setlength{\topmargin}{\flx@temp}
+
+ \setlength{\flx@temp}{\paperheight - \flx@top %
+ - \headheight - \headsep -\footskip - \flx@bot - 2\flx@outerbleed}
+ \setlength{\textheight}{\flx@temp}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\flx@setpagevertical
+\setlength{\flx@textheigt}{\textheight}
+\newlength{\flx@linewidth}
+% \end{macrocode}
+%
+% \begin{macro}{\flx@setpage}
+% \begin{macrocode}
+
+\NewDocumentCommand \flx@setpage {} {
+ \FPifgt\flx@m0\relax\else\setlength{\flx@parsep}{0pt}\fi
+ \setlength{\flx@temp}{\flx@binding+\flx@inner-72pt}
+ \global\oddsidemargin=\flx@temp
+
+ \setlength{\flx@linewidth}{\paperwidth-\oddsidemargin-\flx@outer-72pt-\flx@outerbleed}
+ \ifUse@fancyhdr
+ \setlength{\headwidth}{\flx@linewidth}
+ \fi
+ \setlength{\flx@printarea}{\flx@linewidth-\flx@parsep}
+ \FPsub\flx@t\flx@g\flx@m
+ \setlength{\flx@temp}{\flx@printarea * \real{\flx@t}/\real{\flx@g} }
+ \global\textwidth=\flx@temp
+
+ \setlength{\flx@temp}{\flx@printarea * \real{\flx@m}/\real{\flx@g} }
+ \global\marginparwidth=\flx@temp
+ \global\marginparsep=\flx@parsep
+ \if@twoside
+ \setlength{\flx@temp}{\flx@outer+\marginparwidth+\marginparsep-1in+\flx@outerbleed}
+ \global\evensidemargin=\flx@temp
+ \else
+ \global\evensidemargin=\oddsidemargin
+ \fi
+ \global\fleximarginparsep=\marginparsep
+ \global\hsize=\textwidth
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\flx@setpage
+\flx@orgtextwidth=\textwidth
+\FPset\flx@oldg\flx@g
+\FPset\flx@oldm\flx@m
+\setlength{\flx@oparsep}{\flx@parsep}
+\setlength{\flx@oldparsep}{\flx@parsep}
+% \end{macrocode}
+%
+%
+% \begin{macro}{\NewMarginPage}
+% \begin{macrocode}
+\NewDocumentCommand \NewMarginPage {o d<> m} {
+ \FPset\flx@oldg\flx@g
+ \FPset\flx@oldm\flx@m
+ \setlength{\flx@oldparsep}{\flx@parsep}
+ \ResetFlexiPage
+ \IfNoValueOrEmptyTF{#2}{\relax}{\setlength{\flx@parsep}{#2} }
+ \IfNoValueOrEmptyTF{#1}{\relax}{\FPset\flx@g{#1}}
+ \FPset\flx@m{#3}
+ \flx@setpage
+ \flx@marginparcorrection
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\OldMarginPage}
+% \begin{macrocode}
+\NewDocumentCommand \OldMarginPage {} {
+ \FPset\flx@m\flx@oldm
+ \FPset\flx@g\flx@oldg
+ \flx@ResetFlexiPage
+ \setlength{\flx@parsep}{\flx@oldparsep}
+ \flx@setpage
+ \flx@marginparcorrection
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\NewFullPage}
+% \begin{macrocode}
+\NewDocumentCommand \NewFullPage {}{
+ \FPset\flx@oldg\flx@g
+ \FPset\flx@oldm\flx@m
+ \setlength{\flx@oldparsep}{\flx@parsep}
+ \flx@ResetFlexiPage
+ \FPset\flx@m{0}
+ \setlength{\flx@parsep}{0pt}
+ \flx@setpage
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\ResetFlexiPage}
+% \begin{macrocode}
+\NewDocumentCommand \ResetFlexiPage{} {
+ \FPset\flx@oldg\flx@g
+ \FPset\flx@oldm\flx@m
+ \flx@ResetFlexiPage
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\flx@ResetFlexiPage}
+% \begin{macrocode}
+\NewDocumentCommand \flx@ResetFlexiPage{} {
+ \clearpage
+ \FPset\flx@g\flx@og
+ \FPset\flx@m\flx@om
+ \setlength{\flx@parsep}{\flx@oparsep}
+ \flx@setpage
+ \flx@marginparcorrection
+}
+% \end{macrocode}
+% \end{macro}%
+%
+% \begin{macro}{\Landscape}
+% \begin{macrocode}
+\NewDocumentCommand \Landscape {}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+{
+ \FPset\flx@oldm\flx@m
+ \FPset\flx@oldg\flx@g
+ \setlength{\flx@oldparsep}{\flx@parsep}
+ \clearpage
+ \setlength{\flx@LSfix}{\textheight-\flx@linewidth}
+ \FPset\flx@m{0}
+ \setlength{\flx@parsep}{0ex}
+ \flx@setpage
+ \flx@landscape
+}
+% \end{macrocode}
+%
+% \begin{macro}{\endLandscape}
+% \begin{macrocode}
+\NewDocumentCommand \endLandscape {}
+{
+ \flx@endlandscape
+ \FPset\flx@m\flx@oldm
+ \FPset\flx@g\flx@oldg
+ \setlength{\flx@parsep}{\flx@oldparsep}
+ \flx@setpage
+ \setlength{\flx@LSfix}{0pt}
+ \flx@marginparcorrection
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\landscape}
+% \begin{macrocode}
+\NewDocumentCommand \landscape {}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+{
+ \FPset\flx@oldm\flx@m
+ \FPset\flx@oldg\flx@g
+ \setlength{\flx@oldparsep}{\flx@parsep}
+ \clearpage
+ \setlength{\flx@LSfix}{\textheight-\textwidth}
+ \FPset\flx@m{0}
+ \setlength{\flx@parsep}{0ex}
+ \flx@landscape
+}
+% \end{macrocode}
+%
+% \begin{macro}{\endlandscape}
+% \begin{macrocode}
+\NewDocumentCommand \endlandscape {}
+{
+ \flx@endlandscape
+ \FPset\flx@m\flx@oldm
+ \FPset\flx@g\flx@oldg
+ \setlength{\flx@parsep}{\flx@oldparsep}
+ \flx@setpage
+ \setlength{\flx@LSfix}{0pt}
+ \flx@marginparcorrection
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% If the page layout includes a marginal these lscape.sty package
+% respect these
+%
+%
+% \begin{macrocode}
+%
+
+\def\flx@LS@rot{%
+ \setbox\@outputbox\vbox{\hbox{\rotatebox{90}{\box\@outputbox}}}}
+
+\def\flx@landscape{%
+ \let\flx@LS@makecol=\@makecol
+ \let\flx@LS@makefcolumn=\@makefcolumn
+ \clearpage
+ \begingroup
+ \global\vsize=\textwidth
+ \global\hsize=\textheight
+ \linewidth=\hsize
+ \columnwidth=\hsize
+ \@colroom=\vsize
+ \textheight=\vsize
+ \@colht=\vsize
+ \def\@makecol{\flx@LS@makecol\flx@LS@rot}%
+ \def\@makefcolumn##1{\flx@LS@makefcolumn{##1}\flx@LS@rot}}
+
+\def\flx@endlandscape{%
+ \clearpage
+ \endgroup
+ \global\@colht=\textheight
+ \global\vsize=\textheight
+ \global\@colroom=\textheight}
+%
+% \end{macrocode}
+%
+%
+%
+% \begin{macro}{\flx@marginparcorrection }
+%
+% Mid-document changes to textwidth are not communicated the LaTeX marginpar
+% routines hence the patch to correct the odd-side marginparsep.
+%
+% lifted from https://tex.stackexchange.com/questions/174605
+%
+% % \end{macro}
+%
+%
+% \begin{macrocode}
+\NewDocumentCommand\flx@marginparcorrection{}{
+\ifFix@Margin
+ \setlength{\marginparsepodd}{\marginparsep-\flx@orgtextwidth+\textwidth}
+ \setlength{\marginparsepeven}{\marginparsep}
+ \patchcmd{\@addmarginpar}%In this command
+ {\mph@orig@addmarginpar}%...replace this...
+ {\if@twoside\ifodd\c@page\relax%...with this
+ \marginparsep=\marginparsepodd%Page isodd
+ \else%twoside and eveb
+ \marginparsep=\marginparsepeven%Page iseven
+ \fi
+ \else% oneside
+ \marginparsep=\marginparsepodd
+ \fi
+ \mph@orig@addmarginpar}
+ {}%success
+ {\message{Error! Couldn't hook into command %failure
+ `\string\@addmarginpar'}} %end patch command
+
+ {
+ \def\patcherr{%
+ \message{Error!Couldn't hook into command`\string\@mn@@@marginnote'}}
+ \def\patchok{%
+ \let\patcherr\relax%Only display error if first patch fails
+ \patch%Now patch again.
+ }
+ \def\patch{
+ \patchcmd{\@mn@@@marginnote}%In this command
+ {\kern\marginparsep}%...replace this...
+ {\ifx\@mn@currpage\relax\else%...with this
+ \if@twoside\ifodd\@mn@currpage\relax
+ \kern\marginparsepodd%Page is odd
+ \else
+ \kern\marginparsepeven
+ \fi
+ \else% one side
+ \kern\marginparsepodd
+ \fi
+ \fi}
+ {\message{Patched!}\patchok}%success(recurse)
+ {\patcherr}%fail
+ }
+ \message{Patching`\string\@mn@@@marginnote`!}
+ \patch
+ \global\let\@mn@@@marginnote\@mn@@@marginnote%Makepatch global
+ }
+\fi
+}
+% \end{macrocode}
+%
+%
+% The package showframe.sty is adapted and localised
+%
+%
+% \begin{macrocode}
+\ifSF@frame\RequirePackage{eso-pic}\fi % so that below code can draw frames
+
+\ifSF@frame\AddToShipoutPictureBG{\flx@ShowFramePicture}\fi
+
+\newcommand*\flx@framecolor{\color{green}}
+\newcommand*\flx@frameline{.8pt}
+\newdimen\SF@tempdima
+
+\newcommand\flx@ShowFramePicture{%
+ \begingroup
+ \color{orange}\linethickness{\flx@frameline}%
+ \if@twoside
+ \ifodd\c@page
+ \AtPageUpperLeft{%
+ \put(\flx@innerbleed,-\paperheight+\flx@outerbleed){%
+ \framebox(\paperwidth-\flx@outerbleed-\flx@innerbleed,\paperheight-2\flx@outerbleed){}}}%
+ \else
+ \AtPageUpperLeft{%
+ \put(\flx@outerbleed,-\paperheight+\flx@outerbleed){%
+ \framebox(\paperwidth-\flx@outerbleed-\flx@innerbleed,\paperheight-2\flx@outerbleed){}}}%
+ \fi
+ \else
+ \AtPageUpperLeft{%
+ \put(\flx@innerbleed,-\paperheight+\flx@outerbleed){%
+ \framebox(\paperwidth-\flx@outerbleed-\flx@innerbleed,\paperheight-2\flx@outerbleed){}}}%
+ \fi
+ \flx@framecolor\linethickness{\flx@frameline}%
+ \AtTextLowerLeft{%
+ \put(0,-\flx@LSfix){\framebox(\textwidth,\textheight+\flx@LSfix){}}}%
+
+\ifUse@fancyhdr
+ \if@twoside
+ \ifodd\c@page
+ \AtPageUpperLeft{%
+ \put(\flx@inner+\flx@binding,-\flx@outerbleed-\flx@top-\headheight){%
+ \framebox(\flx@linewidth,\headheight){}}}%
+ \AtPageUpperLeft{%
+ \put(\flx@inner+\flx@binding,%
+ -\flx@outerbleed-\flx@top-\headheight-\headsep-\textheight%
+ -\footskip -\flx@LSfix){%
+ \line(1,0){\flx@linewidth}}}%
+ \else
+ \AtPageUpperLeft{%
+ \put(\flx@outer+\flx@outerbleed,-\flx@outerbleed-\flx@top-\headheight){%
+ \framebox(\flx@linewidth,\headheight){}}}%
+ \AtPageUpperLeft{%
+ \put(\flx@outer+\flx@outerbleed,%
+ -\flx@outerbleed-\flx@top-\headheight-\headsep-\textheight%
+ -\footskip -\flx@LSfix){%
+ \line(1,0){\flx@linewidth}}}%
+
+ \fi
+ \else
+ \AtPageUpperLeft{%
+ \put(\flx@inner+\flx@binding,-\flx@outerbleed-\flx@top-\headheight){%
+ \framebox(\flx@linewidth,\headheight){}}}%
+ \AtPageUpperLeft{%
+ \put(\flx@inner+\flx@binding,%
+ -\flx@outerbleed-\flx@top-\headheight-\headsep-\textheight%
+ -\footskip -\flx@LSfix){%
+ \line(1,0){\flx@linewidth}}}%
+ \fi
+%
+\else
+ \AtTextUpperLeft{%
+ \put(0,\headsep){%
+ \framebox(\textwidth,\headheight){}}}%
+ \AtTextLowerLeft{%
+ \put(0,-\footskip-\flx@LSfix){%
+ \line(1,0){\textwidth}}}%
+\fi
+%
+\FPifgt\flx@m 0{%
+ \AtTextLowerLeft{%
+ \SF@tempdima=\textwidth\advance\SF@tempdima\marginparsep%
+ \if@twoside
+ \ifodd\c@page\else
+ \if@mparswitch
+ \SF@tempdima=-\marginparsep\advance\SF@tempdima-\marginparwidth
+ \fi
+ \fi
+ \fi
+ \put(\SF@tempdima,0)%
+ {\framebox(\marginparwidth,\textheight){}}%
+ }%
+ }\fi
+ \endgroup
+}
+% \end{macrocode}
+%
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \Finale
+\endinput
diff --git a/macros/latex/contrib/flexipage/flexipage.ins b/macros/latex/contrib/flexipage/flexipage.ins
new file mode 100644
index 0000000000..bac888a859
--- /dev/null
+++ b/macros/latex/contrib/flexipage/flexipage.ins
@@ -0,0 +1,64 @@
+%% Copyright (C) 2022 by Anton Vrba
+%%
+%% Home Page: https://github.com/anton-vrba/sidenotesplus
+%% Issues: https://github.com/anton-vrba/sidenotesplus/issues
+%% --------------------------------------------------------------------------
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Anton Vrba.
+%%
+%% This work consists of the files sidenotesplus.dtx and sidenotesplus.ins
+%% and the derived filebase sidenotesplus.sty.
+%%
+
+\input docstrip.tex
+\keepsilent
+
+
+\preamble
+
+ Copyright (C) 2022 by Anton Vrba
+ --------------------------------
+
+ This work may be distributed and/or modified under the
+ conditions of the LaTeX Project Public License, either version 1.3
+ of this license or (at your option) any later version.
+ The latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+ and version 1.3c or later is part of all distributions of LaTeX
+ version 2008-05-04 or later.
+
+
+ This work has the LPPL maintenance status `maintained'.
+
+ The Current Maintainer of this work is Anton Vrba.
+
+
+\endpreamble
+
+\generate{\file{flexipage.sty}{\from{flexipage.dtx}{package}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* sidenotesplus.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file sidenotesplus.dtx *}
+\Msg{* through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
diff --git a/macros/latex/contrib/flexipage/flexipage.pdf b/macros/latex/contrib/flexipage/flexipage.pdf
new file mode 100644
index 0000000000..50018e6bfd
--- /dev/null
+++ b/macros/latex/contrib/flexipage/flexipage.pdf
Binary files differ
diff --git a/macros/latex/contrib/inlinelabel/README.md b/macros/latex/contrib/inlinelabel/README.md
index ea7e66799c..ed2838e8d4 100644
--- a/macros/latex/contrib/inlinelabel/README.md
+++ b/macros/latex/contrib/inlinelabel/README.md
@@ -5,7 +5,7 @@ This package can assign equation numbers to inline equations. When Japanese is s
## Documents
-Documents for this pacakge are available in English and Japanese.
+Documents for this package are available in English and Japanese.
## License
@@ -17,6 +17,9 @@ This package released under [the MIT license](https://ctan.org/license/mit).
## Revision History
++ Version 1.2.1 2022-07-08
+ + Add the .tex source of the documentation.
+ + Improve the documentation.
+ Version 1.2 2022-07-08
+ Add the \equationreset.
+ Improve the documentation.
diff --git a/macros/latex/contrib/inlinelabel/inlinelabel.pdf b/macros/latex/contrib/inlinelabel/inlinelabel.pdf
index 4aef9a8f7d..253ea95264 100644
--- a/macros/latex/contrib/inlinelabel/inlinelabel.pdf
+++ b/macros/latex/contrib/inlinelabel/inlinelabel.pdf
Binary files differ
diff --git a/macros/latex/contrib/inlinelabel/inlinelabel.sty b/macros/latex/contrib/inlinelabel/inlinelabel.sty
index d249d60ad3..384c7fddb4 100644
--- a/macros/latex/contrib/inlinelabel/inlinelabel.sty
+++ b/macros/latex/contrib/inlinelabel/inlinelabel.sty
@@ -10,7 +10,7 @@
%%
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{inlinelabel}[2022/07/08 v1.2]
+\ProvidesPackage{inlinelabel}[2022/07/08 v1.2.1]
%
% When you meet ''Package pxufont Error: You must load this package
% after 'otf'.'', move \usepackage{otf} to a forward row.
diff --git a/macros/latex/contrib/inlinelabel/inlinelabel.tex b/macros/latex/contrib/inlinelabel/inlinelabel.tex
new file mode 100644
index 0000000000..66f961ce7b
--- /dev/null
+++ b/macros/latex/contrib/inlinelabel/inlinelabel.tex
@@ -0,0 +1,373 @@
+\documentclass[%
+fleqn,%
+paper=a4paper,%
+fontsize=10pt,%
+open_bracket_pos=zenkakunibu_nibu,%
+hanging_punctuation,%
+]%
+{jlreq}
+\jlreqsetup{%
+itemization_beforeafter_space=0pt,%
+itemization_itemsep=0pt%
+}
+\makeatletter
+\RequirePackage{luatexja}
+\RequirePackage{luatexja-otf}
+\RequirePackage{graphicx}
+\RequirePackage{amsmath}
+\DeclareRobustCommand{\metaphysicaicon}{\raisebox{-4.0pt}{\includegraphics[width=16pt]{metaphysicaicon.pdf}}}
+\RequirePackage[normalem]{ulem}
+\RequirePackage[explicit]{titlesec}
+\titleformat{\section}[hang]{}{}{0pt}{\uuline{\raisebox{1pt}{\textsf{\thesection\quad #1}}}}[\vspace{0.35\baselineskip}]
+\renewcommand{\thesection}{\S\,\arabic{section}}
+\let\originalsection\section
+\DeclareRobustCommand{\section}{\@ifstar{\@metaphysica@section@star}{\@metaphysica@section@nostar}}
+\DeclareRobustCommand{\@metaphysica@section@star}[1]{\vspace{0.5\baselineskip}\originalsection{#1}\vspace*{-\baselineskip}}
+\DeclareRobustCommand{\@metaphysica@section@nostar}[1]{\vspace{0.5\baselineskip}\originalsection{#1}}
+\RequirePackage[%
+truedimen,%
+margin=30truemm,
+includehead%
+]{geometry}
+\RequirePackage{lastpage}
+\RequirePackage{fancyhdr}
+\pagestyle{fancy}
+\DeclareRobustCommand{\headertitle}[2][\metaphysicaicon]{%
+\rhead[#2]{#1{}\quad\thepage{}/{}\pageref{LastPage}}%
+\lhead[\thepage{}/{}\pageref{LastPage}\quad{}#1]{#2}%
+\cfoot{}%
+}
+\RequirePackage{setspace}
+\setstretch{1.155}
+\DeclareRobustCommand{\linespace}{\@ifstar{\vspace{\baselineskip}}{\vspace{0.25\baselineskip}}}
+\DeclareRobustCommand{\linesmash}{\@ifstar{\vspace{-\baselineskip}}{\vspace{-0.25\baselineskip}}}
+\AtBeginDocument{%
+\abovedisplayskip =0.125\abovedisplayskip
+\abovedisplayshortskip=0.125\abovedisplayshortskip
+\belowdisplayskip =0.125\belowdisplayskip
+\belowdisplayshortskip=0.125\belowdisplayshortskip}
+\setlength{\jot}{0pt}%
+\setlength{\mathindent}{2\zw}%
+\renewcommand{\floatpagefraction}{0.75}
+\allowdisplaybreaks[2]
+\RequirePackage[no-math]{fontspec}
+\RequirePackage[no-math,deluxe,haranoaji]{luatexja-preset}
+\RequirePackage{multicolpar}
+\RequirePackage[style=iso]{datetime2}
+\RequirePackage[unicode]{hyperref}
+\RequirePackage{xparse}
+\RequirePackage{dashbox}
+\newcounter{psuedosectioncounter}
+\setcounter{psuedosectioncounter}{1}
+\newcounter{psuedocontentscounter}
+\setcounter{psuedocontentscounter}{1}
+\DeclareRobustCommand{\psuedosection}[3]{%
+\hypertarget{#1}{\mbox{}}\begin{multicolpar}{2}%
+\noindent\uuline{{\raisebox{1pt}{\textsf{\S\ \thepsuedosectioncounter\quad #2}}}}
+
+\noindent\uuline{{\raisebox{1pt}{\textsf{\S\ \thepsuedosectioncounter\quad #3}}}}
+\end{multicolpar}%
+\stepcounter{psuedosectioncounter}%
+\vspace{\baselineskip}%
+}
+\DeclareRobustCommand{\psuedocontents}[3]{%
+\begin{multicolpar}{2}%
+\noindent{\textsf{\hyperlink{#1}{\S\ \thepsuedocontentscounter\quad #2}}}
+
+\noindent{\textsf{\hyperlink{#1}{\S\ \thepsuedocontentscounter\quad #3}}}\end{multicolpar}%
+\stepcounter{psuedocontentscounter}%
+}
+\newenvironment{translateing}%
+{\begin{multicolpar}{2}}
+{\end{multicolpar}\vspace{\baselineskip}}
+\DeclareRobustCommand{\maketitletranslating}%
+{\maketitle\thispagestyle{fancy}
+\vspace{\baselineskip}\begin{multicolpar}{2}
+\textsf{English}
+
+\noindent
+\textsf{日本語 (Japanese)}
+\end{multicolpar}\vspace{\baselineskip}}
+\NewDocumentCommand\macroexplanation{v}{%
+\noindent\hspace*{\fill}{\texttt{#1}}\hspace*{\fill}\linespace%
+}
+\NewDocumentEnvironment{macroexample}{O{0.625} +b}{%
+\noindent\hspace*{\fill}\dbox{\parbox{#1\textwidth}{%
+#2%
+}}\hspace*{\fill}}%
+{\vspace{\baselineskip}}
+\NewDocumentEnvironment{macroexample*}{O{0.625} m +b}{%
+\noindent\hspace*{\fill}\dbox{\parbox{#1\textwidth}{%
+\vspace{-0.5\baselineskip}\begin{#2}%
+#3
+\end{#2}%
+}}\hspace*{\fill}}
+{\vspace{\baselineskip}}
+\let\code\texttt
+\setlength{\fboxsep}{1em}
+\setstretch{1.05}
+\DeclareRobustCommand{\commandtojskip}{\hspace{2.40554pt plus 1.49994pt minus 0.59998pt}}
+\RequirePackage{listings, jlisting}
+\lstset{
+ language=[LaTeX]TeX,
+ basicstyle={\ttfamily},
+ identifierstyle={\small},
+ commentstyle={\small\itshape},
+ keywordstyle={\small\bfseries},
+ ndkeywordstyle={\small},
+ stringstyle={\small\ttfamily},
+ frame=single,
+ breaklines=true,
+ columns=[l]{fullflexible},
+ stepnumber=1,
+ xrightmargin=0.1709\textwidth,
+ xleftmargin=0.1709\textwidth,
+ lineskip=-0.5ex
+}
+\RequirePackage{bxtexlogo}
+\RequirePackage{shortvrb}
+\MakeShortVerb{\|}
+\RequirePackage[luacircled]{inlinelabel}
+\makeatother
+%
+\hypersetup{%
+bookmarksnumbered=true,%
+colorlinks=true,%
+linkcolor=blue,%
+urlcolor=blue,%
+setpagesize=false,%
+pdftitle={The inlinelabel package},%
+pdfauthor={Yukoh KUSAKABE},%
+pdfsubject={The inlinelabel package},%
+pdfkeywords={TeX LaTeX inlinel label}}
+\title{The \code{inlinelabel} package:\\[0.25\baselineskip]
+assign equation numbers to inline equations}
+\author{Yukoh KUSAKABE}
+%\author{Y\=uk\=o KUSAKABE}
+\date{\today}
+\headertitle[Yukoh KUSAKABE\quad\metaphysicaicon]{The \code{inlinelabel} package}
+%\headertitle[Y\=uk\=o KUSAKABE\quad\metaphysicaicon]{The \code{inlinelabel} package}
+\begin{document}
+\maketitletranslating
+
+\begin{translateing}
+This package can assign equation numbers to inline equations. When Japanese is supported, you can switch to circled equation numbers.
+
+このパッケージは,インライン数式に数式番号を振ることができます。また,日本語を扱えるときには,丸で囲まれた数式番号に切り替えることができます。
+\end{translateing}
+
+%\psuedocontents{inlinelabel}
+%{Package \code{inlinelabel}}
+%{\code{inlinelabel} パッケージ}
+
+\psuedocontents{Requirements}{System Requirements}{前提条件}
+
+\psuedocontents{Installation}{Installation}{インストール}
+
+\psuedocontents{Loading}{Loading}{読み込み}
+
+\psuedocontents{Usage}{Usage}{使用方法}
+
+\psuedocontents{moreinfo}{For More Information}{問い合わせ・詳しくは}
+
+%\psuedosection{inlinelabel}{Package \code{inlinelabel}}{\code{inlinelabel} パッケージ}
+%
+%\begin{translateing}
+%This package can assign equation numbers to inline equations. When Japanese is supported, you can switch to circled equation numbers.
+%
+%このパッケージは,インライン数式に数式番号を振ることができます。また,日本語を扱えるときには,丸で囲まれた数式番号に切り替えることができます。
+%\end{translateing}
+
+\psuedosection{Requirements}{System Requirements}{前提条件}
+
+\begin{translateing}
+\textbullet\ \LaTeXe\ format\\
+\textbullet\ \code{amsmath} package\\
+\textbullet\ \code{refcount} package\\
+\textbullet\ \pTeX\ engine (\code{[circled]} only)\\
+\textbullet\ \code{japanese-otf} package (\code{[circled]} only)\\
+\textbullet\ \LuaTeX\ engine (\code{[luacircled]} only)\\
+\textbullet\ \scalebox{0.95}[1]{\code{luatexja-otf} package (\code{[luacircled]} only)}
+
+\noindent
+\textbullet\ \LaTeXe フォーマット\\
+\textbullet\ \code{amsmath} パッケージ\\
+\textbullet\ \code{refcount} パッケージ\\
+\textbullet\ \pTeX エンジン(\code{[circled]}使用時)\\
+\textbullet\ \scalebox{0.9}[1]{\code{japanese-otf} パッケージ(\code{[circled]}使用時)}\\
+%\textbullet\ \code{luatexja-otf} パッケージ\\
+%\hfill (\code{[luacircled]}使用時)
+\textbullet\ \LuaTeX エンジン(\code{[luacircled]}使用時)\!\\
+\textbullet\ \scalebox{0.8375}[1]{\code{luatexja-otf} パッケージ(\code{[luacircled]}使用時)}
+\end{translateing}
+
+\newpage
+\psuedosection{Installation}{Installation}{インストール}
+
+\begin{translateing}
+If not available, move inlinelabel.sty file to\\\code{\$TEXMF/tex/latex/inlinelabel}.
+
+直ちに使えなければ,inlinelabel.sty を\\\code{\$TEXMF/tex/latex/inlinelabel}\\%(\TeX が見つけられる場所)
+に置いてください。
+\end{translateing}
+
+\psuedosection{Loading}{Loading}{読み込み}
+
+\begin{translateing}
+To use this package, load .sty file with |\usepackage{inlinelabel}| command in
+preamble.
+
+このパッケージを使用するには,プリアンブルに\commandtojskip|\usepackage{inlinelabel}|\commandtojskip と書いてください。
+%\end{translateing}
+
+%\begin{translateing}
+There are three options:\\
+\textbullet\ |[nospace]| swaps with no space command and with space command.\\
+\textbullet\ |[circled]| switches to circled equation numbers on \pLaTeX, which is an engine for Japanese.\\
+\textbullet\ |[luacircled]| switches to circled equation numbers on \LuaLaTeX\ (and Japanese environment required).
+
+3つのオプションがあります。\\
+\textbullet\ |[nospace]|はスペースなし命令とスペースあり命令が入れ替えます。\\
+\textbullet\ |[circled]|は丸で囲まれた数式番号に切り替えます(\pLaTeX 用)。\\
+\textbullet\ |[luacircled]|は丸で囲まれた数式番号に切り替えます(\LuaLaTeX 用)。
+\end{translateing}
+
+
+
+\psuedosection{Usage}{Usage}{使用方法}
+
+\macroexplanation{\inlinelabel{<label>}}
+
+\begin{translateing}
+This command puts the inline equation number. It takes the name of the label as an argument. Place it outside of the equation (outside of the \$--\$). It makes a small margin before and after the text to make it look natural (in Japanese). If you don't want margins, use |\inlinelabel*{<label>}|.
+
+インラインの数式番号を置きます。引数にラベルの名前を取ります。数式(\$--\$)の外に置いてください。自然に見せるために,前後に少しの余白を取ります。余白がいらないときは\commandtojskip|\inlinelabel*{<label>}|\commandtojskip を使ってください。
+%
+%If you don't want margins (not in Japanese), use |\inlinelabel*{<label>}|.
+%
+%日本語組版を念頭に作っていますので,英語では |\inlinelabel*{<label>}| を使って原稿でスペースを入れるのが自然でしょう。
+
+For inconvenience, there is the |[nospace]| option.
+In this case, |\inlinelabel{<label>}| is swapped with no space and |\inlinelabel*{<label>}| has space.
+
+それが面倒なときのために,|[nospace]|オプションが用意されています。
+このとき,|\inlinelabel{<label>}|\commandtojskip がスペースなし,|\inlinelabel*{<label>}|\commandtojskip がスペースありに入れ替わります。
+\end{translateing}
+
+\begin{lstlisting}
+An inlinelabel makes
+$e^{i\theta}=\cos\theta+i\sin\theta$\inlinelabel{test1}.
+
+An asterisked one makes
+$e^{i\pi}+1=0$\inlinelabel*{test2}.
+\end{lstlisting}
+
+\begin{macroexample}
+An inlinelabel makes $e^{i\theta}=\cos\theta+i\sin\theta$\hspace{0.5em}(1)\hspace{0.5em}.
+
+An asterisked one makes $e^{i\pi}+1=0$(2).
+\end{macroexample}
+
+\begin{translateing}
+The |<label>| can be used for |\ref|.
+
+|<label>|\commandtojskip を\commandtojskip|\ref|で使うことができます。
+\end{translateing}
+
+\begin{lstlisting}
+Substituting $\theta=\pi$
+for (\ref{test1}) yields (\ref{test2}).
+\end{lstlisting}
+
+\begin{macroexample}
+Substituting $\theta=\pi$ for (\ref*{test1}) yields (\ref*{test2}).
+\end{macroexample}
+
+\macroexplanation{Options [circled] [luacircled]}
+
+\begin{translateing}
+Assuming you are using a Japanese environment. Switch to circled equation numbers. All equation numbers are rewritten, not just the inline equation numbers.
+
+あなたが日本語の環境を使用していることを前提とします。丸で囲まれた数式番号に切り替えます。インラインの数式番号だけでなく,すべての数式番号が書き換えられます。
+
+When using \pLaTeX\ with the \code{japanese-otf} package, specify \code{[circled]}; when using \LuaLaTeX\ with the \code{luatexja-otf} package, specify \code{[luacircled]}.
+
+\pLaTeX を使っているときは,\code{japanese-otf} パッケージの読み込みとともに\code{[circled]}オプションを指定してください。
+\LuaLaTeX を使っているときは,\code{luatexja-otf} パッケージの読み込みとともに\code{[luacircled]}オプションを指定してください。
+\end{translateing}
+%
+%\begin{lstlisting}
+%$e^{i\theta}=\cos\theta+i\sin\theta$\inlinelabel{test1}はテストです。
+%
+%アスタリスクをつけると$e^{i\pi}+1=0$\inlinelabel*{test2}です。
+%\end{lstlisting}
+
+\begin{macroexample}
+$e^{i\theta}=\cos\theta+i\sin\theta$\inlinelabel{test1}はテストです。
+
+アスタリスクをつけると$e^{i\pi}+1=0$\inlinelabel*{test2}です。
+\end{macroexample}
+
+\begin{translateing}
+The following example is just an align environment.
+
+次の例は単なる align 環境です。
+\end{translateing}
+
+\begin{lstlisting}
+\begin{align}
+&\phantom{=}\log_{3}x+\log_{3}(6-x)\\
+&=\log_{3}x(6-x)\\
+&=\log_{3}(-(x-3)^{2}+9)
+\end{align}
+\end{lstlisting}
+
+%\equationreset
+\begin{macroexample*}{align}
+&\phantom{=}\log_{3}x+\log_{3}(6-x)\\
+&=\log_{3}x(6-x)\\
+&=\log_{3}(-(x-3)^{2}+9)
+\end{macroexample*}
+
+\macroexplanation{\circledref{<label>} \equationref{<label>}}
+
+\begin{translateing}
+These commands are only valid when \code{[circled]} or \code{[luacircled]} option is loaded.
+They refer to the circled equation number.
+
+\code{[circled]}または\code{[luacircled]}オプションを読み込んでいるときにのみ有効です。
+丸で囲まれた数式番号を参照します。
+\end{translateing}
+
+\begin{translateing}
+|\equationref| is synonym with |\circledref|.
+
+|\equationref|は\commandtojskip|\circledref|の別名です。
+\end{translateing}
+
+\begin{lstlisting}
+Substituting $\theta=\pi$
+for \equationref{test1} yields \equationref{test2}.
+\end{lstlisting}
+
+\begin{macroexample}
+Substituting $\theta=\pi$ for \equationref{test1} yields \equationref{test2}.
+\end{macroexample}
+
+\macroexplanation{\equationreset}
+
+\begin{translateing}
+Reset the equation number back to 1.
+
+数式番号を1に戻します。
+\end{translateing}
+
+\psuedosection{moreinfo}{For More Information}{問い合わせ・詳しくは}
+
+\noindent\hspace*{\fill}\begin{tabular}{rl}
+The inlinelabel package:&\url{https://www.metaphysica.info/technote/package_inlinelabel/}\\
+Yukoh KUSAKABE:&\url{https://www.metaphysica.info/}\\
+&\url{https://twitter.com/metaphysicainfo}\\
+&(screen-name, 日下部幽考 in Japanese)
+\end{tabular}\hspace*{\fill}
+\end{document} \ No newline at end of file
diff --git a/macros/latex/contrib/jpneduenumerate/README.md b/macros/latex/contrib/jpneduenumerate/README.md
index 216b463305..aec10d0b35 100644
--- a/macros/latex/contrib/jpneduenumerate/README.md
+++ b/macros/latex/contrib/jpneduenumerate/README.md
@@ -1,31 +1,28 @@
-# Jpneduenumerate Package
+# jpneduenumerate
Mathematical equation representation in Japanese education differs somewhat from the standard LaTeX writing style. This package introduces enumerative expressions in Japanese education.
-## System Requirements
+## Documents
-+ TeX format: LaTeX
-+ TeX engine: pTeX, upTeX
-+ Prerequisite package: enumitem, japanese-otf and refcount
-
-Since the unit zw is used, it can be used only in the pTeX series.
-
-
-## Installation
-
-Move jpneduenumerate.sty file to $TEXMF/tex/latex/jpneduenumerate.
+Documents for this package are available in English and Japanese.
## License
This package released under [the MIT license](https://ctan.org/license/mit).
+(C) 2022 Yukoh KUSAKABE
+
## Revision History
-+ Version 1.0 2022-06-29
- + The first public version.
++ Version 1.1 2022-07-09
+ + Rewrite README.
+ + Add the document (jpneduenumerate.pdf).
+ + Add the [lua] option.
++ Version 1.0 2022-06-28
+ + The first public version.
---
diff --git a/macros/latex/contrib/jpneduenumerate/jpneduenumerate-en.md b/macros/latex/contrib/jpneduenumerate/jpneduenumerate-en.md
deleted file mode 100644
index a8e6658084..0000000000
--- a/macros/latex/contrib/jpneduenumerate/jpneduenumerate-en.md
+++ /dev/null
@@ -1,114 +0,0 @@
-# Jpneduenumerate Package
-
-Mathematical equation representation in Japanese education differs somewhat from the standard LaTeX writing style. This package introduces enumerative expressions in Japanese education.
-
-
-## System Requirements
-
-+ TeX format: LaTeX
-+ TeX engine: pTeX, upTeX
-+ Prerequisite package: enumitem, japanese-otf and refcount
-
-Since the unit zw is used, it can be used only in the pTeX series.
-
-
-## Installation
-
-Move jpneduenumerate.sty file to $TEXMF/tex/latex/jpneduenumerate.
-
-
-## Usage
-
-### astarisked environments
-
-The environment we will describe can be replaced with asterisked ones to eliminate the parindent.
-
-
-### environment enumerate and itemize
-
-The margins in the enumerate and itemize environments are automatically changed when the package is loaded. The symbols in the enumerate and itemize environments are automatically changed when the package is loaded. \labelenumi is (1), \labelenumii is (a), and \item is text bullet.
-
-
-### environment romanenumerate and caseenumerate
-
-This environment replaces the symbol (i) in the enumerate environment. caseenumerate is another name for romanenumerate.
-
-
-### environment Romanenumerate and stepenumerate
-
-This environment replaces the symbol (I) in the enumerate environment. stepenumerate is another name for Romanenumerate.
-
-
-### \parenref{<label>}
-
-Referred to as (1) depending on the label.
-
-
-### \romanref{<label>}
-
-Referred to as i depending on the label.
-
-
-### \parenromanref{<label>}
-
-Referred to as (i) depending on the label.
-
-
-### \Romanref{<label>}
-
-Referred to as I depending on the label.
-
-
-### \parenRomanref{<label>}
-
-Referred to as (I) depending on the labe
-
-
-### \??auto \??keep \??reset \??ref{<label>}
-
-\??auto outputs headings that automatically advance in numbering. \??keep outputs the heading with the previous number. \??reset resets the heading number back to 1. \??ref referred to as (1) depending on the label. \??ref{<label>} is referenced by label. The ?? parts can be the following:
-
-+ square (framed by square)
-+ question (another name for square)
-+ enumerate (1)
-+ subquestion (1)
-+ case (i)
-+ step (I)
-
-
-Non-asterisked commands are heading. Asterisked commands are not heading.
-
-\case is another name for \caseauto.
-
-\step is another name for \stepauto.
-
-
-### \equationreset
-
-Reset the equation number back to 1.
-
-
-### \question
-
-\questionauto and reset the equation, subquestion, enumerate, case and step numbers back to 1. \question* is another name for \questionauto*.
-
-
-### \subquestion
-
-\subquestion and reset the case and step numbers back to 1. \subquestion* is another name for \subquestionauto*.
-
-
-## License
-
-This package released under [the MIT license](https://ctan.org/license/mit).
-
-
-## Revision History
-
-+ Version 1.0 2022-06-29
- + The first public version.
-
-
----
-
-[Yukoh KUSAKABE](https://twitter.com/metaphysicainfo) (screen-name) at [metaphysica.info](https://www.metaphysica.info/) \ No newline at end of file
diff --git a/macros/latex/contrib/jpneduenumerate/jpneduenumerate-ja.md b/macros/latex/contrib/jpneduenumerate/jpneduenumerate-ja.md
deleted file mode 100644
index 2b5b0cb2b5..0000000000
--- a/macros/latex/contrib/jpneduenumerate/jpneduenumerate-ja.md
+++ /dev/null
@@ -1,114 +0,0 @@
-# Jpneduenumerate パッケージ
-
-日本の教育における数式表現には,LaTeX の標準である書きかたとはやや異なる部分があります。このパッケージでは,日本の教育における列挙表現を導入します。
-
-
-## 前提条件
-
-+ TeX format: LaTeX
-+ TeX engine: pTeX, upTeX
-+ Prerequisite package: enumitem, japanese-otf and refcount
-
-単位 zw を用いていますので,pTeX 系列でのみ使用できます。
-
-
-## インストール
-
-jpneduenumerate.sty を $TEXMF/tex/latex/jpneduenumerate (TeXが見つけられる場所)に置いてください。
-
-
-## 使用方法
-
-### アスタリスクのついた環境
-
-これから説明する環境は,アスタリスクをつけることで parindent がなくなります。
-
-
-### enumerate 環境と itemize 環境
-
-パッケージを読み込むと自動的に enumerate 環境と itemize 環境の余白が変更されます。パッケージを読み込むと自動的に enumerate 環境と itemize 環境の記号が変更されます。\labelenumi は (1),\labelenumii は (a),\item は ・ です。
-
-
-### romanenumerate 環境と caseenumerate 環境
-
-この環境は enumerate 環境の記号を (i) に置き換えたものです。caseenumerate は romanenumerate の別名です。
-
-
-### Romanenumerate 環境と stepenumerate 環境
-
-この環境は enumerate 環境の記号を (I) に置き換えたものです。stepenumerate は Romanenumerate の別名です。
-
-
-### \parenref{<label>}
-
-ラベルによって (1) のように参照します。
-
-
-### \romanref{<label>}
-
-ラベルによって i のように参照します。
-
-
-### \parenromanref{<label>}
-
-
-ラベルによって (i) のように参照します。
-
-
-### \Romanref{<label>}
-
-ラベルによって I のように参照します。
-
-
-### \parenRomanref{<label>}
-
-ラベルによって (I) のように参照します。
-
-
-### \??auto \??keep \??reset \??ref{<label>}
-
-\??auto は自動で番号が進む見出しを出力します。\??keep は直前の番号のままで見出しを出力します。\??reset は見出しの番号を1に戻します。\??ref{<label>} はラベルによって参照します。?? の部分には以下のものが使えます。
-
-+ square (framed by square)
-+ question (another name for square)
-+ enumerate (1)
-+ subquestion (1)
-+ case (i)
-+ step (I)
-
-アスタリスクのない命令は見出しになります。アスタリスクの付いた命令は見出しになりません。
-
-\case は \caseauto の別名です。
-
-\step は \stepauto の別名です。
-
-
-### \equationreset
-
-数式番号を1に戻します。
-
-
-### \question
-
-\questionauto を出力し,equation subquestion enumerate case step をすべて1に戻します。\question* は \questionauto* の別名です。
-
-
-### \subquestion
-
-\questionauto を出力し,case step をともに1に戻します。
-
-
-## ライセンス
-
-このパッケージは[MITライセンス](https://ctan.org/license/mit)のもとで配布しています。
-
-
-## 更新履歴
-
-+ Version 1.0 2022-06-29
- + The first public version.
-
-
----
-
-[Yukoh KUSAKABE](https://twitter.com/metaphysicainfo) (screen-name) at [metaphysica.info](https://www.metaphysica.info/) \ No newline at end of file
diff --git a/macros/latex/contrib/jpneduenumerate/jpneduenumerate.pdf b/macros/latex/contrib/jpneduenumerate/jpneduenumerate.pdf
new file mode 100644
index 0000000000..c7928aaac1
--- /dev/null
+++ b/macros/latex/contrib/jpneduenumerate/jpneduenumerate.pdf
Binary files differ
diff --git a/macros/latex/contrib/jpneduenumerate/jpneduenumerate.sty b/macros/latex/contrib/jpneduenumerate/jpneduenumerate.sty
index fa09f9b030..bfe092f80c 100644
--- a/macros/latex/contrib/jpneduenumerate/jpneduenumerate.sty
+++ b/macros/latex/contrib/jpneduenumerate/jpneduenumerate.sty
@@ -11,17 +11,15 @@
%%
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{jpneduenumerate}[2022/06/29 v1.0]
-%
-% %% \if@jpneduenumerate@meaning
-% \newif\if@jpneduenumerate@meaning
-% \@jpneduenumerate@meaningfalse
-% %
-% %% [meaning]
-% \DeclareOption{meaning}{\@jpneduenumerate@meaningtrue}
-% %
-% \ExecuteOptions{}
-% \ProcessOptions\relax
+\ProvidesPackage{jpneduenumerate}[2022/07/09 v1.1]
+%
+%% [lua]
+\newif\if@jpnedu@enumerate@lua
+\@jpnedu@enumerate@luafalse
+\DeclareOption{lua}{\@jpnedu@enumerate@luatrue}%
+%
+\ExecuteOptions{}
+\ProcessOptions\relax
%
%% replace defaluts
% for \setlist
@@ -30,9 +28,105 @@
% for \getrefnumber
\RequirePackage{refcount}
%
+%%%%%%%%%%%%%%%%%%%%%%%%
+% with [lua] %%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%
+\if@jpnedu@enumerate@lua
+%%%%%%%%%%%%%%%%%%%%%%%%
+%
% for \ajroman \ajRoman
-\RequirePackage{otf}
+\RequirePackage{luatexja-otf}
+%
+% If you do not use pLaTeX, LaTeX cannot use '\zw'.
+% In that case, please write \usepackage{bxjacalcux}.
+\setlist{nosep,leftmargin=2\zw,itemindent=1\zw,labelsep=1.15\zw,listparindent=1\zw}
+\setlist[itemize,1]{label=\textbf{\textperiodcentered}}
+\renewcommand{\labelenumi}{(\arabic{enumi})}
+\renewcommand{\labelenumii}{(\alph{enumii})}
+%%
+%
+% Asterisked envionments don't have parindent.
+%
+%% \begin{itemize*}
+\newenvironment{itemize*}%
+{\begin{itemize}[nosep,leftmargin=3\zw,itemindent=0\zw,labelsep=1.15\zw]}%
+{\end{itemize}}
+%
+%% \begin{enumerate*}
+\newenvironment{enumerate*}%
+{\begin{enumerate}[nosep,leftmargin=3\zw,itemindent=0\zw,labelsep=1.15\zw]}%
+{\end{enumerate}}
+%
+%% \begin{romanenumerate}
+%% \begin{romanenumerate*}
+\newenvironment{romanenumerate}%
+{\begin{enumerate}[nosep,leftmargin=2\zw,itemindent=1\zw,labelsep=1.15\zw,listparindent=1\zw]%
+\renewcommand{\labelenumi}{(\ajLabel\ajroman{enumi})}%
+\renewcommand{\labelenumii}{(\alph{enumii})}%
+}%
+{\end{enumerate}}
+\newenvironment{romanenumerate*}%
+{\begin{enumerate}[nosep,leftmargin=3\zw,itemindent=0\zw,labelsep=1.15\zw]%
+\renewcommand{\labelenumi}{(\ajLabel\ajroman{enumi})}%
+\renewcommand{\labelenumii}{(\alph{enumii})}%
+}%
+{\end{enumerate}}
+%
+%% \begin{Romanenumerate}
+%% \begin{Romanenumerate*}
+\newenvironment{Romanenumerate}%
+{\begin{enumerate}[nosep,leftmargin=2\zw,itemindent=1\zw,labelsep=1.15\zw,listparindent=1\zw]%
+\renewcommand{\labelenumi}{(\ajLabel\ajRoman{enumi})}%
+\renewcommand{\labelenumii}{(\alph{enumii})}%
+}%
+{\end{enumerate}}
+\newenvironment{Romanenumerate*}%
+{\begin{enumerate}[nosep,leftmargin=3\zw,itemindent=0\zw,labelsep=1.15\zw]%
+\renewcommand{\labelenumi}{(\ajLabel\ajRoman{enumi})}%
+\renewcommand{\labelenumii}{(\alph{enumii})}%
+}%
+{\end{enumerate}}
+%
+%% \begin{caseenumerate}
+%% \begin{caseenumerate*}
+%% \begin{stepenumerate}
+%% \begin{stepenumerate*}
+\newenvironment{caseenumerate}%
+{\begin{romanenumerate}}%
+{\end{romanenumerate}}
+\newenvironment{caseenumerate*}%
+{\begin{romanenumerate*}}%
+{\end{romanenumerate*}}
+\newenvironment{stepenumerate}%
+{\begin{Romanenumerate}}%
+{\end{Romanenumerate}}
+\newenvironment{stepenumerate*}%
+{\begin{Romanenumerate*}}%
+{\end{Romanenumerate*}}
+%%
+%
+%% \@jpneduenumerate@z@w@space
+\chardef\@jpneduenumerate@z@w@space=\jis"2121\relax
%
+%% \@jpneduenumerate@makenumber
+% Non-stared macros are heading ones.
+% Stared macros are non-heading ones.
+\newcommand{\@jpneduenumerate@makenumber}[2]{%
+\expandafter\newcommand\csname #1\endcsname%
+{\@ifstar{\csname @jpneduenumerate#1@star\endcsname}{\csname @jpneduenumerate#1@nostar\endcsname}}%
+\expandafter\newcommand\csname @jpneduenumerate#1@star\endcsname[1]%
+{#2}%
+\expandafter\newcommand\csname @jpneduenumerate#1@nostar\endcsname[1]%
+{\noindent#2\hspace{0.5\zw}}}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%
+% without [lua] %%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%
+\else
+%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% for \ajroman \ajRoman
+\RequirePackage{otf}
%
% If you do not use pLaTeX, LaTeX cannot use 'zw'.
% In that case, please write \usepackage{bxjacalcux}.
@@ -102,9 +196,6 @@
{\end{Romanenumerate*}}
%%
%
-%% \@jpneduenumerate@zwspace
-\chardef\@jpneduenumerate@zwspace=\jis"2121\relax
-%
%% \@jpneduenumerate@makenumber
% Non-stared macros are heading ones.
% Stared macros are non-heading ones.
@@ -116,6 +207,15 @@
\expandafter\newcommand\csname @jpneduenumerate#1@nostar\endcsname[1]%
{\noindent#2\hspace{0.5zw}}}
%
+%%%%%%%%%%%%%%%%%%%%%%%%
+% common %%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%
+\fi
+%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%% \@jpneduenumerate@z@w@space
+\chardef\@jpneduenumerate@z@w@space=\jis"2121\relax
+%
%% Refs
% \ref{<\labelenumii of romanenumerate and Romanenumerate>} doesn't work.
\@jpneduenumerate@makenumber{parenref}{(\ref{#1})}
@@ -167,9 +267,40 @@
%%
%%*
%
+%%%%%%%%%%%%%%%%%%%%%%%%
+% with [lua] %%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%
+\if@jpnedu@enumerate@lua
+%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%% Numbers
+\@jpneduenumeratetext@makenumber{square}{\mbox{\setlength{\fboxsep}{3pt}\@jpneduenumerate@z@w@space\kern-1\zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}#1}\kern-1\zw\@jpneduenumerate@z@w@space}}
+\@jpneduenumeratetext@makenumber{question}{\mbox{\setlength{\fboxsep}{3pt}\@jpneduenumerate@z@w@space\kern-1\zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}#1}\kern-1\zw\@jpneduenumerate@z@w@space}}
+% NG: \mbox{(#1)}
+\@jpneduenumeratetext@makenumber{subquestion}{\:(#1)}
+\@jpneduenumeratetext@makenumber{enumerate}{\:(#1)}
+\@jpneduenumeratetext@makenumber{case}{\mbox{(\ajroman{#1})}}
+\@jpneduenumeratetext@makenumber{step}{\mbox{(\ajRoman{#1})}}
+%%
+%
+%% Refs
+\@jpneduenumerate@makenumber{squareref}{{\setlength{\fboxsep}{3pt}\@jpneduenumerate@z@w@space\kern-1\zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}\ref{#1}}\kern-1\zw\@jpneduenumerate@z@w@space}}
+\@jpneduenumerate@makenumber{questionref}{{\setlength{\fboxsep}{3pt}\@jpneduenumerate@z@w@space\kern-1\zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}\ref{#1}}\kern-1\zw\@jpneduenumerate@z@w@space}}
+% \@jpneduenumerate@makenumber{questionref}{\mbox{\@jpneduenumerate@z@w@space\kern-1\zw\framebox[1.3em]{\ref{#1}}\kern-1\zw\@jpneduenumerate@z@w@space}}
+\@jpneduenumerate@makenumber{subquestionref}{\:\mbox{(\ref{#1})}}
+\@jpneduenumerate@makenumber{enumerateref}{\:\mbox{(\ref{#1})}}
+\@jpneduenumerate@makenumber{caseref}{\refused{#1}\mbox{(\ajroman{\getrefnumber{#1}})}}
+\@jpneduenumerate@makenumber{stepref}{\refused{#1}\mbox{(\ajRoman{\getrefnumber{#1}})}}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%
+% without [lua] %%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%
+\else
+%%%%%%%%%%%%%%%%%%%%%%%%
+%
%% Numbers
-\@jpneduenumeratetext@makenumber{square}{\mbox{\@jpneduenumerate@zwspace\kern-1zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}#1}\kern-1zw\@jpneduenumerate@zwspace}}
-\@jpneduenumeratetext@makenumber{question}{\mbox{\@jpneduenumerate@zwspace\kern-1zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}#1}\kern-1zw\@jpneduenumerate@zwspace}}
+\@jpneduenumeratetext@makenumber{square}{\mbox{\setlength{\fboxsep}{3pt}\@jpneduenumerate@z@w@space\kern-1zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}#1}\kern-1zw\@jpneduenumerate@z@w@space}}
+\@jpneduenumeratetext@makenumber{question}{\mbox{\setlength{\fboxsep}{3pt}\@jpneduenumerate@z@w@space\kern-1zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}#1}\kern-1zw\@jpneduenumerate@z@w@space}}
% NG: \mbox{(#1)}
\@jpneduenumeratetext@makenumber{subquestion}{\:(#1)}
\@jpneduenumeratetext@makenumber{enumerate}{\:(#1)}
@@ -178,14 +309,20 @@
%%
%
%% Refs
-\@jpneduenumerate@makenumber{squareref}{\@jpneduenumerate@zwspace\kern-1zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}\ref{#1}}\kern-1zw\@jpneduenumerate@zwspace}
-\@jpneduenumerate@makenumber{questionref}{\@jpneduenumerate@zwspace\kern-1zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}\ref{#1}}\kern-1zw\@jpneduenumerate@zwspace}
-% \@jpneduenumerate@makenumber{questionref}{\mbox{\@jpneduenumerate@zwspace\kern-1zw\framebox[1.3em]{\ref{#1}}\kern-1zw\@jpneduenumerate@zwspace}}
+\@jpneduenumerate@makenumber{squareref}{{\setlength{\fboxsep}{3pt}\@jpneduenumerate@z@w@space\kern-1zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}\ref{#1}}\kern-1zw\@jpneduenumerate@z@w@space}}
+\@jpneduenumerate@makenumber{questionref}{{\setlength{\fboxsep}{3pt}\@jpneduenumerate@z@w@space\kern-1zw\framebox[1.5em]{\vphantom{\raisebox{2pt}{1}\raisebox{-2pt}{1}}\ref{#1}}\kern-1zw\@jpneduenumerate@z@w@space}}
+% \@jpneduenumerate@makenumber{questionref}{\mbox{\@jpneduenumerate@z@w@space\kern-1zw\framebox[1.3em]{\ref{#1}}\kern-1zw\@jpneduenumerate@z@w@space}}
\@jpneduenumerate@makenumber{subquestionref}{\:\mbox{(\ref{#1})}}
\@jpneduenumerate@makenumber{enumerateref}{\:\mbox{(\ref{#1})}}
\@jpneduenumerate@makenumber{caseref}{\refused{#1}\mbox{(\ajroman{\getrefnumber{#1}})}}
\@jpneduenumerate@makenumber{stepref}{\refused{#1}\mbox{(\ajRoman{\getrefnumber{#1}})}}
%
+%%%%%%%%%%%%%%%%%%%%%%%%
+% common %%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%
+\fi
+%%%%%%%%%%%%%%%%%%%%%%%%
+%
%%* AVOID ERROR of COUNTER
%% case
\renewcommand{\caseauto}{\@ifstar{\@jpneduenumeratetext@avoid@caseauto@star}{\@jpneduenumeratetext@avoid@caseauto@nostar}}
diff --git a/macros/latex/contrib/jpneduenumerate/jpneduenumerate.tex b/macros/latex/contrib/jpneduenumerate/jpneduenumerate.tex
new file mode 100644
index 0000000000..0f54fe909b
--- /dev/null
+++ b/macros/latex/contrib/jpneduenumerate/jpneduenumerate.tex
@@ -0,0 +1,599 @@
+\documentclass[%
+fleqn,%
+paper=a4paper,%
+fontsize=10pt,%
+open_bracket_pos=zenkakunibu_nibu,%
+hanging_punctuation,%
+]%
+{jlreq}
+\jlreqsetup{%
+itemization_beforeafter_space=0pt,%
+itemization_itemsep=0pt%
+}
+\makeatletter
+\RequirePackage{luatexja}
+\RequirePackage{luatexja-otf}
+\RequirePackage{graphicx}
+\RequirePackage{amsmath}
+\DeclareRobustCommand{\metaphysicaicon}{\raisebox{-4.0pt}{\includegraphics[width=16pt]{metaphysicaicon.pdf}}}
+\RequirePackage[normalem]{ulem}
+\RequirePackage[explicit]{titlesec}
+\titleformat{\section}[hang]{}{}{0pt}{\uuline{\raisebox{1pt}{\textsf{\thesection\quad #1}}}}[\vspace{0.35\baselineskip}]
+\renewcommand{\thesection}{\S\,\arabic{section}}
+\let\originalsection\section
+\DeclareRobustCommand{\section}{\@ifstar{\@metaphysica@section@star}{\@metaphysica@section@nostar}}
+\DeclareRobustCommand{\@metaphysica@section@star}[1]{\vspace{0.5\baselineskip}\originalsection{#1}\vspace*{-\baselineskip}}
+\DeclareRobustCommand{\@metaphysica@section@nostar}[1]{\vspace{0.5\baselineskip}\originalsection{#1}}
+\RequirePackage[%
+truedimen,%
+margin=30truemm,
+includehead%
+]{geometry}
+\RequirePackage{lastpage}
+\RequirePackage{fancyhdr}
+\pagestyle{fancy}
+\DeclareRobustCommand{\headertitle}[2][\metaphysicaicon]{%
+\rhead[#2]{#1{}\quad\thepage{}/{}\pageref{LastPage}}%
+\lhead[\thepage{}/{}\pageref{LastPage}\quad{}#1]{#2}%
+\cfoot{}%
+}
+\RequirePackage{setspace}
+\setstretch{1.155}
+\DeclareRobustCommand{\linespace}{\@ifstar{\vspace{\baselineskip}}{\vspace{0.25\baselineskip}}}
+\DeclareRobustCommand{\linesmash}{\@ifstar{\vspace{-\baselineskip}}{\vspace{-0.25\baselineskip}}}
+\AtBeginDocument{%
+\abovedisplayskip =0.125\abovedisplayskip
+\abovedisplayshortskip=0.125\abovedisplayshortskip
+\belowdisplayskip =0.125\belowdisplayskip
+\belowdisplayshortskip=0.125\belowdisplayshortskip}
+\setlength{\jot}{0pt}%
+\setlength{\mathindent}{2\zw}%
+\renewcommand{\floatpagefraction}{0.75}
+\allowdisplaybreaks[2]
+\RequirePackage[no-math]{fontspec}
+\RequirePackage[no-math,deluxe,haranoaji]{luatexja-preset}
+\RequirePackage{multicolpar}
+\RequirePackage[style=iso]{datetime2}
+\RequirePackage[unicode]{hyperref}
+\RequirePackage{xparse}
+\RequirePackage{dashbox}
+\newcounter{psuedosectioncounter}
+\setcounter{psuedosectioncounter}{1}
+\newcounter{psuedocontentscounter}
+\setcounter{psuedocontentscounter}{1}
+\DeclareRobustCommand{\psuedosection}[3]{%
+\hypertarget{#1}{\mbox{}}\begin{multicolpar}{2}%
+\noindent\uuline{{\raisebox{1pt}{\textsf{\S\ \thepsuedosectioncounter\quad #2}}}}
+
+\noindent\uuline{{\raisebox{1pt}{\textsf{\S\ \thepsuedosectioncounter\quad #3}}}}
+\end{multicolpar}%
+\stepcounter{psuedosectioncounter}%
+\vspace{\baselineskip}%
+}
+\DeclareRobustCommand{\psuedocontents}[3]{%
+\begin{multicolpar}{2}%
+\noindent{\textsf{\hyperlink{#1}{\S\ \thepsuedocontentscounter\quad #2}}}
+
+\noindent{\textsf{\hyperlink{#1}{\S\ \thepsuedocontentscounter\quad #3}}}\end{multicolpar}%
+\stepcounter{psuedocontentscounter}%
+}
+\newenvironment{translateing}%
+{\begin{multicolpar}{2}}
+{\end{multicolpar}\vspace{\baselineskip}}
+\DeclareRobustCommand{\maketitletranslating}%
+{\maketitle\thispagestyle{fancy}
+\vspace{\baselineskip}\begin{multicolpar}{2}
+\textsf{English}
+
+\noindent
+\textsf{日本語 (Japanese)}
+\end{multicolpar}\vspace{\baselineskip}}
+\NewDocumentCommand\macroexplanation{v}{%
+\noindent\hspace*{\fill}{\texttt{#1}}\hspace*{\fill}\linespace%
+}
+\NewDocumentEnvironment{macroexample}{O{0.625} +b}{%
+\noindent\hspace*{\fill}\dbox{\parbox{#1\textwidth}{%
+#2%
+}}\hspace*{\fill}}%
+{\vspace{\baselineskip}}
+\NewDocumentEnvironment{macroexample*}{O{0.625} m +b}{%
+\noindent\hspace*{\fill}\dbox{\parbox{#1\textwidth}{%
+\vspace{-0.5\baselineskip}\begin{#2}%
+#3
+\end{#2}%
+}}\hspace*{\fill}}
+{\vspace{\baselineskip}}
+\let\code\texttt
+\setlength{\fboxsep}{1em}
+\setstretch{1.05}
+\DeclareRobustCommand{\commandtojskip}{\hspace{2.40554pt plus 1.49994pt minus 0.59998pt}}
+\RequirePackage{listings, jlisting}
+\lstset{
+ language=[LaTeX]TeX,
+ basicstyle={\ttfamily},
+ identifierstyle={\small},
+ commentstyle={\small\itshape},
+ keywordstyle={\small\bfseries},
+ ndkeywordstyle={\small},
+ stringstyle={\small\ttfamily},
+ frame=single,
+ breaklines=true,
+ columns=[l]{fullflexible},
+ stepnumber=1,
+ xrightmargin=0.1709\textwidth,
+ xleftmargin=0.1709\textwidth,
+ lineskip=-0.5ex
+}
+\RequirePackage{bxtexlogo}
+\RequirePackage{shortvrb}
+\MakeShortVerb{\|}
+\RequirePackage[lua]{jpneduenumerate}
+\makeatother
+%
+\hypersetup{%
+bookmarksnumbered=true,%
+colorlinks=true,%
+linkcolor=blue,%
+urlcolor=blue,%
+setpagesize=false,%
+pdftitle={The jpneduenumerate package},%
+pdfauthor={Yukoh KUSAKABE},%
+pdfsubject={The jpneduenumerate package},%
+pdfkeywords={TeX LaTeX enumerate Japanese education}}
+\title{The \code{jpneduenumerate} package:\\[0.25\baselineskip]
+enumerative expressions in Japanese education}
+\author{Yukoh KUSAKABE}
+\date{\today}
+\headertitle[Yukoh KUSAKABE\quad\metaphysicaicon]{The \code{jpneduenumerate} package}
+\begin{document}
+\maketitletranslating
+
+\begin{translateing}
+Mathematical equation representation in Japanese education differs somewhat from the standard \LaTeX\ writing style.
+This package introduces enumerative expressions in Japanese education.
+
+日本の教育における数式表現には,\LaTeX の標準である書きかたとはやや異なる部分があります。
+このパッケージでは,日本の教育における列挙表現を導入します。
+\end{translateing}
+
+\psuedocontents{Requirements}{System Requirements}{前提条件}
+
+\psuedocontents{Installation}{Installation}{インストール}
+
+\psuedocontents{Loading}{Loading}{読み込み}
+
+\psuedocontents{Usage}{Usage}{使用方法}
+
+\psuedocontents{moreinfo}{For More Information}{問い合わせ・詳しくは}
+
+\psuedosection{Requirements}{System Requirements}{前提条件}
+
+\begin{translateing}
+\textbullet\ \LaTeXe\ format\\
+\textbullet\ \code{enumitem} package\\
+\textbullet\ \code{refcount} package\\
+\textbullet\ \scalebox{0.875}[1]{\pTeX/\upTeX\ engine (when no options are loaded)}\\
+\textbullet\ \code{japanese-otf} package\\\hfill(when no options are loaded)\\
+\textbullet\ \LuaTeX\ engine (\code{[lua]} only)\\
+\textbullet\ \code{luatexja} package (\code{[lua]} only)\\
+\textbullet\ \code{luatexja-otf} package (\code{[lua]} only)
+
+\noindent
+\textbullet\ \LaTeXe フォーマット\\
+\textbullet\ \code{enumitem}パッケージ\\
+\textbullet\ \code{refcount}パッケージ\\
+\textbullet\ \scalebox{0.925}[1]{\pTeX/\upTeX エンジン(オプション不使用時)}\\
+\textbullet\ \code{japanese-otf}パッケージ\\\hfill(オプション不使用時)\\
+\textbullet\ \LuaTeX エンジン(\code{[lua]}使用時)\\
+\textbullet\ \code{luatexja}パッケージ(\code{[lua]}使用時)\\
+\textbullet\ \code{luatexja-otf}パッケージ(\code{[lua]}使用時)
+\end{translateing}
+
+\psuedosection{Installation}{Installation}{インストール}
+
+\begin{translateing}
+If not available, move jpneduenumerate.sty file to \code{\$TEXMF/tex/latex/jpneduenumerate}.
+
+直ちに使えなければ,jpneduenumerate.sty を\commandtojskip\code{\$TEXMF/tex/latex/jpneduenumerate}%(\TeX が見つけられる場所)
+に置いてください。
+\end{translateing}
+
+\psuedosection{Loading}{Loading}{読み込み}
+
+\begin{translateing}
+To use this package, load .sty file with |\usepackage{jpneduenumerate}| command in preamble.
+
+このパッケージを使用するには,プリアンブルに\commandtojskip|\usepackage{jpneduenumerate}| と書いてください。
+%\end{translateing}
+
+%\begin{translateing}
+There are the |[lua]| options:
+This option changes the engine this package runs on from \pTeX/\upTeX\ to \LuaTeX. It does not change the appearance of the output.
+Since the unit |zw| is used when no options are loaded, it can be used only in the \pTeX/\upTeX\ series.
+Since the unit |\zw| is used when the \code{[lua]} loaded, it can be used only in the \LuaTeX\ series and \LuaTeX-ja.
+
+|[lua]| オプションがあります。
+このオプションは,このパッケージが動作するエンジンを\pTeX/\upTeX から\LuaTeX に変更します。それは出力の見た目には変化を及ぼしません。
+オプションを使用しないときには単位|zw|を用いますので,\pTeX/\upTeX 系列でのみ使用できます。
+\code{[lua]}を読み込むと単位\commandtojskip|\zw|を用いますので,\LuaTeX 系列でのみ使用できます。
+\end{translateing}
+
+\psuedosection{Usage}{Usage}{使用方法}
+
+\macroexplanation{astarisked environments}
+
+\begin{translateing}
+The environment we will describe can be replaced with asterisked ones to eliminate the |parindent|.
+For example:
+
+これから説明する環境は,アスタリスクをつけることで|parindent|がなくなります。
+たとえば,次のようになります。
+\end{translateing}
+
+\newpage
+
+\noindent\hspace*{\fill}\fbox{\parbox{0.625\textwidth}{%
+\ttfamily\textbackslash begin\{itemize\}\\
+\textbackslash item 石炭をば早や積み果てつ。中等室の卓のほとりはいと靜にて、熾熱燈の光の晴れがましきも徒なり。\\
+\textbackslash item 今宵は夜毎にこゝに集ひ來る骨牌仲間も「ホテル」に宿りて、舟に殘れるは余一人のみなれば。\\
+\textbackslash end\{itemize\}
+
+\linespace*
+\textbackslash begin\{itemize*\}\\
+\textbackslash item 石炭をば早や積み果てつ。中等室の卓のほとりはいと靜にて、熾熱燈の光の晴れがましきも徒なり。\\
+\textbackslash item 今宵は夜毎にこゝに集ひ來る骨牌仲間も「ホテル」に宿りて、舟に殘れるは余一人のみなれば。\\
+\textbackslash end\{itemize*\}%
+}}\hspace*{\fill}%
+{\vspace{\baselineskip}}
+
+\begin{macroexample}
+\begin{itemize}
+\item 石炭をば早や積み果てつ。中等室の卓のほとりはいと靜にて、熾熱燈の光の晴れがましきも徒なり。
+\item 今宵は夜毎にこゝに集ひ來る骨牌仲間も「ホテル」に宿りて、舟に殘れるは余一人のみなれば。
+\end{itemize}
+
+\begin{itemize*}
+\item 石炭をば早や積み果てつ。中等室の卓のほとりはいと靜にて、熾熱燈の光の晴れがましきも徒なり。
+\item 今宵は夜毎にこゝに集ひ來る骨牌仲間も「ホテル」に宿りて、舟に殘れるは余一人のみなれば。
+\end{itemize*}
+\end{macroexample}
+
+\begin{translateing}
+For the purpose of this package, example sentences are in Japanese.
+If you use this package in a Latin text, the |parindent| will be set to the same size, i.e., one full-width character.
+
+このパッケージの目的から,例文は日本語としました。
+欧文のもとでこのパッケージを使用しても,同じ大きさすなわち全角1文字分の|parindent|が設定されます。
+\end{translateing}
+
+\macroexplanation{environment enumerate and itemize}
+
+\begin{translateing}
+The margins and the symbols in the |enumerate| and |itemize| environments are automatically changed when the package is loaded.
+|\labelenumi| is (1), |\labelenumii| is (a), and |\item| is text bullet.
+See the examples immediately above.
+
+パッケージを読み込むと自動的に|enumerate|環境と|itemize|環境の余白と記号が変更されます。
+|\labelenumi|\commandtojskip は(1),|\labelenumii|\commandtojskip は(a),|\item|\commandtojskip は・です。
+例は直前のものを見てください。
+\end{translateing}
+
+\newpage
+\macroexplanation{environment romanenumerate and caseenumerate}
+
+\begin{translateing}
+This environment replaces the symbols in the |enumerate| environment with a full-width (i).
+|caseenumerate| is synonym for |romanenumerate|.
+
+この環境は|enumerate|環境の記号を全角の(i)に置き換えたものです。
+|caseenumerate|は|romanenumerate|の別名です。
+\end{translateing}
+
+\begin{lstlisting}
+\begin{caseenumerate}
+\item The best and most beautiful things in the world cannot be seen or even touched.
+\item They must be felt with the heart.
+\end{caseenumerate}
+\end{lstlisting}
+
+\begin{macroexample}
+\begin{caseenumerate}
+\item The best and most beautiful things in the world cannot be seen or even touched.
+\item They must be felt with the heart.
+\end{caseenumerate}
+\end{macroexample}
+
+\macroexplanation{environment Romanenumerate and stepenumerate}
+
+\begin{translateing}
+This environment replaces the symbols in the |enumerate| environment with a full-width (I).
+|stepenumerate| is synonym for |Romanenumerate|.
+
+この環境は|enumerate|環境の記号を全角の(I)に置き換えたものです。
+|stepenumerate|は|Romanenumerate|の別名です。
+\end{translateing}
+
+\begin{lstlisting}
+\begin{stepenumerate}
+\item The best and most beautiful things in the world cannot be seen or even touched.
+\item They must be felt with the heart.
+\end{stepenumerate}
+\end{lstlisting}
+
+\begin{macroexample}
+\begin{stepenumerate}
+\item The best and most beautiful things in the world cannot be seen or even touched.
+\item They must be felt with the heart.
+\end{stepenumerate}
+\end{macroexample}
+
+\newpage
+\macroexplanation{\parenref{<label>}}
+
+\begin{translateing}
+Referred to as (1) depending on the label.
+
+ラベルによって(1)のように参照します。
+\end{translateing}
+
+\macroexplanation{\romanref{<label>}}
+
+\begin{translateing}
+Referred to as \ajroman{1} depending on the label.
+
+ラベルによって\ajroman{1}のように参照します。
+\end{translateing}
+
+\macroexplanation{\parenromanref{<label>}}
+
+\begin{translateing}
+Referred to as (\ajroman{1}) depending on the label.
+
+ラベルによって(\ajroman{1})のように参照します。
+\end{translateing}
+
+\macroexplanation{\Romanref{<label>}}
+
+\begin{translateing}
+Referred to as \ajRoman{1} depending on the label.
+
+ラベルによって\ajRoman{1}のように参照します。
+\end{translateing}
+
+\macroexplanation{\parenRomanref{<label>}}
+
+\begin{translateing}
+Referred to as (\ajRoman{1}) depending on the label.
+
+ラベルによって(\ajRoman{1})のように参照します。
+\end{translateing}
+
+\begin{lstlisting}
+\begin{enumerate}
+\item The best and most beautiful things in the world cannot be seen or even touched.\label{A}
+\item They must be felt with the heart.\label{B}
+\end{enumerate}
+
+\parenref{A}\parenref{B}
+\romanref{A}\romanref{B}
+\parenromanref{A}\parenromanref{B}
+\Romanref{A}\Romanref{B}
+\parenRomanref{A}\parenRomanref{B}
+\end{lstlisting}
+
+\begin{macroexample}
+\begin{enumerate}
+\item The best and most beautiful things in the world cannot be seen or even touched.\label{A}
+\item They must be felt with the heart.\label{B}
+\end{enumerate}
+
+\parenref{A}\parenref{B}
+\romanref{A}\romanref{B}
+\parenromanref{A}\parenromanref{B}
+\Romanref{A}\Romanref{B}
+\parenRomanref{A}\parenRomanref{B}
+\end{macroexample}
+
+\begin{translateing}
+Since the label only manages numbers, the appearance is achieved by changing the ref type.
+
+ラベルは数字しか管理していないので,見た目はrefの種類を変えることで実現します。
+
+As in the example above, these commands except |\parenref| disable |hyperref|.
+
+上の例で分かる通り,|\parenref|以外のこれらのコマンドは|hyperref|を無効にします。
+\end{translateing}
+
+\newpage
+\macroexplanation{\??auto \??keep \??reset \??ref{<label>}}
+
+\begin{translateing}
+|\??auto| outputs headings that automatically advance in numbering.
+|\??keep| outputs the heading with the previous number.
+|\??reset| resets the heading number back to 1.
+%|\??ref| referred to as (1) depending on the label.
+|\??ref{<label>}| is referenced by label.
+The |??| parts can be the following:\\
+\textbullet\ |square| or |question| (\squarenumber*{1})\\
+\textbullet\ |enumerate| (1)\\
+\textbullet\ |subquestion| (1)\\
+\textbullet\ |case| (\ajroman{1})\\
+\textbullet\ |step| (\ajRoman{1})
+
+|\??auto|は自動で番号が進む見出しを出力します。
+|\??keep|は直前の番号のままで見出しを出力します。
+|\??reset|は見出しの番号を1に戻します。
+|\??ref{<label>}|\commandtojskip はラベルによって参照します。
+|??|の部分には以下のものが使えます。\\
+\textbullet\ |square|または|question| (\squarenumber*{1})\\
+\textbullet\ |enumerate| (1)\\
+\textbullet\ |subquestion| (1)\\
+\textbullet\ |case| (\ajroman{1})\\
+\textbullet\ |step| (\ajRoman{1})
+
+Non-asterisked commands are heading.
+Asterisked commands are not heading.
+
+アスタリスクのない命令は見出しになります。
+アスタリスクの付いた命令は見出しになりません。
+
+|\case| is synonym for |\caseauto|.
+|\step| is synonym for |\stepauto|.
+
+|\case|は\commandtojskip|\caseauto|の別名です。
+|\step|は\commandtojskip|\stepauto|の別名です。
+\end{translateing}
+
+\begin{lstlisting}
+\setlength{\parindent}{1em}
+\squareauto is heading.
+
+\squareauto* is not heading.
+
+\enumerateauto\enumerateauto\enumeratekeep\enumeratekeep%
+\enumerateauto\label{test}\enumerateauto\enumerateauto%
+\enumeratereset\enumerateauto\enumerateref{test}
+
+\questionauto\subquestionauto\subquestionauto\\
+\caseauto\caseauto\caseauto\caseauto
+\stepauto\stepauto\stepauto\stepauto
+\end{lstlisting}
+
+\begin{macroexample}
+\setlength{\parindent}{1em}
+\squareauto is heading.
+
+\squareauto* is not heading.
+
+\enumerateauto\enumerateauto\enumeratekeep\enumeratekeep%
+\enumerateauto\label{test}\enumerateauto\enumerateauto%
+\enumeratereset\enumerateauto\enumerateauto\enumerateauto
+\enumeratereset\enumerateauto\enumerateref{test}
+
+\questionauto\subquestionauto\subquestionauto\\
+\caseauto\caseauto\caseauto\caseauto
+\stepauto\stepauto\stepauto\stepauto
+\end{macroexample}
+
+\macroexplanation{\equationreset}
+
+\begin{translateing}
+Reset the equation number back to 1.
+
+数式番号を1に戻します。
+\end{translateing}
+
+\begin{lstlisting}
+\begin{gather}
+A\\
+B
+\end{gather}
+\equationreset
+\begin{equation}
+C
+\end{equation}
+\end{lstlisting}
+
+\begin{macroexample}
+\begin{gather}
+A\\
+B
+\end{gather}
+\equationreset
+\begin{equation}
+C
+\end{equation}
+\end{macroexample}
+
+\macroexplanation{\question}
+
+\begin{translateing}
+|\questionauto| and reset the equation, subquestion, enumerate, case and step numbers back to 1.
+
+|\questionauto|を出力し,equation・subquestion・enumerate・case・stepの番号を1に戻します。
+
+|\question*| is synonym for |\questionauto*| (and doesn't reset numbers).
+
+|\question*|\commandtojskip は\commandtojskip|\questionauto*|\commandtojskip の別名です(から,番号は戻しません)。
+\end{translateing}
+
+\macroexplanation{\subquestion}
+
+\begin{translateing}
+|\subquestionauto| and reset the case and step numbers back to 1.
+
+|\subquestionauto|を出力し,|case|と|step|の番号を1に戻します。
+
+|\subquestion*| is another name for |\subquestionauto*| (and doesn't reset numbers).
+
+|\subquestion*|\commandtojskip は\commandtojskip|\subquestionauto*|\commandtojskip の別名です(から,番号は戻しません)。
+\end{translateing}
+
+\newpage
+\questionreset
+\begin{lstlisting}
+\question\subquestion\case\case\subquestion\case\case
+\begin{gather}
+A\\
+B
+\end{gather}
+\subquestion
+
+\question\subquestion\step\step\subquestion\step\step
+\begin{equation}
+C
+\end{equation}
+\end{lstlisting}
+
+\begin{macroexample}
+\question\subquestion\case\case\subquestion\case\case
+\begin{gather}
+A\\
+B
+\end{gather}
+\subquestion
+
+\question\subquestion\step\step\subquestion\step\step
+\begin{equation}
+C
+\end{equation}
+\end{macroexample}
+
+\begin{translateing}
+In the default setting, the equation number and the appearance of the |\subquestion| are identical, which makes it difficult to understand.
+In Japanese high school mathematics, equation numbers are generally expressed as circled numbers, so we have kept this in mind.
+It can be achieved, for example, with the |[circled]| or |[luacircled]| option of my |inlinelabel| package.
+
+既定の設定では数式番号と|\subquestion|の見た目が一致しており分かりにくくなっています。
+日本の高校数学では数式番号は丸囲み数字で表されることが一般的ですから,それを念頭に置いています。
+それは,たとえば私が作成した|inlinelabel|パッケージの|[circled]|または|[luacircled]|オプションで実現できます。
+\end{translateing}
+
+%\def\tagform@#1{\maketag@@@{$\ldots\hspace*{-0.075em}$\ignorespaces\ajMaru{#1}\unskip\@@italiccorr}}%
+\questionreset
+\hspace*{\fill}with |\usepackage[circled]{inlinelabel}| or |\usepackage[luacircled]{inlinelabel}|:\hspace*{\fill}\\
+\begin{macroexample}
+\question\subquestion\case\case\subquestion\case\case
+\begin{gather*}
+A\hspace*{21.05\zw}\ldots\mbox{\ajMaru{1}}\\
+B\hspace*{21\zw}\ldots\mbox{\ajMaru{2}}
+\end{gather*}
+\subquestion
+
+\question\subquestion\step\step\subquestion\step\step
+\begin{equation*}
+C\hspace*{21\zw}\ldots\mbox{\ajMaru{1}}\
+\end{equation*}
+\end{macroexample}
+
+\psuedosection{moreinfo}{For More Information}{問い合わせ・詳しくは}
+
+\noindent\hspace*{\fill}\begin{tabular}{rl}
+\multicolumn{2}{l}{The jpneduenumerate package:}%&
+\\%
+\multicolumn{2}{r}{\hspace{8\zw}\url{https://www.metaphysica.info/technote/package_jpneduenumerate/}}\\
+Yukoh KUSAKABE:&\url{https://www.metaphysica.info/}\\
+&\url{https://twitter.com/metaphysicainfo}\\
+&(screen-name, 日下部幽考 in Japanese)
+\end{tabular}\hspace*{\fill}
+\end{document} \ No newline at end of file
diff --git a/macros/latex/contrib/rescansync/README b/macros/latex/contrib/rescansync/README
new file mode 100644
index 0000000000..27851c5f61
--- /dev/null
+++ b/macros/latex/contrib/rescansync/README
@@ -0,0 +1,24 @@
+rescansync -- Re-scan tokens with synctex information
+Allow users to execute saved code to typeset text while preserving Sync\TeX\ information.
+
+Released under the LaTeX Project Public License v1.3c or later
+See http://www.latex-project.org/lppl.txt
+
+Report bugs at https://github.com/user202729/TeXlib
+
+========
+
+Copyright 2022 user202729
+
+This work may be distributed and/or modified under the conditions of the
+LaTeX Project Public License (LPPL), either version 1.3c of this license or
+(at your option) any later version. The latest version of this license is in
+the file:
+
+ http://www.latex-project.org/lppl.txt
+
+This work has the LPPL maintenance status `maintained'.
+
+The Current Maintainer of this work is user202729.
+
+This work consists of the files rescansync.sty.
diff --git a/macros/latex/contrib/rescansync/rescansync.pdf b/macros/latex/contrib/rescansync/rescansync.pdf
new file mode 100644
index 0000000000..67d2c7c790
--- /dev/null
+++ b/macros/latex/contrib/rescansync/rescansync.pdf
Binary files differ
diff --git a/macros/latex/contrib/rescansync/rescansync.sty b/macros/latex/contrib/rescansync/rescansync.sty
new file mode 100644
index 0000000000..197a7cad89
--- /dev/null
+++ b/macros/latex/contrib/rescansync/rescansync.sty
@@ -0,0 +1,145 @@
+% File: rescansync.sty
+% Copyright 2022 user202729
+%
+% This work may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this license or
+% (at your option) any later version. The latest version of this license is in
+% the file:
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is user202729.
+
+\ProvidesExplPackage{rescansync}{2022/07/09}{0.0.0}{Re-scan tokens with synctex information}
+
+\cs_generate_variant:Nn \regex_replace_all:nnN {nxN}
+\cs_generate_variant:Nn \tl_replace_all:Nnn {Nxn}
+
+\msg_new:nnn {rescansync} {currfile-package-not-loaded}
+ {currfile~package~is~needed~for~this~functionality}
+
+\msg_new:nnn {rescansync} {saveenv-package-not-loaded}
+ {saveenv~package~is~needed~for~this~functionality}
+
+\makeatletter
+
+\sys_if_engine_luatex:TF {
+ \let \_RS_optionaldirectlua \directlua
+ \cs_new:Npn \rescansync_gettag: {
+ \directlua{
+ tex.sprint(tex.get_synctex_tag())
+ }
+ }
+}
+{
+ \let \_RS_optionaldirectlua \@gobble
+ \let \rescansync_gettag: \empty
+}
+
+
+
+%\let \rescansyncTMPfixsync \undefined
+
+\tl_gset:Nn \_RS_count {0}
+\edef \_RS_j_tl {\char_generate:nn {`\^^J} {12}}
+
+\iow_new:N \_RS_file
+
+% #1: the content (will be detokenized)
+% #2: the number (line offset)
+% #3: the file name
+% #4: the synctex tag (get from \rescansync_gettag:)
+%
+% content is an expl3 string with ^^J represent line break -- same format as expected by iow_now
+%
+% NOTE: because filecontentsdef make character >= 128 in pdftex active character and
+% they cannot be \write safely, we detokenize it then replace ^^M later.
+\cs_new_protected:Npn \rescansync:nnnn #1 #2 #3 #4 {
+ \tl_gset:Nx \_RS_count {\int_eval:n {\_RS_count+1}}
+ \tl_set:Nx \_RS_filename {RS\_RS_count-#3}
+
+ \begingroup % will be closed by the active `~` later
+ \iow_open:Nn \_RS_file {\_RS_filename}
+
+ \iow_now:Nx \_RS_file {
+ % print some initial padding newlines first
+ \prg_replicate:nV {#2} \_RS_j_tl
+
+ % prepend some content to the start of the line...
+ \c_backslash_str a \c_backslash_str _RS_optionaldirectlua{tex.set_synctex_tag( #4 )} \c_tilde_str % this one works
+ % note that the directlua must be directly inside the file, not indirectly invoked through some macro
+
+ % print the content
+ \detokenize{#1}
+ }
+
+ \iow_close:N \_RS_file
+
+ \int_step_inline:nnn {33} {125} {\catcode ##1=11~} % set all to letter
+ \catcode `\~ \active
+ \catcode `\\ 0
+ \catcode `\{ 1
+ \catcode `\} 2~
+
+ % just so that the content '\_RS_optionaldirectlua{tex.set_synctex_tag( ... )}~' is interpreted correctly...
+
+
+ \char_set_active_eq:NN \~ \endgroup
+ \exp_args:NNNo \expandafter \_RS_skip_initial_endlinechars \@@input {\_RS_filename}
+}
+
+\cs_new_protected:Npn \rescansync:nnn #1 #2 #3 {
+ \rescansync:nnnn {#1} {#2} {#3} {\rescansync_gettag:} % #4 will be expanded inside
+}
+
+\cs_new_protected:Npn \_RS_skip_initial_endlinechars #1 \a {} % #1: tokens generated by endlinechar
+
+\NewDocumentEnvironment {rescansyncSaveenvPacked} {m} {
+ \edef \_RS_lineno {\the\inputlineno}
+ \cs_if_free:NT \saveenv {
+ \msg_error:nn {rescansync} {saveenv-package-not-loaded}
+ }
+ \cs_if_free:NT \currfilename {
+ \msg_error:nn {rescansync} {currfile-package-not-loaded}
+ }
+ \saveenv \_RS_body
+} {
+ \endsaveenv
+ \global\edef #1 { {\_RS_body} {\_RS_lineno} {\currfilename} }
+ %\pretty:V #1
+}
+
+\NewDocumentEnvironment {rescansyncSaveenvghostPacked} {m} {
+ \edef \_RS_lineno {\the\inputlineno}
+ \cs_if_free:NT \saveenv {
+ \msg_error:nn {rescansync} {saveenv-package-not-loaded}
+ }
+ \cs_if_free:NT \currfilename {
+ \msg_error:nn {rescansync} {currfile-package-not-loaded}
+ }
+ \saveenvghost \_RS_body
+} {
+ \endsaveenvghost
+ \global\edef #1 { {\_RS_body} {\_RS_lineno} {\currfilename} }
+ %\pretty:V #1
+}
+
+\NewDocumentCommand \rescansyncPacked {m} {
+ %\pretty:V {#1}
+ \exp_last_unbraced:Nx \rescansync:nnn {#1}
+}
+
+
+
+\cs_generate_variant:Nn \iow_now:Nn {No}
+\cs_generate_variant:Nn \prg_replicate:nn {nV}
+
+% #1: the macro that contain the content, #2: the number (line offset)
+\cs_new_protected:Npn \rescansync:nn #1 #2 {
+ \cs_if_free:NT \currfilename {
+ \msg_error:nn {rescansync} {currfile-package-not-loaded}
+ }
+ \rescansync:nnn {#1} {#2} {\currfilename}
+}
diff --git a/macros/latex/contrib/rescansync/rescansync.tex b/macros/latex/contrib/rescansync/rescansync.tex
new file mode 100644
index 0000000000..c68dd3e29d
--- /dev/null
+++ b/macros/latex/contrib/rescansync/rescansync.tex
@@ -0,0 +1,162 @@
+%%! TEX program = lualatex
+\ProvidesFile{rescansync.tex} [2022/07/09 v0.0.0 ]
+\documentclass{l3doc}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\fvset{gobble=0,tabsize=4,frame=single,numbers=left,numbersep=3pt}
+\usepackage{hyperref}
+\usepackage{csquotes}
+
+%\MakeOuterQuote{"}
+\begin{document}
+\GetFileInfo{\jobname.tex}
+
+\title{\textsf{rescansync} --- Re-scan tokens with synctex information
+\thanks{This file describes version \fileversion, last revised \filedate.}
+}
+\author{user202729%
+%\thanks{E-mail: (not set)}
+}
+\date{Released \filedate}
+
+\maketitle
+
+\begin{abstract}
+Allow users to execute saved code to typeset text while preserving Sync\TeX\ information.
+\end{abstract}
+
+\section{Simple interface}
+
+\DescribeEnv{rescansyncSaveenvPacked}
+Saves the environment body into the specified macro after the environment name, with additional information required to execute it later.
+
+The macro is stored in some internal format. If the user want to modify the content, use one of the advanced interface described below.
+
+Requires the \pkg{saveenv} and \pkg{currfile} package to be loaded. If you want to save the environment body using some other package, use the advanced interface.
+
+\begin{function}{\rescansyncPacked}
+ \begin{syntax}
+ \tn{rescansyncPacked} \meta{macro}
+ \end{syntax}
+ Execute the stored content in \meta{macro}.
+
+ The content must be stored with \env{rescansyncSaveenvPacked} environment or similar.
+\end{function}
+
+To give an usage example: the following code
+\begin{verbatim}
+% the following line will save the content "123 456"
+% and some auxiliary information into the macro \mycontent.
+\begin{rescansyncSaveenvPacked}{\mycontent}
+123
+
+456
+\end{rescansyncSaveenvPacked}
+
+% the following line will typeset 789 as usual.
+789
+
+% the following line will typeset "123 456".
+\rescansyncPacked{\mycontent}
+\end{verbatim}
+will typeset \enquote{789 123 456} as 3 separate paragraphs, with Sync\TeX\ information preserved.
+
+If the engine is not \LuaTeX, there will still be limited Sync\TeX\ information that points to a temporary file, but the line number is preserved.
+
+\DescribeEnv{rescansyncSaveenvghostPacked}
+The usage of this environment is similar to the \env{rescansyncSaveenvPacked} above, except that the content is still typeset with Sync\TeX\ information preserved while it's stored.
+
+In the example above, if this environment is used instead
+\begin{verbatim}
+\begin{rescansyncSaveenvghostPacked}{\mycontent}
+123
+
+456
+\end{rescansyncSaveenvghostPacked}
+
+789
+
+\rescansyncPacked{\mycontent}
+\end{verbatim}
+the content typeset will be \enquote{123 456 789 123 456}.
+
+As with \env{saveenvghost} environment (read \pkg{saveenv} package documentation for more details), the Sync\TeX\ information of the first section is guaranteed to be preserved, but there might be some performance hit.
+
+\section{Advanced interface}
+
+\begin{function}{\rescansync:nn}
+ \begin{syntax}
+ \cs{rescansync:nn} \Arg{content} \Arg{line offset}
+ \end{syntax}
+ Execute (rescan) the \Arg{content}. Requires \pkg{currfile}.
+
+ Details: \Arg{content} will be detokenized, and characters with char code 10 will be interpreted as a line break
+ (the behavior is inherited from |\iow_now:Nn| function. As a consequence, it's not allowed to write literal character with char code 10 to the file;
+ however this is not very useful regardless because on some operating systems this is equivalent to a real newline)
+
+ \Arg{line offset} is some non-negative number. If it's 0 then the first line of \Arg{content} corresponds to the first line in the target file.
+
+ Remark: If \pkg{newverbs}, \pkg{xparse} or \pkg{filecontentsdef} is used to collect multiline verbatim environment,
+ they have the line separation characters separated by character with char code 13 by default, you need to
+ manually replace them.
+
+ Even though the Sync\TeX\ information points to the correct file, if there's some error the temporary file name (which has the form
+ \texttt{RS\meta{number}-\meta{file name}} will be shown.
+
+ Engines other than \LuaTeX\ has the limitations described above.
+\end{function}
+
+\begin{function}{\rescansync:nnn}
+ \begin{syntax}
+ \cs{rescansync:nnn} \Arg{content} \Arg{line offset} \Arg{file name}
+ \end{syntax}
+
+ Similar to above, but use \Arg{file name} as the temporary file name. (only important in error messages, the Sync\TeX\ information
+ points to the file that the content is scanned.)
+\end{function}
+
+\begin{function}{\rescansync:nnnn}
+ \begin{syntax}
+ \cs{rescansync:nnnn} \Arg{content} \Arg{line offset} \Arg{file name} \Arg{Sync\TeX\ tag}
+ \end{syntax}
+
+ Similar to above, but you're allowed to specify the Sync\TeX\ tag.
+
+ More details: each file ever read has an associated Sync\TeX\ tag value, which is a number. The Sync\TeX\ information will point to that file.
+
+ On engines other than \LuaTeX, this feature is not supported and the function returns empty.
+\end{function}
+
+\begin{function}[EXP]{\rescansync_gettag:}
+ \begin{syntax}
+ \cs{rescansync_gettag:}
+ \end{syntax}
+
+ Function that fully expands to some token list that represents the Sync\TeX\ tag that corresponds to some file.
+
+ Note that if a file is |\input| more than once (or if |\file_get:nnN| \pkg{expl3} function is used on that file, which internally uses the \TeX\ |\input| primitive),
+ the tag value will be different and forward search may fail to work.
+\end{function}
+
+As a full example, assume there's a file named \file{a.tex}:
+\begin{verbatim}
+\tl_set:Nx \mytag {\rescansync_gettag:}
+\end{verbatim}
+After it's executed, a file \file{b.tex} executes:
+\begin{verbatim}
+\rescansync:nnnV {abcdef} {3} {rescanned-a} \mytag
+\end{verbatim}
+then the text |abcdef| will be typesetted, the Sync\TeX\ information points to line $1+3=4$ in the file \file{a.tex}
+(as the code |abcdef| is on the first line of the \Arg{content}, and the line offset is 3).
+
+If there's any error while typesetting |abcdef|, the error file name will be reported as for example, \file{RS1-rescanned-a.tex} (the number |1| might vary) instead of \file{a.tex}.
+
+\StopEventually{%
+ \PrintChanges
+ \PrintIndex
+}
+\Finale
+\end{document}
+
+
diff --git a/macros/latex/contrib/sidenotesplus/README.txt b/macros/latex/contrib/sidenotesplus/README.txt
index e602b7cd34..c2a416610f 100644
--- a/macros/latex/contrib/sidenotesplus/README.txt
+++ b/macros/latex/contrib/sidenotesplus/README.txt
@@ -2,7 +2,7 @@ LaTeX package sidenotesplus
Copyright (c) Anton Vrba, 2022
-------------------------------------------------------------------
Version:
- 2022/05/31 1.01
+ 2022/07/09 1.02 added Ragged option
Licence:
This work may be distributed and/or modified under the conditions
of the LaTeX Project Public License, version 1.3c of the license.
@@ -17,5 +17,6 @@ Abstract:
For biblatex users, routines for side references are provided.
-------------------------------------------------------------------
-Previous Versions:
+Previous Versions:
+ 2022/05/31 1.01 Minor bug fix
2022/05/15 1.00 Initial release
diff --git a/macros/latex/contrib/sidenotesplus/sidenotesplus.dtx b/macros/latex/contrib/sidenotesplus/sidenotesplus.dtx
index b6c51d20d2..7e76cd609d 100644
--- a/macros/latex/contrib/sidenotesplus/sidenotesplus.dtx
+++ b/macros/latex/contrib/sidenotesplus/sidenotesplus.dtx
@@ -36,7 +36,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[2020/10/01]
%<package>\ProvidesPackage{sidenotesplus}
%<*package>
- [2022/05/31 v1.01 rich text marginal notes, tables and figures ]
+ [2022/07/09 1.02 rich text marginal notes, tables and figures ]
%</package>
%<package>\RequirePackage{marginnote} % provides an offset option for the marginals instead of a float
%<package>\RequirePackage{caption} % handles the captions (in the margin)
@@ -94,8 +94,9 @@
%
% \maketitle
%
-% \changes{v1.0}{2022/05/15}{Initial Release}
-% \changes{v1.01}{2022/05/31}{Environment text* improved}
+% \changes{1.0}{2022/05/15}{Initial Release}
+% \changes{1.01}{2022/05/31}{Environment text* improved}
+% \changes{1.02}{2022/07/09}{added Ragged option}
%
% \begin{abstract}
% \noindent A package to manage the margin notes, figures, tables and captions.
@@ -124,6 +125,7 @@
% |size=| & |footnote, normal, small, script| \\
% |shape=| & | up, it, sl|\\
% |ragged| & switches to ragged outer margins\\
+% |Ragged| & switches to ragged outer margins but uses ragged2e package\\
% |classic| & switches to a classic look\\
% |sepdiff=| & |1em|, or a valid length within reason \\
% |alerton| & switches on the rendering of the margin alerts \\
@@ -132,9 +134,13 @@
% ~
%
% The normal page style is that margin notes are left-right justified with the
-% last line ragged to the outer edge. The option |ragged| changes this
+% last line ragged to the outer edge. The option |ragged| or |Ragged| changes this
% style to ragged-outer, that is the left page's marginal notes are |\raggedleft|
% and the right page's are |\raggedright|.
+% If you opt to use |Ragged| the package |ragged2e| is loaded and |RaggedLeft/Right|
+% is used instead of |raggedleft/right|. Load package |ragged2e| with required
+% options before |sidenotesplus| is loaded, otherwise |sidenotesplus| loads
+% |ragged2e| without any options.
%
% The marginal note's reference number or mark is placed in the margin separator,
% that is on the left page the mark is on the right hand side of the note.
@@ -325,6 +331,8 @@
% \item[ifoddpage] provides the command |\ifoddpage|
% \item[etoolbox] provides the command |\patchcmd|
% \item[calc] provides calculation such as adding lengths
+% \item[ragged2e] if |Ragged| option is used, and provides hyphenation
+% to prevent very short lines
%
% \end{description}%
@@ -360,7 +368,7 @@
\snp@size\snp@shape\snp@font\leavevmode%
\lineskip=0pt \lineskiplimit=0pt %
\tolerance=2000 \hyphenpenalty=300 \exhyphenpenalty=300%
- \doublehyphendemerits=100000%
+ \doublehyphendemerits=300%
\finalhyphendemerits=\doublehyphendemerits
}
\NewDocumentCommand \snp@sideformat {} {}
@@ -385,6 +393,7 @@
\bool_new:N \l@snp@alerton
\bool_new:N \l@snp@alertmarkon
\bool_new:N \l@snp@ragged
+\bool_new:N \l@snp@Ragged
\bool_new:N \l@snp@symmetric
\bool_new:N \l@snp@page
@@ -392,6 +401,7 @@
\bool_set_false:N \l@snp@alerton
\bool_set_false:N \l@snp@alertmarkon
\bool_set_false:N \l@snp@ragged
+\bool_set_false:N \l@snp@Ragged
\bool_set_true:N \l@snp@symmetric
@@ -430,9 +440,19 @@
ragged .code:n = { \RenewDocumentCommand \snp@leftmarginstyle {}{\raggedleft}
\RenewDocumentCommand \snp@rightmarginstyle {}{\raggedright}
\bool_set_true:N \l@snp@ragged },
+ Ragged .code:n = { \RenewDocumentCommand \snp@leftmarginstyle {}{\RaggedLeft}
+ \RenewDocumentCommand \snp@rightmarginstyle {}{\RaggedRight}
+ \bool_set_true:N \l@snp@Ragged
+ \bool_set_true:N \l@snp@ragged },
alerton .code:n = {\bool_set_true:N \l@snp@alerton},
}
\ProcessKeysOptions { sidenoteplus }
+\bool_if:NTF \l@snp@Ragged
+ {
+ \@ifpackageloaded{ragged2e}
+ {\relax}{\RequirePackage{ragged2e}}
+ }
+ {\relax}
\bool_if:NTF \l@snp@ragged
{\setlength{\snp@marginsepdiff}{0pt} \bool_set_false:N \l@snp@symmetric}
{\relax}
@@ -683,13 +703,13 @@
% --
%
% \begin{macrocode}
-\NewDocumentCommand \sidenotemark {s d() d!! m }
+\NewDocumentCommand \sidenotemark {s d() d!! }
{
\IfBooleanTF{#1}
{ % starred
\relax}
{% unstarred
- \IfNoValueOrEmptyT{#3}
+ \IfNoValueOrEmptyTF{#3}
{\snp@sidenotemark (#2)}
{\snp@sidenotemark !#3!( #2)}
}
@@ -1213,19 +1233,14 @@
% \begin{macrocode}
\RenewDocumentEnvironment{table*}{O{htbp} }
{
- \begin{table}[#1]
- \begin{@snp@autoadjustwidth}{}{\d@snp@extrawidth}
- \if@twoside
- \snp@isoddpage{\raggedright}{\raggedleft}
- \snp@isoddpage
- {\captionsetup{margin={0pt,0pt}} }
- {\captionsetup{margin={-\d@snp@extrawidth,\d@snp@extrawidth}} }
- \else
- \raggedright \captionsetup{margin={0pt,0pt}}
- \fi
-}
-{ % end part
- \end{@snp@autoadjustwidth}
+ \begin{table}[#1]
+ \begin{@snp@autoadjustwidth}{}{\d@snp@extrawidth}
+ \begin{minipage}[c]{\linewidth}
+ \centering
+ \captionsetup{ margin={\d@snp@extrawidth/2,\d@snp@extrawidth/2}}
+}{ % end part
+ \end{minipage}
+ \end{@snp@autoadjustwidth}
\end{table}
}
% \end{macrocode}
diff --git a/macros/latex/contrib/sidenotesplus/sidenotesplus.pdf b/macros/latex/contrib/sidenotesplus/sidenotesplus.pdf
index 5237810fea..46bd149c76 100644
--- a/macros/latex/contrib/sidenotesplus/sidenotesplus.pdf
+++ b/macros/latex/contrib/sidenotesplus/sidenotesplus.pdf
Binary files differ
diff --git a/macros/latex/contrib/sidenotesplus/tests-sidenoteplus.pdf b/macros/latex/contrib/sidenotesplus/tests-sidenoteplus.pdf
index e9cf85133f..dcf7635717 100644
--- a/macros/latex/contrib/sidenotesplus/tests-sidenoteplus.pdf
+++ b/macros/latex/contrib/sidenotesplus/tests-sidenoteplus.pdf
Binary files differ