summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty')
-rw-r--r--Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty152
1 files changed, 73 insertions, 79 deletions
diff --git a/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty b/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty
index bb18b85d6fa..47dd6b869a7 100644
--- a/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty
+++ b/Master/texmf-dist/tex/latex/diffcoeff/diffcoeff.sty
@@ -5,11 +5,11 @@
% Free Software Foundation; either version 2 of the License, or (at your
% option) any later version.
%
-% Andrew Parsloe aparsloe@clear.net.nz
+% Andrew Parsloe ajparsloe@gmail.com
%
\RequirePackage{expl3}
\RequirePackage{xparse}
-\ProvidesExplPackage{diffcoeff} {2016/06/27} {1.0}
+\ProvidesExplPackage{diffcoeff} {2018/10/25} {1.1}
{Write differential coefficients easily.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -26,7 +26,7 @@
\tl_new:N \g_diffco_p_ldelim_tl
\tl_new:N \g_diffco_p_rdelim_tl
-\tl_new:N \l__diffco_entiand_tl
+\tl_new:N \l__diffco_rentiand_tl
\tl_new:N \l__diffco_phantom_tl
\tl_new:N \g_diffco_dop_tl
\tl_new:N \l__diffco_denom_tl
@@ -106,15 +106,19 @@
d-nudge,p-nudge,sep,d-sep,p-sep }
}
}
-
+
% now set the defaults
\diffset
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Derivatives
-% Ordinary differential coefficient. #1 is the order; #2 the
-% differentiand; #3 the variable of differentiation; #4 the
-% point of evaluation.
+
+% Ordinary differential coefficient
+
+% #1 = the order
+% #2 = differentiand
+% #3 = the variable of differentiation
+% #4 = point of evaluation
+
\NewDocumentCommand \diff{ s o m t/ m g }
{
\group_begin:
@@ -136,8 +140,8 @@
{ \tl_set:Nn \l__diffco_denom_tl { #5 } }
}
-% position of differentiand: appended (star) or numerator (no star);
-% slash or fraction?
+ % position of differentiand: appended (star) or in numerator (no star);
+ % slash or fraction?
\IfBooleanTF { #1 }
{ % differentiand follows diff coeff
\__diffco_phantom:n { #3 }
@@ -148,11 +152,11 @@
(\g_diffco_dop_tl \l__diffco_order_tl
/
\g_diffco_dop_tl \l__diffco_denom_tl )
- \l__diffco_entiand_tl
+ \l__diffco_rentiand_tl
}
{ % frac
\frac { \g_diffco_dop_tl \l__diffco_order_tl \l__diffco_phantom_tl }
- { \g_diffco_dop_tl \l__diffco_denom_tl } \l__diffco_entiand_tl
+ { \g_diffco_dop_tl \l__diffco_denom_tl } \l__diffco_rentiand_tl
}
}
}
@@ -188,7 +192,7 @@
}
\group_end:
}
-
+
\NewDocumentCommand \Diff { o m m g }
{
\group_begin:
@@ -236,38 +240,33 @@
{
\bool_if:nTF
{
- \tl_if_head_eq_meaning_p:nN { #1 } \hfill ||
- \tl_if_head_eq_meaning_p:nN { #1 } \hfil
+ \tl_if_head_eq_meaning_p:nN { #1 } \hfill ||
+ \tl_if_head_eq_meaning_p:nN { #1 } \hfil
}
+ { \l__diffco_phantom_aux:nn #1\q_stop }
{
- \l__diffco_phantom_aux:nn #1\q_stop
- }
- {
- \bool_if:nTF
- {
- \tl_if_head_eq_meaning_p:nN { #1 } \hspace ||
- \tl_if_head_eq_meaning_p:nN { #1 } \hphantom
- }
- {
- \l__diffco_phantom_aux:nnn #1\q_stop
- }
- {
- \tl_set:Nn \l__diffco_entiand_tl { #1 }
- }
+ \bool_if:nTF
+ {
+ \tl_if_head_eq_meaning_p:nN { #1 } \hspace ||
+ \tl_if_head_eq_meaning_p:nN { #1 } \hphantom
+ }
+ { \l__diffco_phantom_aux:nnn #1\q_stop }
+ { \tl_set:Nn \l__diffco_rentiand_tl { #1 } }
}
}
\cs_new:Npn \l__diffco_phantom_aux:nn #1#2\q_stop
{
\tl_set:Nn \l__diffco_phantom_tl { #1 }
- \tl_set:Nn \l__diffco_entiand_tl { #2 }
+ \tl_set:Nn \l__diffco_rentiand_tl { #2 }
}
\cs_new:Npn \l__diffco_phantom_aux:nnn #1#2#3\q_stop
{
\tl_set:Nn \l__diffco_phantom_tl { #1 { #2 } }
- \tl_set:Nn \l__diffco_entiand_tl { #3 }
+ \tl_set:Nn \l__diffco_rentiand_tl { #3 }
}
+
%%%%%%%%%%%%%%%%%%%%
% Partial differential coefficient.
% #1 (star) = append differentiand boolean
@@ -305,15 +304,15 @@
{
\IfBooleanTF { #5 }
{ % slash (therefore no phantom)
- ( \partial \__diffco_omit_order_if_i:N
- \l__diffco_order_tl
- /
- \l__diffco_denom_tl ) \l__diffco_entiand_tl
+ ( \partial \__diffco_omit_order_if_i:N
+ \l__diffco_order_tl
+ /
+ \l__diffco_denom_tl ) \l__diffco_rentiand_tl
}
{ % frac
- \frac { \partial \__diffco_omit_order_if_i:N
- \l__diffco_order_tl \l__diffco_phantom_tl }
- { \l__diffco_denom_tl } \l__diffco_entiand_tl
+ \frac { \partial \__diffco_omit_order_if_i:N
+ \l__diffco_order_tl \l__diffco_phantom_tl }
+ { \l__diffco_denom_tl } \l__diffco_rentiand_tl
}
}
}
@@ -326,17 +325,15 @@
/ \l__diffco_denom_tl
}
{
- \frac { \partial
- \__diffco_omit_order_if_i:N \l__diffco_order_tl
- #4 } { \l__diffco_denom_tl }
+ \frac { \partial
+ \__diffco_omit_order_if_i:N \l__diffco_order_tl
+ #4 } { \l__diffco_denom_tl }
}
}
}
\IfNoValueTF { #7 }
- {
- \l__diffco_coeff_tl
- }
+ { \l__diffco_coeff_tl }
{
\tl_if_empty:nTF { #7 }
{
@@ -465,29 +462,27 @@
\int_set:Nn #2 { \c_one }
}
{
- \tl_case:NnF #1
- {
- + { \int_set_eq:NN #2 \c_zero }
- - { \int_set_eq:NN #2 \c_zero }
- ( {
- \msg_error:nnxx { diffcoeff } { unknown_token }
- { \l__diffco_order_spec_tl } { parentheses }
- }
- ^ {
- \msg_error:nnxx { diffcoeff } { unknown_token }
- { \l__diffco_order_spec_tl } { superscript }
- }
- }
- {
- \token_if_math_subscript:NTF #1
- {
- \msg_error:nnxx { diffcoeff } { unknown_token }
- { \l__diffco_order_spec_tl } { subscript }
+ \tl_case:NnF #1
+ {
+ + { \int_set_eq:NN #2 \c_zero }
+ - { \int_set_eq:NN #2 \c_zero }
+ ( {
+ \msg_error:nnxx { diffcoeff } { unknown_token }
+ { \l__diffco_order_spec_tl } { parentheses }
+ }
+ ^ {
+ \msg_error:nnxx { diffcoeff } { unknown_token }
+ { \l__diffco_order_spec_tl } { superscript }
+ }
+ }
+ {
+ \token_if_math_subscript:NTF #1
+ {
+ \msg_error:nnxx { diffcoeff } { unknown_token }
+ { \l__diffco_order_spec_tl } { subscript }
+ }
+ { \int_set_eq:NN #2 \c_two } % var
}
- { % var
- \int_set_eq:NN #2 \c_two
- }
- }
}
}
@@ -505,10 +500,9 @@
{
{ \c_zero } % tok = s
{
- \tl_if_eq:NNTF \l__diffco_curr_term_tl \l__diffco_curr_tok_tl
- { \tl_set:Nn \l__diffco_curr_term_tl { + } }
- { \tl_set:Nn \l__diffco_curr_term_tl { - } }
- % \int_set:Nn #1 { \c_zero }
+ \tl_if_eq:NNTF \l__diffco_curr_term_tl \l__diffco_curr_tok_tl
+ { \tl_set:Nn \l__diffco_curr_term_tl { + } }
+ { \tl_set:Nn \l__diffco_curr_term_tl { - } }
}
{ \c_one } % tok = d
{ \__diffco_term_append:NN #1#2 }
@@ -550,6 +544,7 @@
}
{ \c_one } % tok = d
{
+ \__diffco_term_var_append:NN #1 \c_two
\msg_error:nnx { diffcoeff } { variable_digit_sequence }
{ \l__diffco_order_spec_tl }
}
@@ -692,20 +687,19 @@
}
%%%%%%%%%%%
% messages
-\cs_gset:Npn \msg_error_text:n #1
- { Unimplemented~in~#1.sty: }
-\cs_gset:Npn \msg_info_text:n #1
+\tl_gset:Nn \g__diffcoeff_info_text:
{ Use~the~order-override~option~to~specify~the~overall~order~of~
- differentiation~(or~use~diffcoeffx.sty). }
+ differentiation. }
\msg_new:nnnn { diffcoeff } { unknown_token }
- { \msg_error_text:n { diffcoeff }~#2~in~the~order~specification~#1~
+ { Unimplemented~in~diffcoeff.sty:~#2~in~the~order~specification~#1~
\msg_line_context:. }
- { \msg_info_text:n { diffcoeff } }
+ { \g__diffcoeff_info_text: }
\msg_new:nnnn { diffcoeff } { variable_digit_sequence }
- { \msg_error_text:n { diffcoeff }~a~digit~follows~a~variable~in~the~order~
+ { Unimplemented~in~diffcoeff.sty:~a~digit~follows~a~variable~in~the~order~
specification~#1~\msg_line_context:. }
- { \msg_info_text:n { diffcoeff } }
+ { \g__diffcoeff_info_text: }
- \ No newline at end of file
+%% version history
+% 1.1 Fix message handling mess; avoids conflict with mhchem.sty \ No newline at end of file