texlive[52116] Master/texmf-dist: derivative (18sep19)
commits+karl at tug.org
commits+karl at tug.org
Wed Sep 18 23:56:41 CEST 2019
Revision: 52116
http://tug.org/svn/texlive?view=revision&revision=52116
Author: karl
Date: 2019-09-18 23:56:41 +0200 (Wed, 18 Sep 2019)
Log Message:
-----------
derivative (18sep19)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/derivative/README.md
trunk/Master/texmf-dist/doc/latex/derivative/derivative.pdf
trunk/Master/texmf-dist/doc/latex/derivative/derivative.tex
trunk/Master/texmf-dist/tex/latex/derivative/derivative.sty
Modified: trunk/Master/texmf-dist/doc/latex/derivative/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/derivative/README.md 2019-09-18 21:56:20 UTC (rev 52115)
+++ trunk/Master/texmf-dist/doc/latex/derivative/README.md 2019-09-18 21:56:41 UTC (rev 52116)
@@ -1,13 +1,13 @@
-## README for derivative package v0.9 dated 2019-07-21
+## README for derivative package v0.95 dated 2019-09-18
The package provides a set of commands `\NewOdvVariant`, `\NewPdvVariant` etc. that can be used to define a variant of a derivative. The package have already defined several derivatives:
- - \odv Ordinary derivative
- - \pdv Partial derivative
- - \fdv Functional derivtive
- - \mdv Material derivative
- - \adv Average rate of change
- - \jdv Jacobian
+ - `\odv` Ordinary derivative
+ - `\pdv` Partial derivative
+ - `\fdv` Functional derivtive
+ - `\mdv` Material derivative
+ - `\adv` Average rate of change
+ - `\jdv` Jacobian
### Copyright and license
Modified: trunk/Master/texmf-dist/doc/latex/derivative/derivative.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/derivative/derivative.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/derivative/derivative.tex 2019-09-18 21:56:20 UTC (rev 52115)
+++ trunk/Master/texmf-dist/doc/latex/derivative/derivative.tex 2019-09-18 21:56:41 UTC (rev 52116)
@@ -12,6 +12,7 @@
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Simon Jensen.
+
\NeedsTeXFormat{LaTeX2e}
\documentclass[final,british,10pt]{scrartcl}
@@ -54,9 +55,6 @@
\makeatletter
\ExplSyntaxOn
-\def\verbatim{\@beginparpenalty \predisplaypenalty \@verbatim
- \VerbFont \frenchspacing \@vobeyspaces \@xverbatim}
-
\tl_new:N \pakkenavn
\tl_new:N \titel
\tl_new:N \g_deriv_email
@@ -64,17 +62,6 @@
\tl_new:N \g_deriv_dato
\tl_new:N \g_deriv_version
-\seq_new:N \l__deriv_args_seq
-\seq_new:N \l__deriv_marg_args_seq
-\seq_new:N \l__deriv_macro_seq
-\seq_new:N \l__deriv_tmp_seq
-\seq_new:N \l__deriv_def_opt_seq
-\seq_new:N \l__deriv_opt_seq
-\seq_new:N \l__deriv_value_seq
-
-\tl_new:N \l__deriv_tmp_tl
-\tl_new:N \l__deriv_default_tl
-
\NewDocumentCommand{\Pakkenavn}{ m }{ \tl_gset:Nf \pakkenavn { \tl_trim_spaces:n { #1 } } }
\NewDocumentCommand{\Titel} { m }{ \tl_gset:Nf \titel { \tl_trim_spaces:n { #1 } } }
\NewDocumentCommand{\Forfatter}{ m }{ \tl_gset:Nf \forfatter { \tl_trim_spaces:n { #1 } } }
@@ -81,13 +68,11 @@
\NewDocumentCommand{\Email} { m }{ \tl_gset:Nf \g_deriv_email { \tl_trim_spaces:n { #1 } } }
\NewDocumentCommand{\Dato} { m }{ \tl_gset:Nf \g_deriv_dato { \tl_trim_spaces:n { #1 } } }
\NewDocumentCommand{\Version} { m }{ \tl_gset:Nf \g_deriv_version { \tl_trim_spaces:n { #1 } } }
-\NewDocumentCommand{\default} { s }
-{
- \bool_if:nTF {#1}
- { \seq_use:Nnnn \l__deriv_def_opt_seq {~and~} { ,~} {~and~} }
- { \seq_use:Nn \l__deriv_def_opt_seq { ,~} }
-}
+\NewDocumentCommand{\mypackage}{ } { \pkg{\pakkenavn} }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
\NewDocumentCommand{\forside}{}
{
\thispagestyle{empty}
@@ -130,32 +115,17 @@
\clearpage
}
-\newlist{todo}{enumerate}{1}
-\setlist[todo]{label=(\roman{todoi}),~ref=\thesubsection(\roman{todoi})}
-\crefname{todoi}{todo}{todos}
-
-\newlist{revision}{enumerate}{1}
-\setlist[revision]{label=(\roman{revisioni}), ref=\thesubsection(\roman{revisioni})}
-\crefname{revisioni}{revision}{revisions}
-
-\newlist{consideration}{enumerate}{1}
-\setlist[consideration]{label=(\roman{considerationi}), ref=\thesubsection(\roman{considerationi})}
-\crefname{considerationi}{consideration}{considerations}
-
-\renewcommand{\@idxitem}{\par \hangindent 0\p@ }
-\renewcommand{\subitem}{\@idxitem \hspace *{0\p@ }}
-
\lstset
{
tabsize = 1,
columns = fullflexible,
- basicstyle = \CommonFont,
+ basicstyle = \ttfamily\upshape\small,
escapechar = \%,
alsoletter = {\\,-},
keywords = [0]{style-inf, add-delims,sep-inf-ord,sep-ord-fun},
- keywordstyle = [0]\OptionFont,
+ keywordstyle = [0]\__mydoc_option_font:,
keywords = [1]{\\odv, \\mdv, \\fdv, \\adv, \\jdv, \\pdv, \\NewOdvVariant, \\RenewOdvVariant, \\ProvideOdvVariant, \\DeclareOdvVariant, \\NewPdvVariant, \\RenewPdvVariant, \\ProvidePdvVariant, \\DeclarePdvVariant},
- keywordstyle = [1]\MacroFont,
+ keywordstyle = [1]\__mydoc_function_font:,
commentstyle = \footnotesize,
frame = single,
xleftmargin=3.4pt,
@@ -167,194 +137,387 @@
\lstnewenvironment{definition}{\normalmarginpar}{\reversemarginpar}
+\newlist{todo}{enumerate}{1}
+\setlist[todo]{label=(\roman{todoi}), ref=\thesubsection(\roman{todoi})}
+\crefname{todoi}{todo}{todos}
+
+\newlist{changes}{enumerate}{1}
+\setlist[changes]{label=(\roman{changesi}), ref=\thesubsection(\roman{changesi})}
+\crefname{changesi}{change}{changes}
+
+\newlist{consideration}{enumerate}{1}
+\setlist[consideration]{label=(\roman{considerationi}), ref=\thesubsection(\roman{considerationi})}
+\crefname{considerationi}{consideration}{considerations}
+
+\renewcommand{\@idxitem}{\par \hangindent 0\p@ }
+\renewcommand{\subitem}{\@idxitem \hspace *{0\p@ }}
+
\NewDocumentCommand{\marginnote}{ m }
{
\leavevmode
- \marginline{\leavevmode \CommonFont \color{RoyalDarkGray} \tl_trim_spaces:n {#1} }
+ \marginline{\leavevmode \ttfamily\upshape\small \color{RoyalDarkGray} \tl_trim_spaces:n {#1} }
}
-\NewDocumentCommand{\print}{ m }
-{
- \__deriv_print:n {#1}
- \tl_use:N \l_tmpb_tl
-}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\cs_new:Npn \__deriv_print:n #1
+\NewDocumentCommand{\ket}{ m }
{
- \tl_set:Nn \l_tmpa_tl {#1}
- \regex_replace_all:nnN { . } { \c{string} \0 } \l_tmpa_tl
- \tl_set:Nx \l_tmpb_tl { \l_tmpa_tl }
+ \lvert #1 \rangle
}
-\seq_new:N \l__deriv_eks_seq
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\NewDocumentCommand{\eks}{ s m }
+\NewDocumentCommand{\pkg}{ m }
{
- \int_gzero:N \g_tmpa_int
- \begin{center}
- \bool_if:nTF {#1}
- {
- \__deriv_eks_star:n {#2}
- }
- {
- \__deriv_eks:n {#2}
- }
- \end{center}
+ \group_begin:
+ \sffamily \upshape \small #1
+ \group_end:
}
-\cs_new_protected:Npn \__deriv_eks_star:n #1
+\NewDocumentCommand{\uni}{} % Kræver unicode
+{ \textsuperscript{\texttt{U}} }
+
+\NewDocumentCommand{\pdf}{} % Kræver pdflatex
+{ \textsuperscript{\texttt{P}} }
+
+\NewDocumentCommand{\req}{} % Kræver pakke
+{ \textsuperscript{\texttt{R}} }
+
+\NewDocumentCommand{\tex}{}{\texorpdfstring{\hologo{TeX}}{TeX}}
+\NewDocumentCommand{\pdftex}{}{\texorpdfstring{\hologo{pdfTeX}}{pdfTeX}}
+\NewDocumentCommand{\luatex}{}{\texorpdfstring{\hologo{LuaTeX}}{LuaTeX}}
+\NewDocumentCommand{\xetex}{}{\texorpdfstring{\hologo{XeTeX}}{XeTeX}}
+\NewDocumentCommand{\latex}{ t2 t3 }
{
- \seq_set_split:Nnn \l__deriv_eks_seq { ; } { #1 }
- \tabular{ @{}c@{} }
- \seq_map_inline:Nn \l__deriv_eks_seq
+ \bool_if:nTF {#1}
+ { \texorpdfstring{\hologo{LaTeX2e}}{LaTeX2e} }
{
- \int_gincr:N \g_tmpa_int
- \EksFont
- \print{##1}
-
- \\[0.5em]
- $ \Longrightarrow \qquad \displaystyle ##1 $
- \int_compare:nNnF { \g_tmpa_int } = { \seq_count:N \l__deriv_eks_seq }
- {
- \\ \addlinespace[0.5em]
- }
+ \bool_if:nTF {#2}
+ { \texorpdfstring{\hologo{LaTeX3}}{LaTeX3} }
+ { \LaTeX }
}
- \endtabular
}
-\cs_new_protected:Npn \__deriv_eks:n #1
+\NewDocumentCommand{\xmark}{}
{
- \seq_set_split:Nnn \l__deriv_eks_seq { ; } { #1 }
- \tabular{ @{}r c l@{} }
- \seq_map_inline:Nn \l__deriv_eks_seq
- {
- \int_gincr:N \g_tmpa_int
- \EksFont
- \print{##1}
-
- & $ \Longrightarrow $
- & $ \displaystyle ##1 $
- \int_compare:nNnF { \g_tmpa_int } = { \seq_count:N \l__deriv_eks_seq }
- {
- \\ \addlinespace[0.5em]
+ \textcolor{red}{\ensuremath{\mathord{\mathpalette\bigcdot@{}}}}
+}
+\NewDocumentCommand{\cmark}{}
+{
+ \textcolor{green}{\ensuremath{\checkmark}}
+}
+
+\NewDocumentCommand{\answer}{ m m }
+{
+ #1
+ \textbf{Conclusion:}
+ \c_space_tl
+ \group_begin:
+ \slshape
+ #2
+ \group_end:
+}
+
+\newcommand*{\bigcdot at scalefactor}{1.25}
+\newcommand*{\bigcdot at widthfactor}{1.15}
+\newcommand*{\bigcdot@}[2]{
+ % #1: math style
+ % #2: unused
+ \sbox0{$#1\vcenter{}$}% math axis
+ \sbox2{$#1\vectimes\m at th$}
+ \hbox to \bigcdot at widthfactor\wd2{
+ \hfil
+ \raise\ht0\hbox{
+ \scalebox{\bigcdot at scalefactor}{
+ \lower\ht0\hbox{$#1\vectimes\m at th$}
+ }
}
+ \hfil
}
- \endtabular
}
-\RenewDocumentCommand{\arg}{ m }
+
+
+
+
+
+
+
+
+
+\tl_new:N \l__mydoc_ch_version_tl
+\tl_new:N \l__mydoc_ch_date_tl
+\tl_new:N \l__mydoc_ch_change_tl
+
+\bool_new:N \l__mydoc_ch_beta_bool
+\bool_new:N \l__mydoc_ch_change_bool
+
+\keys_define:nn { mydoc/changelog }
{
- { \ArgFont \seq_item:Nn \l__deriv_marg_args_seq {#1} }
+ version .tl_set:N = \l__mydoc_ch_version_tl,
+ version .default:n = \c_novalue_tl,
+
+ date .tl_set:N = \l__mydoc_ch_date_tl,
+ date .default:n = \c_novalue_tl,
+
+ beta .bool_set:N = \l__mydoc_ch_beta_bool,
+ beta .default:n = {false}
}
-\NewDocumentCommand{\macro}{ s m o }
+
+\let\mydoc_item:\item
+
+\DeclareDocumentCommand{\item}{ }
{
- \token_if_macro:NTF {#2}
+ \mydoc_item:
+ \bool_if:NT \l__mydoc_ch_change_bool
{
- \tl_set:Nf \l__deriv_tmp_tl { \cs_to_str:N #2 }
+ \tl_use:N \l__mydoc_ch_change_tl
+ \bool_set_false:N \l__mydoc_ch_change_bool
}
- {
- \tl_set:Nf \l__deriv_tmp_tl { \seq_item:Nn \l__deriv_declare_macros_seq {#2} }
- }
+}
+
+\DeclareDocumentEnvironment{change}{ o }
+{
+ \IfNoValueTF{#1}
+ { \keys_set:nn { mydoc/changelog } { version, date, beta } }
+ { \keys_set:nn { mydoc/changelog } { version, date, beta, #1 } }
- { \MacroFont \cs{ \tl_use:N \l__deriv_tmp_tl } }
-
- \bool_if:nF {#1} { \exp_args:NV \__deriv_index:nn \l__deriv_tmp_tl { macro } }
-
- \tl_if_novalue:nF {#3}
+ \mydoc_change_set:
+ \mydoc_change_begin:
+}
+{
+ \mydoc_change_end:
+}
+
+\cs_new_protected:Npn \mydoc_change_set:
+{
+ \bool_set_true:N \l__mydoc_ch_change_bool
+ \tl_set:Nn \l__mydoc_ch_change_tl
{
- \group_begin:
- \__deriv_macro_syntax:n {#3}
- \group_end:
+ \leavevmode
+ \marginline
+ {
+ \upshape \scriptsize \ttfamily
+ %\leavevmode
+ \null\vspace{-3.5\baselineskip}\null
+ \tabular[t]{ r }
+ \toprule
+ v\tl_use:N \l__mydoc_ch_version_tl
+ \\
+ \tl_use:N \l__mydoc_ch_date_tl
+ \bool_if:NT \l__mydoc_ch_beta_bool
+ { \\ \midrule \color{RoyalRed} Beta }
+ \\ \bottomrule
+ \endtabular
+ }
+ \ignorespaces
}
}
-\NewDocumentCommand{\DescribeMacro}{ s m m }
+\cs_new_protected:Npn \mydoc_change_begin:
{
- \__deriv_cs_to_str_seq:Nn \l__deriv_declare_macros_seq {#2}
- \bool_if:nTF {#1} {\noindent} { \__deriv_init: }
-
- \__deriv_index_def:Nn \l__deriv_declare_macros_seq { macro-def }
- \__deriv_marginpar_macro:NN \MacroFont \l__deriv_declare_macros_seq
- \__deriv_macro_syntax:n {#3} \hfill
- \__deriv_end_par:
+ \itemize
}
-\NewDocumentCommand{\DescribeArg}{ s m }
+\cs_new_protected:Npn \mydoc_change_end:
{
- \seq_set_from_clist:Nn \l__deriv_args_seq {#2}
- \bool_if:nTF {#1} {\noindent} { \__deriv_init: }
-
- \__deriv_marginpar:NN \ArgFont \l__deriv_args_seq
- \__deriv_end:
+ \enditemize
+ \let\item\mydoc_item:
}
-\NewDocumentCommand{\DescribeOption}{ s v o m }
+\NewDocumentEnvironment{changelog}{ }
{
- \seq_set_from_clist:Nn \l__deriv_keys_seq {#2}
- \bool_if:nTF {#1} {\noindent} { \__deriv_init: }
-
- \__deriv_index_def:Nn \l__deriv_keys_seq { option-def }
- \__deriv_marginpar:NN \OptionFont \l__deriv_keys_seq
- \__deriv_option_syntax:nn {#3} {#4}
- \__deriv_end_par:
+ \mydoc_ch_begin:
}
+{
+ \mydoc_ch_end:
+}
-\cs_new_protected:Npn \__deriv_cs_to_str_seq:Nn #1 #2
+\cs_new_protected:Npn \mydoc_ch_begin:
{
- \seq_clear:N #1
- \seq_set_from_clist:Nn \l_tmpa_seq {#2}
-
- \seq_map_inline:Nn \l_tmpa_seq
+}
+
+\cs_new_protected:Npn \mydoc_ch_end:
+{
+}
+
+
+
+\tl_new:N \l__mydoc_number_tl
+\tl_new:N \l_mydoc_index_item_tl
+\tl_new:N \l_mydoc_index_subitem_tl
+\tl_new:N \l_mydoc_index_entry_tl
+
+\seq_new:N \l__mydoc_macro_arg_seq
+
+\seq_new:N \l__mydoc_group_seq
+\seq_new:N \l__mydoc_type_seq
+\seq_new:N \l__mydoc_function_seq
+\seq_new:N \g__mydoc_syntax_seq
+\seq_new:N \l__deriv_earg_seq
+
+\int_new:N \l__mydoc_earg_int
+\int_new:N \l__mydoc_function_int
+\int_new:N \l__mydoc_option_int
+
+\bool_new:N \l__mydoc_number_bool
+
+\tl_set:Nn \l__mydoc_number_tl {0123456789}
+
+\seq_new:N \l__mydoc_example_seq
+\int_new:N \g__mydoc_example_int
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\cs_new_protected:Npn \mydoc_define_vars_keys:nnnn #1 #2 #3 #4
+{
+ \seq_set_from_clist:Nn \l__mydoc_group_seq {#4}
+ \seq_map_inline:Nn \l__mydoc_group_seq
{
- \exp_args:NNf \seq_put_right:Nn #1 { \cs_to_str:N ##1 }
+ \mydoc_define_var:nnnn {#1} {#2} {#3} {##1}
+ \mydoc_define_key:nnnn {#1} {#2} {#3} {##1}
}
}
-\cs_new_protected:Npn \__deriv_index_def:Nn #1 #2
+\cs_new_protected:Npn \mydoc_define_var:nnnn #1 #2 #3 #4
+{ \use:c { #3_new:c } { #2__mydoc_#1_#4_#3 } }
+
+\cs_new_protected:Npn \mydoc_define_key:nnnn #1 #2 #3 #4
{
- \str_case:nn {#2}
+ \str_if_eq:nnTF {#2} { g }
+ { \keys_define:nn { mydoc/#1 } { #4 .#3_#2set:c = { #2__mydoc_#1_#4_#3 } } }
+ { \keys_define:nn { mydoc/#1 } { #4 .#3_set:c = { #2__mydoc_#1_#4_#3 } } }
+}
+
+%\cs_new_protected:Npn \mydoc_define_inital:nnn #1 #2 #3
+%{ \keys_define:nn { mydoc/#1 } { #3 .initial:n = {#2} } }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\cs_new_protected:Npn \mydoc_set_keys:nn #1 #2
+{
+ \keys_set:nn { mydoc/#1 } {#2}
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\cs_new_protected:Npn \mydoc_define_font_i:n #1
+{
+ \mydoc_define_vars_keys:nnnn {#1} { l } { tl } { colour, family, shape, size }
+
+ \cs_new_protected:cpn { __mydoc_#1_font: }
{
- { macro-def } { \__deriv_index_macro_def:Nn #1 { macro } }
- { option-def } { \__deriv_index_option_def:Nn #1 { option } }
+ \color { \use:c { l__mydoc_#1_colour_tl } }
+ \tl_use:c { l__mydoc_#1_family_tl }
+ \tl_use:c { l__mydoc_#1_shape_tl }
+ \tl_use:c { l__mydoc_#1_size_tl }
}
}
-\cs_new_protected:Npn \__deriv_index:nn #1 #2
+\cs_new_protected:Npn \mydoc_define_font_ii:n #1
{
- \str_case:nn {#2}
+ \mydoc_define_vars_keys:nnnn {#1} { l } { tl } { colour, family, shape, size }
+ \mydoc_define_vars_keys:nnnn {#1} { l } { bool } { colourb, familyb, shapeb, sizeb }
+
+ \cs_new_protected:cpn { __mydoc_#1_font: }
{
- { option } { \__deriv_index_option:nn {#1} {#2} }
- { macro } { \__deriv_index_macro:nn {#1} {#2} }
+ \bool_if:cT { l__mydoc_#1_colourb_bool } { \color { \use:c { l__mydoc_#1_colour_tl } } }
+ \bool_if:cT { l__mydoc_#1_familyb_bool } { \tl_use:c { l__mydoc_#1_family_tl } }
+ \bool_if:cT { l__mydoc_#1_shapeb_bool } { \tl_use:c { l__mydoc_#1_shape_tl } }
+ \bool_if:cT { l__mydoc_#1_sizeb_bool } { \tl_use:c { l__mydoc_#1_size_tl } }
}
}
-\cs_new_protected:Npn \__deriv_index_macro_def:Nn #1 #2
+\cs_new_protected:Npn \mydoc_define_index:n #1
{
- \seq_map_inline:Nn #1
- { \index[#2]{##1@\protect{\CommonFont\cs{##1}}|textbf} }
+ \mydoc_define_vars_keys:nnnn {#1} { l } { bool } { index }
+ \mydoc_define_vars_keys:nnnn {#1} { l } { bool } { definition }
}
-\cs_new_protected:Npn \__deriv_index_option_def:Nn #1 #2
+
+\cs_new_protected:Npn \mydoc_define_default:n #1
{
- \seq_map_inline:Nn #1
+ \mydoc_define_vars_keys:nnnn {#1} { g } { clist } { default }
+ \mydoc_define_vars_keys:nnnn {#1} { l } { tl } { sepa }
+ \mydoc_define_vars_keys:nnnn {#1} { l } { tl } { sepb }
+ \mydoc_define_vars_keys:nnnn {#1} { l } { tl } { sepc }
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\cs_new_protected:Npn \mydoc_define_type:nn #1 #2
+{
+ \seq_set_from_clist:Nn \l__mydoc_type_seq {#2}
+ \seq_map_inline:Nn \l__mydoc_type_seq
{
- \seq_set_split:Nnn \l_tmpa_seq {-} {##1}
- \tl_set:Nx \l_tmpa_tl { \seq_item:Nn \l_tmpa_seq {1} }
- \index[#2]{{\l_tmpa_tl}!##1@\protect{\CommonFont##1}|textbf}
+ \str_case:nn {##1}
+ {
+ { font_i } { \mydoc_define_font_i:n {#1} }
+ { font_ii } { \mydoc_define_font_ii:n {#1} }
+ { index } { \mydoc_define_index:n {#1} }
+ { default } { \mydoc_define_default:n {#1} }
+ }
}
}
-\cs_new_protected:Npn \__deriv_index_macro:nn #1 #2
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\mydoc_define_type:nn { function } { font_i, index }
+\mydoc_define_type:nn { macro } { font_i, index }
+\mydoc_define_type:nn { syntax } { font_i }
+\mydoc_define_type:nn { argument } { font_i, }
+\mydoc_define_type:nn { arg } { font_i, }
+\mydoc_define_type:nn { option } { font_i, index }
+\mydoc_define_type:nn { key } { font_i, index }
+\mydoc_define_type:nn { values } { font_i, default }
+\mydoc_define_type:nn { val } { font_i }
+\mydoc_define_type:nn { example } { font_i }
+\mydoc_define_type:nn { marg } { font_ii }
+\mydoc_define_type:nn { narg } { font_ii }
+\mydoc_define_type:nn { oarg } { font_ii }
+\mydoc_define_type:nn { targ } { font_ii }
+\mydoc_define_type:nn { meta } { font_ii }
+\mydoc_define_type:nn { cs } { font_ii }
+
+\mydoc_set_keys:nn { function } { colour = RoyalRed, family = \ttfamily, shape = \upshape, size = \small, index = true, definition = true }
+\mydoc_set_keys:nn { macro } { colour = black, family = \ttfamily, shape = \upshape, size = \small, index = true, definition = false }
+\mydoc_set_keys:nn { syntax } { colour = black, family = \rmfamily, shape = \upshape, size = \small }
+\mydoc_set_keys:nn { argument } { colour = RoyalBlue, family = \rmfamily, shape = \upshape, size = \small }
+\mydoc_set_keys:nn { arg } { colour = black, family = \rmfamily, shape = \upshape, size = \small }
+\mydoc_set_keys:nn { option } { colour = RoyalGreen, family = \ttfamily, shape = \upshape, size = \small, index = true, definition = true }
+\mydoc_set_keys:nn { key } { colour = black, family = \ttfamily, shape = \upshape, size = \small, index = true, definition = false }
+\mydoc_set_keys:nn { values } { colour = black, family = \ttfamily, shape = \upshape, size = \small, default = \c_novalue_tl, sepa = { ,~}, sepb = { ,~}, sepc = { ,~} }
+\mydoc_set_keys:nn { val } { colour = black, family = \ttfamily, shape = \upshape, size = \small }
+\mydoc_set_keys:nn { example } { colour = black, family = \ttfamily, shape = \upshape, size = \small }
+\mydoc_set_keys:nn { marg } { colour = black, family = \ttfamily, shape = \upshape, size = \small, colourb = true, familyb = true, shapeb = true, sizeb = true }
+\mydoc_set_keys:nn { narg } { colour = black, family = \ttfamily, shape = \upshape, size = \small, colourb = true, familyb = true, shapeb = true, sizeb = true }
+\mydoc_set_keys:nn { oarg } { colour = black, family = \ttfamily, shape = \upshape, size = \small, colourb = true, familyb = true, shapeb = true, sizeb = true }
+\mydoc_set_keys:nn { targ } { colour = black, family = \ttfamily, shape = \upshape, size = \small, colourb = true, familyb = true, shapeb = true, sizeb = true }
+\mydoc_set_keys:nn { meta } { colour = black, family = \rmfamily, shape = \slshape, size = \small, colourb = true, familyb = true, shapeb = true, sizeb = true }
+\mydoc_set_keys:nn { cs } { colour = black, family = \rmfamily, shape = \upshape, size = \small, colourb = true, familyb = true, shapeb = true, sizeb = true }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\prg_new_protected_conditional:Npnn \mydoc_if_int:n #1 { T, F, TF }
{
- \index[#2]{#1@\protect{\CommonFont\cs{#1}}}
+ \tl_map_inline:Nn {#1}
+ {
+ \tl_if_in:NnTF \l__mydoc_number_tl {##1}
+ { \bool_set_true:N \l__mydoc_number_bool }
+ { \tl_map_break:n { \bool_set_false:N \l__mydoc_number_bool } }
+ }
+ \bool_if:NTF \l__mydoc_number_bool
+ { \prg_return_true: }
+ { \prg_return_false: }
}
-\cs_new_protected:Npn \__deriv_index_option:nn #1 #2
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\cs_new_protected:Npn \mydoc_vspace:n #1
{
- \seq_set_split:Nnn \l_tmpa_seq {-} {#1}
- \tl_set:Nx \l_tmpa_tl { \seq_item:Nn \l_tmpa_seq {1} }
- \index[#2]{{\l_tmpa_tl}!#1@\protect{\CommonFont#1}}
+ \vspace{#1\baselineskip}
}
-
-\cs_new_protected:Npn \__deriv_marginpar:NN #1 #2
+\cs_new_protected:Npn \mydoc_margin:n #1
{
\leavevmode
\marginline
@@ -361,214 +524,520 @@
{
\leavevmode
#1
- \seq_use:Nn #2 { \\ }
}
+ \ignorespaces
}
-\cs_new_protected:Npn \__deriv_marginpar_macro:NN #1 #2
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\cs_new_protected:Npn \__mydoc_function_begin:n #1
{
- \int_zero:N \l_tmpb_int
- \leavevmode
- \marginline
+ \par
+ \bool_if:NF {#1} { \mydoc_vspace:n { 0.3 } }
+ \@afterindentfalse \@afterheading
+}
+
+\cs_new_protected:Npn \__mydoc_function_end:
+{
+ \seq_gclear:N \g__mydoc_syntax_seq
+ \par \noindent \ignorespacesafterend
+}
+
+\cs_new_protected:Npn \__mydoc_function_margin:n #1
+{
+ \seq_set_from_clist:Nn \l__mydoc_function_seq {#1}
+ \int_zero:N \l__mydoc_function_int
+
+ \mydoc_margin:n
{
- \leavevmode
- #1
- \seq_map_inline:Nn #2
+ \__mydoc_function_font:
+ \seq_map_inline:Nn \l__mydoc_function_seq
{
- \cs{##1}
- \int_incr:N \l_tmpb_int
- \int_compare:nNnF { \l_tmpb_int } = { \seq_count:N #2 }
+ \int_incr:N \l__mydoc_function_int
+ \mydoc_cs_to_str:N ##1
+ \mydoc_index_cs:Nnn ##1 { function } { macro }
+ \int_compare:nNnF { \l__mydoc_function_int } = { \seq_count:N \l__mydoc_function_seq }
{ \\ }
}
}
}
-\cs_new_protected:Npn \__deriv_init:
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\cs_new_protected:Npn \__mydoc_syntax_begin:
+{ \ignorespaces }
+
+\cs_new_protected:Npn \mydoc_syntax:n #1
{
- \vspace{0.30\baselineskip}
- \noindent \ignorespaces
+ \seq_gset_from_clist:Nn \g__mydoc_syntax_seq {#1}
+
+ \__mydoc_syntax_font:
+ \seq_use:Nn \g__mydoc_syntax_seq { }
}
-\cs_new_protected:Npn \__deriv_end_par:
+\cs_new_protected:Npn \__mydoc_syntax_end:
+{ \par \mydoc_vspace:n { 0.2 } \noindent \ignorespacesafterend }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\cs_new_protected:Npn \__mydoc_argument_begin:n #1
{
\par
- \vspace{0.20\baselineskip}
- \noindent \ignorespaces
+ \bool_if:NF {#1} { \mydoc_vspace:n { 0.3 } }
+ \@afterindentfalse \@afterheading
}
-\cs_new_protected:Npn \__deriv_end:
+\cs_new_protected:Npn \__mydoc_argument_end:
{
- \noindent \ignorespaces
+ \par\noindent\ignorespacesafterend
}
-\cs_new_protected:Npn \__deriv_macro_syntax:n #1
+\cs_new_protected:Npn \__mydoc_argument_margin:n #1
{
- \seq_set_from_clist:Nn \l__deriv_marg_args_seq { #1 }
-
- \group_begin:
- \CommonFontsize
- \seq_use:Nn \l__deriv_marg_args_seq {}
- \group_end:
+ \mydoc_margin:n
+ {
+ \mydoc_set_keys:nn { marg } { colourb = false, familyb = false, shapeb = false, sizeb = false }
+ \mydoc_set_keys:nn { narg } { colourb = false, familyb = false, shapeb = false, sizeb = false }
+ \mydoc_set_keys:nn { oarg } { colourb = false, familyb = false, shapeb = false, sizeb = false }
+ \mydoc_set_keys:nn { targ } { colourb = false, familyb = false, shapeb = false, sizeb = false }
+ \mydoc_set_keys:nn { meta } { colourb = false, familyb = true, shapeb = true, sizeb = false }
+ \mydoc_set_keys:nn { cs } { colourb = false, familyb = false, shapeb = false, sizeb = false }
+ \__mydoc_argument_font:
+ \mydoc_if_int:nTF {#1}
+ { \seq_item:Nn \g__mydoc_syntax_seq {#1} }
+ { #1 }
+ }
}
-\cs_new_protected:Npn \__deriv_option_syntax:nn #1 #2
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\cs_new_protected:Npn \__mydoc_option_begin:n #1
{
- \__deriv_set_option_seq:Nn \l__deriv_opt_seq {#2}
-
- \seq_use:Nn \l__deriv_opt_seq { ,~}
-
- \hfill
- \tl_if_novalue:nF {#1}
- {
- \__deriv_set_option_seq:Nn \l__deriv_def_opt_seq {#1}
- \seq_use:Nn \l__deriv_def_opt_seq { ,~}
- }
+ \par
+ \bool_if:NF {#1} { \mydoc_vspace:n { 0.3 } }
+ \@afterindentfalse \@afterheading
}
-\cs_new_protected:Npn \__deriv_set_option_seq:Nn #1 #2
+\cs_new_protected:Npn \__mydoc_option_end:
{
- \seq_set_from_clist:Nn \l__deriv_tmp_seq {#2}
- \seq_clear:N #1
+ \seq_clear:N \l__mydoc_option_seq
+ \par \noindent \ignorespacesafterend
+}
+
+\cs_new_protected:Npn \__mydoc_option_margin:n #1
+{
+ \seq_set_from_clist:Nn \l__mydoc_option_seq {#1}
+ \int_zero:N \l__mydoc_option_int
- \seq_map_inline:Nn \l__deriv_tmp_seq
+ \mydoc_margin:n
{
- \tl_if_head_eq_charcode:nNTF {##1} !
+ \__mydoc_option_font:
+ \seq_map_inline:Nn \l__mydoc_option_seq
{
- \seq_put_right:Nn #1 { { \CommonFontsize \tl_tail:n {##1} } }
+ \int_incr:N \l__mydoc_option_int
+ ##1
+ \mydoc_index_key:nnn {##1} { option } { option }
+ \int_compare:nNnF { \l__mydoc_option_int } = { \seq_count:N \l__mydoc_option_seq }
+ { \\ }
}
- {
- \seq_put_right:Nn #1 { \val{##1} }
- }
}
}
-\DeclareRobustCommand\meta[1]{%
- \ensuremath\langle
- \ifmmode \expandafter \nfss at text \fi
- {%
- \meta at font@select
- \edef\meta at hyphen@restore
- {\hyphenchar\the\font\the\hyphenchar\font}%
- \hyphenchar\font\m at ne
- \language\l at nohyphenation
- #1\/%
- \meta at hyphen@restore
- }\ensuremath\rangle
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\cs_new_protected:Npn \__mydoc_values_begin:
+{ \ignorespaces }
+
+\cs_new_protected:Npn \mydoc_values:n #1
+{
+ \seq_gset_from_clist:Nn \g__mydoc_values_seq {#1}
+
+ \__mydoc_values_font:
+ \seq_use:Nn \g__mydoc_values_seq { ,~}
+
+ \exp_args:Nf \tl_if_novalue:nF { \clist_item:Nn \g__mydoc_values_default_clist { 1 } }
+ {
+ \hfill
+ \mydoc_clist_use:n { values }
+ }
}
-\def\meta at font@select{\itshape}
-\DeclareRobustCommand\cs[1]{{\CommonFont \char`\\#1}}
-\NewDocumentCommand{\marg}{ s m }
+\cs_new_protected:Npn \mydoc_clist_use:n #1
{
- \bool_if:NTF {#1}
- { {\ttfamily\char`\{} { \CommonFontfamily #2 } {\ttfamily\char`\}} }
- { {\ttfamily\char`\{} \meta{#2} {\ttfamily\char`\}} }
+ \clist_use:cnnn { g__mydoc_#1_default_clist }
+ { \tl_use:c { l__mydoc_#1_sepa_tl } }
+ { \tl_use:c { l__mydoc_#1_sepb_tl } }
+ { \tl_use:c { l__mydoc_#1_sepc_tl } }
}
-\providecommand\oarg[1]{%
- {\ttfamily[}\meta{#1}{\ttfamily]}}
-\let\garg\marg
+\cs_new_protected:Npn \__mydoc_values_end:
+{ \par \mydoc_vspace:n { 0.2 } \noindent \ignorespacesafterend }
-\providecommand\targ[1]{
- {\ttfamily #1}}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\providecommand{\sarg}{ \targ{*} }
+\NewDocumentEnvironment{example}{ s o b }
+{ \__mydoc_example_begin:nn {#1} {#3} }
+{ \__mydoc_example_end: }
-\seq_new:N \l__deriv_earg_seq
+\cs_new_protected:Npn \__mydoc_example_begin:nn #1 #2
+{
+ \seq_set_split:Nnn \l__deriv_example_seq { \\ } {#2}
+ \bool_if:nTF {#1}
+ {
+ \center \tabular{ @{} c @{} }
+ \__mydoc_example_content:Nnn \l__deriv_example_seq { \\[0.5em] } { \qquad }
+ }
+ {
+ \center \tabular{ @{} r c l @{} }
+ \__mydoc_example_content:Nnn \l__deriv_example_seq { & } { $ & $ }
+ }
+}
-\NewDocumentCommand{\earg}{ m }
+\cs_new_protected:Npn \__mydoc_example_content:Nnn #1 #2 #3
{
- \seq_set_from_clist:Nn \l__deriv_earg_seq {#1}
-
- \int_zero:N \l_tmpa_int
- \seq_map_inline:Nn \l__deriv_earg_seq
+ \int_gzero:N \g__mydoc_example_int
+ \seq_map_inline:Nn #1
{
- \int_incr:N \l_tmpa_int
- \int_if_odd:nTF \l_tmpa_int
- {
- { \ttfamily ##1 }
- }
- {
- \marg{ ##1 }
- }
+ \int_gincr:N \g__mydoc_example_int
+ \__mydoc_example_font:
+ \__mydoc_print:n {##1}
+ #2
+ $\Longrightarrow #3 \displaystyle ##1 $
+ \int_compare:nNnF { \g__mydoc_example_int } = { \seq_count:N #1 }
+ { \\ \addlinespace[0.5em] }
}
}
-\NewDocumentCommand{\key}{ s m o o }
+\cs_new_protected:Npn \__mydoc_example_end:
{
- { \KeyFont #2 }
- \bool_if:nF {#1}{ \__deriv_index:nn {#2} {option} }
- \IfNoValueF{#3}{ { \KeyFont - } \meta{#3} }
- \IfNoValueF{#4}{ { \KeyFont - } \meta{#4} }
+ \endtabular
+ \endcenter
}
-\NewDocumentCommand{\keyval}{ s m m }
+\tl_new:N \l__mydoc_print_tmp_tl
+\cs_new_protected:Npn \__mydoc_print:n #1
{
+ \tl_set:Nn \l__mydoc_print_tmp_tl {#1}
+ \regex_replace_all:nnN { . } { \c{string} \0 } \l__mydoc_print_tmp_tl
+ \tl_use:N \l__mydoc_print_tmp_tl
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\NewDocumentEnvironment{function}{ s o m }
+{
+ \tl_if_novalue:nF {#2} { \mydoc_set_keys:nn { function } {#2} }
+ \__mydoc_function_begin:n {#1}
+ \__mydoc_function_margin:n {#3}
+}
+{
+ \__mydoc_function_end:
+}
+
+\NewDocumentEnvironment{syntax}{ o b }
+{
+ \tl_if_novalue:nF {#1} { \mydoc_set_keys:nn { syntax } {#1} }
+ \__mydoc_syntax_begin:
+ \mydoc_syntax:n {#2}
+}
+{
+ \__mydoc_syntax_end:
+}
+
+\NewDocumentEnvironment{argument}{ s o m }
+{
+ \tl_if_novalue:nF {#2} { \mydoc_set_keys:nn { argument } {#2} }
+ \__mydoc_argument_begin:n {#1}
+ \__mydoc_argument_margin:n {#3}
+}
+{
+ \__mydoc_argument_end:
+}
+
+\NewDocumentEnvironment{option}{ s o m }
+{
+ \tl_if_novalue:nF {#2} { \mydoc_set_keys:nn { option } {#2} }
+ \__mydoc_option_begin:n {#1}
+ \__mydoc_option_margin:n {#3}
+}
+{
+ \__mydoc_option_end:
+}
+
+\NewDocumentEnvironment{values}{ o b }
+{
+ \tl_if_novalue:nF {#1} { \mydoc_set_keys:nn { values } {#1} }
+ \__mydoc_values_begin:
+ \mydoc_values:n {#2}
+}
+{
+ \__mydoc_values_end:
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\NewDocumentCommand{\default}{ s O{values} }
+{
\group_begin:
- \seq_set_from_clist:Nn \l__deriv_value_seq {#3}
- \int_compare:nNnTF { \seq_count:N \l__deriv_value_seq } = { 1 }
+ \mydoc_default:nn {#1} {#2}
+ \group_end:
+}
+
+\cs_new_protected:Npn \mydoc_default:nn #1 #2
+{
+ \bool_if:nTF {#1}
+ { \clist_use:cnnn { g__mydoc_#2_default_clist } {~and~} { ,~} {~and~} }
+ { \clist_use:cn { g__mydoc_#2_default_clist } { ,~} }
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\NewDocumentCommand{\macro}{ o m o }
+{
+ \group_begin:
+ \tl_if_novalue:nF {#1} { \mydoc_set_keys:nn { macro } { #1 } }
+ \mydoc_macro:nn {#2} {#3}
+ \group_end:
+}
+
+\cs_new_protected:Npn \mydoc_macro:nn #1 #2
+{
+ \__mydoc_macro_font:
+ \mydoc_if_int:nTF {#1}
{
- \KeyFont #2
- \bool_if:nF {#1}{ \__deriv_index:nn {#2} {option} }
- = \ValFont \seq_use:Nn \l__deriv_value_seq {,}
+ \tl_set:Nx \l__mydoc_marg_tl { \seq_item:Nn \l__mydoc_function_seq {#1} }
+ \mydoc_cs_to_str:x { \seq_item:Nn \l__mydoc_function_seq {#1} }
+ \exp_args:NV \mydoc_index_cs:Nnn \l__mydoc_marg_tl { macro } { macro }
}
{
- \KeyFont #2
- \bool_if:nF {#1}{ \__deriv_index:nn {#2} {option} }
- = \ValFont \{ \seq_use:Nn \l__deriv_value_seq {,} \}
+ \mydoc_cs_to_str:N #1
+ \mydoc_index_cs:Nnn #1 { macro } { macro }
}
+ \tl_if_novalue:nF {#2}
+ {
+ \seq_set_from_clist:Nn \l__mydoc_macro_arg_seq {#2}
+ \seq_map_function:NN \l__mydoc_macro_arg_seq \mydoc_arg:n
+ }
+}
+
+\RenewDocumentCommand{\arg}{ o m }
+{
+ \group_begin:
+ \mydoc_arg:n {#2}
\group_end:
}
-\NewDocumentCommand{\val}{ m }
+\cs_new_protected:Npn \mydoc_arg:n #1
{
- { \ValFont #1 }
+ \__mydoc_arg_font:
+ \mydoc_if_int:nTF {#1}
+ { \seq_item:Nn \g__mydoc_syntax_seq {#1} }
+ { #1 }
}
-\NewDocumentCommand{\CommonFontsize}{ }{ \small }
+\NewDocumentCommand{\key}{ o m }
+{
+ \group_begin:
+ \tl_if_novalue:nF {#1} { \mydoc_set_keys:nn { key } {#1} }
+ \mydoc_key:n {#2}
+ \group_end:
+}
-\NewDocumentCommand{\CommonFontfamily}{ }{ \ttfamily }
+\NewDocumentCommand{\val}{ o m }
+{
+ \group_begin:
+ \tl_if_novalue:nF {#1} { \mydoc_set_keys:nn { val } {#1} }
+ \mydoc_val:n {#2}
+ \group_end:
+}
-\NewDocumentCommand{\CommonFont}{ }{ \CommonFontsize\CommonFontfamily }
+\NewDocumentCommand{\keyval}{ o m m }
+{
+ \group_begin:
+ \tl_if_novalue:nF {#1} { \mydoc_set_keys:nn { key } {#1} }
+ \mydoc_keyval:nn {#2} {#3}
+ \group_end:
+}
-\NewDocumentCommand{\PackageFont}{ }{ \small \sffamily }
+\cs_new_protected:Npn \mydoc_key:n #1
+{
+ \__mydoc_key_font:
+ #1
+ \mydoc_index_key:nnn {#1} { key } { option }
+}
-\NewDocumentCommand{\KeyFont}{ }{ \CommonFont }
+\cs_new_protected:Npn \mydoc_val:n #1
+{
+ \__mydoc_key_font:
+ #1
+}
-\NewDocumentCommand{\ValFont}{ }{ \CommonFont }
+\cs_new_protected:Npn \mydoc_keyval:nn #1 #2
+{
+ \group_begin:
+ \mydoc_key:n {#1}
+ =
+ \mydoc_val:n {#2}
+ \group_end:
+}
-\NewDocumentCommand{\EksFont}{ }{ \CommonFont }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\NewDocumentCommand{\OptionFont}{ }{ \CommonFont \color{RoyalGreen} }
+\cs_new_protected:Npn \mydoc_index_cs:Nnn #1 #2 #3
+{
+ \tl_set:Nf \l_mydoc_index_item_tl { \cs_to_str:N #1 }
+ \tl_set:Nx \l_mydoc_index_entry_tl { \cstostr{#1} }
+
+ \bool_if:cT { l__mydoc_#2_index_bool }
+ {
+ \bool_if:cTF { l__mydoc_#2_definition_bool }
+ { \mydoc_index:VVnn \l_mydoc_index_item_tl \l_mydoc_index_entry_tl {#3} { textbf } }
+ { \mydoc_index:VVnn \l_mydoc_index_item_tl \l_mydoc_index_entry_tl {#3} { textnormal } }
+ }
+}
-\NewDocumentCommand{\MacroFont}{ }{ \CommonFont \color{RoyalRed} }
+\cs_new_protected:Npn \mydoc_index_key:nnn #1 #2 #3
+{
+ \seq_set_split:Nnn \l__mydoc_index_seq { - } {#1}
+ \tl_set:Nx \l_mydoc_index_item_tl { \seq_item:Nn \l__mydoc_index_seq {1} }
+ \tl_set:Nx \l_mydoc_index_subitem_tl {#1}
+ \tl_set:Nx \l_mydoc_index_entry_tl {#1}
+
+ \bool_if:cT { l__mydoc_#2_index_bool }
+ {
+ \bool_if:cTF { l__mydoc_#2_definition_bool }
+ { \mydoc_index:VVVnn \l_mydoc_index_item_tl \l_mydoc_index_subitem_tl \l_mydoc_index_entry_tl {#3} { textbf } }
+ { \mydoc_index:VVVnn \l_mydoc_index_item_tl \l_mydoc_index_subitem_tl \l_mydoc_index_entry_tl {#3} { textnormal } }
+ }
+}
-\NewDocumentCommand{\ArgFont}{ }{ \small \color{RoyalBlue} }
+\cs_new_protected:Npn \mydoc_index:nnnn #1 #2 #3 #4
+{
+ \index[#3]{#1@\protect{#2}|#4}
+}
-\NewDocumentCommand{\VerbFont}{ }{ \CommonFont }
+\cs_new_protected:Npn \mydoc_index:nnnnn #1 #2 #3 #4 #5
+{
+ \index[#4]{#1!#2@\protect{#3}|#5}
+}
+\cs_generate_variant:Nn \mydoc_index:nnnnn { VVV }
+\cs_generate_variant:Nn \mydoc_index:nnnn { VV }
-\NewDocumentCommand{\pkg}{ s m }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\NewDocumentCommand{\tsb}{ m }{ \textsubscript{#1} }
+
+\NewDocumentCommand{\meta}{ m }
{
- \IfBooleanTF{ #1 }
- { { \PackageFont #2.sty } }
- { { \PackageFont #2 } }
+ \ensuremath{\langle}
+ \group_begin:
+ \__mydoc_meta_font:
+ #1
+ \group_end:
+ \ensuremath{\rangle}
+}
+
+\NewDocumentCommand{\marg}{ m }
+{
+ \group_begin:
+ \mydoc_marg:n {#1}
+ \group_end:
+}
+\NewDocumentCommand{\narg}{ m }
+{
+ \group_begin:
+ \mydoc_narg:n {#1}
+ \group_end:
+}
+\NewDocumentCommand{\oarg}{ m }
+{
+ \group_begin:
+ \mydoc_oarg:n {#1}
+ \group_end:
+}
+\NewDocumentCommand{\earg}{ m }
+{
+ \group_begin:
+ \mydoc_earg:n {#1}
+ \group_end:
+}
+\NewDocumentCommand{\targ}{ m }
+{
+ \group_begin:
+ \mydoc_targ:n {#1}
+ \group_end:
+}
+\NewDocumentCommand{\sarg}{ }
+{
+ \group_begin:
+ \mydoc_sarg:
+ \group_end:
+}
+\NewDocumentCommand{\cs}{ m }
+{
+ \group_begin:
+ \mydoc_cs:n {#1}
+ \group_end:
+}
+
+\cs_new:Npn \mydoc_marg:n #1
+{
+ \__mydoc_marg_font:
+ \mydoc_arg_delim_format:n { \{ }
+ \meta{#1}
+ \mydoc_arg_delim_format:n { \} }
+}
+
+\cs_new:Npn \mydoc_narg:n #1
+{
+ \__mydoc_narg_font:
+ \mydoc_arg_delim_format:n { \{ }
+ #1
+ \mydoc_arg_delim_format:n { \} }
+}
+
+\cs_new:Npn \mydoc_oarg:n #1
+{
+ \__mydoc_oarg_font:
+ \mydoc_arg_delim_format:n { [ }
+ \meta{#1}
+ \mydoc_arg_delim_format:n { ] }
+}
+
+\cs_new:Npn \mydoc_earg:n #1
+{
+ \seq_set_from_clist:Nn \l__deriv_earg_seq {#1}
+ \int_zero:N \l__mydoc_earg_int
+ \seq_map_inline:Nn \l__deriv_earg_seq
+ {
+ \int_incr:N \l__mydoc_earg_int
+ \int_if_odd:nTF \l__mydoc_earg_int
+ { \mydoc_arg_delim_format:n {##1} }
+ { \mydoc_marg:n {##1} }
+ }
}
-\NewDocumentCommand{\mypackage}{ }
+\cs_new:Npn \mydoc_targ:n #1
{
- \pkg{\pakkenavn}
+ \__mydoc_targ_font:
+ \mydoc_arg_delim_format:n {#1}
}
-\NewDocumentCommand{\tsb}{ m }
+\cs_new:Npn \mydoc_sarg:
+{ \mydoc_targ:n { * } }
+
+\cs_new:Npn \mydoc_cs:n #1
{
- \textsubscript{#1}
+ \__mydoc_cs_font:
+ \mydoc_arg_delim_format:n { \\#1 }
}
-\NewDocumentCommand{\tcf}{ }
+
+\cs_new:Npn \mydoc_arg_delim_format:n #1
{
- \textasciicircum
+ \group_begin:
+ \ttfamily \char` #1
+ \group_end:
}
-\seq_new:N \l__low_seq
\NewDocumentCommand{\low}{ O{0,0} m m }
{
@@ -599,46 +1068,25 @@
\group_end:
}
-\NewDocumentCommand{\uni}{} % Kræver unicode
-{ \textsuperscript{\texttt{U}} }
+\cs_new_protected:Npn \mydoc_cs_to_str:N #1
+{ \char` \\ \cs_to_str:N #1 }
-\NewDocumentCommand{\pdf}{} % Kræver pdflatex
-{ \textsuperscript{\texttt{P}} }
+\cs_new_protected:Npn \mydoc_cs_to_str:n #1
+{ \char` \\ \cs_to_str:N #1 }
+\cs_generate_variant:Nn \mydoc_cs_to_str:n { x }
-\NewDocumentCommand{\req}{} % Kræver pakke
-{ \textsuperscript{\texttt{R}} }
+\NewDocumentCommand{\cstostr}{ m }
+{ \mydoc_cs_to_str:N #1 }
-\NewDocumentCommand{\tex}{}{\texorpdfstring{\hologo{TeX}}{TeX}}
-\NewDocumentCommand{\pdftex}{}{\texorpdfstring{\hologo{pdfTeX}}{pdfTeX}}
-\NewDocumentCommand{\luatex}{}{\texorpdfstring{\hologo{LuaTeX}}{LuaTeX}}
-\NewDocumentCommand{\xetex}{}{\texorpdfstring{\hologo{XeTeX}}{XeTeX}}
-\NewDocumentCommand{\latex}{ t2 t3 }
-{
- \bool_if:nTF {#1}
- { \texorpdfstring{\hologo{LaTeX2e}}{LaTeX2e} }
- {
- \bool_if:nTF {#2}
- { \texorpdfstring{\hologo{LaTeX3}}{LaTeX3} }
- { \LaTeX }
- }
-}
-
-\NewDocumentCommand{\ket}{ m }
-{
- \lvert #1 \rangle
-}
-
-\mathitalicsmode=1
-
+\makeatother
\ExplSyntaxOff
-\makeatother
\Pakkenavn{derivative}
\Titel{The \pakkenavn{} package}
\Forfatter{Simon Jensen}
\Email{sjelatex at gmail.com}
-\Dato{2019-07-21}
-\Version{v0.9}
+\Dato{2019-09-18}
+\Version{v0.95}
\hypersetup
{
@@ -661,398 +1109,676 @@
\indexsetup{level = \subsection*, noclearpage = true, toclevel = subsection}
+\def\indexspace{}
+
\begin{document}
-
-\forside
-
-\clearpage
-\tableofcontents
-
-\clearpage
-\section{Introduction}
-This is a beta version meaning that some elements might be changed in the official release. Using this package in its current state is therefore on your own risk. An update will be made before the official release explaining what will be changed and what impact this might cause.
-
-This package started as a personnel 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. 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} and abbreviated as \texttt{inf} for the operator symbol $d, \partial, \delta$ etc. used in various derivatives like $\odv{y}{x}, \pdv{y}{x}, \fdv{y}{x}$ etc. Moreover I explicitly use \emph{differential d} for $d$ and \emph{partial} for $\partial$. 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-orders} is used in the partial derivative's description to denote the order differentiation and is read as a comma-separated list of orders. It should also be noted that whenever an argument reads \meta{key=value}, it means that it is a comma-separated list of key-value pairs.
-
-
-\clearpage
-\section{Ordinary derivative}
-
-\DescribeMacro*{\odv}{ \sarg, \oarg{order}, \marg{function}, \targ{/}, \marg{variable}, \earg{\_,{point\tsb{1}},\tcf,{point\tsb{2}}} }
-The ordinary derivative \macro{1} is defined with a set of mandatory and optional arguments that either typeset specific parts or changing the style of the derivative. In this package, the ordinary derivative is defined with an upright lowercase d, because it is used by many nowadays books, as
-
-\begin{definition}
- \DeclareOdvVariant{\odv}{d}[style-inf=\mathrm]%\marginnote{\pdftex\\\xetex, \luatex}%
- \DeclareOdvVariant{\odv}{d}[style-inf=\symup]
-\end{definition}
-
-\DescribeArg*{\arg{1}}
-The first argument of \macro{1} is an optional star that determines where the function is typeset; either in the numerator of the fraction or next to the fraction. Using the option \keyval{switch-*}{false}, the function is typeset in the numerator when the star is absent, and next to the fraction when the star is present as shown below
-
-\eks{ \odv{y}{x} ; \odv*{y}{x} }
-
-\noindent The effect of the star's presence can be switched around using \keyval{switch-*}{true} i.e. the equations in the above example are exchanged, as described in \cref{ssec:odv_options}.
-
-\DescribeArg{\arg{2}}
-The second argument is optional and is written inside square brackets. This argument is used to set the order of differentiation as seen below
-
-\eks{ \odv[2]{y}{x} ; \odv[n]{y}{x} ; \odv[n+2]{y}{x} }
-
-\noindent The order may be a number, a symbol and a combination hereof, because it is simply typeset there. This is different from how the partial derivative's mixed order is typeset, which is computed. The order \textit{is not} automatically sorted as the mixed order for the partial derivative. This argument is subject to change, see \cref{consid:order2keyval} for more information.
-
-\DescribeArg{\arg{3}}
-This is the first mandatory argument that typeset the function that is to be differentiated
-
-\eks{ \odv{f(x)}{x} ; \odv{e^{\sin(x)}}{x} }
-
-\noindent The function is simply typeset in the numerator or next to the fraction.
-
-\DescribeArg{\arg{4}}
-The fourth argument is an optional slash written \emph{between the function and the variable} and determines which fraction style the derivative is typeset with, as described in \cref{ssec:odv_options}. Using the option \keyval{switch-/}{false} and the package's default settings, the derivative is typeset with \cs{frac} when the slash is absent, and \cs{slashfrac}\footnote{which is a macro defined by the package, see \cref{ssec:slashfrac} for more information.\label{foot:sfrac}} when the slash is present, as shown below
-
-\eks{ \odv{y}{x} ; \odv{y}/{x} }
-
-\noindent As for the star argument, the effect of the slash's presence can be switched around using \keyval{switch-/}{true} i.e. the equations in the above example are exchanged, as described in \cref{ssec:odv_options}.
-
-\DescribeArg{\arg{5}}
-This is the second and final mandatory argument, which purpose is to typeset the variable in which the function is differentiated with respect to as shown below
-
-\eks{ \odv{f}{x} ; \odv{f}{y} }
-
-\noindent The variable is always typeset in the denominator.
-
-\DescribeArg{\arg{6}}
-This is the last optional argument that specifies the point(s) of evaluation. It is an \emph{e-type} argument in the \pkg{xparse} language and given as \verb|e{_^}|. This means that the subscript \verb|_| and superscript \verb|^| accepts an argument given in braces. Moreover, the order of \verb|_| and \verb|^| is independent as shown below
-
-\eks{ \odv{y}{x}_{x_1} ; \odv{y}{x}^{x_2} ; \odv{y}{x}_{x_1}^{x_2} ; \odv{y}{x}^{x_2}_{x_1} }
-
-The common way to specify the point of evaluation is using the subscript argument. If needed, the second point of evaluation can be specified with the superscript argument.
-
-\subsection{Variants}
-This package offers four variants of the ordinary derivative: Material derivative \macro{\mdv}, functional derivative \macro{\fdv}, the average rate of change \macro{\adv} and the Jacobian \macro{\jdv}. A unique feature of this package, is that you can define your own variants of the ordinary derivative as described in \cref{ssec:CreateOdvVariant}.
-
-\DescribeMacro{\mdv}{ \sarg, \oarg{order}, \marg{function}, \targ{/}, \marg{variable}, \earg{\_,{point\tsb{1}},\tcf,{point\tsb{2}}} }
-The material derivative is used in some branches of physics (e.g. thermodynamic, fluid dynamic etc.). It is only natural for a physics student as me to define such a variant, that used an upright uppercase D. In this package, the material derivative is defined as
-
-\begin{definition}
- \DeclareOdvVariant{\mdv}{D}[style-inf=\mathrm]%\marginnote{\pdftex\\\xetex, \luatex}%
- \DeclareOdvVariant{\mdv}{D}[style-inf=\symup]
-\end{definition}
-
-\noindent In physics, the material derivative is defined by
-\begin{equation*}
- \mdv{ \varphi(\symbf{r}, t) }{ t } \coloneq \pdv{ \varphi(\symbf{r}, t) }{ t } + \dot{\symbf{r}} \cdot \nabla \varphi(\symbf{r}, t)
-\end{equation*}
-
-\DescribeMacro{\fdv}{ \sarg, \oarg{order}, \marg{function}, \targ{/}, \marg{variable}, \earg{\_,{point\tsb{1}},\tcf,{point\tsb{2}}} }
-The functional derivative is used in the calculus of variation and uses a lowercase delta. With the package's default settings, it will use an italic delta. In this package, the functional derivative is defined as
-
-\begin{definition}
- \DeclareOdvVariant{\fdv}{\delta}%\marginnote{\pdftex, \xetex, \luatex}%
-\end{definition}
-
-\noindent In physics, it is for example used in the Lagrange equation or in the derivation of the Hartree-Fock equation
-\begin{equation*}
- \fdv{I}{q_{\alpha}} = \pdv{L}{q_{\alpha}} - \odv*{ \pdv{L}{ \dot{q}_{\alpha} } } { t } = 0, \qquad \fdv{ \symcal{L} }{ \psi_{n}^* } = \hat{F} \ket{\psi_{n}} - \epsilon_{n} \ket{\psi_{n}} = 0
- ,
-\end{equation*}
-respectively.
-
-\DescribeMacro{\adv}{ \sarg, \oarg{order}, \marg{function}, \targ{/}, \marg{variable}, \earg{\_,{point\tsb{1}},\tcf,{point\tsb{2}}} }
-The average rate of change is defined to use an upright uppercase delta with the packages default settings. In this package, the average rate of change is defined as
-
-\begin{definition}
- \DeclareOdvVariant{\adv}{\Delta}[style-inf=\mathrm]%\marginnote{\pdftex\\\xetex, \luatex}%
- \DeclareOdvVariant{\adv}{\Delta}
-\end{definition}
-
-\noindent The average rate of change is used to determine the slope of a straight line
-\begin{equation*}
- \adv{ y }{ x } = \frac{y_2- y_1}{x_2 - x_1}
-\end{equation*}
-
-\DescribeMacro{\jdv}{ \sarg, \oarg{order}, \marg{function}, \targ{/}, \marg{variable}, \earg{\_,{point\tsb{1}},\tcf,{point\tsb{2}}} }
-The Jacobian is defined to use an italic partial differential with the package's default settings. Also a pair of parentheses is automatically inserted around the function and variable. In this package, the Jacobian is defined as
-
-\begin{definition}
- \DeclareOdvVariant{\jdv}{\partial}[add-delims={fun,var}]%\marginnote{\pdftex, \xetex, \luatex}%
-\end{definition}
-
-\noindent which gives
-\begin{equation*}
- \jdv{f,g,h}{x,y,z}
-\end{equation*}
-
-
-\clearpage
-\section{Partial derivative}
-
-\DescribeMacro*{\pdv}{ \sarg, \oarg{cs-orders}, \oarg{mixed order}, \marg{function}, \targ{/}, \marg{cs-variables}, \earg{\_,{point\tsb{1}},\tcf,{point\tsb{2}}} }
-The partial derivative \macro{1} is defined with a set of mandatory and optional arguments that either typeset specific parts or changing the style of the derivative. In this package, the partial derivative is defined with an italic partial differential as
-
-\begin{definition}
- \DeclarePdvVariant{\pdv}{\partial}[sep-inf-ord=1, sep-ord-fun=-2]%\marginnote{\pdftex, \xetex, \luatex}%
-\end{definition}
-
-\DescribeArg*{\arg{1}}
-The first argument of \macro{1} is an optional star that determines where the function is typeset; either in the numerator of the fraction or next to the fraction. Using the
-option \keyval{switch-*}{false}, the function is typeset in the numerator when the star is absent, and next to the fraction when the star is present as shown below
-
-\eks{ \pdv{f}{x,y} ; \pdv*{f}{x,y} }
-
-\noindent The effect of the star's presence can be switched around using \keyval{switch-*}{true} i.e. the equations in the above example are exchanged, as described in \cref{ssec:pdv_options}.
-
-\DescribeArg{\arg{2}}
-The second argument is optional and is written inside square brackets. This argument is used to set the order of differentiation for each of the variables and should be given in a comma-separated list e.g. \texttt{[1,2,3]} as shown below
-
-\eks{ \pdv[2,3]{f}{x,y} ; \pdv[\beta,a,n+2a]{f}{x,y,z} ; \pdv[2,n^2,n^2-1]{f}{x,y,z} }
-
-The orders may consist numbers, symbols and a combination hereof. Notice, that the mixed order is automatically calculated and sorted based on the variables orders by the package. See \cref{ssec:pdv_options,ssec:overall_order} for more information. This argument is subject to change, see \cref{consid:order2keyval} for more information.
-
-\DescribeArg{\arg{3}}
-If you, unfortunately, come to the conclusion, that you are unsatisfied with how the package typeset the mixed order or if it gives a wrong result, then you can overwrite it with this argument. The use of this argument completely bypass the automatic calculation and sorting done by the package, and simply typeset the mixed order as you wrote it as shown below
-
-\eks{ \pdv[4n+2k, 3k+n]{ f(x,y) }{ x,y } ; \pdv[4n+2k, 3k+n][5(n+k)]{ f(x,y) }{ x,y } }
-
-\noindent This argument is also subject to change, see \cref{consid:RemoveMixedOrder} for more information.
-
-\DescribeArg{\arg{4}}
-This is the first mandatory argument that typeset the function that is to be partially differentiated as shown below
-
-\eks{ \pdv{ f(x,y,z) }{ x, y, z } ; \pdv{ e^x \sin(y) \ln(z) }{ x, y, z } }
-
-\noindent The function is simply typeset in the numerator or next to the fraction.
-
-\DescribeArg{\arg{5}}
-The fifth argument is an optional slash written \emph{between the function and the variables} and determines which fraction style the derivative is typeset with, as described in \cref{ssec:pdv_options}. Using the option \keyval{switch-/}{false} and the package's default settings, the derivative is typeset with \cs{frac} when the slash is absent and \cs{slashfrac}\footref{foot:sfrac} when the slash is present, as shown below
-
-\eks{ \pdv{f}{x,y} ; \pdv{f}/{x,y} }
-
-\noindent As for the star argument, the effect of the slash's presence can be switched around using \keyval{switch-/}{true} i.e. the equations in the above example are exchanged, as described in \cref{ssec:pdv_options}.
-
-\DescribeArg{\arg{6}}
-This is the second and final mandatory argument, which purpose is to typeset the variables in which the function is partially differentiated with respect to. The variables are given in a comma-separated list e.g. \texttt{\{x, y, z\}}, as shown below
-
-\eks{ \pdv{f}{x} ; \pdv{f}{x,y} }
-
-\noindent The variables are typeset in the denominator with a $\partial$ inserted to the left of them.
-
-\DescribeArg{\arg{7}}
-This is the last optional argument that specifies the point(s) of evaluation or variables held constant.
-It is an \emph{e-type} argument in the \pkg{xparse} language and given as \verb|e{_^}|. This means that the
-subscript \verb|_| and superscript \verb|^| accepts an argument given in braces. Moreover, the order
-of \verb|_| and \verb|^| is independent as shown below
-
-\eks{ \pdv{f}{x,y}_{(x_1,y_1)} ; \pdv{f}{x,y}^{(x_2,y_2)} ; \pdv{f}{x,y}_{(x_1,y_1)}^{(x_2,y_2)} ; \pdv{f}{x,y}^{(x_2,y_2)}_{(x_1,y_1)} }
-
-The subscript argument is commonly used as the point of evaluation or variables held constant. If needed, the superscript argument may be used for the second point of evaluation.
-
-\subsection{Variants}
-This package does not define any variants of the partial derivative. However, a unique feature of this package, is that you can define your own variants of the partial derivative as described in \cref{ssec:CreatePdvVariant}.
-
-\clearpage
-\section{Package options}
-This package accepts its options using the well-known \emph{key=value} syntax. The keys are divided into categories, for which each key have its associated category as a prefix. Each category and option is explained below.
-
-\DescribeMacro{\derivset}{ \marg{derivative}, \oarg{key=value} }
-The package options can be set either in the preamble or in the document using the \macro{1} command. The options may also be set when defining a new derivative. Currently, there is no other way to set the options however this is subject to change, see \cref{consid:order2keyval} for more information.
-
-\DescribeArg{\arg{1}}
-A mandatory argument that determines which derivative the \emph{key=value} pairs is assigned to, where the allowed \meta{main-category} are the derivatives defined by the packages and you, see \cref{ssec:CreateOdvVariant,ssec:CreatePdvVariant}. The special value \texttt{all} is also allowed, which gives access to the options that applies to \textit{all} derivatives.
-
-\DescribeArg{\arg{2}}
-This optional argument accepts its input as a comma-separated list of \emph{key=value} pairs. Leaving out \arg{2} sets the options to the packages default settings for the chosen \arg{1} e.g. \macro{\derivset}[\marg*{\macro{\odv}}] sets the options for the ordinary derivative to the packages default settings. This argument is subject to change, see \cref{consid:DerivsetOptional} for more information.
-
-\subsection{Categories}
-This section seeks to give a detailed description of each category.
-
-\begin{itemize}
- \item The \key*{style}[\dots] keys sets either the font style or the fraction style of \meta{\dots}. The font styles \cs{mathnormal}/\cs{symnormal} and \cs{mathrm}/\cs{symup} are commonly used in literature. The fraction style can be either \cs{frac}, \cs{dfrac}, \cs{tfrac}, \cs{sfrac}\req{}, \cs{slashfrac}\footref{foot:sfrac} and many more.
- \item The \key*{delims}[\dots] keys sets the delimiters used around the \meta{\dots}. The Rule of Two applies here: \enquote{Always two there are, no more, no less. A left and a right delimiter}. The allowed delimiters are those that can be scaled with \cs{left}, \cs{big} etc.
- \item The \key*{scale}[\dots] keys sets the size of the \meta{\dots}'s delimiters. The values \texttt{big}, \texttt{Big}, \texttt{bigg}, and \texttt{Bigg} are self-explanatory and internally a left and right version are used e.g. \cs{bigl} and \cs{bigr}. The value \texttt{none} inserts the delimiters (except periods) unscaled. While the value \texttt{auto} scales the delimiters automatically using \cs{left} and \cs{right}.
- \item The \key*{sep}[\dots][\dots] keys inserts math space between \meta{\dots} and \meta{\dots} using \cs{mskip}. These keys accepts a comma-separated list of numbers \texttt{\{x,y,z\}} that are internally used to form the syntax \texttt{x mu plus y mu minus z mu}.
- \item The \key*{switch}[\dots] keys serves to change an argument's behaviour by swapping the effect of an optional character's presence.
- \item The \key*{sort}[\dots] keys deals with the sorting algorithm behind the mixed order, where you can choose the sorting method that suits you best. These keys are unique to the partial derivative and variants of it.
- \item The \key*{mics}[\dots] keys are miscellaneous keys that does not belong to any of the above categories.
-\end{itemize}
-
-\begin{note}
- A value with superscripted \texttt{U}, \texttt{P} and \texttt{R} refers to a unicode engine i.e. \luatex{} and \xetex, \pdftex{} and requires package, respectively. Additionally, some keys have two versions; with and without \texttt{-/} at the end. These keys are related to the slash argument. If \keyval{switch-/}{false} then the keys with and without \texttt{-/} are used when the slash argument is present and absent, respectively. Setting \keyval{switch-/}{true} then these keys are used in the opposite cases for the slash's presence.
-\end{note}
-
-\subsection{Ordinary derivative} \label{ssec:odv_options}
-The options in this subsection are available for the ordinary derivative \macro{\odv} and variants hereof that are defined by the package and you.
-
-\subsubsection*{Style}
-\DescribeOption*{style-inf}[\cs{mathnormal}\pdf, \cs{symnormal}\uni]{ !\meta{math-font-style} }
-The font style of the infinitesimal for the chosen derivative is set by this key. The default font style is \default*. If an upright font is preferred then \cs{mathrm}\pdf{} and \cs{symup}\uni{} could be used, or if an italic font then \cs{mathnormal}\pdf{} and \cs{symit}\uni.
-
-\DescribeOption{style-frac}[\cs{frac}]{ !\meta{fraction} }
-The derivative uses the fraction set by this key whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default value is the usual fraction \default.
-
-\DescribeOption{style-frac-/}[\cs{slashfrac}]{ !\meta{fraction} }
-The derivative uses the fraction set by this key whenever \keyval{switch-/}{false} and the slash argument is present. The key's default value is a text-styled fraction \default\footref{foot:sfrac} i.e. on the form $\derivset{\odv}[style-frac-/=\slashfrac, switch-/=false] \odv{y}/{x}$.
-
-\subsubsection*{Scaling}
-\DescribeOption*{scale-eval}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used for the point of evaluation. This scaling is used whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default value is set to scale the delimiters automatically.
-
-\DescribeOption{scale-eval-/}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used for the point of evaluation. This scaling is used whenever \keyval{switch-/}{false} and the slash argument is present. The key's default value is set to scale the delimiters automatically.
-
-\DescribeOption{scale-fun}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used around the function. The scaling is used whenever \keyval{misc-add-delims}{fun} is used. The key's default value is set to scale the delimiters automatically.
-
-\DescribeOption{scale-var}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used around the variable. The scaling is used whenever \keyval{misc-add-delims}{fun} is used. The key's default value is set to scale the delimiters automatically.
-
-\DescribeOption{scale-frac}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used for around the fraction. This scaling is used whenever \keyval{switch-/}{false}, the slash argument is absent and \keyval{misc-add-delims}{frac} is used. The key's default value is set to scale the delimiters automatically.
-
-\DescribeOption{scale-frac-/}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used for around the fraction. This scaling is used whenever \keyval{switch-/}{false}, the slash argument is present and \keyval{misc-add-delims}{frac} is used. The key's default value is set to scale the delimiters automatically.
-
-\subsubsection*{Delimiters}
-\DescribeOption*{delims-eval}[.~\cs{rvert}]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to indicate the point of evaluation. These delimiters are inserted whenever \keyval{switch-/}{false} and the slash argument is absent. The default left and right delimiters is a period\footnote{which doesn't output anything.\label{foot:period_no_output}} and a vertical bar, respectively.
-
-\DescribeOption{delims-eval-/}[.~\cs{rvert}]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to indicate the point of evaluation. These delimiters are inserted whenever \keyval{switch-/}{false} and the slash argument is present. The default left and right delimiters is a period\footref{foot:period_no_output} and a vertical bar, respectively.
-
-\DescribeOption{delims-fun}[(~)]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to around the function and these are inserted whenever \keyval{misc-add-delims}{fun} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
-
-\DescribeOption{delims-var}[(~)]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to around the variable and these are inserted whenever \keyval{misc-add-delims}{var} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
-
-\DescribeOption{delims-frac}[(~)]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to around the variable- These delimiters are inserted whenever \keyval{switch-/}{false}, the slash argument is absent and \keyval{misc-add-delims}{frac} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
-
-\DescribeOption{delims-frac-/}[(~)]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to around the variable- These delimiters are inserted whenever \keyval{switch-/}{false}, the slash argument is present and \keyval{misc-add-delims}{frac} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
-
-\subsubsection*{Math spacing}
-The options in this subsection inserts extra horizontal math space. The below equation illustrates where the space is inserted
-\begin{equation*}
+
+ \forside
+
+ \clearpage
+ \tableofcontents
+
+ \clearpage
+ \section{Introduction}
+ This is a beta version meaning that some elements might be changed in the official release. Using this package in its current state is therefore on your own risk. An update will be made before the official release explaining what will be changed and what impact this might cause.
+
+ This package started as a personnel 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. 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} and abbreviated as \texttt{inf} for the operator symbol $d, \partial, \delta$ etc. used in various derivatives like $\odv{y}{x}, \pdv{y}{x}, \fdv{y}{x}$ etc. Moreover I explicitly use \emph{differential d} for $d$ and \emph{partial} for $\partial$. 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-orders} is used in the partial derivative's description to denote the order differentiation and is read as a comma-separated list of orders. It should also be noted that whenever an argument reads \meta{key=value}, it means that it is a comma-separated list of key-value pairs.
+
+
+
+ \clearpage
+ \section{Ordinary derivative}
+
+ \begin{function}*{\odv}
+ \begin{syntax}
+ \sarg, \oarg{order}, \marg{function}, \targ{/}, \marg{variable}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
+ \end{syntax}
+ The ordinary derivative \macro{1} is defined with a set of mandatory and optional arguments that either typeset specific parts or changing the style of the derivative. In this package, the ordinary derivative is defined with an upright lowercase d, because it is used by many nowadays books, as
+
+ \begin{definition}
+ \DeclareOdvVariant{\odv}{d}[style-inf=\mathrm]%\marginnote{\pdftex\\\xetex, \luatex}%
+ \DeclareOdvVariant{\odv}{d}[style-inf=\symup]
+ \end{definition}
+
+ \begin{argument}*{1}
+ The first argument of \macro{1} is an optional star that determines where the function is typeset; either in the numerator of the fraction or next to the fraction. Using the option \keyval{switch-*}{false}, the function is typeset in the numerator when the star is absent, and next to the fraction when the star is present as shown below
+
+ \begin{example}
+ \odv{y}{x} \\
+ \odv*{y}{x}
+ \end{example}
+
+ \noindent The effect of the star's presence can be switched around using \keyval{switch-*}{true} i.e. the equations in the above example are exchanged, as described in \cref{ssec:odv_options}.
+ \end{argument}
+
+ \begin{argument}{2}
+ The second argument is optional and is written inside square brackets. This argument is used to set the order of differentiation as seen below
+
+ \begin{example}
+ \odv[2]{y}{x} \\
+ \odv[n]{y}{x} \\
+ \odv[n+2]{y}{x}
+ \end{example}
+
+ \noindent The order may be a number, a symbol and a combination hereof, because it is simply typeset there. This is different from how the partial derivative's mixed order is typeset, which is computed. The order \textit{is not} automatically sorted as the mixed order for the partial derivative. This argument is subject to change, see \cref{consid:order2keyval} for more information.
+ \end{argument}
+
+ \begin{argument}{3}
+ This is the first mandatory argument that typeset the function that is to be differentiated
+
+ \begin{example}
+ \odv{f(x)}{x} \\
+ \odv{e^{\sin(x)}}{x}
+ \end{example}
+
+ \noindent The function is simply typeset in the numerator or next to the fraction.
+ \end{argument}
+
+ \begin{argument}{4}
+ The fourth argument is an optional slash written \emph{between the function and the variable} and determines which fraction style the derivative is typeset with, as described in \cref{ssec:odv_options}. Using the option \keyval{switch-/}{false} and the package's default settings, the derivative is typeset with \cs{frac} when the slash is absent, and \cs{slashfrac}\footnote{which is a macro defined by the package, see \cref{ssec:slashfrac} for more information.\label{foot:sfrac}} when the slash is present, as shown below
+
+ \begin{example}
+ \odv{y}{x} \\
+ \odv{y}/{x}
+ \end{example}
+
+ \noindent As for the star argument, the effect of the slash's presence can be switched around using \keyval{switch-/}{true} i.e. the equations in the above example are exchanged, as described in \cref{ssec:odv_options}.
+ \end{argument}
+
+ \begin{argument}{5}
+ This is the second and final mandatory argument, which purpose is to typeset the variable in which the function is differentiated with respect to as shown below
+
+ \begin{example}
+ \odv{f}{x} \\
+ \odv{f}{y}
+ \end{example}
+
+ \noindent The variable is always typeset in the denominator.
+ \end{argument}
+
+ \begin{argument}{6}
+ This is the last optional argument that specifies the point(s) of evaluation. It is an \emph{e-type} argument in the \pkg{xparse} language and given as \verb|e{_^}|. This means that the subscript \verb|_| and superscript \verb|^| accepts an argument given in braces. Moreover, the order of \verb|_| and \verb|^| is independent as shown below
+
+ \begin{example}
+ \odv{y}{x}_{x_1} \\
+ \odv{y}{x}^{x_2} \\
+ \odv{y}{x}_{x_1}^{x_2} \\
+ \odv{y}{x}^{x_2}_{x_1}
+ \end{example}
+
+ The common way to specify the point of evaluation is using the subscript argument. If needed, the second point of evaluation can be specified with the superscript argument.
+ \end{argument}
+
+ \end{function}
+
+ \subsection{Variants}
+ This package offers four variants of the ordinary derivative: Material derivative \macro{\mdv}, functional derivative \macro{\fdv}, the average rate of change \macro{\adv} and the Jacobian \macro{\jdv}. A unique feature of this package, is that you can define your own variants of the ordinary derivative as described in \cref{ssec:CreateOdvVariant}.
+
+ \begin{function}*{\mdv}
+ \begin{syntax}
+ \sarg, \oarg{order}, \marg{function}, \targ{/}, \marg{variable}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
+ \end{syntax}
+ The material derivative is used in some branches of physics (e.g. thermodynamic, fluid dynamic etc.). It is only natural for a physics student as me to define such a variant, that used an upright uppercase D. In this package, the material derivative is defined as
+
+ \begin{definition}
+ \DeclareOdvVariant{\mdv}{D}[style-inf=\mathrm]%\marginnote{\pdftex\\\xetex, \luatex}%
+ \DeclareOdvVariant{\mdv}{D}[style-inf=\symup]
+ \end{definition}
+
+ \noindent In physics, the material derivative is defined by
+ \begin{equation*}
+ \mdv{ \varphi(\symbf{r}, t) }{ t } \coloneq \pdv{ \varphi(\symbf{r}, t) }{ t } + \dot{\symbf{r}} \cdot \nabla \varphi(\symbf{r}, t)
+ \end{equation*}
+ \end{function}
+
+ \begin{function}*{\fdv}
+ \begin{syntax}
+ \sarg, \oarg{order}, \marg{function}, \targ{/}, \marg{variable}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
+ \end{syntax}
+ The functional derivative is used in the calculus of variation and uses a lowercase delta. With the package's default settings, it will use an italic delta. In this package, the functional derivative is defined as
+
+ \begin{definition}
+ \DeclareOdvVariant{\fdv}{\delta}%\marginnote{\pdftex, \xetex, \luatex}%
+ \end{definition}
+
+ \noindent In physics, it is for example used in the Lagrange equation or in the derivation of the Hartree-Fock equation
+ \begin{equation*}
+ \fdv{I}{q_{\alpha}} = \pdv{L}{q_{\alpha}} - \odv*{ \pdv{L}{ \dot{q}_{\alpha} } } { t } = 0, \qquad \fdv{ \symcal{L} }{ \psi_{n}^* } = \hat{F} \ket{\psi_{n}} - \epsilon_{n} \ket{\psi_{n}} = 0
+ ,
+ \end{equation*}
+ respectively.
+ \end{function}
+
+ \begin{function}*{\adv}
+ \begin{syntax}
+ \sarg, \oarg{order}, \marg{function}, \targ{/}, \marg{variable}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
+ \end{syntax}
+ The average rate of change is defined to use an upright uppercase delta with the packages default settings. In this package, the average rate of change is defined as
+
+ \begin{definition}
+ \DeclareOdvVariant{\adv}{\Delta}[style-inf=\mathrm]%\marginnote{\pdftex\\\xetex, \luatex}%
+ \DeclareOdvVariant{\adv}{\Delta}
+ \end{definition}
+
+ \noindent The average rate of change is used to determine the slope of a straight line
+ \begin{equation*}
+ \adv{ y }{ x } = \frac{y_2- y_1}{x_2 - x_1}
+ \end{equation*}
+ \end{function}
+
+ \begin{function}*{\jdv}
+ \begin{syntax}
+ \sarg, \oarg{order}, \marg{function}, \targ{/}, \marg{variable}, \earg{\_, point\tsb{1}, \^, point\tsb{2}}
+ \end{syntax}
+ The Jacobian is defined to use an italic partial differential with the package's default settings. Also a pair of parentheses is automatically inserted around the function and variable. In this package, the Jacobian is defined as
+
+ \begin{definition}
+ \DeclareOdvVariant{\jdv}{\partial}[misc-add-delims={fun,var}]%\marginnote{\pdftex, \xetex, \luatex}%
+ \end{definition}
+
+ \noindent which gives
+ \begin{equation*}
+ \jdv{f,g,h}{x,y,z}
+ \end{equation*}
+ \end{function}
+
+
+
+ \clearpage
+ \section{Partial derivative}
+
+ \begin{function}*{\pdv}
+ \begin{syntax}
+ \sarg, \oarg{cs-orders}, \oarg{mixed order}, \marg{function}, \targ{/}, \marg{cs-variables}, \earg{\_,point\tsb{1},\^,point\tsb{2}}
+ \end{syntax}
+ The partial derivative \macro{1} is defined with a set of mandatory and optional arguments that either typeset specific parts or changing the style of the derivative. In this package, the partial derivative is defined with an italic partial differential as
+
+ \begin{definition}
+ \DeclarePdvVariant{\pdv}{\partial}[sep-inf-ord=1, sep-ord-fun=-2]%\marginnote{\pdftex, \xetex, \luatex}%
+ \end{definition}
+
+ \begin{argument}*{1}
+ The first argument of \macro{1} is an optional star that determines where the function is typeset; either in the numerator of the fraction or next to the fraction. Using the
+ option \keyval{switch-*}{false}, the function is typeset in the numerator when the star is absent, and next to the fraction when the star is present as shown below
+
+ \begin{example}
+ \pdv{f}{x,y} \\
+ \pdv*{f}{x,y}
+ \end{example}
+
+ \noindent The effect of the star's presence can be switched around using \keyval{switch-*}{true} i.e. the equations in the above example are exchanged, as described in \cref{ssec:pdv_options}.
+ \end{argument}
+
+ \begin{argument}{2}
+ The second argument is optional and is written inside square brackets. This argument is used to set the order of differentiation for each of the variables and should be given in a comma-separated list e.g. \texttt{[1,2,3]} as shown below
+
+ \begin{example}
+ \pdv[2,3]{f}{x,y} \\
+ \pdv[\beta,a,n+2a]{f}{x,y,z} \\
+ \pdv[2,n^2,n^2-1]{f}{x,y,z}
+ \end{example}
+
+ The orders may consist numbers, symbols and a combination hereof. Notice, that the mixed order is automatically calculated and sorted based on the variables orders by the package. See \cref{ssec:pdv_options,ssec:overall_order} for more information. This argument is subject to change, see \cref{consid:order2keyval} for more information.
+ \end{argument}
+
+ \begin{argument}{3}
+ If you, unfortunately, come to the conclusion, that you are unsatisfied with how the package typeset the mixed order or if it gives a wrong result, then you can overwrite it with this argument. The use of this argument completely bypass the automatic calculation and sorting done by the package, and simply typeset the mixed order as you wrote it as shown below
+
+ \begin{example}
+ \pdv[4n+2k, 3k+n]{ f(x,y) }{ x,y } \\
+ \pdv[4n+2k, 3k+n][5(n+k)]{ f(x,y) }{ x,y }
+ \end{example}
+
+ \noindent This argument is also subject to change, see \cref{consid:RemoveMixedOrder} for more information.
+ \end{argument}
+
+ \begin{argument}{4}
+ This is the first mandatory argument that typeset the function that is to be partially differentiated as shown below
+
+ \begin{example}
+ \pdv{ f(x,y,z) }{ x, y, z } \\
+ \pdv{ e^x \sin(y) \ln(z) }{ x, y, z }
+ \end{example}
+
+ \noindent The function is simply typeset in the numerator or next to the fraction.
+ \end{argument}
+
+ \begin{argument}{5}
+ The fifth argument is an optional slash written \emph{between the function and the variables} and determines which fraction style the derivative is typeset with, as described in \cref{ssec:pdv_options}. Using the option \keyval{switch-/}{false} and the package's default settings, the derivative is typeset with \cs{frac} when the slash is absent and \cs{slashfrac}\footref{foot:sfrac} when the slash is present, as shown below
+
+ \begin{example}
+ \pdv{f}{x,y} \\
+ \pdv{f}/{x,y}
+ \end{example}
+
+ \noindent As for the star argument, the effect of the slash's presence can be switched around using \keyval{switch-/}{true} i.e. the equations in the above example are exchanged, as described in \cref{ssec:pdv_options}.
+ \end{argument}
+
+ \begin{argument}{6}
+ This is the second and final mandatory argument, which purpose is to typeset the variables in which the function is partially differentiated with respect to. The variables are given in a comma-separated list e.g. \texttt{\{x, y, z\}}, as shown below
+
+ \begin{example}
+ \pdv{f}{x} \\
+ \pdv{f}{x,y}
+ \end{example}
+
+ \noindent The variables are typeset in the denominator with a $\partial$ inserted to the left of them.
+ \end{argument}
+
+ \begin{argument}{7}
+ This is the last optional argument that specifies the point(s) of evaluation or variables held constant.
+ It is an \emph{e-type} argument in the \pkg{xparse} language and given as \verb|e{_^}|. This means that the
+ subscript \verb|_| and superscript \verb|^| accepts an argument given in braces. Moreover, the order
+ of \verb|_| and \verb|^| is independent as shown below
+
+ \begin{example}
+ \pdv{f}{x,y}_{(x_1,y_1)} \\
+ \pdv{f}{x,y}^{(x_2,y_2)} \\
+ \pdv{f}{x,y}_{(x_1,y_1)}^{(x_2,y_2)} \\
+ \pdv{f}{x,y}^{(x_2,y_2)}_{(x_1,y_1)}
+ \end{example}
+
+ The subscript argument is commonly used as the point of evaluation or variables held constant. If needed, the superscript argument may be used for the second point of evaluation.
+ \end{argument}
+ \end{function}
+
+ \subsection{Variants}
+ This package does not define any variants of the partial derivative. However, a unique feature of this package, is that you can define your own variants of the partial derivative as described in \cref{ssec:CreatePdvVariant}.
+
+
+
+ \clearpage
+ \section{Package options}
+ This package accepts its options using the well-known \emph{key=value} syntax. The keys are divided into categories, for which each key have its associated category as a prefix. Each category and option is explained below.
+
+ \begin{function}{\derivset}
+ \begin{syntax}
+ \marg{derivative}, \oarg{key=value}
+ \end{syntax}
+ The package options can be set either in the preamble or in the document using the \macro{1} command. The options may also be set when defining a new derivative. Currently, there is no other way to set the options however this is subject to change, see \cref{consid:order2keyval} for more information.
+
+ \begin{argument}{1}
+ A mandatory argument that determines which derivative the \emph{key=value} pairs is assigned to, where the allowed \meta{main-category} are the derivatives defined by the packages and you, see \cref{ssec:CreateOdvVariant,ssec:CreatePdvVariant}. The special value \texttt{all} is also allowed, which gives access to the options that applies to \textit{all} derivatives.
+ \end{argument}
+
+ \begin{argument}{2}
+ This optional argument accepts its input as a comma-separated list of \emph{key=value} pairs. Leaving out \arg{2} sets the options to the packages default settings for the chosen \arg{1} e.g. \macro{\derivset}[\marg*{\macro{\odv}}] sets the options for the ordinary derivative to the packages default settings. This argument is subject to change, see \cref{consid:DerivsetOptional} for more information.
+ \end{argument}
+ \end{function}
+
+ \subsection{Categories}
+ This section seeks to give a detailed description of each category.
+
+ \begin{itemize}
+ \item The \key[index=false]{style-\meta{\dots}} keys sets either the font style or the fraction style of \meta{\dots}. The font styles \cs{mathnormal}/\cs{symnormal} and \cs{mathrm}/\cs{symup} are commonly used in literature. The fraction style can be either \cs{frac}, \cs{dfrac}, \cs{tfrac}, \cs{sfrac}\req{}, \cs{slashfrac}\footref{foot:sfrac} and many more.
+ \item The \key[index=false]{delims-\meta{\dots}} keys sets the delimiters used around the \meta{\dots}. The Rule of Two applies here: \enquote{Always two there are, no more, no less. A left and a right delimiter}. The allowed delimiters are those that can be scaled with \cs{left}, \cs{big} etc.
+ \item The \key[index=false]{scale-\meta{\dots}} keys sets the size of the \meta{\dots}'s delimiters. The values \texttt{big}, \texttt{Big}, \texttt{bigg}, and \texttt{Bigg} are self-explanatory and internally a left and right version are used e.g. \cs{bigl} and \cs{bigr}. The value \texttt{none} inserts the delimiters (except periods) unscaled. While the value \texttt{auto} scales the delimiters automatically using \cs{left} and \cs{right}.
+ \item The \key[index=false]{sep-\meta{\dots}-\meta{\dots}} keys inserts math space between \meta{\dots} and \meta{\dots} using \cs{mskip}. These keys accepts a comma-separated list of numbers \texttt{\{x,y,z\}} that are internally used to form the syntax \texttt{x mu plus y mu minus z mu}.
+ \item The \key[index=false]{switch-\meta{\dots}} keys serves to change an argument's behaviour by swapping the effect of an optional character's presence.
+ \item The \key[index=false]{sort-\meta{\dots}} keys deals with the sorting algorithm behind the mixed order, where you can choose the sorting method that suits you best. These keys are unique to the partial derivative and variants of it.
+ \item The \key[index=false]{mics-\meta{\dots}} keys are miscellaneous keys that does not belong to any of the above categories.
+ \end{itemize}
+
+ \begin{note}
+ A value with superscripted \texttt{U}, \texttt{P} and \texttt{R} refers to a unicode engine i.e. \luatex{} and \xetex, \pdftex{} and requires package, respectively. Additionally, some keys have two versions; with and without \texttt{-/} at the end. These keys are related to the slash argument. If \keyval{switch-/}{false} then the keys with and without \texttt{-/} are used when the slash argument is present and absent, respectively. Setting \keyval{switch-/}{true} then these keys are used in the opposite cases for the slash's presence.
+ \end{note}
+
+ \subsection{Ordinary derivative} \label{ssec:odv_options}
+ The options in this subsection are available for the ordinary derivative \macro{\odv} and variants hereof that are defined by the package and you.
+
+ \subsubsection*{Style}
+
+ \begin{option}*{style-inf}
+ \begin{values}[default = { \cs{mathnormal}\pdf, \cs{symnormal}\uni }]
+ \meta{math-font-style}
+ \end{values}
+ The font style of the infinitesimal for the chosen derivative is set by this key. The default font style is \default*. If an upright font is preferred then \cs{mathrm}\pdf{} and \cs{symup}\uni{} could be used, or if an italic font then \cs{mathnormal}\pdf{} and \cs{symit}\uni.
+ \end{option}
+
+ \begin{option}{style-frac}
+ \begin{values}[default = \cs{frac}]
+ \meta{fraction}
+ \end{values}
+ The derivative uses the fraction set by this key whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default value is the usual fraction \default.
+ \end{option}
+
+ \begin{option}{style-frac-/}
+ \begin{values}[default = \cs{slashfrac}]
+ \meta{fraction}
+ \end{values}
+ The derivative uses the fraction set by this key whenever \keyval{switch-/}{false} and the slash argument is present. The key's default value is a text-styled fraction \default\footref{foot:sfrac} i.e. on the form $\derivset{\odv}[style-frac-/=\slashfrac, switch-/=false] \odv{y}/{x}$.
+ \end{option}
+
+ \subsubsection*{Scaling}
+
+ \begin{option}*{scale-eval}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used for the point of evaluation. This scaling is used whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \begin{option}{scale-eval-/}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used for the point of evaluation. This scaling is used whenever \keyval{switch-/}{false} and the slash argument is present. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \begin{option}{scale-fun}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used around the function. The scaling is used whenever \keyval{misc-add-delims}{fun} is used. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \begin{option}{scale-var}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used around the variable. The scaling is used whenever \keyval{misc-add-delims}{var} is used. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \begin{option}{scale-frac}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used for around the fraction. This scaling is used whenever \keyval{switch-/}{false}, the slash argument is absent and \keyval{misc-add-delims}{frac} is used. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \begin{option}{scale-frac-/}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used for around the fraction. This scaling is used whenever \keyval{switch-/}{false}, the slash argument is present and \keyval{misc-add-delims}{frac} is used. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \subsubsection*{Delimiters}
+
+ \begin{option}*{delims-eval}
+ \begin{values}[default = .~\cs{rvert}]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to indicate the point of evaluation. These delimiters are inserted whenever \keyval{switch-/}{false} and the slash argument is absent. The default left and right delimiters is a period\footnote{which doesn't output anything.\label{foot:period_no_output}} and a vertical bar, respectively.
+ \end{option}
+
+ \begin{option}{delims-eval-/}
+ \begin{values}[default = .~\cs{rvert}]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to indicate the point of evaluation. These delimiters are inserted whenever \keyval{switch-/}{false} and the slash argument is present. The default left and right delimiters is a period\footref{foot:period_no_output} and a vertical bar, respectively.
+ \end{option}
+
+ \begin{option}{delims-fun}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to around the function and these are inserted whenever \keyval{misc-add-delims}{fun} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
+ \end{option}
+
+ \begin{option}{delims-var}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to around the variable and these are inserted whenever \keyval{misc-add-delims}{var} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
+ \end{option}
+
+ \begin{option}{delims-frac}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to around the fraction in the derivative e.g. $\derivset{\odv}[misc-add-delims=frac] \odv*{y}{x}$ These delimiters are inserted whenever \keyval{switch-/}{false}, the slash argument is absent and \keyval{misc-add-delims}{frac} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
+ \end{option}
+
+ \begin{option}{delims-frac-/}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to around the fraction in the derivative e.g. $\derivset{\odv}[misc-add-delims=frac] \odv*{y}/{x}$ These delimiters are inserted whenever \keyval{switch-/}{false}, the slash argument is present and \keyval{misc-add-delims}{frac} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
+ \end{option}
+
+ \subsubsection*{Math spacing}
+ The options in this subsection inserts extra horizontal math space. The below equation illustrates where the space is inserted
+ \begin{equation*}
\frac{ \symup{d} \ms{inf-fun} y }{ \symup{d} \ms{inf-var} x }
\qquad
\frac{ \symup{d}^{ \ms{inf-ord} 2 } \ms{ord-fun} y }{ \symup{d} x^{ \ms{var-ord} 2 } }
\qquad
\mleft. \frac{ \symup{d} y}{ \symup{d} x } \mright\rvert_{ \ms{eval-sb} x_1}^{ \ms{eval-sp} x_2}
-\end{equation*}
-where it have been split into three to give a better overview.
-
-\DescribeOption{sep-inf-ord}[0]{ !\meta{cs-numbers} }
-This key sets the math space that is inserted in the infinitesimal's power left to the order. It is only inserted when the order is different from \num{1}. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-inf-fun}[0]{ !\meta{cs-numbers} }
-This key sets the math space that is inserted between the infinitesimal and the function when the order \emph{is equal} to \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-ord-fun}[0]{ !\meta{cs-numbers} }
-This key sets the math space that is inserted between the infinitesimal and the function when the order \emph{is different} from \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-inf-var}[0]{ !\meta{cs-numbers} }
-This key sets the math space that is inserted between the infinitesimal and the variable. The space is only inserted when a non-blank variable is given. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-var-ord}[0]{ !\meta{cs-numbers} }
-This key sets the math space that is inserted in the variable's power left to the order. The space is only inserted when the order is different from \num{1}. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-eval-sb}[0]{ !\meta{cs-numbers} }
-This key sets the math space that is inserted in the evaluation subscript left to the point of evaluation. The space is only inserted when a non-blank subscript is given. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-eval-sp}[0]{ !\meta{cs-numbers} }
-This key sets the math space that is inserted in the evaluation superscript left to the point of evaluation. The space is only inserted when a non-blank superscript is given. The key's default value is \default{} \texttt{mu}.
-
-\subsubsection*{Switches}
-\DescribeOption*{switch-*}[false]{ true, false }
-The effect of the star's presence can be switched with the value \val{true}. That is, the function is typeset next to the fraction when the star is absent and in the numerator when the star is present. As an example, compare below where the option is turned on (\val{true}) and off (\val{false}),
-
-\eks{ \derivset{\odv}[switch-*=false] \odv{y}{x} ; \derivset{\odv}[switch-*=true] \odv{y}{x} }
-
-\noindent The key's default value is \default.
-
-\DescribeOption{switch-/}[false]{ true, false }
-The effect of the slash's presence can be switched with the value \val{true}. That is, the derivative is typeset with the fraction set by \key{style-frac-/} when the slash is absent and with the fraction set by \key{style-frac} when the slash is present. As an example, compare below where the option is turned on (\val{true}) and off (\val{false}),
-
-\eks{ \derivset{\odv}[switch-/=false] \odv{y}{x} ; \derivset{\odv}[switch-/=true] \odv{y}{x} }
-
-\noindent The key's default value is \default.
-
-\subsubsection*{Miscellaneous}
-\DescribeOption*{ misc-add-delims, misc-remove-delims }{ fun, var, frac }
-These two keys accepts its input as an comma-separated list of values such that
-\begin{verbatim}
- \derivset{\odv}[misc-add-delims=fun]
- \derivset{\odv}[misc-add-delims={fun,var}]
- \derivset{\odv}[misc-add-delims={fun,var,frac}]
-\end{verbatim}
-are all valid, and the same goes for \key{misc-remove-delims}. The key \key{misc-add-delims}{} is used to insert the delimiters around the key's values, while \key{misc-remove-delims}{} is used to remove the inserted delimiters. The next example shows the key \key{misc-add-delims} in action
-
-\eks{\derivset{\odv}[misc-add-delims=fun] \odv{y}{x} ; \derivset{\odv}[misc-add-delims={fun,var}] \odv{y}{x} ; \derivset{\odv}[misc-add-delims={fun,var,frac}] \odv{y}{x}}
-
-\noindent All the above applies to \key{misc-remove-delims}{} as well, except it removes the delimiters. The effect of the key \key{misc-add-delims}{} is turned off (\val{false}) locally inside a derivative. This is to ensure that the option is not applied to more than one derivative when nested as shown below
-
-\eks{\derivset{\odv}[misc-add-delims=var] \odv*{\odv{y}{x}}{x};\derivset{\odv}[misc-add-delims=fun] \odv*{\odv{y}{x}}{x};\derivset{\odv}[misc-add-delims=frac] \odv*{\odv{y}{x}}{x}}
-
-\noindent These two keys and this local behaviour are subject to change, see \cref{revis:add_remove,consid:add_remove_local} for more information.
-
-
-\subsection{Partial derivative} \label{ssec:pdv_options}
-The options in this subsection are available for the partial derivative \macro{\pdv} and variants hereof that are defined by the package and you.
-
-\subsubsection*{Style}
-\DescribeOption*{style-inf}[\cs{mathnormal}\pdf, \cs{symnormal}\uni]{ !\meta{math-font-style} }
-The font style of the infinitesimal for the chosen derivative is set by this key. The default font style is \default*. If an upright font is preferred then \cs{mathrm}\pdf{} and \cs{symup}\uni{} could be used, or if an italic font then \cs{mathnormal}\pdf{} and \cs{symit}\uni.
-
-\DescribeOption{style-frac}[\cs{frac}]{ !\meta{fraction} }
-The derivative uses the fraction set by this key whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default value is the usual fraction \cs{frac}.
-
-\DescribeOption{style-frac-/}[\cs{slashfrac}]{ !\meta{fraction} }
-The derivative uses the fraction set by this key whenever \keyval{switch-/}{false} and the slash argument is present. The key's default value is a text-styled fraction \default\footref{foot:sfrac} i.e. on the form $\derivset{\pdv}[style-frac-/=\slashfrac, switch-/=false] \pdv{f}/{x,y}$.
-
-\subsubsection*{Scaling}
-\DescribeOption*{scale-eval}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used for the point of evaluation. This scaling is used whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default value is set to scale the delimiters automatically.
-
-\DescribeOption{scale-eval-/}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used for the point of evaluation. This scaling is used whenever \keyval{switch-/}{false} and the slash argument is present. The key's default value is set to scale the delimiters automatically.
-
-\DescribeOption{scale-fun}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used around the function. The scaling is used whenever \keyval{misc-add-delims}{fun} is used. The key's default value is set to scale the delimiters automatically.
-
-\DescribeOption{scale-var}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used around the variable. The scaling is used whenever \keyval{misc-add-delims}{fun} is used. The key's default value is set to scale the delimiters automatically.
-
-\DescribeOption{scale-frac}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used for around the fraction. This scaling is used whenever \keyval{switch-/}{false}, the slash argument is absent and \keyval{misc-add-delims}{frac} is used. The key's default value is set to scale the delimiters automatically.
-
-\DescribeOption{scale-frac-/}[auto]{ auto, none, big, Big, bigg, Bigg }
-This key sets the size of the delimiters used for around the fraction. This scaling is used whenever \keyval{switch-/}{false}, the slash argument is present and \keyval{misc-add-delims}{frac} is used. The key's default value is set to scale the delimiters automatically.
-
-\subsubsection*{Delimiters}
-\DescribeOption*{delims-eval}[(~)]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to indicate the point of evaluation. These delimiters are inserted whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default left and right delimiters are a left and a right parenthesis, respectively.
-
-\DescribeOption{delims-eval-/}[(~)]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to indicate the point of evaluation. These delimiters are inserted whenever \keyval{switch-/}{false} and the slash argument is present. The key's default left and right delimiters are a left and a right parenthesis, respectively.
-
-\DescribeOption{delims-fun}[(~)]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to around the function and these are inserted whenever \keyval{misc-add-delims}{fun} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
-
-\DescribeOption{delims-var}[(~)]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to around the variable and these are inserted whenever \keyval{misc-add-delims}{var} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
-
-\DescribeOption{delims-frac}[(~)]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to around the variable- These delimiters are inserted whenever \keyval{switch-/}{false}, the slash argument is absent and \keyval{misc-add-delims}{frac} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
-
-\DescribeOption{delims-frac-/}[(~)]{ !\meta{left delimiter}\meta{right delimiter} }
-This key sets the left and right delimiters used to around the variable- These delimiters are inserted whenever \keyval{switch-/}{false}, the slash argument is present and \keyval{misc-add-delims}{frac} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
-
-\subsubsection*{Math spacing}
-The options in this subsection inserts extra horizontal math space. The below equation illustrates where the space is inserted
-\begin{equation*}
+ ,
+ \end{equation*}
+ where it has been split into three to give a better overview.
+
+ \begin{option}{sep-inf-ord}
+ \begin{values}[default = 0]
+ \meta{cs-numbers}
+ \end{values}
+ This key sets the math space that is inserted in the infinitesimal's power left to the order. It is only inserted when the order is different from \num{1}. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-inf-fun}
+ \begin{values}[default = 0]
+ \meta{cs-numbers}
+ \end{values}
+ This key sets the math space that is inserted between the infinitesimal and the function when the order \emph{is equal} to \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-ord-fun}
+ \begin{values}[default = 0]
+ \meta{cs-numbers}
+ \end{values}
+ This key sets the math space that is inserted between the infinitesimal and the function when the order \emph{is different} from \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-inf-var}
+ \begin{values}[default = 0]
+ \meta{cs-numbers}
+ \end{values}
+ This key sets the math space that is inserted between the infinitesimal and the variable. The space is only inserted when a non-blank variable is given. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-var-ord}
+ \begin{values}[default = 0]
+ \meta{cs-numbers}
+ \end{values}
+ This key sets the math space that is inserted in the variable's power left to the order. The space is only inserted when the order is different from \num{1}. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-eval-sb}
+ \begin{values}[default = 0]
+ \meta{cs-numbers}
+ \end{values}
+ This key sets the math space that is inserted in the evaluation subscript left to the point of evaluation. The space is only inserted when a non-blank subscript is given. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-eval-sp}
+ \begin{values}[default = 0]
+ \meta{cs-numbers}
+ \end{values}
+ This key sets the math space that is inserted in the evaluation superscript left to the point of evaluation. The space is only inserted when a non-blank superscript is given. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \subsubsection*{Switches}
+
+ \begin{option}*{switch-*}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ The effect of the star's presence can be switched with the value \val{true}. That is, the function is typeset next to the fraction when the star is absent and in the numerator when the star is present. As an example, compare below where the option is turned on (\val{true}) and off (\val{false}),
+
+ \begin{example}
+ \derivset{\odv}[switch-*=false] \odv{y}{x} \\
+ \derivset{\odv}[switch-*=true] \odv{y}{x}
+ \end{example}
+
+ \noindent The key's default value is \default.
+ \end{option}
+
+ \begin{option}{switch-/}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ The effect of the slash's presence can be switched with the value \val{true}. That is, the derivative is typeset with the fraction set by \key{style-frac-/} when the slash is absent and with the fraction set by \key{style-frac} when the slash is present. As an example, compare below where the option is turned on (\val{true}) and off (\val{false}),
+
+ \begin{example}
+ \derivset{\odv}[switch-/=false] \odv{y}{x} \\
+ \derivset{\odv}[switch-/=true] \odv{y}{x}
+ \end{example}
+
+ \noindent The key's default value is \default.
+ \end{option}
+
+ \subsubsection*{Miscellaneous}
+
+ \begin{option}*{misc-add-delims, misc-remove-delims}
+ \begin{values}
+ fun, var, frac
+ \end{values}
+ These two keys accepts its input as an comma-separated list of values such that
+ \begin{verbatim}
+ \derivset{\odv}[misc-add-delims=fun]
+ \derivset{\odv}[misc-add-delims={fun,var}]
+ \derivset{\odv}[misc-add-delims={fun,var,frac}]
+ \end{verbatim}
+ are all valid, and the same goes for \key{misc-remove-delims}. The key \key{misc-add-delims}{} is used to insert the delimiters around the key's values, while \key{misc-remove-delims}{} is used to remove the inserted delimiters. The next example shows the key \key{misc-add-delims} in action
+
+ \begin{example}
+ \derivset{\odv}[misc-add-delims=fun] \odv{y}{x} \\
+ \derivset{\odv}[misc-add-delims={fun,var}] \odv{y}{x} \\
+ \derivset{\odv}[misc-add-delims={fun,var,frac}] \odv{y}{x}
+ \end{example}
+
+ \noindent All the above applies to \key{misc-remove-delims}{} as well, except it removes the delimiters. The effect of the key \key{misc-add-delims}{} is turned off (\val{false}) locally inside a derivative. This is to ensure that the option is not applied to more than one derivative when nested as shown below
+
+ \begin{example}
+ \derivset{\odv}[misc-add-delims=var] \odv*{\odv{y}{x}}{x} \\
+ \derivset{\odv}[misc-add-delims=fun] \odv*{\odv{y}{x}}{x} \\
+ \derivset{\odv}[misc-add-delims=frac] \odv*{\odv{y}{x}}{x}
+ \end{example}
+
+ \noindent These two keys and this local behaviour are subject to change, see \cref{revis:add_remove,consid:add_remove_local} for more information.
+ \end{option}
+
+
+ \subsection{Partial derivative} \label{ssec:pdv_options}
+ The options in this subsection are available for the partial derivative \macro{\pdv} and variants hereof that are defined by the package and you.
+
+ \subsubsection*{Style}
+
+ \begin{option}*{style-inf}
+ \begin{values}[default = { \cs{mathnormal}\pdf, \cs{symnormal}\uni }]
+ \meta{math-font-style}
+ \end{values}
+ The font style of the infinitesimal for the chosen derivative is set by this key. The default font style is \default*. If an upright font is preferred then \cs{mathrm}\pdf{} and \cs{symup}\uni{} could be used, or if an italic font then \cs{mathnormal}\pdf{} and \cs{symit}\uni.
+ \end{option}
+
+ \begin{option}{style-frac}
+ \begin{values}[default = \cs{frac}]
+ \meta{fraction}
+ \end{values}
+ The derivative uses the fraction set by this key whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default value is the usual fraction \cs{frac}.
+ \end{option}
+
+ \begin{option}{style-frac-/}
+ \begin{values}[default = \cs{slashfrac}]
+ \meta{fraction}
+ \end{values}
+ The derivative uses the fraction set by this key whenever \keyval{switch-/}{false} and the slash argument is present. The key's default value is a text-styled fraction \default\footref{foot:sfrac} i.e. on the form $\derivset{\pdv}[style-frac-/=\slashfrac, switch-/=false] \pdv{f}/{x,y}$.
+ \end{option}
+
+ \subsubsection*{Scaling}
+
+ \begin{option}*{scale-eval}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used for the point of evaluation. This scaling is used whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \begin{option}{scale-eval-/}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used for the point of evaluation. This scaling is used whenever \keyval{switch-/}{false} and the slash argument is present. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \begin{option}{scale-fun}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used around the function. The scaling is used whenever \keyval{misc-add-delims}{fun} is used. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \begin{option}{scale-var}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used around the variable. The scaling is used whenever \keyval{misc-add-delims}{var} is used. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \begin{option}{scale-frac}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used for around the fraction. This scaling is used whenever \keyval{switch-/}{false}, the slash argument is absent and \keyval{misc-add-delims}{frac} is used. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \begin{option}{scale-frac-/}
+ \begin{values}[default = auto]
+ auto, none, big, Big, bigg, Bigg
+ \end{values}
+ This key sets the size of the delimiters used for around the fraction. This scaling is used whenever \keyval{switch-/}{false}, the slash argument is present and \keyval{misc-add-delims}{frac} is used. The key's default value is set to scale the delimiters automatically.
+ \end{option}
+
+ \subsubsection*{Delimiters}
+
+ \begin{option}*{delims-eval}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to indicate the point of evaluation. These delimiters are inserted whenever \keyval{switch-/}{false} and the slash argument is absent. The key's default left and right delimiters are a left and a right parenthesis, respectively.
+ \end{option}
+
+ \begin{option}{delims-eval-/}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to indicate the point of evaluation. These delimiters are inserted whenever \keyval{switch-/}{false} and the slash argument is present. The key's default left and right delimiters are a left and a right parenthesis, respectively.
+ \end{option}
+
+ \begin{option}{delims-fun}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to around the function and these are inserted whenever \keyval{misc-add-delims}{fun} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
+ \end{option}
+
+ \begin{option}{delims-var}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to around the variable and these are inserted whenever \keyval{misc-add-delims}{var} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
+ \end{option}
+
+ \begin{option}{delims-frac}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to around the fraction in the derivative e.g. $\derivset{\pdv}[misc-add-delims=frac] \pdv*{y}{x}$. These delimiters are inserted whenever \keyval{switch-/}{false}, the slash argument is absent and \keyval{misc-add-delims}{frac} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
+ \end{option}
+
+ \begin{option}{delims-frac-/}
+ \begin{values}[default = (~)]
+ \meta{left delimiter}\meta{right delimiter}
+ \end{values}
+ This key sets the left and right delimiters used to around the fraction in the derivative e.g. $\derivset{\pdv}[misc-add-delims=frac] \pdv*{y}/{x}$. These delimiters are inserted whenever \keyval{switch-/}{false}, the slash argument is present and \keyval{misc-add-delims}{frac} is used. The key's default left and right delimiters are a left and a right parenthesis, respectively.
+ \end{option}
+
+ \subsubsection*{Math spacing}
+ The options in this subsection inserts extra horizontal math space. The below equation illustrates where the space is inserted
+ \begin{equation*}
\frac{ \partial \ms{inf-fun} f }{ \partial \ms{inf-var} x }
\qquad
\frac{ \partial^{ \ms{inf-ord} 2 } \ms{ord-fun} f }{ \partial x \ms{var-inf} \partial y }
@@ -1060,172 +1786,282 @@
\frac{ \partial^{ 3 } f }{ \partial x^{ \ms{var-ord} 2 } \ms{ord-inf} \partial y }
\qquad
\mleft( \frac{ \partial f}{ \partial x } \mright)_{ \ms{eval-sb} (x_1,y_1)}^{ \ms{eval-sp} (x_2,y_2)}
-\end{equation*}
-where it have been split into four to give a better overview.
-
-\DescribeOption{sep-inf-ord}[0]{ !\meta{cs-number} }
-This key sets the math space that is inserted in the infinitesimal's power left to the mixed order. It is only inserted when the mixed order is different from \num{1}. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-inf-fun}[0]{ !\meta{cs-number} }
-This key sets the math space that is inserted between the infinitesimal and the function when the mixed order \emph{is equal} to \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-ord-fun}[0]{ !\meta{cs-number} }
-This key sets the math space that is inserted between the infinitesimal and the function when the mixed order \emph{is different} from \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-inf-var}[0]{ !\meta{cs-number} }
-This key sets the math space that is inserted between the infinitesimal and the following variable. The space is only inserted when a non-blank variable is given. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-var-ord}[0]{ !\meta{cs-number} }
-This key sets the math space that is inserted in a variable's power left to the order. The space is only inserted when the order is different from \num{1}. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-var-inf}[3]{ !\meta{cs-number} }
-They key sets the math space that is inserted between a variable and the following infinitesimal. The space is only inserted when the variable's order \emph{is equal} to \num{1}. It is only inserted when more than one non-blank variables are given. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-ord-inf}[3]{ !\meta{cs-number} }
-They key sets the math space that is inserted between a variable and the following infinitesimal. The space is only inserted when the variable's order \emph{is different} from \num{1}. It is only inserted when more than one non-blank variables are given. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-eval-sb}[-4]{ !\meta{cs-number} }
-This key sets the math space that is inserted in the evaluation subscript left to the point of evaluation. The space is only inserted when a non-blank subscript is given. The key's default value is \default{} \texttt{mu}.
-
-\DescribeOption{sep-eval-sp}[-4]{ !\meta{cs-number} }
-This key sets the math space that is inserted in the evaluation superscript left to the point of evaluation. The space is only inserted when a non-blank superscript is given. The key's default value is \default{} \texttt{mu}.
-
-\subsubsection*{Switches}
-\DescribeOption*{switch-*}[false]{ true, false }
-The effect of the star's presence can be switched with the value \val{true}. That is, the function is typeset next to the fraction when the star is absent and in the numerator when the star is present. As an example, compare below where the option is turned on (\val{true}) and off (\val{false}),
-
-\eks{ \derivset{\pdv}[switch-/=false] \pdv{y}{x} ; \derivset{\pdv}[switch-/=true] \pdv{y}{x} }
-
-\noindent The key's default value is \default.
-
-\DescribeOption{switch-/}[false]{ true, false }
-The effect of the slash's presence can be switched with the value \val{true}. That is, the derivative is typeset with the fraction set by \key{style-frac-/} when the slash is absent and with the fraction set by \key{style-frac} when the slash is present. As an example, compare below where the option is turned on (\val{true}) and off (\val{false}),
-
-\eks{ \derivset{\pdv}[switch-*=false] \pdv{y}{x} ; \derivset{\pdv}[switch-*=true] \pdv{y}{x} }
-
-\noindent The key's default value is \default.
-
-\subsubsection*{Miscellaneous}
-\DescribeOption*{ misc-add-delims, misc-remove-delims }{ fun, var, frac }
-These two keys accepts its input as an comma-separated list of values such that
-\begin{verbatim}
- \derivset{\pdv}[misc-add-delims=fun]
- \derivset{\pdv}[misc-add-delims={fun,var}]
- \derivset{\pdv}[misc-add-delims={fun,var,frac}]
-\end{verbatim}
-are all valid, and the same goes for \key{misc-remove-delims}. The key \key{misc-add-delims}{} is used to insert the delimiters around the key's values, while \key{misc-remove-delims}{} is used to remove the inserted delimiters. The next example shows the key \key{misc-add-delims} in action
-
-\eks{\derivset{\pdv}[misc-add-delims=fun] \pdv{y}{x} ; \derivset{\pdv}[misc-add-delims={fun,var}] \pdv{y}{x} ; \derivset{\pdv}[misc-add-delims={fun,var,frac}] \pdv{y}{x}}
-
-\noindent All the above applies to \key{misc-remove-delims}{} as well, except it removes the delimiters. The effect of the key \key{misc-add-delims}{} is turned off (\val{false}) locally inside a derivative. This is to ensure that the option is not applied to more than one derivative when nested as shown below
-
-\eks{\derivset{\pdv}[misc-add-delims=var] \pdv*{\pdv{y}{x}}{x}}
-
-\noindent These two keys and this local behaviour are subject to change, see \cref{revis:add_remove,consid:add_remove_local} for more information.
-
-\subsubsection*{Sort}
-The keys given in this subsection will be briefly described here and a more in-depth description will be given in \cref{ssec:overall_order}.
-
-\DescribeOption{sort-method}[sign, symbol, abs]{abs, sign, symbol}
-This key sets the sorting method behind the mixed order using build in algorithms. The symbolic terms in the mixed order is sorted by sign, symbolic length and absolute value by the \val{sign}, \val{symbol} and \val{abs} algorithms, respectively. The key takes its input as a comma-separated list of values, accepting up to three values e.g.
-
-\eks*{\derivset{\pdv}[sort-method=sign] \pdv[c+kn,-b+2a]{f}{x,y}; \derivset{\pdv}[sort-method={sign,symbol}] \pdv[c+kn,-b+2a]{f}{x,y}; \derivset{\pdv}[sort-method={sign,symbol,abs}] \pdv[c+kn,-b+2a]{f}{x,y}}
-
-\noindent are valid inputs. Note how the terms in the mixed order are ordered using different sorting methods. This key is further described in \cref{ssec:sort-method}. The key's default value uses all three algorithms as \default.
-
-\DescribeOption{sort-numerical}[auto]{auto, first, last}
-This key determines where the numerical term\footnote{The numerical term is the sum of all the orders that does not contain any symbols, but solely consist of numbers.\label{foot:numerical-term}} is placed in the mixed order. Using the values \val{first} and \val{last}, then the numerical term will \emph{always} be placed as the first and last term in the mixed order, respectively. While the value \val{auto} will automatically determine where to place the numerical term depending on the sign of the first symbolic term; it is placed as the first and last term if the sign is negative and positive, respectively. This is shown below
-
-\eks*{\derivset{\pdv}[sort-numerical=first] \pdv[n,2]{f}{x,y}; \derivset{\pdv}[sort-numerical=last] \pdv[-n,2]{f}{x,y}}
-
-\noindent where the value \val{auto} would have placed the numerical term opposite in both equations. The key is further described in \cref{ssec:sort-numerical}, and its default value is \default.
-
-\DescribeOption{sort-sign-reverse}[false]{true, false}
-The sorting algorithm \val{sign} separates the positive and negative terms where the former is placed first and the latter last. The value \val{true} will reverse this ordering such that the negative terms is placed first and the positive terms last. See \cref{ssec:sort-reverse} for more information.
-
-\DescribeOption{sort-symbol-reverse}[false]{true, false}
-The sorting algorithm \val{symbol} separates the terms by their symbolic length, where the terms are ordered in a descending manner according to their length. If the value \val{true} is used, then the terms will ordered in a ascending manner instead. See \cref{ssec:sort-reverse} for more information.
-
-\DescribeOption{sort-abs-reverse}[false]{true, false}
-The sorting algorithm \val{number} separates the terms by their absolute value, where the terms are ordered in a descending manner. If the value \val{true} is used, then the terms will ordered in a ascending manner instead. See \cref{ssec:sort-reverse} for more information.
-
-\subsection{All derivatives} \label{ssec:both_options}
-The options in this subsection are applied to all of the derivatives that are defined by the package and you, because some options should be consisting regardless of the derivatives. The options are accessed using \macro{\derivset}[\marg*{all},\oarg{key=value}].
-
-\DescribeOption*{scale-auto}[leftright]{ leftright, mleftmright\req }
-This package uses \cs{left} and \cs{right} to automatically scale delimiters. The value \val{mleftmright} requires the \pkg{mleftright} package, which makes this package use \cs{mleft} and \cs{mright} instead.
-
-
-\clearpage
-\section{Defining variants} \label{sec:createvariants}
-This section goes into detail with how to define variants of the ordinary and partial derivative based on the package's internal commands, as mentioned earlier. The \mypackage{} package provides a \latex2 way of defining the derivatives. Thought it is preferable to define variants of the ordinary derivative over the partial derivative, unless one needs more than one variable of differentiation and access to the mixed order.
-
-\subsection{Variants of the ordinary derivative} \label{ssec:CreateOdvVariant}
-\DescribeMacro*{\NewOdvVariant, \RenewOdvVariant, \ProvideOdvVariant, \DeclareOdvVariant}{\meta{control-sequence}, \meta{inf-d}, \oarg{key=value}}
-This family of commands are used to define a variant of the ordinary derivative with the macro name \arg{1}. Moreover, the new derivative will use \arg{2} as its infinitesimal and inherit the package's default settings given in \cref{ssec:odv_options}, but they may be overwritten with \arg{3}. The difference between them, is as follows:
-
-\begin{itemize}
- \item \macro{1} is similar to \cs{NewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has already been defined.
- \item \macro{2} is similar to \cs{RenewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has not previously been defined.
- \item \macro{3} is similar to \cs{ProvideDocumentCommand} of the \pkg{xparse} package and will define \arg{1} if it does not have an existing definition. It will not issue any errors.
- \item \macro{4} is similar to \cs{DeclareDocumentCommand} of the \pkg{xparse} package and will always define the \arg{1} with the new definition regardless of whether it already exists.
-\end{itemize}
-
-\DescribeArg*{\arg{1}}
-The first argument is the macro name of the derivative that is to be defined.
-
-\DescribeArg{\arg{2}}
-While the second argument makes the derivative \arg{1} use \arg{2} as the infinitesimal, like \enquote{d} is used as the infinitesimal in the ordinary derivative \macro{\odv}. The argument must be a \emph{single token} thought this is subject to change, see \cref{consid:infd_single_token}.
-
-\DescribeArg{\arg{3}}
-The optional argument accepts its input as a comma-separated list of \emph{key=value} pairs, which overrides the package's default options for the keys given. Leaving out this argument, then the derivative will use the package's default settings.
-
-\subsection{Variants of the partial derivative} \label{ssec:CreatePdvVariant}
-\DescribeMacro{\NewPdvVariant, \RenewPdvVariant, \ProvidePdvVariant, \DeclarePdvVariant}{\meta{control-sequence}, \meta{inf-p}, \oarg{key=value}}
-This family of commands are used to define a variant of the partial derivative with the macro name \arg{1}. Moreover, the new derivative will use \arg{2} as its infinitesimal and inherit the package's default options given in \cref{ssec:pdv_options}, but they may be overwritten with \arg{3}. The difference between them is as follows:
-
-\begin{itemize}
- \item \macro{1} is similar to \cs{NewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has already been defined.
- \item \macro{2} is similar to \cs{RenewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has not previously been defined.
- \item \macro{3} is similar to \cs{ProvideDocumentCommand} of the \pkg{xparse} package and will define \arg{1} if it does not have an existing definition. It will not issue any errors.
- \item \macro{4} is similar to \cs{DeclareDocumentCommand} of the \pkg{xparse} package and will always define the \arg{1} with the new definition regardless of whether it already exists.
-\end{itemize}
-
-\DescribeArg*{\arg{1}}
-The first argument is the macro name of the derivative that is to be defined.
-
-\DescribeArg{\arg{2}}
-While the second argument makes the derivative \arg{1} use \arg{2} as the infinitesimal, like \enquote{$\partial$} is used as the infinitesimal in the partial derivative \macro{\pdv}. The argument must be a \emph{single token} thought this is subject to change, see \cref{consid:infd_single_token}.
-
-\DescribeArg{\arg{3}}
-The optional argument accepts its input as a comma-separated list of \emph{key=value} pairs, which overrides the package's default options for the keys given. Leaving out this argument, then the derivative will use the package's default settings.
-
-
-\clearpage
-\section{The mixed order} \label{ssec:overall_order}
-
-\subsection{Sorting algorithms} \label{ssec:sort-method}
-A unique feature of this package is that the sorting method behind the mixed order may be changed using built-in algorithms and there are currently three algorithms available: \val{sign}, \val{symbol} and \val{abs} which are explained below. 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, putting the former terms first and the latter terms last in the mixed order. Using the option \keyval{sort-sign-reverse}{true}, then this 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 ordered in a descending manner according to their length. Using the option \keyval{sort-symbol-reverse}{true}, then the terms are ordered 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 according to their absolute value. Using the option \keyval{sort-abs-reverse}{true}, then the terms are ordered in an ascending manner instead.
-\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. It should be understood as that 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 order the terms within each groups according to the terms symbolic length. The mixed order is then formed by combining these two groups such that the positive terms comes first.
-
-The next subsubsection is dedicated to give some examples of how the algorithms in this package sorts the mixed order.
-
-\subsubsection{Examples}
-The examples are constructed of a partial derivative with the comma separated list of orders given by \texttt{[3a-3hh-2b, 4c+4gg+2ff, -5d-5ee]} and a close up view of the mixed order. Square brackets are used to indicate grouping of terms and the text below a group refers to the algorithm applied. Here the words positive and negative, long and short, and big and low refers to the \val{sign}, \val{symbol}, and \val{abs} algorithms, respectively. A row of square brackets represents a layer.
-
-The packages default sorting method is \keyval{sort-method}{sign,symbol,abs}, which is used below. The \val{sign} algorithm separate the positive and negative terms in the first layer. While in the second layer, the terms are separated by symbol length etc.
-\begin{equation*}
+ \end{equation*}
+ where it have been split into four to give a better overview.
+
+ \begin{option}{sep-inf-ord}
+ \begin{values}[default = 0]
+ \meta{cs-number}
+ \end{values}
+ This key sets the math space that is inserted in the infinitesimal's power left to the mixed order. It is only inserted when the mixed order is different from \num{1}. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-inf-fun}
+ \begin{values}[default = 0]
+ \meta{cs-number}
+ \end{values}
+ This key sets the math space that is inserted between the infinitesimal and the function when the mixed order \emph{is equal} to \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-ord-fun}
+ \begin{values}[default = 0]
+ \meta{cs-number}
+ \end{values}
+ This key sets the math space that is inserted between the infinitesimal and the function when the mixed order \emph{is different} from \num{1}. The space is only inserted when a non-blank function is printed \emph{in the numerator}. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-inf-var}
+ \begin{values}[default = 0]
+ \meta{cs-number}
+ \end{values}
+ This key sets the math space that is inserted between the infinitesimal and the following variable. The space is only inserted when a non-blank variable is given. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-var-ord}
+ \begin{values}[default = 0]
+ \meta{cs-number}
+ \end{values}
+ This key sets the math space that is inserted in a variable's power left to the order. The space is only inserted when the order is different from \num{1}. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-var-inf}
+ \begin{values}[default = 3]
+ \meta{cs-number}
+ \end{values}
+ They key sets the math space that is inserted between a variable and the following infinitesimal. The space is only inserted when the variable's order \emph{is equal} to \num{1}. It is only inserted when more than one non-blank variables are given. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-ord-inf}
+ \begin{values}[default = 3]
+ \meta{cs-number}
+ \end{values}
+ They key sets the math space that is inserted between a variable and the following infinitesimal. The space is only inserted when the variable's order \emph{is different} from \num{1}. It is only inserted when more than one non-blank variables are given. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-eval-sb}
+ \begin{values}[default = -4]
+ \meta{cs-number}
+ \end{values}
+ This key sets the math space that is inserted in the evaluation subscript left to the point of evaluation. The space is only inserted when a non-blank subscript is given. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \begin{option}{sep-eval-sp}
+ \begin{values}[default = -4]
+ \meta{cs-number}
+ \end{values}
+ This key sets the math space that is inserted in the evaluation superscript left to the point of evaluation. The space is only inserted when a non-blank superscript is given. The key's default value is \default{} \texttt{mu}.
+ \end{option}
+
+ \subsubsection*{Switches}
+
+ \begin{option}*{switch-*}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ The effect of the star's presence can be switched with the value \val{true}. That is, the function is typeset next to the fraction when the star is absent and in the numerator when the star is present. As an example, compare below where the option is turned on (\val{true}) and off (\val{false}),
+
+ \begin{example}
+ \derivset{\pdv}[switch-/=false] \pdv{y}{x} \\
+ \derivset{\pdv}[switch-/=true] \pdv{y}{x}
+ \end{example}
+
+ \noindent The key's default value is \default.
+ \end{option}
+
+ \begin{option}{switch-/}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ The effect of the slash's presence can be switched with the value \val{true}. That is, the derivative is typeset with the fraction set by \key{style-frac-/} when the slash is absent and with the fraction set by \key{style-frac} when the slash is present. As an example, compare below where the option is turned on (\val{true}) and off (\val{false}),
+
+ \begin{example}
+ \derivset{\pdv}[switch-/=false] \pdv{y}{x} \\
+ \derivset{\pdv}[switch-/=true] \pdv{y}{x}
+ \end{example}
+
+ \noindent The key's default value is \default.
+ \end{option}
+
+ \subsubsection*{Miscellaneous}
+
+ \begin{option}*{misc-add-delims, misc-remove-delims}
+ \begin{values}
+ fun, var, frac
+ \end{values}
+ These two keys accepts its input as an comma-separated list of values such that
+ \begin{verbatim}
+ \derivset{\pdv}[misc-add-delims=fun]
+ \derivset{\pdv}[misc-add-delims={fun,var}]
+ \derivset{\pdv}[misc-add-delims={fun,var,frac}]
+ \end{verbatim}
+ are all valid, and the same goes for \key{misc-remove-delims}. The key \key{misc-add-delims}{} is used to insert the delimiters around the key's values, while \key{misc-remove-delims}{} is used to remove the inserted delimiters. The next example shows the key \key{misc-add-delims} in action
+
+ \begin{example}
+ \derivset{\pdv}[misc-add-delims=fun] \pdv{y}{x} \\
+ \derivset{\pdv}[misc-add-delims={fun,var}] \pdv{y}{x} \\
+ \derivset{\pdv}[misc-add-delims={fun,var,frac}] \pdv{y}{x}
+ \end{example}
+
+ \noindent All the above applies to \key{misc-remove-delims}{} as well, except it removes the delimiters. The effect of the key \key{misc-add-delims}{} is turned off (\val{false}) locally inside a derivative. This is to ensure that the option is not applied to more than one derivative when nested as shown below
+
+ \begin{example}
+ \derivset{\pdv}[misc-add-delims=var] \pdv*{\pdv{y}{x}}{x}
+ \end{example}
+
+ \noindent These two keys and this local behaviour are subject to change, see \cref{revis:add_remove,consid:add_remove_local} for more information.
+ \end{option}
+
+ \subsubsection*{Sort}
+ The keys given in this subsection will be briefly described here and a more in-depth description will be given in \cref{ssec:overall_order}.
+
+ \begin{option}{sort-method}
+ \begin{values}[default = {sign, symbol, abs}]
+ abs, 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 is sorted by sign, symbolic length and absolute value by the \val{sign}, \val{symbol} and \val{abs} algorithms, respectively. The key takes its input as a comma-separated list of values, accepting up to three values e.g.
+
+ \begin{example}*
+ \derivset{\pdv}[sort-method=sign] \pdv[c+kn,-b+2a]{f}{x,y} \\
+ \derivset{\pdv}[sort-method={sign,symbol}] \pdv[c+kn,-b+2a]{f}{x,y} \\
+ \derivset{\pdv}[sort-method={sign,symbol,abs}] \pdv[c+kn,-b+2a]{f}{x,y}
+ \end{example}
+
+ \noindent are valid inputs. Note how the terms in the mixed order are ordered using different sorting methods. This key is further described in \cref{ssec:sort-method}. The key's default value uses all three algorithms as \default.
+ \end{option}
+
+ \begin{option}{sort-numerical}
+ \begin{values}[default = auto]
+ auto, first, last
+ \end{values}
+ This key determines where the numerical term\footnote{The numerical term is the sum of all the orders that does not contain any symbols, but solely consist of numbers.\label{foot:numerical-term}} is placed in the mixed order. Using the values \val{first} and \val{last}, then the numerical term will \emph{always} be placed as the first and last term in the mixed order, respectively. While the value \val{auto} will automatically determine where to place the numerical term depending on the sign of the first symbolic term; it is placed as the first and last term if the sign is negative and positive, respectively. This is shown below
+
+ \begin{example}*
+ \derivset{\pdv}[sort-numerical=first] \pdv[n,2]{f}{x,y} \\
+ \derivset{\pdv}[sort-numerical=last] \pdv[-n,2]{f}{x,y}
+ \end{example}
+
+ \noindent where the value \val{auto} would have placed the numerical term opposite in both equations. The key is further described in \cref{ssec:sort-numerical}, and its default value is \default.
+ \end{option}
+
+ \begin{option}{sort-sign-reverse}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ The sorting algorithm \val{sign} separates the positive and negative terms where the former is placed first and the latter last. The value \val{true} will reverse this ordering such that the negative terms is placed first and the positive terms last. See \cref{ssec:sort-reverse} for more information.
+ \end{option}
+
+ \begin{option}{sort-symbol-reverse}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ The sorting algorithm \val{symbol} separates the terms by their symbolic length, where the terms are ordered in a descending manner according to their length. If the value \val{true} is used, then the terms will ordered in a ascending manner instead. See \cref{ssec:sort-reverse} for more information.
+ \end{option}
+
+ \begin{option}{sort-abs-reverse}
+ \begin{values}[default = false]
+ true, false
+ \end{values}
+ The sorting algorithm \val{number} separates the terms by their absolute value, where the terms are ordered in a descending manner. If the value \val{true} is used, then the terms will ordered in a ascending manner instead. See \cref{ssec:sort-reverse} for more information.
+ \end{option}
+
+ \subsection{All derivatives} \label{ssec:both_options}
+ The options in this subsection are applied to all of the derivatives that are defined by the package and you, because some options should be consisting regardless of the derivatives. The options are accessed using \macro{\derivset}[\narg{all},\oarg{key=value}].
+
+ \begin{option}{scale-auto}
+ \begin{values}[default = leftright]
+ leftright, mleftmright\req
+ \end{values}
+ This package uses \cs{left} and \cs{right} to automatically scale delimiters. The value \val{mleftmright} requires the \pkg{mleftright} package, which makes this package use \cs{mleft} and \cs{mright} instead.
+ \end{option}
+
+
+
+ \clearpage
+ \section{Defining variants} \label{sec:createvariants}
+ This section goes into detail with how to define variants of the ordinary and partial derivative based on the package's internal commands, as mentioned earlier. The \mypackage{} package provides a \latex2 way of defining the derivatives. Thought it is preferable to define variants of the ordinary derivative over the partial derivative, unless one needs more than one variable of differentiation and access to the mixed order.
+
+ \subsection{Variants of the ordinary derivative} \label{ssec:CreateOdvVariant}
+
+ \begin{function}*{\NewOdvVariant, \RenewOdvVariant, \ProvideOdvVariant, \DeclareOdvVariant}
+ \begin{syntax}
+ \meta{control-sequence}, \meta{inf-d}, \oarg{key=value}
+ \end{syntax}
+ This family of commands are used to define a variant of the ordinary derivative with the macro name \arg{1}. Moreover, the new derivative will use \arg{2} as its infinitesimal and inherit the package's default settings given in \cref{ssec:odv_options}, but they may be overwritten with \arg{3}. The difference between them, is as follows:
+ \begin{itemize}
+ \item \macro{1} is similar to \cs{NewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has already been defined.
+ \item \macro{2} is similar to \cs{RenewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has not previously been defined.
+ \item \macro{3} is similar to \cs{ProvideDocumentCommand} of the \pkg{xparse} package and will define \arg{1} if it does not have an existing definition. It will not issue any errors.
+ \item \macro{4} is similar to \cs{DeclareDocumentCommand} of the \pkg{xparse} package and will always define the \arg{1} with the new definition regardless of whether it already exists.
+ \end{itemize}
+
+ \begin{argument}{1}
+ The first argument is the macro name of the derivative that is to be defined.
+ \end{argument}
+
+ \begin{argument}{2}
+ While the second argument makes the derivative \arg{1} use \arg{2} as the infinitesimal, like \enquote{d} is used as the infinitesimal in the ordinary derivative \macro{\odv}. The argument must be a \emph{single token} thought this is subject to change, see \cref{consid:infd_single_token}.
+ \end{argument}
+
+ \begin{argument}{3}
+ The optional argument accepts its input as a comma-separated list of \emph{key=value} pairs, which overrides the package's default options for the keys given. Leaving out this argument, then the derivative will use the package's default settings.
+ \end{argument}
+ \end{function}
+
+ \subsection{Variants of the partial derivative} \label{ssec:CreatePdvVariant}
+
+ \begin{function}*{\NewPdvVariant, \RenewPdvVariant, \ProvidePdvVariant, \DeclarePdvVariant}
+ \begin{syntax}
+ \meta{control-sequence}, \meta{inf-p}, \oarg{key=value}
+ \end{syntax}
+ This family of commands are used to define a variant of the partial derivative with the macro name \arg{1}. Moreover, the new derivative will use \arg{2} as its infinitesimal and inherit the package's default options given in \cref{ssec:pdv_options}, but they may be overwritten with \arg{3}. The difference between them is as follows:
+
+ \begin{itemize}
+ \item \macro{1} is similar to \cs{NewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has already been defined.
+ \item \macro{2} is similar to \cs{RenewDocumentCommand} of the \pkg{xparse} package and will issue an error if \arg{1} has not previously been defined.
+ \item \macro{3} is similar to \cs{ProvideDocumentCommand} of the \pkg{xparse} package and will define \arg{1} if it does not have an existing definition. It will not issue any errors.
+ \item \macro{4} is similar to \cs{DeclareDocumentCommand} of the \pkg{xparse} package and will always define the \arg{1} with the new definition regardless of whether it already exists.
+ \end{itemize}
+
+ \begin{argument}{1}
+ The first argument is the macro name of the derivative that is to be defined.
+ \end{argument}
+
+ \begin{argument}{2}
+ While the second argument makes the derivative \arg{1} use \arg{2} as the infinitesimal, like \enquote{$\partial$} is used as the infinitesimal in the partial derivative \macro{\pdv}. The argument must be a \emph{single token} thought this is subject to change, see \cref{consid:infd_single_token}.
+ \end{argument}
+
+ \begin{argument}{3}
+ The optional argument accepts its input as a comma-separated list of \emph{key=value} pairs, which overrides the package's default options for the keys given. Leaving out this argument, then the derivative will use the package's default settings.
+ \end{argument}
+ \end{function}
+
+
+
+ \clearpage
+ \section{The mixed order} \label{ssec:overall_order}
+
+ \subsection{Sorting algorithms} \label{ssec:sort-method}
+ A unique feature of this package is that the sorting method behind the mixed order may be changed using built-in algorithms and there are currently three algorithms available: \val{sign}, \val{symbol} and \val{abs} which are explained below. 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, putting the former terms first and the latter terms last in the mixed order. Using the option \keyval{sort-sign-reverse}{true}, then this 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 ordered in a descending manner according to their length. Using the option \keyval{sort-symbol-reverse}{true}, then the terms are ordered 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 according to their absolute value. Using the option \keyval{sort-abs-reverse}{true}, then the terms are ordered in an ascending manner instead.
+ \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. It should be understood as that 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 order the terms within each groups according to the terms symbolic length. The mixed order is then formed by combining these two groups such that the positive terms comes first.
+
+ The next subsubsection is dedicated to give some examples of how the algorithms in this package sorts the mixed order.
+
+ \subsubsection{Examples}
+ The examples are constructed of a partial derivative with the comma separated list of orders given by \texttt{[3a-3hh-2b, 4c+4gg+2ff, -5d-5ee]} and a close up view of the mixed order. Square brackets are used to indicate grouping of terms and the text below a group refers to the algorithm applied. Here the words positive and negative, long and short, and big and low refers to the \val{sign}, \val{symbol}, and \val{abs} algorithms, respectively. A row of square brackets represents a layer.
+
+ The packages default sorting method is \keyval{sort-method}{sign,symbol,abs}, which is used below. The \val{sign} algorithm separate the positive and negative terms in the first layer. While in the second layer, the terms are separated by symbol length etc.
+ \begin{equation*}
\derivset{\pdv}[sort-method = {sign,symbol,abs}]
\pdv[3a-3hh-2b, 4c+4gg+2ff, -5d-5ee]{f}{x,y,z}
-\end{equation*}
-\begin{equation*}
+ \end{equation*}
+ \begin{equation*}
\low{
\low{
\low{4gg}{big} +
@@ -1246,13 +2082,13 @@
\low[2,2]{2b}{low}
}{short}
}{negative}
-\end{equation*}
-as expected. Interchanging \val{sign} and \val{symbol} algorithms from the previous example i.e \keyval{sort-method}{symbol, sign, abs}, then the \val{symbol} \cal{sign} algorithms are now applied in the first and second layer, respectively. The result is shown below
-\begin{equation*}
+ \end{equation*}
+ as expected. Interchanging \val{sign} and \val{symbol} algorithms from the previous example i.e \keyval{sort-method}{symbol, sign, abs}, then the \val{symbol} \cal{sign} algorithms are now applied in the first and second layer, respectively. The result is shown below
+ \begin{equation*}
\derivset{\pdv}[sort-method = {symbol,sign,abs}]
\pdv[3a-3hh-2b, 4c+4gg+2ff, -5d-5ee]{f}{x,y,z}
-\end{equation*}
-\begin{equation*}
+ \end{equation*}
+ \begin{equation*}
\low{
\low{
\low{4gg}{big} +
@@ -1273,15 +2109,15 @@
\low[2,2]{2b}{low}
}{negative}
}{short}
-\end{equation*}
-where a clear difference is seen between the above two examples.
-
-The above two examples used 3-layer sorting methods but as mentioned earlier, the sorting method can also be constructed with one and two algorithms i.e. 1-layer and 2-layer sorting methods. A sorting method with two layers could be constructed as \keyval{sort-method}{sign,symbol} and with it, the terms are ordered by sign and then symbolic length. In this case, there is not a third layer. Instead, the terms \enquote{appear randomly} according to their absolute value as shown below
-\begin{equation*}
+ \end{equation*}
+ where a clear difference is seen between the above two examples.
+
+ The above two examples used 3-layer sorting methods but as mentioned earlier, the sorting method can also be constructed with one and two algorithms i.e. 1-layer and 2-layer sorting methods. A sorting method with two layers could be constructed as \keyval{sort-method}{sign,symbol} and with it, the terms are ordered by sign and then symbolic length. In this case, there is not a third layer. Instead, the terms \enquote{appear randomly} according to their absolute value as shown below
+ \begin{equation*}
\derivset{\pdv}[sort-method = {sign,symbol}]
\pdv[3a-3hh-2b, 4c+4gg+2ff, -5d-5ee]{f}{x,y,z}
-\end{equation*}
-\begin{equation*}
+ \end{equation*}
+ \begin{equation*}
\low{
\low{ 4gg + 2ff }{long} +
\low{ 3a + 4c }{short}
@@ -1290,34 +2126,34 @@
\low{ 3hh - 5ee }{long} -
\low{ 2b - 5d }{short}
}{negative}
-\end{equation*}
-It is seen that the first two terms came out in a descending manner according to their absolute value, while the next two terms came out in a ascending manner. Hence the choice of word: \enquote{appear randomly}. The last example shows a 1-layer sorting method given as \keyval{sort-method}{symbol} which gives the result
-\begin{equation*}
+ \end{equation*}
+ It is seen that the first two terms came out in a descending manner according to their absolute value, while the next two terms came out in a ascending manner. Hence the choice of word: \enquote{appear randomly}. The last example shows a 1-layer sorting method given as \keyval{sort-method}{symbol} which gives the result
+ \begin{equation*}
\derivset{\pdv}[sort-method = symbol]
\pdv[3a-3hh-2b, 4c+4gg+2ff, -5d-5ee]{f}{x,y,z}
-\end{equation*}
-\begin{equation*}
+ \end{equation*}
+ \begin{equation*}
\low{ - 3hh + 4gg + 2ff - 5ee }{long} +
\low{ 3a - 2b + 4c - 5d }{short}
-\end{equation*}
-where it can be see that the terms are not ordered by sign nor absolute value. A fourth sorting algorithm might be implemented in the future, see \cref{consid:sort_number} for more information.
-
-\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}. For this reason it is treated differently than the symbolic terms. Currently it is only possible to control its position in the mixed order.
-
-The numerical term may be placed either at the beginning or at the end of the mixed order with the values \val{first} and \val{last}, respectively. Thought it is also possible to have the package automatically determine where to place the term with the value \val{auto}. Compare below
-\begin{align*}
+ \end{equation*}
+ where it can be see that the terms are not ordered by sign nor absolute value. A fourth sorting algorithm might be implemented in the future, see \cref{consid:sort_number} for more information.
+
+ \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}. For this reason it is treated differently than the symbolic terms. Currently it is only possible to control its position in the mixed order.
+
+ The numerical term may be placed either at the beginning or at the end of the mixed order with the values \val{first} and \val{last}, respectively. Thought it is also possible to have the package automatically determine where to place the term with the value \val{auto}. Compare below
+ \begin{align*}
\text{\keyval{sort-numerical}{auto}:} & \quad \pdv[\beta, 2]{f}{x,y} \qquad \pdv[\beta, -2]{f}{x,y} \qquad \pdv[-\beta, 2]{f}{x,y} \qquad \pdv[-\beta, -2]{f}{x,y} \\
\text{\keyval{sort-numerical}{first}:} & \quad \derivset{\pdv}[sort-numerical = first]
\pdv[\beta, 2]{f}{x,y} \qquad \pdv[\beta, -2]{f}{x,y} \qquad \pdv[-\beta, 2]{f}{x,y} \qquad \pdv[-\beta, -2]{f}{x,y} \\
\text{\keyval{sort-numerical}{last}:} & \quad \derivset{\pdv}[sort-numerical = last]
\pdv[\beta, 2]{f}{x,y} \qquad \pdv[\beta, -2]{f}{x,y} \qquad \pdv[-\beta, 2]{f}{x,y} \qquad \pdv[-\beta, -2]{f}{x,y}
-\end{align*}
-These three options should satisfy every need, but there might come more options, see \cref{consid:sort_numerical}.
-
-\subsection{Reversing the sort algorithm} \label{ssec:sort-reverse}
-The three reverse keys serves to reverse the sorting order of the sorting algorithms. This allows for even greater flexibility over the sorting method by \enquote{doubling} the number of algorithms. 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 first and the negative terms last, but using the option \keyval{sort-sign-reverse}{true} will place the negative terms first and positive terms last. The reverse keys in action are shown below
-\begin{align*}
+ \end{align*}
+ These three options should satisfy every need, but there might come more options, see \cref{consid:sort_numerical}.
+
+ \subsection{Reversing the sort algorithm} \label{ssec:sort-reverse}
+ The three reverse keys serves to reverse the sorting order of the sorting algorithms. This allows for even greater flexibility over the sorting method by \enquote{doubling} the number of algorithms. 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 first and the negative terms last, but using the option \keyval{sort-sign-reverse}{true} will place the negative terms first and positive terms last. The reverse keys in action are shown below
+ \begin{align*}
\text{\keyval{sort-sign-reverse}{false}:} & \quad \derivset{\pdv}[sort-sign-reverse = false] \pdv[a, -b]{f}{x,y} &
\text{\keyval{sort-sign-reverse}{true}:} & \quad \derivset{\pdv}[sort-sign-reverse = true] \pdv[a, -b]{f}{x,y} \\
\text{\keyval{sort-symbol-reverse}{false}:} & \quad \derivset{\pdv}[sort-symbol-reverse = false] \pdv[ab, c]{f}{x,y} &
@@ -1324,69 +2160,124 @@
\text{\keyval{sort-symbol-reverse}{true}:} & \quad \derivset{\pdv}[sort-symbol-reverse = true] \pdv[ab, c]{f}{x,y} \\
\text{\keyval{sort-abs-reverse}{false}:} & \quad \derivset{\pdv}[sort-abs-reverse = false] \pdv[2a, b]{f}{x,y} &
\text{\keyval{sort-abs-reverse}{true}:} & \quad \derivset{\pdv}[sort-abs-reverse = true] \pdv[2a, b]{f}{x,y}
-\end{align*}
-
-
-\clearpage
-\section{Miscellaneous}
-
-\subsection{Slashfrac}\label{ssec:slashfrac}
-\DescribeMacro*{\slashfrac}{ \oarg{scale}, \marg{numerator}, \marg{denominator} }
-A text-styled fraction i.e. $\slashfrac{a}{b}$, is commonly used in text-mode. While \macro{\slashfrac}[\marg*{a},\marg*{b}] is certainly longer to write than \texttt{a/b}, which only requires three keystrokes, but for the implementation of text-styled derivatives, a macro is needed anyway.
-
-\DescribeArg{\arg{1}}
-The optional argument is the scaling parameter for the slash and takes the inputs as shown below. Leaving out \arg{1} sets the scaling parameter to \val{auto}
-
-\eks{\slashfrac[auto]{y_f}{x} ; \slashfrac[none]{y_f}{x} ; \slashfrac[big]{y_f}{x} ; \slashfrac[Big]{y_f}{x} ; \slashfrac[bigg]{y_f}{x} ; \slashfrac[Bigg]{y_f}{x}}
-
-This argument is subject to change, see \cref{consid:slashfrac_opt,consid:slashfrac_def_scale} for more information.
-
-\DescribeArg{\arg{2}}
-This argument typeset the fraction's numerator.
-
-\DescribeArg{\arg{3}}
-This argument typeset the fraction's denominator.
-
-
-\clearpage
-\section{To do}
-
-\subsection{Future implementation}
-The list describes what \emph{will be added} to the package in a later release.
-\begin{todo}
- \item Define commands that can create variants of infinitesimal like $\symup{d}$, $\partial$, $\delta$ etc. for use in integrals $\int f(x) \mathop{}\!\symup{d}x$, in differential equations $\pdv{f}{x} \mathop{}\! \symup{d}x + \pdv{f}{y}\mathop{}\! \symup{d}y$ and a shorthand notation of the partial derivative $\partial_{xx}f(x,y)$.
- \item Implement the option to turn off the sorting of the terms in the mixed order. This could be made as a \val{draft} / \val{final} option.
-\end{todo}
-
-\subsection{Future changes}
-The list describes what \emph{will be changed} in the package in a later release.
-\begin{revision}
- \item A complete rewrite of the options \key*{misc-add-delims} and \key*{misc-remove-delims} is necessary so that they have a clearer syntax. Moreover, the value \val{var} needs to work differently (and correctly) for the partial derivatives and variants hereof( pretty much useless here). \label{revis:add_remove}
-\end{revision}
-
-\subsection{Future considerations}
-The list describes what \emph{might be changed or added} to the package in a later release.
-\begin{consideration}
- \item As mentioned earlier in the documentation, I heavily consider to change the optional argument \oarg{order} to a \oarg{key=value} argument. Of course this will lead to some changes: \label{consid:order2keyval}
- \begin{itemize}
- \item I would need a way to set the order of differentiation.. I am thinking of something like a key value option; \keyval*{order}{\marg{cs-orders}}.
- \item Such an option should not be possible to be set with \macro*{\derivset} or in the definition of a new derivative (or maybe if one really needs a lot of higher order derivative).
- \end{itemize}
- \item With the above consideration, than it would only be natural to remove the mixed order and then have an option \keyval*{mixed-order}{\marg{mixed-order}}. Likewise, it should not be possible to be set with \macro*{\derivset} or in the definition of a new derivative. \label{consid:RemoveMixedOrder}
- \item Currently \macro*{\derivset}'s optional argument \oarg{key=val}, when not given, sets the derivatives options to the package default settings. This should probably be changed to the options set in the definition of the derivative. \label{consid:DerivsetOptional}
- \item It can become rather cumbersome to read a derivative with a very long function. To ease this up, I am considering to add a switch that exchange the variable and the function arguments. But this might be against the \latex{} way of using arguments, which is reason I have not done it and I would like feedback on it. \label{consid:Fun_Var_switch}
- \item Should I add a key, possible a switch, that turn on/off the local behaviour \key*{misc-add-delims} and \key*{misc-remove-delims} inside derivative? \label{consid:add_remove_local}
- \item It was mentioned in \cref{sec:createvariants}, that the second argument of \cs{\ldots Varaint} should be a single token, e.g. meaning that \macro*{\NewOdvVariant}[\marg*{\cs{myvariant}},\marg*{\cs{partial}\_\cs{mu}}] is not allowed but \macro*{\NewOdvVariant}[\marg*{\cs{myvariant}},\marg*{\marg*{\cs{partial}\_\cs{mu}}}] is. It can easily be change to accept a multi token input. \label{consid:infd_single_token}
- \item Should I add the option to \key*{sort-numerical}, so that it is treated as a symbolic term instead of a numerical term? \label{consid:sort_numerical}
- \item Should I add a sorting algorithm that order the terms according to their number (including sign)? \label{consid:sort_number}
- \item I am considering making the optional argument of \macro*{\slashfrac} into a \oarg{key=value} argument with something like \keyval*{scale}{\marg{scaling}}. \label{consid:slashfrac_opt}
- \item Should the default scaling for \macro*{\slashfrac} be \val{auto} or \val{none}? Or should it be possible to set it with something like \cs{slashfracset}\oarg{key=value}? \label{consid:slashfrac_def_scale}
-\end{consideration}
-
-\clearpage
-\addsec{Index}
-Numbers in bold refer to the page where the entry is defined.
-\printindex[option]
-\printindex[macro]
-
+ \end{align*}
+
+
+
+ \clearpage
+ \section{Miscellaneous}
+
+ \subsection{Slashfrac}\label{ssec:slashfrac}
+ \begin{function}*{\slashfrac}
+ \begin{syntax}
+ \oarg{scale}, \marg{numerator}, \marg{denominator}
+ \end{syntax}
+ A text-styled fraction i.e. $\slashfrac{a}{b}$, is commonly used in text-mode. While \macro{\slashfrac}[\narg{a},\narg{b}] is certainly longer to write than \texttt{a/b}, which only requires three keystrokes, but for the implementation of text-styled derivatives, a macro is needed anyway.
+
+ \begin{argument}{1}
+ The optional argument is the scaling parameter for the slash and takes the inputs as shown below. Leaving out \arg{1} sets the scaling parameter to \val{auto}
+ \begin{example}
+ \slashfrac[auto]{y_f}{x} \\
+ \slashfrac[none]{y_f}{x} \\
+ \slashfrac[big]{y_f}{x} \\
+ \slashfrac[Big]{y_f}{x} \\
+ \slashfrac[bigg]{y_f}{x} \\
+ \slashfrac[Bigg]{y_f}{x}
+ \end{example}
+ This argument is subject to change, see \cref{consid:slashfrac_opt,consid:slashfrac_def_scale} for more information.
+ \end{argument}
+
+ \begin{argument}{2}
+ This argument typeset the fraction's numerator.
+ \end{argument}
+
+ \begin{argument}{3}
+ This argument typeset the fraction's denominator.
+ \end{argument}
+ \end{function}
+
+
+
+ \clearpage
+ \section{To do}
+
+ Entries marked with \cmark{} will be implemented in a future release specified in the entry. Entries marked with \xmark{} will not be implemented.
+
+ \subsection{Future implementation}
+ The list describes what \emph{will be added} to the package in a later release.
+ \begin{todo}
+ \item Define commands that can create variants of infinitesimal like $\symup{d}$, $\partial$, $\delta$ etc. for use in integrals $\int f(x) \mathop{}\!\symup{d}x$, in differential equations $\pdv{f}{x} \mathop{}\! \symup{d}x + \pdv{f}{y}\mathop{}\! \symup{d}y$ and a shorthand notation of the partial derivative $\partial_{xx}f(x,y)$.
+ \item Implement the option to turn off the sorting of the terms in the mixed order. This could be made as a \val{draft} / \val{final} option.
+ \end{todo}
+
+ \subsection{Future changes}
+ The list describes what \emph{will be changed} in the package in a later release.
+ \begin{changes}
+ \item A complete rewrite of the options \key[index=false]{misc-add-delims} and \key[index=false]{misc-remove-delims} is necessary so that they have a clearer syntax. Moreover, the value \val{var} needs to work differently (and correctly) for the partial derivatives and variants hereof (pretty much useless here). \label{revis:add_remove}
+ \end{changes}
+
+ \subsection{Future considerations}
+ The list describes what \emph{might be changed or added} to the package in a later release.
+ \begin{consideration}
+ \item As mentioned earlier in the documentation, I heavily consider to change the optional argument \oarg{order} to a \oarg{key=value} argument. Of course this will lead to some changes: \label{consid:order2keyval}
+ \begin{itemize}
+ \item I would need a way to set the order of differentiation. I am thinking of something like a key value option; \keyval[index=false]{order}{\marg{cs-orders}}.
+ %
+ \item Such an option should not be possible to be set with \macro[index=false]{\derivset} or in the definition of a new derivative (or maybe if one really needs a lot of higher order derivative).
+ \end{itemize}
+ \answer{\cmark}{I truly believe this is the right way forward and is coming in the next release. More features can easily be added in a key-value style. The order argument will be replaced with a key-value argument and a order key introduced; \texttt{ord=\meta{order}}.}
+ %
+ \item With the above consideration, than it would only be natural to remove the mixed order and then have an option \keyval[index=false]{mixed-order}{\marg{mixed-order}}. Likewise, it should not be possible to be set with \macro[index=false]{\derivset} or in the definition of a new derivative. \label{consid:RemoveMixedOrder} \\
+ \answer{\cmark}{The mixed order argument will be removed due to the introduction of a key-value argument as mentioned above in the next release. The mixed order can be set with the knew key \texttt{m-ord=\meta{mixed-order}}.}
+ \item Currently \macro[index=false]{\derivset}'s optional argument \oarg{key=val}, when not given, sets the derivatives options to the package default settings. This should probably be changed to the options set in the definition of the derivative. \label{consid:DerivsetOptional} \\
+ \answer{\cmark}{I believe this would a nice change for the future, but I do not have the time to make the implementation for the next release.}
+ %
+ \item It can become rather cumbersome to read a derivative with a very long function. To ease this up, I am considering to add a switch that exchange the variable and the function arguments. But this might be against the \latex{} way of using arguments, which is the reason it have not been done and I would like feedback on it. \label{consid:Fun_Var_switch}
+ %
+ \item Should I add a key, possible a switch, that turn on/off the local behaviour \key[index=false]{misc-add-delims} and \key[index=false]{misc-remove-delims} inside derivative? \label{consid:add_remove_local}
+ %
+ \item It was mentioned in \cref{sec:createvariants}, that the second argument of \cs{\ldots Variant} should be a single token, e.g. meaning that \macro[index=false]{\NewOdvVariant}[\narg{\cs{myvariant}},\narg{\cs{partial}\_\cs{mu}}] is not allowed but \macro[index=false]{\NewOdvVariant}[\narg{\cs{myvariant}},\narg{\{\cs{partial}\_\cs{mu}\}}] is. It can easily be change to accept a multi token input. \label{consid:infd_single_token} \\
+ \answer{\cmark}{This have already been changed in this release, since it is an unnecessary constraint.}
+ %
+ \item Should I add the option to \key[index=false]{sort-numerical}, so that it is treated as a symbolic term instead of a numerical term? \label{consid:sort_numerical}
+ \\ \answer{\cmark}{Yes. Yes I should. This feature will be added in the next release.}
+ \item Should I add a sorting algorithm that order the terms according to their number (including sign)? \label{consid:sort_number}
+ \\ \answer{\cmark}{Yes. Yes I should. This feature will be added in the next release.}
+ %
+ \item I am considering making the optional argument of \macro[index=false]{\slashfrac} into a \oarg{key=value} argument with something like \keyval[index=false]{scale}{\marg{scaling}}. \label{consid:slashfrac_opt} \\
+ \answer{\cmark}{I want an key-value implementation like this in the future, but it will not be added it the next release.}
+ %
+ \item Should the default scaling for \macro[index=false]{\slashfrac} be \val{auto} or \val{none}? Or should it be possible to set it with something like \cs{slashfracset}\oarg{key=value}? \label{consid:slashfrac_def_scale} \\
+ \answer{\xmark}{The package default should be \val{auto}, but it will be possible to change it, when the key-value is implemented or \macro[index=false]{\slashfrac}.}
+ \end{consideration}
+
+
+
+ \clearpage
+ \addsec{Index}
+ Numbers in bold refer to the page where the entry is defined.
+
+ \printindex[option]
+ \printindex[macro]
+
+
+
+ \clearpage
+ \addsec{Change history}
+
+ \setlength{\marginparwidth}{75pt}
+
+ \begin{changelog}
+ \begin{change}[version = 0.9, date = 2019-07-21, beta = true]
+ \item First release of the package. The package is currently in a beta version.
+ \end{change}
+ \bigskip
+ \begin{change}[version = 0.95, date = 2019-09-18, beta = true]
+ \item Second beta release of the package.
+ \item Removed the single token restriction of the infinitesimal since it made no sense.
+ \item Fixed the documentation errors and typos.
+ \item Minor fixes to the code.
+ \end{change}
+ \end{changelog}
+
\end{document}
\ No newline at end of file
Modified: trunk/Master/texmf-dist/tex/latex/derivative/derivative.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/derivative/derivative.sty 2019-09-18 21:56:20 UTC (rev 52115)
+++ trunk/Master/texmf-dist/tex/latex/derivative/derivative.sty 2019-09-18 21:56:41 UTC (rev 52116)
@@ -16,11 +16,11 @@
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{xparse}[2018/05/09]
-\ProvidesExplPackage{derivative}{2019/07/21}{0.9}{Nice and easy derivatives}
+\ProvidesExplPackage{derivative}{2018/06/14}{1.0}{Nice and easy derivatives}
%%%%% Useful conditionals %%%%%
-\prg_new_conditional:Npnn \__if_novalue_blank:n #1 { T , F , TF }
+\prg_new_conditional:Npnn \__deriv_if_novalue:n #1 { T , F , TF }
{
\tl_if_novalue:nTF {#1}
{ \prg_return_true: }
@@ -31,11 +31,11 @@
}
}
-\prg_new_conditional:Npnn \__if_novalue_blank_or:nn #1 #2 { F, TF }
+\prg_new_conditional:Npnn \__deriv_if_novalue_and:nn #1 #2 { F, TF }
{
- \__if_novalue_blank:nTF {#1}
+ \__deriv_if_novalue:nTF {#1}
{
- \__if_novalue_blank:nTF {#2}
+ \__deriv_if_novalue:nTF {#2}
{ \prg_return_true: }
{ \prg_return_false: }
}
@@ -42,7 +42,7 @@
{ \prg_return_false: }
}
-\prg_new_conditional:Npnn \__show_order:N #1 { T, TF }
+\prg_new_conditional:Npnn \__deriv_show_order:N #1 { T, TF }
{
\quark_if_no_value:NTF #1
{ \prg_return_false: }
@@ -86,43 +86,6 @@
\cs_new:Npn \__deriv_case_end:nw #1#2#3 \q_mark #4#5 \q_stop
{ \exp_end: #1 #4 }
-%%%%% slash frac %%%%%
-
-\DeclareDocumentCommand{\slashfrac}{ o m m }
-{
- \tl_if_novalue:nTF {#1}
- { \__deriv_slashfrac_auto:nn {#2} {#3} }
- {
- \str_case:nnF {#1}
- {
- { auto } { \__deriv_slashfrac_auto:nn {#2} {#3} }
- { none } { \__deriv_slashfrac_none:nn {#2} {#3} }
- }
- { \__deriv_slashfrac_scale:nnn {#1} {#2} {#3} }
- }
-}
-% numerator , denominator
-\cs_new_protected:Npn \__deriv_slashfrac_auto:nn #1 #2
-{
- \__deriv_auto_left:n . \kern-\nulldelimiterspace
- {#1} \middle/ {#2}
- \__deriv_auto_right:n . \kern-\nulldelimiterspace
-}
-% numerator , denominator
-\cs_new_protected:Npn \__deriv_slashfrac_none:nn #1 #2
-{
- {#1} / {#2}
-}
-% scale , numerator , denominator
-\cs_new_protected:Npn \__deriv_slashfrac_scale:nnn #1 #2 #3
-{
- \cs:w #1 l \cs_end: .
- {#2}
- \cs:w #1 \cs_end: /
- {#3}
- \cs:w #1 r \cs_end: .
-}
-
%%%%% Variables for settings of odv, pdv and variants %%%%%
\cs_new_protected:Npn \__deriv_auto_left:n #1 { \left #1 }
@@ -201,7 +164,7 @@
%%%%% Key-val for odv and variants %%%%%
\cs_new:Npn \__deriv_d_define_keys:n #1
{
- \keys_define:nn { deriv-d-#1 }
+ \keys_define:nn { deriv/d/#1 }
{
style-inf .code:n = { \cs_set_eq:cN { __deriv_#1_style_inf:n } ##1 },
@@ -214,7 +177,6 @@
scale-eval .choices:nn =
{ auto, none, big, Big, bigg, Bigg }
{ \tl_set_eq:cN { l__deriv_#1_scale_eval_tl } \l_keys_choice_tl },
-
scale-eval .default:n = { auto },
scale-eval-/ .choices:nn =
@@ -285,20 +247,14 @@
misc-remove-delims .default:n = { fun, var, frac }
}
\bool_lazy_or:nnT { \sys_if_engine_luatex_p: } { \sys_if_engine_xetex_p: }
- {
- \keys_define:nn { deriv-d-#1 }
- { style-inf .default:n = { \symnormal } }
- }
+ { \keys_define:nn { deriv/d/#1 } { style-inf .default:n = { \symnormal } } }
\sys_if_engine_pdftex:T
- {
- \keys_define:nn { deriv-d-#1 }
- { style-inf .default:n = { \mathnormal } }
- }
+ { \keys_define:nn { deriv/d/#1 } { style-inf .default:n = { \mathnormal } } }
}
%%%%%% Key-val for pdv and variants %%%%%%
\cs_new:Npn \__deriv_p_define_keys:n #1
{
- \keys_define:nn { deriv-p-#1 }
+ \keys_define:nn { deriv/p/#1 }
{
style-inf .code:n = { \cs_set_eq:cN { __deriv_#1_style_inf:n } ##1 },
@@ -400,17 +356,13 @@
sort-abs-reverse .default:n = { false }
}
\bool_lazy_or:nnT { \sys_if_engine_luatex_p: } { \sys_if_engine_xetex_p: }
- {
- \keys_define:nn { deriv-p-#1 }
- { style-inf .default:n = { \symnormal } }
- }
+ { \keys_define:nn { deriv/p/#1 } { style-inf .default:n = { \symnormal } } }
\sys_if_engine_pdftex:T
- {
- \keys_define:nn { deriv-p-#1 }
- { style-inf .default:n = { \mathnormal } }
- }
+ { \keys_define:nn { deriv/p/#1 } { style-inf .default:n = { \mathnormal } } }
}
+%%%%% Setting keys %%%%%
+
\DeclareDocumentCommand{\derivset}{ m o }
{
\token_if_macro:NTF {#1}
@@ -443,7 +395,7 @@
{
\tl_if_novalue:nTF {#2}
{
- \keys_set:nn { deriv-d-#1 }
+ \keys_set:nn { deriv/d/#1 }
{
style-inf , style-frac , style-frac-/ ,
scale-eval , scale-eval-/ , scale-fun , scale-var , scale-frac , scale-frac-/ ,
@@ -453,7 +405,7 @@
misc-remove-delims
}
}
- { \keys_set:nn { deriv-d-#1 } {#2} }
+ { \keys_set:nn { deriv/d/#1 } {#2} }
}
% key=val clist
\cs_new_protected:Npn \__deriv_p_set_keys:nn #1 #2
@@ -460,7 +412,7 @@
{
\tl_if_novalue:nTF {#2}
{
- \keys_set:nn { deriv-p-#1 }
+ \keys_set:nn { deriv/p/#1 }
{
style-inf , style-frac , style-frac-/ ,
scale-eval , scale-eval-/ , scale-fun , scale-var , scale-frac , scale-frac-/ ,
@@ -471,7 +423,7 @@
misc-remove-delims
}
}
- { \keys_set:nn { deriv-p-#1 } {#2} }
+ { \keys_set:nn { deriv/p/#1 } {#2} }
}
% key=val clist
\cs_new_protected:Npn \__deriv_all_set_keys:n #1
@@ -483,49 +435,7 @@
%%%%% Declaring variants %%%%%
-\DeclareDocumentCommand{\NewOdvVariant}{ m m o }
-{
- \cs_if_exist:NTF #1
- {
- \msg_error:nnxx { deriv } { command-already-defined }
- { \token_to_str:N #1 }
- { \token_to_str:N \NewOdvVariant }
- }
- {
- \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { New } {#1} {#2}
- }
-}
-
-\DeclareDocumentCommand{\RenewOdvVariant}{ m m o }
-{
- \cs_if_exist:NTF #1
- {
- \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Renew } {#1} {#2}
- }
- {
- \msg_error:nnxx { deriv } { command-not-defined }
- { \token_to_str:N #1 }
- { \token_to_str:N \RenewOdvVariant }
- }
-}
-
-\DeclareDocumentCommand{\ProvideOdvVariant}{ m m o }
-{
- \cs_if_exist:NF #1
- {
- \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Provide } {#1} {#2}
- }
-}
-
-\DeclareDocumentCommand{\DeclareOdvVariant}{ m m o }
-{
- \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Declare } {#1} {#2}
-}
-
+% tl-dv , macro , key-value
\cs_new_protected:Npn \deriv_d_preamble:Nnn #1 #2 #3
{
\tl_set:Nx #1 { \cs_to_str:N #2 }
@@ -538,7 +448,7 @@
\__deriv_derivset:VV #1 \c_novalue_tl
\tl_if_novalue:nF {#3} { \__deriv_derivset:Vn #1 {#3} }
}
-
+% dv , new/delare/renew/provide , macro , inf
\cs_new_protected:Npn \deriv_d_define:nnnn #1 #2 #3 #4
{
\use:c { #2 DocumentCommand }{#3}{ s o m t/ m !e{\sb^} }
@@ -547,61 +457,18 @@
\exp_args:Nnc \bool_xor:nnTF {##4} { l__deriv_#1_switch_slash_bool }
{
\exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_#1_switch_star_bool }
- { \__deriv_odv_both:Nnnnnnn #4 {#1} {##2} {##3} {##5} {##6} {##7} }
- { \__deriv_odv_slash:Nnnnnnn #4 {#1} {##2} {##3} {##5} {##6} {##7} }
+ { \__deriv_odv_both:nnnnnnn {#4} {#1} {##2} {##3} {##5} {##6} {##7} }
+ { \__deriv_odv_slash:nnnnnnn {#4} {#1} {##2} {##3} {##5} {##6} {##7} }
}
{
\exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_#1_switch_star_bool }
- { \__deriv_odv_star:Nnnnnnn #4 {#1} {##2} {##3} {##5} {##6} {##7} }
- { \__deriv_odv_none:Nnnnnnn #4 {#1} {##2} {##3} {##5} {##6} {##7} }
+ { \__deriv_odv_star:nnnnnnn {#4} {#1} {##2} {##3} {##5} {##6} {##7} }
+ { \__deriv_odv_none:nnnnnnn {#4} {#1} {##2} {##3} {##5} {##6} {##7} }
}
\group_end:
}
}
-
-\DeclareDocumentCommand{\NewPdvVariant}{ m m o }
-{
- \cs_if_exist:NTF #1
- {
- \msg_error:nnxx { deriv } { command-already-defined }
- { \token_to_str:N #1 }
- { \token_to_str:N \NewPdvVariant }
- }
- {
- \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { New } {#1} {#2}
- }
-}
-
-\DeclareDocumentCommand{\RenewPdvVariant}{ m m o }
-{
- \cs_if_exist:NTF #1
- {
- \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Renew } {#1} {#2}
- }
- {
- \msg_error:nnxx { deriv } { command-already-defined }
- { \token_to_str:N #1 }
- { \token_to_str:N \RenewPdvVariant }
- }
-}
-
-\DeclareDocumentCommand{\ProvidePdvVariant}{ m m o }
-{
- \cs_if_exist:NF #1
- {
- \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Provide } {#1} {#2}
- }
-}
-
-\DeclareDocumentCommand{\DeclarePdvVariant}{ m m o }
-{
- \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
- \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Declare } {#1} {#2}
-}
-
+% tl-dv , macro , key-value
\cs_new_protected:Npn \deriv_p_preamble:Nnn #1 #2 #3
{
\tl_set:Nx #1 { \cs_to_str:N #2 }
@@ -614,7 +481,7 @@
\__deriv_derivset:VV #1 \c_novalue_tl
\tl_if_novalue:nF {#3} { \__deriv_derivset:Vn #1 {#3} }
}
-
+% dv , new/delare/renew/provide , macro , inf
\cs_new_protected:Npn \deriv_p_define:nnnn #1 #2 #3 #4
{
\use:c { #2 DocumentCommand }{#3}{ s o o m t/ m !e{\sb^} }
@@ -623,13 +490,13 @@
\exp_args:Nnc \bool_xor:nnTF {##5} { l__deriv_#1_switch_slash_bool }
{
\exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_#1_switch_star_bool }
- { \__deriv_pdv_both:Nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
- { \__deriv_pdv_slash:Nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
+ { \__deriv_pdv_both:nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
+ { \__deriv_pdv_slash:nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
}
{
\exp_args:Nnc \bool_xor:nnTF {##1} { l__deriv_#1_switch_star_bool }
- { \__deriv_pdv_star:Nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
- { \__deriv_pdv_none:Nnnnnnnn #4 {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
+ { \__deriv_pdv_star:nnnnnnnn {#4} {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
+ { \__deriv_pdv_none:nnnnnnnn {#4} {#1} {##2} {##3} {##4} {##6} {##7} {##8} }
}
\group_end:
}
@@ -637,36 +504,36 @@
% dv
\cs_new_protected:Npn \__deriv_d_variables:n #1
{
- \__deriv_new:nnnn {#1} { scale } { tl } { eval, eval_slash, fun, var, frac, frac_slash }
- \__deriv_new:nnnn {#1} { delims } { tl } { eval, eval_slash, fun, var, frac, frac_slash }
- \__deriv_new:nnnn {#1} { sep } { muskip } { inf_ord, inf_fun, ord_fun, var_ord, inf_var, eval_sb, eval_sp }
- \__deriv_new:nnnn {#1} { switch } { bool } { star, slash }
- \__deriv_new:nnnn {#1} { mics } { bool } { fun, var, frac }
+ \__deriv_new:nnnn { tl } {#1} { scale } { eval, eval_slash, fun, var, frac, frac_slash }
+ \__deriv_new:nnnn { tl } {#1} { delims } { eval, eval_slash, fun, var, frac, frac_slash }
+ \__deriv_new:nnnn { muskip } {#1} { sep } { inf_ord, inf_fun, ord_fun, var_ord, inf_var, eval_sb, eval_sp }
+ \__deriv_new:nnnn { bool } {#1} { switch } { star, slash }
+ \__deriv_new:nnnn { bool } {#1} { mics } { fun, var, frac }
}
% dv
\cs_new_protected:Npn \__deriv_p_variables:n #1
{
- \__deriv_new:nnnn {#1} { scale } { tl } { eval, eval_slash, fun, var, frac, frac_slash }
- \__deriv_new:nnnn {#1} { delims } { tl } { eval, eval_slash, fun, var, frac, frac_slash }
- \__deriv_new:nnnn {#1} { sep } { muskip } { inf_ord, inf_fun, ord_fun, inf_var, var_ord, var_inf, ord_inf, eval_sb, eval_sp }
- \__deriv_new:nnnn {#1} { switch } { bool } { star, slash }
- \__deriv_new:nnnn {#1} { sort } { clist } { method }
- \__deriv_new:nnnn {#1} { sort } { tl } { numerical }
- \__deriv_new:nnnn {#1} { sort } { bool } { sign_reverse, symbol_reverse, abs_reverse }
- \__deriv_new:nnnn {#1} { mics } { bool } { fun, var, frac }
+ \__deriv_new:nnnn { tl } {#1} { scale } { eval, eval_slash, fun, var, frac, frac_slash }
+ \__deriv_new:nnnn { tl } {#1} { delims } { eval, eval_slash, fun, var, frac, frac_slash }
+ \__deriv_new:nnnn { muskip } {#1} { sep } { inf_ord, inf_fun, ord_fun, inf_var, var_ord, var_inf, ord_inf, eval_sb, eval_sp }
+ \__deriv_new:nnnn { bool } {#1} { switch } { star, slash }
+ \__deriv_new:nnnn { clist } {#1} { sort } { method }
+ \__deriv_new:nnnn { tl } {#1} { sort } { numerical }
+ \__deriv_new:nnnn { bool } {#1} { sort } { sign_reverse, symbol_reverse, abs_reverse }
+ \__deriv_new:nnnn { bool } {#1} { mics } { fun, var, frac }
}
-% dv , sub-category , data-type , cs-var-list
+% data-type , dv , category , cs-var-list
\cs_new:Npn \__deriv_new:nnnn #1 #2 #3 #4
{
\seq_set_from_clist:Nn \l__deriv_var_seq {#4}
\seq_map_inline:Nn \l__deriv_var_seq
- { \cs:w #3_new:c \cs_end: { l__deriv_#1_#2_##1_#3 } }
+ { \cs:w #1_new:c \cs_end: { l__deriv_#2_#3_##1_#1 } }
}
%%%%% Ordinary derivative definition %%%%%
% inf , dv , order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_odv_both:Nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \__deriv_odv_both:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
\__deriv_set_order:Nn \l__deriv_d_order_tl {#3}
\__deriv_evaluation_slash:nnnn {#2} {#6} {#7}
@@ -674,15 +541,14 @@
\__deriv_fraction_slash:nn {#2}
{
\use:c { __deriv_#2_style_frac_slash:n }
- { \__deriv_d_numerator_nofun:Nn #1 {#2} }
- { \__deriv_d_denominator:Nnn #1 {#2} {#5} }
+ { \__deriv_d_numerator_nofun:nn {#1} {#2} }
+ { \__deriv_d_denominator:nnn {#1} {#2} {#5} }
}
-
\__deriv_function:nn {#2} {#4}
}
}
% inf , dv , order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_odv_star:Nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \__deriv_odv_star:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
\__deriv_set_order:Nn \l__deriv_d_order_tl {#3}
\__deriv_evaluation:nnnn {#2} {#6} {#7}
@@ -690,14 +556,14 @@
\__deriv_fraction:nn {#2}
{
\use:c { __deriv_#2_style_frac:n }
- { \__deriv_d_numerator_nofun:Nn #1 {#2} }
- { \__deriv_d_denominator:Nnn #1 {#2} {#5} }
+ { \__deriv_d_numerator_nofun:nn {#1} {#2} }
+ { \__deriv_d_denominator:nnn {#1} {#2} {#5} }
}
\__deriv_function:nn {#2} {#4}
}
}
% inf , dv , order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_odv_slash:Nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \__deriv_odv_slash:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
\__deriv_set_order:Nn \l__deriv_d_order_tl {#3}
\__deriv_evaluation_slash:nnnn {#2} {#6} {#7}
@@ -705,13 +571,13 @@
\__deriv_fraction_slash:nn {#2}
{
\use:c { __deriv_#2_style_frac_slash:n }
- { \__deriv_d_numerator_fun:Nnn #1 {#2} {#4} }
- { \__deriv_d_denominator:Nnn #1 {#2} {#5} }
+ { \__deriv_d_numerator_fun:nnn {#1} {#2} {#4} }
+ { \__deriv_d_denominator:nnn {#1} {#2} {#5} }
}
}
}
% inf , dv , order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_odv_none:Nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \__deriv_odv_none:nnnnnnn #1 #2 #3 #4 #5 #6 #7
{
\__deriv_set_order:Nn \l__deriv_d_order_tl {#3}
\__deriv_evaluation:nnnn {#2} {#6} {#7}
@@ -719,42 +585,42 @@
\__deriv_fraction:nn {#2}
{
\use:c { __deriv_#2_style_frac:n }
- { \__deriv_d_numerator_fun:Nnn #1 {#2} {#4} }
- { \__deriv_d_denominator:Nnn #1 {#2} {#5} }
+ { \__deriv_d_numerator_fun:nnn {#1} {#2} {#4} }
+ { \__deriv_d_denominator:nnn {#1} {#2} {#5} }
}
}
}
% inf , dv , function
-\cs_new_protected:Npn \__deriv_d_numerator_fun:Nnn #1 #2 #3
+\cs_new_protected:Npn \__deriv_d_numerator_fun:nnn #1 #2 #3
{
- \__deriv_insert_inf:Nn #1 {#2}
+ \__deriv_insert_inf:nn {#1} {#2}
\__deriv_insert_ord:Nnn \l__deriv_d_order_tl {#2} { inf_ord }
\__deriv_insert_fun:Nnn \l__deriv_d_order_tl {#2} {#3}
}
% inf , dv
-\cs_new_protected:Npn \__deriv_d_numerator_nofun:Nn #1 #2
+\cs_new_protected:Npn \__deriv_d_numerator_nofun:nn #1 #2
{
- \__deriv_insert_inf:Nn #1 {#2}
+ \__deriv_insert_inf:nn {#1} {#2}
\__deriv_insert_ord:Nnn \l__deriv_d_order_tl {#2} { inf_ord }
}
% inf , dv , variable
-\cs_new_protected:Npn \__deriv_d_denominator:Nnn #1 #2 #3
+\cs_new_protected:Npn \__deriv_d_denominator:nnn #1 #2 #3
{
- \__deriv_insert_inf:Nn #1 {#2}
+ \__deriv_insert_inf:nn {#1} {#2}
\__deriv_insert_var_ord:Nnn \l__deriv_d_order_tl {#2} {#3}
}
%%%%% Partial derivative definition %%%%%
% inf , dv , order , mixed order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_pdv_both:Nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
+\cs_new_protected:Npn \__deriv_pdv_both:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \__deriv_preparation:NNNnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl #1 {#2} {#3} {#4} {#6}
+ \__deriv_preparation:NNnnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl {#1} {#2} {#3} {#4} {#6}
\__deriv_evaluation_slash:nnnn {#2} {#7} {#8}
{
\__deriv_fraction_slash:nn {#2}
{
\use:c { __deriv_#2_style_frac_slash:n }
- { \__deriv_p_numerator_nofun:Nn #1 {#2} }
+ { \__deriv_p_numerator_nofun:nn {#1} {#2} }
{ \__deriv_p_denominator:n {#2} }
}
\__deriv_function:nn {#2} {#5}
@@ -761,15 +627,15 @@
}
}
% inf , dv , order , mixed order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_pdv_star:Nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
+\cs_new_protected:Npn \__deriv_pdv_star:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \__deriv_preparation:NNNnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl #1 {#2} {#3} {#4} {#6}
+ \__deriv_preparation:NNnnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl {#1} {#2} {#3} {#4} {#6}
\__deriv_evaluation:nnnn {#2} {#7} {#8}
{
\__deriv_fraction:nn {#2}
{
\use:c { __deriv_#2_style_frac:n }
- { \__deriv_p_numerator_nofun:Nn #1 {#2} }
+ { \__deriv_p_numerator_nofun:nn {#1} {#2} }
{ \__deriv_p_denominator:n {#2} }
}
\__deriv_function:nn {#2} {#5}
@@ -776,43 +642,43 @@
}
}
% inf , dv , order , mixed order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_pdv_slash:Nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
+\cs_new_protected:Npn \__deriv_pdv_slash:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \__deriv_preparation:NNNnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl #1 {#2} {#3} {#4} {#6}
+ \__deriv_preparation:NNnnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl {#1} {#2} {#3} {#4} {#6}
\__deriv_evaluation_slash:nnnn {#2} {#7} {#8}
{
\__deriv_fraction_slash:nn {#2}
{
\use:c { __deriv_#2_style_frac_slash:n }
- { \__deriv_p_numerator_fun:Nnn #1 {#2} {#5} }
+ { \__deriv_p_numerator_fun:nnn {#1} {#2} {#5} }
{ \__deriv_p_denominator:n {#2} }
}
}
}
% inf , dv , order , mixed order , function , variable , sb-point , sp-point
-\cs_new_protected:Npn \__deriv_pdv_none:Nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
+\cs_new_protected:Npn \__deriv_pdv_none:nnnnnnnn #1 #2 #3 #4 #5 #6 #7 #8
{
- \__deriv_preparation:NNNnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl #1 {#2} {#3} {#4} {#6}
+ \__deriv_preparation:NNnnnnn \l__deriv_p_mo_tl \l__deriv_p_denom_tl {#1} {#2} {#3} {#4} {#6}
\__deriv_evaluation:nnnn {#2} {#7} {#8}
{
\__deriv_fraction:nn {#2}
{
\use:c { __deriv_#2_style_frac:n }
- { \__deriv_p_numerator_fun:Nnn #1 {#2} {#5} }
+ { \__deriv_p_numerator_fun:nnn {#1} {#2} {#5} }
{ \__deriv_p_denominator:n {#2} }
}
}
}% inf , dv , function
-\cs_new_protected:Npn \__deriv_p_numerator_fun:Nnn #1 #2 #3
+\cs_new_protected:Npn \__deriv_p_numerator_fun:nnn #1 #2 #3
{
- \__deriv_insert_inf:Nn #1 {#2}
+ \__deriv_insert_inf:nn {#1} {#2}
\__deriv_insert_ord:Nnn \l__deriv_p_mo_tl {#2} { inf_ord }
\__deriv_insert_fun:Nnn \l__deriv_p_mo_tl {#2} {#3}
}
% inf , dv
-\cs_new_protected:Npn \__deriv_p_numerator_nofun:Nn #1 #2
+\cs_new_protected:Npn \__deriv_p_numerator_nofun:nn #1 #2
{
- \__deriv_insert_inf:Nn #1 {#2}
+ \__deriv_insert_inf:nn {#1} {#2}
\__deriv_insert_ord:Nnn \l__deriv_p_mo_tl {#2} { inf_ord }
}
% dv
@@ -821,7 +687,7 @@
\tl_use:N \l__deriv_p_denom_tl %{ \__deriv_insert_mskip:nn {#1} { var_inf } }
}
% mixed-order-tl , denom-seq , inf , dv , order , mixed order , variable
-\cs_new_protected:Npn \__deriv_preparation:NNNnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \__deriv_preparation:NNnnnnn #1 #2 #3 #4 #5 #6 #7
{
\seq_clear:N #2
\seq_set_from_clist:Nn \l__deriv_p_var_seq {#7}
@@ -835,7 +701,7 @@
}
{ \tl_set:Nn #1 {#6} }
- \__deriv_p_build_denom:NNNNn \l__deriv_p_var_seq \l__deriv_p_order_seq #2 #3 {#4}
+ \__deriv_p_build_denom:NNNnn \l__deriv_p_var_seq \l__deriv_p_order_seq #2 {#3} {#4}
}
\cs_new_protected:Npn \__deriv_adjust_mo_seq:NNN #1 #2 #3
@@ -852,7 +718,7 @@
}
}
% \l__deriv_p_var_seq \l__deriv_p_order_seq, denom-tl , inf , dv
-\cs_new_protected:Npn \__deriv_p_build_denom:NNNNn #1 #2 #3 #4 #5
+\cs_new_protected:Npn \__deriv_p_build_denom:NNNnn #1 #2 #3 #4 #5
{
\int_zero:N \l__deriv_tmpa_int
\seq_map_inline:Nn #1
@@ -863,7 +729,7 @@
{
\tl_put_right:Nx #3
{
- \__deriv_insert_inf:Nn #4 {#5}
+ \__deriv_insert_inf:nn {#4} {#5}
\int_compare:nNnTF { \l__deriv_tmpa_int } = { \seq_count:N #1 }
{ \__deriv_insert_var_ord:Nnn \l__deriv_p_tmpa_tl {#5} {##1} }
{ \__deriv_insert_var_ord_sep:Nnn \l__deriv_p_tmpa_tl {#5} {##1} }
@@ -873,12 +739,11 @@
}
%%%%% And the rest of the code %%%%%
% inf , dv
-\cs_new:Npn \__deriv_insert_inf:Nn #1 #2
+\cs_new:Npn \__deriv_insert_inf:nn #1 #2
{
\exp_not:n
{
- \use:c { __deriv_#2_style_inf:n }
- { \tl_use:N #1 }
+ \use:c { __deriv_#2_style_inf:n } {#1}
}
}
% dv , function
@@ -920,7 +785,7 @@
% order , dv , name
\cs_new:Npn \__deriv_insert_ord:Nnn #1 #2 #3
{
- \__show_order:NT #1
+ \__deriv_show_order:NT #1
{
\sp
{
@@ -932,7 +797,7 @@
% order , dv , name
\cs_new:Npn \__deriv_insert_ord:Nn #1 #2
{
- \__show_order:NTF #1
+ \__deriv_show_order:NTF #1
{
\sp
{
@@ -1003,23 +868,23 @@
% dv , sub , sup , code-for-fraction
\cs_new:Npn \__deriv_evaluation:nnnn #1 #2 #3 #4
{
- \__if_novalue_blank_or:nnTF {#2} {#3}
+ \__deriv_if_novalue_and:nnTF {#2} {#3}
{ #4 }
{
\__deriv_add_delims:nnn {#1} { eval } {#4}
- \__if_novalue_blank:nF {#2} { \sb{ \__deriv_insert_mskip:nn {#1} { eval_sb } #2 } }
- \__if_novalue_blank:nF {#3} { \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 } }
+ \__deriv_if_novalue:nF {#2} { \sb{ \__deriv_insert_mskip:nn {#1} { eval_sb } #2 } }
+ \__deriv_if_novalue:nF {#3} { \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 } }
}
}
% dv , sub , sup , code-for-fraction
\cs_new:Npn \__deriv_evaluation_slash:nnnn #1 #2 #3 #4
{
- \__if_novalue_blank_or:nnTF {#2} {#3}
+ \__deriv_if_novalue_and:nnTF {#2} {#3}
{ #4 }
{
\__deriv_add_delims:nnn {#1} { eval_slash } {#4}
- \__if_novalue_blank:nF {#2} { \sb{ \__deriv_insert_mskip:nn {#1} { eval_sb } #2 } }
- \__if_novalue_blank:nF {#3} { \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 } }
+ \__deriv_if_novalue:nF {#2} { \sb{ \__deriv_insert_mskip:nn {#1} { eval_sb } #2 } }
+ \__deriv_if_novalue:nF {#3} { \sp{ \__deriv_insert_mskip:nn {#1} { eval_sp } #3 } }
}
}
% dv , name , value
@@ -1208,12 +1073,12 @@
{
\__deriv_case:nF
{
- { \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpb_tl - && ! \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpa_tl - } { \__deriv_sort_reverse:nnn {#1} { sign } { same } }
- { \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpa_tl - && ! \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpb_tl - } { \__deriv_sort_reverse:nnn {#1} { sign } { swapped } }
+ { \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpb_tl - && ! \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpa_tl - } { \__deriv_sort_reverse:nnn {#1} { sign } { same } }
+ { \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpa_tl - && ! \tl_if_head_eq_charcode_p:VN \l__deriv_num_tmpb_tl - } { \__deriv_sort_reverse:nnn {#1} { sign } { swapped } }
}
{
\int_compare:nNnTF { \l__deriv_sort_counter_int } = { \l__deriv_sort_max_int }
- { \sort_return_same: }
+ { \sort_return_same: }
{ \__deriv_sort_method:n {#1} }
}
}
@@ -1227,7 +1092,7 @@
}
{
\int_compare:nNnTF { \l__deriv_sort_counter_int } = { \l__deriv_sort_max_int }
- { \sort_return_same: }
+ { \sort_return_same: }
{ \__deriv_sort_method:n {#1} }
}
}
@@ -1241,7 +1106,7 @@
}
{
\int_compare:nNnTF { \l__deriv_sort_counter_int } = { \l__deriv_sort_max_int }
- { \sort_return_same: }
+ { \sort_return_same: }
{ \__deriv_sort_method:n {#1} }
}
}
@@ -1279,6 +1144,131 @@
\tl_if_empty:NT #1 { \tl_set:Nn #1 { 0 } }
}
+%%%%% Declaring Variant %%%%%
+
+\DeclareDocumentCommand{\NewOdvVariant}{ m m o }
+{
+ \cs_if_exist:NTF #1
+ {
+ \msg_error:nnxx { deriv } { command-already-defined }
+ { \token_to_str:N #1 }
+ { \token_to_str:N \NewOdvVariant }
+ }
+ {
+ \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { New } {#1} {#2}
+ }
+}
+
+\DeclareDocumentCommand{\RenewOdvVariant}{ m m o }
+{
+ \cs_if_exist:NTF #1
+ {
+ \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Renew } {#1} {#2}
+ }
+ {
+ \msg_error:nnxx { deriv } { command-not-defined }
+ { \token_to_str:N #1 }
+ { \token_to_str:N \RenewOdvVariant }
+ }
+}
+
+\DeclareDocumentCommand{\ProvideOdvVariant}{ m m o }
+{
+ \cs_if_exist:NF #1
+ {
+ \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Provide } {#1} {#2}
+ }
+}
+
+\DeclareDocumentCommand{\DeclareOdvVariant}{ m m o }
+{
+ \deriv_d_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_d_define:Vnnn \l__deriv_dv_tmp_tl { Declare } {#1} {#2}
+}
+
+\DeclareDocumentCommand{\NewPdvVariant}{ m m o }
+{
+ \cs_if_exist:NTF #1
+ {
+ \msg_error:nnxx { deriv } { command-already-defined }
+ { \token_to_str:N #1 }
+ { \token_to_str:N \NewPdvVariant }
+ }
+ {
+ \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { New } {#1} {#2}
+ }
+}
+
+\DeclareDocumentCommand{\RenewPdvVariant}{ m m o }
+{
+ \cs_if_exist:NTF #1
+ {
+ \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Renew } {#1} {#2}
+ }
+ {
+ \msg_error:nnxx { deriv } { command-already-defined }
+ { \token_to_str:N #1 }
+ { \token_to_str:N \RenewPdvVariant }
+ }
+}
+
+\DeclareDocumentCommand{\ProvidePdvVariant}{ m m o }
+{
+ \cs_if_exist:NF #1
+ {
+ \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Provide } {#1} {#2}
+ }
+}
+
+\DeclareDocumentCommand{\DeclarePdvVariant}{ m m o }
+{
+ \deriv_p_preamble:Nnn \l__deriv_dv_tmp_tl {#1} {#3}
+ \deriv_p_define:Vnnn \l__deriv_dv_tmp_tl { Declare } {#1} {#2}
+}
+
+%%%%% slash frac %%%%%
+
+\DeclareDocumentCommand{\slashfrac}{ o m m }
+{
+ \tl_if_novalue:nTF {#1}
+ { \__deriv_slashfrac_auto:nn {#2} {#3} }
+ {
+ \str_case:nnF {#1}
+ {
+ { auto } { \__deriv_slashfrac_auto:nn {#2} {#3} }
+ { none } { \__deriv_slashfrac_none:nn {#2} {#3} }
+ }
+ { \__deriv_slashfrac_scale:nnn {#1} {#2} {#3} }
+ }
+}
+% numerator , denominator
+\cs_new_protected:Npn \__deriv_slashfrac_auto:nn #1 #2
+{
+ \__deriv_auto_left:n . \kern-\nulldelimiterspace
+ {#1} \middle/ {#2}
+ \__deriv_auto_right:n . \kern-\nulldelimiterspace
+}
+% numerator , denominator
+\cs_new_protected:Npn \__deriv_slashfrac_none:nn #1 #2
+{
+ {#1} / {#2}
+}
+% scale , numerator , denominator
+\cs_new_protected:Npn \__deriv_slashfrac_scale:nnn #1 #2 #3
+{
+ \cs:w #1 l \cs_end: .
+ {#2}
+ \cs:w #1 \cs_end: /
+ {#3}
+ \cs:w #1 r \cs_end: .
+}
+
%%%%% Generate variants %%%%%
\cs_generate_variant:Nn \tl_if_head_eq_charcode_p:nN { V }
@@ -1332,6 +1322,6 @@
\DeclareOdvVariant{\jdv}{\partial}[misc-add-delims = {fun, var}]
\DeclarePdvVariant{\pdv}{\partial}[sep-inf-ord=1, sep-ord-fun=-2]
}
-%\derivset{all}
+\derivset{all}
\endinput
More information about the tex-live-commits
mailing list