texlive[49571] Master/texmfdist: diffcoeff (1jan19)
commits+karl at tug.org
commits+karl at tug.org
Tue Jan 1 23:50:45 CET 2019
Revision: 49571
http://tug.org/svn/texlive?view=revision&revision=49571
Author: karl
Date: 20190101 23:50:44 +0100 (Tue, 01 Jan 2019)
Log Message:

diffcoeff (1jan19)
Modified Paths:

trunk/Master/texmfdist/doc/latex/diffcoeff/README.txt
trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff.pdf
trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff.tex
trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeffdoc.def
trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff.sty
Modified: trunk/Master/texmfdist/doc/latex/diffcoeff/README.txt
===================================================================
 trunk/Master/texmfdist/doc/latex/diffcoeff/README.txt 20190101 22:50:26 UTC (rev 49570)
+++ trunk/Master/texmfdist/doc/latex/diffcoeff/README.txt 20190101 22:50:44 UTC (rev 49571)
@@ 9,16 +9,15 @@
version. The latest version of this license is in
http://www.latexproject.org/lppl.txt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This is version 2.1 of diffcoeff.sty, and associated files,
+This is version 3 of diffcoeff.sty, and associated files,
and requires the LaTeX3 bundles l3kernel and l3packages.
Version 2.1 is identical with version 2 but renumbered to
get around some difficulties when uploading the package.
Version 2 is built on xtemplate (in l3packages). As a result,
the \diffset command of version 1 is now functionless and has
been superseded by the more versatile \diffdef command.
+Version 3 adds a command for writing differentials like dx
+(in integralsf for instance) in the same form (mathitalic
+or upright) as for derivatives. Some simple spacing commands
+are also added.
Manifest
%%%%%%%%
Modified: trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff.tex
===================================================================
 trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff.tex 20190101 22:50:26 UTC (rev 49570)
+++ trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff.tex 20190101 22:50:44 UTC (rev 49571)
@@ 1,4 +1,4 @@
%% LyX 2.3.11 created this file. For more info, see http://www.lyx.org/.
+%% LyX 2.3.21 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage{lmodern}
@@ 6,21 +6,20 @@
\renewcommand{\ttdefault}{lmtt}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\usepackage{color}
\definecolor{shadecolor}{rgb}{1, 0.667969, 0.5}
\usepackage{babel}
\usepackage{wrapfig}
\usepackage{booktabs}
\usepackage{calc}
\usepackage{framed}
\usepackage{amsmath}
\usepackage{amssymb}
+\usepackage{esint}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2,
 breaklinks=true,pdfborder={0 0 0},pdfborderstyle={},backref=section,colorlinks=true,pdfpagemode=FullScreen]
+ breaklinks=true,pdfborder={0 0 1},backref=section,colorlinks=true,pdfpagemode=FullScreen]
{hyperref}
+\hypersetup{
+ pdfborderstyle=}
\makeatletter
@@ 43,6 +42,7 @@
{\end{list}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
+\usepackage{babel}
\usepackage[deffile=diffcoeffdoc]{diffcoeff}
\makeatother
@@ 49,24 +49,26 @@
\begin{document}
\title{\texttt{diffcoeff}~\\
a \LaTeX{} package to ease\texttt{ }the\texttt{}~\\
+ a \LaTeX{} package to ease\texttt{ }the~\\
writing of differential coefficients \\
in all their variety\\
Version 2}
+ in all their variety\\
+ Version 3}
\author{Andrew Parsloe\\
{\small{}(ajparsloe at gmail.com)}}
\maketitle
\begin{abstract}
\noindent \texttt{diffcoeff.sty} allows the easy and consistent writing
of ordinary, partial and other derivatives of arbitrary (algebraic or numeric)
order. For mixed partial derivatives, the total order of differentiation
is calculated by the package. Optional arguments allow specification of
points of evaluation (ordinary derivatives), or variables held constant
(partial derivatives), and the placement of the differentiand (numerator
or appended). Version 2 is built on \texttt{xtemplate,} allowing the systematic
finetuning of the display and generation and use of variant forms (like
derivatives built from $D$, $\Delta$ or $\delta$). The package requires
the \LaTeX 3 bundles \texttt{l3kernel} and \texttt{l3packages}.
+\noindent This package allows the easy and consistent writing of ordinary,
+partial and other derivatives of arbitrary (algebraic or numeric) order.
+For mixed partial derivatives, the total order of differentiation is calculated
+by the package. Optional arguments allow for points of evaluation (ordinary
+derivatives), or variables held constant (partial derivatives), and the
+placement of the differentiand (numerator or appended). The package uses
+\texttt{xtemplate,} allowing systematic finetuning of the display and
+generation and use of variant forms, including derivatives built from $D$,
+$\Delta$ or $\delta$. A command for differentials ensures the $\dl x$
+(or $\dl.up.x$) used in integrals is consistent with the form used in
+derivatives. The package requires the \LaTeX 3 bundles \texttt{l3kernel}
+and \texttt{l3packages}.
\end{abstract}
\tableofcontents{}
@@ 75,28 +77,28 @@
The \LaTeX{} package \texttt{diffcoeff.sty} is written in the expl3 language
of \LaTeX 3\texttt{ }and requires the bundles \texttt{l3kernel} and \texttt{l3packages}
(the latter for the \texttt{xparse}, \texttt{l3keys2e} and \texttt{xtemplate}
packages\texttt{)}. The package is invoked in the usual way by entering
+packages\texttt{)}. The package is invoked in the usual way by entering
\begin{lyxcode}
\textbackslash usepackage\{diffcoeff\}
\end{lyxcode}
in the preamble of your document. There are two package options. The first
is a switch, \texttt{ISO}, which turns on formatting conforming to ISO
recommendations:
+recommendations:
\begin{lyxcode}
\textbackslash usepackage{[}ISO{]}\{diffcoeff\}
\end{lyxcode}
The effect of this is discussed in Section~\ref{sec:Changingdefaults}.
The second is a filename for a file containing definitions of variant forms
of derivative:
+The second is a filename for a file of extension \texttt{.def} containing
+definitions of variant forms of derivative:
\begin{lyxcode}
\textbackslash usepackage{[}deffile=<filename>{]}\{diffcoeff\}
\end{lyxcode}
This is discussed in Subsection~\ref{subsec:The.deffile}. Of course
both options can be used in the same call if desired:
+both options can be used in the same call if desired:
\begin{lyxcode}
\textbackslash usepackage{[}ISO,deffile=<filename>{]}\{diffcoeff\}
\end{lyxcode}
For the present document, the call was
+For the present document, the call is
\begin{lyxcode}
\textbackslash usepackage{[}deffile=diffcoeffdoc{]}\{diffcoeff\}
\end{lyxcode}
@@ 104,14 +106,10 @@
\subsection{Version comparison}
The present document discusses \emph{version 2} of the \texttt{diffcoeff}
package. Unlike version 1, version 2 is built on the the \texttt{xtemplate}
+Unlike version 1, version 2 and later are built on the the \texttt{xtemplate}
package (included in the \texttt{l3packages} bundle) which makes certain
facilities available which it would be silly not to exploit. Hence the
coding between the versions is completely different and there are consequences.

\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{shaded}%
+coding in the later versions is completely different and there are consequences.
\begin{enumerate}
\item The \texttt{\textbackslash diffset} command, formerly used to tweak the
display of derivatives, has been superseded by the \texttt{\textbackslash diffdef}
@@ 122,7 +120,7 @@
command\texttt{ }will not eventuate. The warning message is: \texttt{Obsolete
command: \textbackslash diffset has been superseded by the \textbackslash diffdef
command. See the diffcoeff documentation for further information.} The
\texttt{\textbackslash diffdef} command is discussed in Subsection~\ref{subsec:diffdef}.
+\texttt{\textbackslash diffdef} command is discussed in Subsection~\ref{subsec:diffdef}.
\item The optional trailing argument used to indicate a point of evaluation or
variables held constant is now delimited by square brackets, \texttt{{[}}
and \texttt{{]}}, as other optional arguments are. For compatibility with
@@ 129,16 +127,21 @@
version 1, braces can still be used but their use to delimit an \emph{optional}
argument is now deprecated in \texttt{xparse} on which \texttt{diffcoeff}
depends. Presumably at some stage this provision will be removed from \texttt{xparse}.
For futureproofing documents use square brackets.
+For futureproofing documents use square brackets.
\item The commands \texttt{\textbackslash Diff}, \texttt{\textbackslash diffd}
and \texttt{\textbackslash Diffd} used to construct derivatives from $D$,
$\delta$ and $\Delta$ in version 1, are still available in version 2,
but deprecated. A new optional argument in the \texttt{\textbackslash diff}
+$\delta$ and $\Delta$ in version 1, are still available in versions 2
+and 3, but deprecated. A new optional argument in the \texttt{\textbackslash diff}
command offers these and a host of other possibilities and is now the preferred
method of forming such variants; see Subsection~\ref{subsec:DdeltaDelta}.
+\item Version 3 adds a command, \texttt{\textbackslash dl} (from \emph{d}ifferentia\emph{l})
+to write differentials like $dx$ that occur in integrals and in other
+contexts in a manner consistent with the form used in derivatives. After
+all, if one is using upright `d's in derivatives, similarly upright `d's
+should occur in these other contexts.\footnote{This rather obvious lack in version 2 was pointed out to me by Sergio Callegari.}
+\item Version 3 also provides some simple spacing commands that can be useful
+for tweaking standard spacing.
\end{enumerate}
\end{shaded}%
\end{minipage}
\subsubsection*{Note on terminology}
@@ 150,9 +153,9 @@
\label{sec:Rogues'gallery}Browsing through texts on statistical mechanics,
relativity and classical mechanics I find the following choice examples
of derivatives `disporting every which way'.
+of derivatives `disporting every which way'.
Multicharacter variables of differentiation unparenthesized:
+Multicharacter variables of differentiation unparenthesized:
\begin{equation}
\diffp{\frac{\psi}{\Theta}}{\frac{1}{\Theta}},\quad\diffp{E/T}{1/T},\quad\diffp{\ln f}{\ln x_{0}},\quad\diffp\psi{a_{i},\frac{1}{\Theta}},\quad\diffp{\mathcal{L}}{\eta_{,i}^{(r)}}\label{eq:eg1}
@@ 162,7 +165,7 @@
\diffp H{\displaystyle \diffp S{q_{k}}[]},\quad\diffp\varepsilon{(1/\Theta)},\label{eq:eg2}
\end{equation}
Higherorder derivatives where the parentheses do not or do include the
operator:
+operator:
\begin{equation}
\diffp[2]q{\frac{1}{\Theta}},\quad\diffp[2]q{1/\Theta},\quad\diffp[2]\varepsilon{a_{i}},\quad\diff.wrapall.[2]{\phi^{i}(x^{i})}{x^{i}}.\label{eq:eg3}
\end{equation}
@@ 170,14 +173,13 @@
the last of (\ref{eq:eg3}), or not, as in the others? Logic says `yes';
practice suggests (generally) `no'.
Indicating a point of evaluation is similarly varied:
+Indicating a point of evaluation is similarly varied:
\begin{equation}
\diff.pvrule.\phi\varepsilon[\varepsilon=\varepsilon_{0}],\quad\diff.pvrule.[2]\phi\varepsilon[\varepsilon=\varepsilon_{0}],\quad\diff.psqbra.{b^{\beta}}{a^{\alpha}}[b=0],\quad\diff.paren.uv[v=0].\label{eq:eg4}
\end{equation}
 ISO 800002 (item 2.11.13) favours the last of these \textendash{} parentheses
\textendash{} for ordinary derivatives. Presumably, partial derivatives
should follow suit, although parentheses are also used to indicate variables
held constant:
+ISO 800002 (item 2.11.13) favours the last of these  parentheses 
+for ordinary derivatives. Presumably, partial derivatives should follow
+suit, although parentheses are also used to indicate variables held constant:
\begin{equation}
\diffp*{\frac{P}{T}}U[V],\quad\diffp S{N_{2}}[U,V,N_{1}],\quad\diffp S/T[V].\label{eq:eg5}
\end{equation}
@@ 184,7 +186,7 @@
Other symbols besides $d$ and $\partial$ are used to denote derivativelike
quantities. From introductory calculus, classical mechanics and thermodynamics
come $\delta$ and $\Delta$, from fluid mechanics comes $D$:
+come $\delta$ and $\Delta$, from fluid mechanics comes $D$:
\begin{equation}
\diff.delta.yx,\quad\diff.D.\rho t,\quad\diff.pDelta.UT[V],\quad\diff.Delta.U/T,\quad\diff.delta.{\mathcal{L}}{\eta^{(r)}}.\label{eq:eg6}
\end{equation}
@@ 196,9 +198,8 @@
\end{equation}
When the differentiand is too big or awkward to sit in the numerator and
is appended to the operator, the $d$ or $\partial$ in the numerator is
generally centred \textendash{} but not always. In texts prior to the age
of computerised typesetting one will sometimes find the symbol pushed to
the \emph{left}:
+generally centred  but not always. In texts prior to the age of computerised
+typesetting one will sometimes find the symbol pushed to the \emph{left}:
\begin{equation}
\diff.pleft.*{\diffp{x^{i^{*}}}{x^{k^{*}}}{}}{x^{l^{*}}},\quad\diff.left.*{\left(\frac{m\mathbf{q}_{x}}{\sqrt{1q^{2}}}\right)}{t}.\label{eq:eg12}
\end{equation}
@@ 205,21 +206,20 @@
The observant will note an italic adjustment with the first expression,
so that the $\partial$ in the numerator and the $\partial$ in the denominator
line up in a slanting column, but no such adjustment for the $d$s in
the second derivative.
+the second derivative.
And finally, the operator in the numerator may differ from that in the
denominator. For instance, in tensor calculus acceleration is sometimes
written as
+written
\[
\diff.nabla.{v^{i}}t=\diff{v^{i}}t+\Gamma_{k\hphantom{i}h}^{\hphantom{k}i}v^{h}\diff{y^{k}}t
\]
where $\nabla v^{i}$ is the `absolute differential' of the velocity
$v^{i}$.
+where $\nabla v^{i}$ is the `absolute differential' of the velocity $v^{i}$.
Version 2 of the \texttt{diffcoeff} package has the generative power to
cope with all these variations \textendash{} see Section~\ref{sec:Changingdefaults}
\textendash{} although it is unlikely an author should need to call on
this capacity to anything like the extent required for this Rogues' Gallery.
+Version 2 or later of the \texttt{diffcoeff} package has the generative
+power to cope with all these variations  see Section~\ref{sec:Changingdefaults}
+ although it is unlikely an author should need to call on this capacity
+to anything like the extent required for this Rogues' Gallery.
\section{Ordinary derivatives \label{sec:Ordinaryderivatives}}
@@ 231,16 +231,16 @@
in display style (i.e., placed between \texttt{\textbackslash{[} \textbackslash{]}}
). In fact \texttt{\textbackslash diff yx} (omitting the braces) will
produce these results, with a saving on keystrokes. The braces are needed
only when an argument \textendash{} differentiand, variable of differentiation
\textendash{} is more than a single token.
+only when an argument  differentiand, variable of differentiation 
+is more than a single token.
\begin{itemize}
\item If you want upright `$\mathrm{d}$'s as default, as ISO 800002 recommends,
rather than the mathitalic `$d$'s I am using, this can easily be done;
see Section~\ref{sec:Changingdefaults} on changing default settings.
+rather than the mathitalic `$d$'s used here, this can easily be done;
+see Section~\ref{sec:Changingdefaults} on changing default settings.
\end{itemize}
For inclusion in a line of text you might prefer to use a slashfraction
form of derivative. That is achieved by inserting a slash, `/', between
numerator and denominator arguments: \texttt{\textbackslash diff \{\textbackslash ln
+numerator and denominator arguments: \texttt{\textbackslash diff\{\textbackslash ln
x\}/x} produces $\diff{\ln x}/x$. (Braces are required for the numerator
in this case since it contains more than one token.)
@@ 260,7 +260,7 @@
are essential. For a firstorder derivative, no optional argument is needed
and entering \texttt{1} as the optional argument has no effect:
\begin{example}
\textbackslash diff{[}1{]}yx $\Longrightarrow\quad{\displaystyle \diff[1]yx.}$
+\textbackslash diff{[}1{]}yx $\Longrightarrow\quad{\displaystyle \diff[1]yx.}$
\end{example}
\noindent In slash style, \texttt{\textbackslash diff{[}2{]}y/x} produces
@@ 274,36 +274,36 @@
$x$ means forming the product
\begin{example}
\textbackslash diff\{\textbackslash ln\textbackslash sin x\}\{\textbackslash sin
x\}\textbackslash diff\{\textbackslash sin x\}x $\Longrightarrow\quad{\displaystyle \diff{\ln\sin x}{\sin x}\diff{\sin x}x.}$
+x\}\textbackslash diff\{\textbackslash sin x\}x $\Longrightarrow\quad{\displaystyle \diff{\ln\sin x}{\sin x}\diff{\sin x}x.}$
\end{example}
\noindent Forming the \emph{second} derivative of $\ln\sin x$ will now
involve forming (among other quantities)
\begin{example}
\textbackslash diff{[}2{]}\{\textbackslash ln\textbackslash sin x\}\{\textbackslash sin
x\} $\Longrightarrow\quad{\displaystyle \diff[2]{\ln\sin x}{\sin x}.}$
+\noindent \textbackslash diff{[}2{]}\{\textbackslash ln\textbackslash sin
+x\}\{\textbackslash sin x\} $\Longrightarrow\quad{\displaystyle \diff[2]{\ln\sin x}{\sin x}.}$
\end{example}
\noindent Parentheses have been inserted automatically by \texttt{diffcoeff}
around $\sin x$ in the denominator to avoid any visual hint that we are
differentiating in the sine of the square of $x$.
+differentiating in the sine of the square of $x$.
The question is: are the parentheses in the right place? Logically, no.
They should include the $d$: $(d\sin x)^{2}$ \textendash{} it is the
differential $d\sin x$ that is of the second order. But as the examples
in the Rogues' Gallery show \textendash{} see particularly (\ref{eq:eg3})
\textendash{} the inclination seems to be to do otherwise. This may be
because one wants, in any case, to parenthesise the variable. A second,
outer pair of parentheses then seems fussy and distracting:
+They should include the $d$: $(d\sin x)^{2}$  it is the differential
+$d\sin x$ that is of the second order. But as the examples in the Rogues'
+Gallery show  see particularly (\ref{eq:eg3})  the inclination seems
+to be to do otherwise. This may be because one wants, in any case, to parenthesise
+the variable. A second, outer pair of parentheses then seems too fussy
+and detracts from comprehending the symbol `at a glance':
\[
\diff.wrapall.[2]{f(x)}{(1/x)}.
\]
Customary but illogical notations are familiar in mathematics \textendash{}
think of the position of the superscripts in an identity like $\sin^{2}\theta+\cos^{2}\theta=1$.
+Customary but illogical notations are familiar in mathematics  think
+of the position of the superscripts in an identity like $\sin^{2}\theta+\cos^{2}\theta=1$.
But, like other features of the derivative, the manner of this wrapping
in parentheses of long variables for \emph{higher order} derivatives is
customisable; see Section~\ref{sec:Changingdefaults}.
+customisable; see Section~\ref{sec:Changingdefaults}.
For first order derivatives, parenthesising does not occur. If you want
the variable of differentiation to be parenthesised, you need to insert
@@ 314,6 +314,26 @@
\end{example}
+\subsubsection{Minutiae of spacing}
+
+You may find the spacing between the `d' and the `f' in the last example
+uncomfortably close. The \texttt{diffcoeff} package offers four simple
+spacing commands to finetune the display. These are
+\begin{description}
+\item [{\texttt{\textbackslash negmu}}] insert spacing of $1$ mu
+\item [{\texttt{\textbackslash nilmu}}] insert spacing of $0$ mu
+\item [{\texttt{\textbackslash onemu}}] insert spacing of $1$ mu
+\item [{\texttt{\textbackslash twomu}}] insert spacing of $2$ mu
+\end{description}
+Thus for the last example, inserting \texttt{\textbackslash nilmu} and
+\texttt{\textbackslash onemu} in the appropriate places produces
+\begin{example}
+\textbackslash diff \{\textbackslash nilmu f(x)\}\{\textbackslash onemu
+1/x\}, \textbackslash quad \textbackslash diff \{\textbackslash nilmu
+f(x)\}\{(1/x)\} $\Longrightarrow\quad{\displaystyle \diff{\nilmu f(x)}{\onemu1/x},\quad\diff{\nilmu f(x)}{(1/x)}.}$
+\end{example}
+
+
\subsection{Appending the differentiand: \texttt{\textbackslash diff{*}}}
Some differentiands are too big or awkward to be placed neatly in the numerator
@@ 323,16 +343,16 @@
differentiand. A better way is to star the \texttt{\textbackslash diff}
command. This tells \texttt{diffcoeff} to append the differentiand. Thus
suppose the differentiand is a polynomial, say $ax^{2}+bx+c$. Add a star
(an asterisk) to the \texttt{\textbackslash diff} command:
+(an asterisk) to the \texttt{\textbackslash diff} command:
\begin{example}
\textbackslash diff{*}\{(ax\textasciicircum 2+bx+c)\}x $\Longrightarrow\quad{\displaystyle \diff*{(ax^{2}+bx+c)}x.}$
+\textbackslash diff{*}\{(ax\textasciicircum 2+bx+c)\}x $\Longrightarrow\quad{\displaystyle \diff*{(ax^{2}+bx+c)}x.}$
\end{example}
A virtue of using an asterisk is that if one isn't sure whether a differentiand
should be appended or not, it is an easy matter to simply insert or delete
the asterisk to compare the results. For example, a second derivative is
an iterated derivative \textendash{} one in which a derivative forms the
differentiand of another derivative:
+an iterated derivative  one in which a derivative forms the differentiand
+of another derivative:
\begin{example}
\textbackslash diff{[}2{]}yx = \textbackslash diff{*}\{\textbackslash diff
yx\}x $\Longrightarrow\quad{\displaystyle \diff[2]yx=\diff*{\diff yx}x},$
@@ 340,17 +360,17 @@
\noindent which is more elegant to my eye than
\begin{example}
\textbackslash diff{[}2{]}yx = \textbackslash diff\{\textbackslash diff
+\noindent \textbackslash diff{[}2{]}yx = \textbackslash diff\{\textbackslash diff
yx\}x $\Longrightarrow\quad{\displaystyle \diff[2]yx=\diff{\diff yx}x},$
\end{example}
\noindent although whether the \emph{meaning} is clearer is moot.\emph{
}It is easy to switch between the two forms on the right, simply by inserting
or removing the asterisk.
+or removing the asterisk.
In slash style with the star option, the polynomial example becomes
\begin{example}
\textbackslash diff{*}\{(ax\textasciicircum 2+bx+c)\}/x $\Longrightarrow\quad\text{\ensuremath{{\displaystyle (\diff{}/{x})(ax^{2}+bx+c)}}, }$
+\textbackslash diff{*}\{(ax\textasciicircum 2+bx+c)\}/x $\Longrightarrow\quad\text{\ensuremath{{\displaystyle (\diff{}/{x})(ax^{2}+bx+c)}}, }$
\end{example}
\noindent where the parentheses around the differential operator are automatically
@@ 361,7 +381,7 @@
If you want to specify a point at which the derivative is evaluated, append
a final optional argument. Note that there \emph{must be no space} before
the left square bracket of the argument:
+the left square bracket of the argument:
\begin{example}
\textbackslash diff{[}2{]}yx{[}0{]} $\Longrightarrow\quad{\displaystyle \diff[2]yx[0]}$
\end{example}
@@ 369,13 +389,12 @@
\noindent If a space does slip in before the final optional argument, it
will not cause a \LaTeX{} error. Instead, the argument will be treated as
a squarebracketed mathematical expression following the derivative, and
typeset as such.
+typeset as such.
\begin{itemize}
\item If you prefer to use subscripted \emph{parentheses} around the derivative
to indicate a point of evaluation \textendash{} as ISO 800002 recommends
\textendash{} then this can easily be done; see Section~\ref{sec:Changingdefaults}
on changing default settings. Or use the \texttt{ISO} package option; see
the introduction.
+to indicate a point of evaluation  as ISO 800002 recommends  then
+this can easily be done; see Section~\ref{sec:Changingdefaults} on changing
+default settings. Or use the \texttt{ISO} package option; see the introduction.
\end{itemize}
Because the slash form spreads the derivative out horizontally, parentheses
are preferred here to indicate a point of evaluation:
@@ 384,9 +403,9 @@
$\Longrightarrow\quad{\displaystyle \diff{\ln\sin x}/{\sin x}[x=\pi/6]}$
\end{example}
\noindent A vertical rule (or `pipe') can become too remote from the
opening $d$ of the differential coefficient: $\diff.svrule.{\ln\sin x}/{\sin x}[x=\pi/6]$;
parentheses tie the whole cluster of symbols together.
+\noindent A vertical rule (or `pipe') can become too remote from the opening
+$d$ of the differential coefficient: $\diff.svrule.{\ln\sin x}/{\sin x}[x=\pi/6]$;
+parentheses tie the whole cluster of symbols together.
\subsubsection{Superscripts}
@@ 401,7 +420,7 @@
optional argument but leave it empty. Thus, for a particle of mass $m$
moving along a line, distance $x$ at time $t$, the kinetic energy is:
\begin{example}
\textbackslash tfrac 12 m \textbackslash diff x/t{[}{]}\textasciicircum 2
+\noindent \textbackslash tfrac 12 m \textbackslash diff x/t{[}{]}\textasciicircum 2
$\Longrightarrow\quad{\displaystyle \tfrac{1}{2}m\diff x/t[]^{2}}.$
\end{example}
@@ 408,8 +427,8 @@
\section{Partial derivatives\label{sec:Partialderivatives}}
\noindent \begin{flushleft}
Partial derivatives follow the same pattern as for ordinary derivatives,
with some extensions. The command this time is \texttt{\textbackslash diffp}.
+Partial derivatives follow the same pattern as ordinary derivatives, with
+some extensions. The command this time is \texttt{\textbackslash diffp}.
Thus \texttt{\textbackslash diffp\{F\}\{x\}}, or, with a saving on keystrokes,\texttt{
\textbackslash diffp Fx}, produces $\diffp Fx$ in text style and
\[
@@ 421,17 +440,17 @@
form, generally preferred for inline use, \texttt{\textbackslash diffp
F/x}, displaying as $\diffp F/x$. Given that \texttt{\textbackslash partial}
takes 8 keystrokes to type, the slash form \emph{does }economise on keystrokes
for a partial derivative.
+for a partial derivative.
\par\end{flushleft}
\begin{flushleft}
Again an optional argument allows the specification of the order of differentiation
and it may be numeric or algebraic or a mix of the two:
+and it may be numeric or algebraic or a mix of the two:
\par\end{flushleft}
\begin{example}
\textbackslash diffp{[}3{]}F/x , \textbackslash quad \textbackslash diffp{[}n{]}F/x
$\Longrightarrow\quad{\displaystyle {\displaystyle {\displaystyle \diffp[3]F/x}},\quad{\displaystyle \diffp[n]F/x.}}$\medskip{}
\textbackslash diffp{[}n+1{]}Fx $\Longrightarrow\quad{\displaystyle {\displaystyle \diffp[n+1]Fx,}}$
+ \textbackslash diffp{[}n+1{]}Fx $\Longrightarrow\quad{\displaystyle {\displaystyle \diffp[n+1]Fx,}}$
\end{example}
@@ 451,7 +470,7 @@
\noindent In slash form the same expression looks like
\begin{example}
\textbackslash diffp S/T{[}V{]} $\Longrightarrow\quad{\displaystyle \diffp{S}/{T}[V]}.$
+\noindent \textbackslash diffp S/T{[}V{]} $\Longrightarrow\quad{\displaystyle \diffp{S}/{T}[V]}.$
\end{example}
This use of a parenthesised, subscripted form to indicate a variable or
@@ 463,11 +482,11 @@
\textbackslash diffp \{F(x,y)\}x{[}(0,0){]} $\Longrightarrow\quad{\displaystyle \diffp{F(x,y)}x[(0,0)]}$
\end{example}
However, you may prefer (as I do) to use a vertical rule for this purpose:
+However, you may prefer (as many do) to use a vertical rule for this purpose:
\[
\diff.pvrule.{F(x,y)}x[(0,0)]
\]
Making this possibility available is discussed in Section~\ref{sec:Changingdefaults}.
+Making this possibility available is discussed in Section~\ref{sec:Changingdefaults}.
An empty final argument produces a parenthesised derivative with no subscript:
\begin{example}
@@ 477,7 +496,7 @@
\noindent This can be useful sometimes, e.g. for writing Lagrange's equations
of motion in analytic mechanics:
\begin{example}
\textbackslash diffp L\{q\_k\}\textbackslash diff{*}\{\textbackslash diffp
+\noindent \textbackslash diffp L\{q\_k\}\textbackslash diff{*}\{\textbackslash diffp
L\{\textbackslash dot\{q\}\_k\}{[}{]}\}t = 0 $\Longrightarrow\quad{\displaystyle \diffp L{q_{k}}\diff*{\diffp L{\dot{q}_{k}}[]}t}=0.$
\end{example}
@@ 485,15 +504,15 @@
\subsubsection{Textstyle derivatives}
The \texttt{diffcoeff} package assumes that derivatives formed as `numerator
over denominator' will be used in displaystyle expressions, and that
the slash form will be used for inline use (text style). This is the familiar
+over denominator' will be used in displaystyle expressions, and that the
+slash form will be used for inline use (text style). This is the familiar
practice in the literature. If one \emph{does} use the first form in an
inline expression where a variable is held constant, say \texttt{\textbackslash diffp
ST{[}V{]}} as here $\diffp ST[V]$, the result is unsatisfactory, the subscript
too tight on the closing parenthesis and too much space between parentheses
and derivative. The matter is easily resolved using `variant forms' \textendash{}
see Subsection~\ref{subsec:Textandscriptstyle} below \textendash{}
giving, for our example, $\diff.ptxt.ST[V]$.
+and derivative. The matter is easily resolved using `variant forms' 
+see Subsection~\ref{subsec:Textandscriptstyle} below  giving, for
+our example, $\diff.ptxt.ST[V]$.
\subsection{Appending the differentiand\label{subsec:Partialappending}}
@@ 501,9 +520,9 @@
it to a preceding differential operator, rather than create a fractional
form with the long expression in the numerator. As with ordinary derivatives,
this is achieved by adding an asterisk to (i.e. by starring) the \texttt{\textbackslash diffp}
command.
+command.
\begin{example}
\textbackslash diffp{*}{[}2{]}\{\textbackslash phi(x,y,z)\}x $\Longrightarrow\quad{\displaystyle \diffp*[2]{\phi(x,y,z)}x.}$
+\textbackslash diffp{*}{[}2{]}\{\textbackslash Phi(x,y,z)\}x $\Longrightarrow\quad{\displaystyle \diffp*[2]{\Phi(x,y,z)}x.}$
\end{example}
\noindent Alternatively you could leave the first mandatory argument empty
@@ 518,7 +537,7 @@
\end{example}
\noindent although this behaviour can be changed (Section~\ref{sec:Changingdefaults}
again).
+again).
If you wish to both append the differentiand \emph{and} indicate variables
held constant, then the starred form is much the easier way to achieve
@@ 529,7 +548,7 @@
\end{example}
\noindent where the starring automatically takes care of the parentheses
and subscripts.
+and subscripts.
\subsection{Mixed partial derivatives}
@@ 544,8 +563,8 @@
The variables of differentiation are listed in order in a comma list forming
the second mandatory argument. The total order of differentiation (3 in
this example) is inserted automatically \textendash{} \texttt{diffcoeff}
does the calculation. There is also a slash form:
+this example) is inserted automatically  \texttt{diffcoeff} does the
+calculation. There is also a slash form:
\begin{example}
\textbackslash diffp F/\{x,y,z\} $\Longrightarrow\quad{\displaystyle \diffp F/{x,y,z}}.$
\end{example}
@@ 557,40 +576,99 @@
\textbackslash diffp{[}2,3{]}F\{x,y,z\} $\Longrightarrow\quad{\displaystyle \diffp[2,3]F{x,y,z}.}$
\end{example}
\noindent Notice that the overall order of the derivative \textendash{}
6 \textendash{} is again automatically calculated and inserted as a superscript
on the $\partial$ symbol in the numerator. In this example, the comma
list of orders has only two members, even though there are three variables.
It is assumed that the orders given in the comma list apply in sequence
to the variables, the first order to the first variable, the second to
the second variable, and so on, and that any subsequent orders not listed
in the optional argument are, by default, 1. Thus we need to specify only
2 and 3 in the example; the order of differentiation of $z$ is 1 by default.
But you \emph{cannot} use an order specification like \texttt{{[},,2{]}}.
Instead write \texttt{{[}1,1,2{]}}.\textbf{ }It is only the \emph{tail}
of an order specification which can be omitted.
+\noindent Notice that the overall order of the derivative  6  is
+again automatically calculated and inserted as a superscript on the $\partial$
+symbol in the numerator. In this example, the comma list of orders has
+only two members, even though there are three variables. It is assumed
+that the orders given in the comma list apply in sequence to the variables,
+the first order to the first variable, the second to the second variable,
+and so on, and that any subsequent orders not listed in the optional argument
+are, by default, 1. Thus we need to specify only 2 and 3 in the example;
+the order of differentiation of $z$ is 1 by default. But you \emph{cannot}
+use an order specification like \texttt{{[} , ,2{]}}. Instead write \texttt{{[}1,1,2{]}}.\textbf{
+}It is only the \emph{tail} of an order specification which can be omitted.
The automatic calculation of the overall order of differentiation remains
true even when some or all of the individual orders are variables rather
than numbers. For example, differentiating in three variables to orders
\texttt{1, m+1, m1},
+\subsubsection{Minutiae of spacing (again)\label{subsec:Minutiaeofspacing}}
+
+In Chapter 18 of the \emph{The\TeX book}, Knuth suggests inserting a thin
+space, \texttt{\textbackslash ,} (or 3 mu), between differentials in appropriate
+contexts, giving as an example $dx\,dy=r\,dr\,d\theta$. In the denominator
+of a derivative, however, that degree of extra spacing seems too great
+(to my eye), interfering with seeing the derivative `as a whole',
+\[
+\diff.pwide.{F}{x,y,z},
+\]
+especially for the slashform of derivative: $\diff.pwide.F/{x,y,z}$.
+Some spacing is desirable, but less; by default \texttt{diffcoeff} inserts
+2 mu between the differentials in the fraction form of derivative and 1
+mu in the slash form.
+
+Should a differentiation occur to higher order and so a variable acquire
+a superscript, an adjustment is made to the extra spacing. By default 1
+mu is subtracted from the default spacing. Thus in
+\[
+\diffp[2]F{x,y,z},
+\]
+2 mu of spacing is inserted between the $\partial y$ and $\partial z$,
+but because the superscript already provides some separation between them,
+only 1 mu is inserted between $\partial x^{2}$ and $\partial y$.
+
+The values used for the spacing and its adjustment in the presence of a
+superscript can be adjusted by the user; see Section~\ref{sec:Changingdefaults}.
+Some other minutiae of spacing are discussed below in Subsection~\ref{subsec:Commalistofvars}
+when the variables themselves are super or subscripted (as happens in
+tensor calculus, for instance).
+
+\subsubsection{Algebraic orders of differentiation}
+
+Calculation of the overall order of differentiation still occurs even when
+some or all of the individual orders are algebraic variables rather than
+numbers. For example, differentiating in three variables to orders \texttt{1,
+m+1, m1},
\begin{example}
\textbackslash diffp{[}1,m+1,m1{]}\{F(x,y,z)\}\{x,y,z\} $\Longrightarrow\quad{\displaystyle \diffp[1,m+1,m1]{F(x,y,z)}{x,y,z}.}$
\end{example}
Should you specify \emph{more} orders in the comma list than there are
variables, compilation will fail and an error message will be sent to the
terminal and \LaTeX{} log . For example, if on line 53 (say) of my document
I specify \texttt{{[}1,m1,m+1,2{]}} for the orders of differentiation
but list only \texttt{\{x,y,z\}} for the variables, the message will be
+
+\subsubsection{Error messages}
+
+Should you specify \emph{more} orders in the comma list of the order specification
+than there are variables, compilation will fail and an error message will
+be sent to the terminal and \LaTeX{} log . For example, if on line 53 (say)
+of my document I specify \texttt{{[}1,m1,m+1,2{]}} for the orders of differentiation
+but list only \texttt{\{x,y,z\}} for the variables, the message will be
\begin{lyxcode}
!~Package~diffcoeff~Error:~4~orders~specified~for~3
+!~Package~diffcoeff~Error:~4~orders~of~differentiation~
variables;~{[}1,m+1,m1,2{]}~(on~line~53)~for~variables~x,y,z.
+specified~for~3~variables;~orders~{[}1,m+1,m1,2{]}
+
+(on~line~53)~for~variables~x,y,z.
\end{lyxcode}
+Should you try using a \emph{number} raised to a power in an order specification,
+it will cause an error. For example, if on line 53 (say) of my document
+I try to form \texttt{\textbackslash diffp{[}2\textasciicircum 2{]}f\{x,y,z\}}
+compilation will fail with the message
+\begin{lyxcode}
+!~Package~diffcoeff~Error:~number~followed~by~\textasciicircum ~in~the~
+
+order~specification~{[}2\textasciicircum n,1,1{]}~on~line~53.~Diffcoeff~
+
+cannot~calculate~the~overall~order~of~differentiation~
+
+in~this~case.~Use~the~orderoverride~option~to~enter~
+
+the~overall~order.
+\end{lyxcode}
+Similarly, you cannot use multiplication (\texttt{\textbackslash times}
+or \texttt{{*}})\texttt{ }or division (\texttt{/} or \texttt{\textbackslash div})
+signs after \emph{numbers} in an order specification; only \texttt{+} or
+\texttt{} or a left parenthesis (see below) are allowed.
+
+\subsubsection{The orderoverride option}
+
\noindent Perhaps the differentiations are to orders \texttt{{[}2km,m1,m+1{]}}:
\begin{example}
\textbackslash diffp{[}2km,m1,m+1{]}\{F(x,y,z)\}\{x,y,z\} $\Longrightarrow\quad{\displaystyle \diffp[2km,m1,m+1]{F(x,y,z)}{x,y,z}.}$
+\noindent \textbackslash diffp{[}2km,m1,m+1{]}\{F(x,y,z)\}\{x,y,z\} $\Longrightarrow\quad{\displaystyle \diffp[2km,m1,m+1]{F(x,y,z)}{x,y,z}.}$
\end{example}
\noindent Here the overall order is presented as \texttt{2km+2m}. You might
@@ 600,11 +678,9 @@
to present the order in a manner distinct from that presented by \texttt{diffcoeff},
use the \emph{orderoverride option}.
\subsubsection{The orderoverride option}

\noindent This is a second optional argument immediately following the
order specification. For our last example, filling the override option
with \texttt{2m(k+1)} gives the desired result:
+This is a second optional argument immediately following the order specification.
+For our last example, filling the override option with \texttt{2m(k+1)}
+gives the desired result:
\begin{example}
\textbackslash diffp{[}2km,m1,m+1{]}{[}2m(k+1){]}\{F(x,y,z)\}\{x,y,z\}
$\Longrightarrow\quad{\displaystyle \diffp[2km,m1,m+1][2m(k+1)]{F(x,y,z)}{x,y,z}}.$
@@ 613,13 +689,14 @@
\noindent As another example, left to its own devices, \texttt{diffcoeff}
produces
\begin{example}
\textbackslash diffp{[}m/2+n/2,m/2,n/2{]}F\{x,y,z\} $\Longrightarrow\quad{\displaystyle \diffp[m/2+n/2,m/2,n/2]F{x,y,z},}$
+\noindent \textbackslash diffp{[}m/2+n/2,m/2,n/2{]}F\{x,y,z\} $\Longrightarrow\quad{\displaystyle \diffp[m/2+n/2,m/2,n/2]F{x,y,z},}$
\end{example}
\noindent whereas we would like the total order to be presented as $m+n$.
Using the override option,
\begin{example}
\textbackslash diffp{[}m/2+n/2,m/2,n/2{]}{[}m+n{]}F\{x,y,z\} $\Longrightarrow\quad{\displaystyle \diffp[m/2+n/2,m/2,n/2][m+n]F{x,y,z}}.$
+\noindent \textbackslash diffp{[}m/2+n/2,m/2,n/2{]}{[}m+n{]}F\{x,y,z\}
+$\Longrightarrow\quad{\displaystyle \diffp[m/2+n/2,m/2,n/2][m+n]F{x,y,z}}.$
\end{example}
The orderoverride option does exactly that: overrides the presentation
@@ 629,11 +706,11 @@
wishes or, indeed, add essentially arbitrary material as a superscript
to the $\partial$ symbol in the numerator.
\subsubsection{Comma list of variables of differentiation}
+\subsubsection{Comma list of variables of differentiation\label{subsec:Commalistofvars}}
In tensor calculus the differentiations are almost always in terms of super
or subscripted coordinates. In many other contexts this is the case too
\textendash{} the reciprocal of the temperature in thermodynamics or generalized
+ the reciprocal of the temperature in thermodynamics or generalized
cooredinates in analytical mechanics. This is why a comma list is used
in \texttt{diffcoeff} for specifying variables of differentiation for mixed
partial derivatives. Although it would be nice to write the minimal \texttt{\{xy\}}
@@ 653,13 +730,32 @@
braces. There are plenty of instances of this out in the world (see, e.g.,
the last equation of (\ref{eq:eg1})) but it is overall a rare occurrence.
+\paragraph*{Minutiae of spacing (yet again):}
+
+In Subsection~\ref{subsec:Minutiaeofspacing} above, I discussed a slight
+reduction in the space inserted between the terms occurring in the denominator
+of a mixed partial derivative when a higher order differentiation is involved.
+The superscript appearing on a differentiation variable in that case \emph{of
+itself} introduced a spacing adjustment between the terms. But the present
+discussion involves only first order differentiations and no such reduction
+is automatically made by \texttt{diffcoeff}. However it is still possible
+to explicitly make such an adjustment with the \texttt{\textbackslash negmu}
+command, which inserts \texttt{1 mu} of spacing. For our example,
+\begin{example}
+\textbackslash diffp\{A\_i\}\{ x\textasciicircum j\textbackslash negmu,x\textasciicircum k
+\} $\Longrightarrow\quad{\displaystyle \diffp{A_{i}}{x^{j}\negmu,x^{k}},}$
+\end{example}
+
+\noindent the \texttt{\textbackslash negmu} decreasing the spacing between
+the terms from the default 2 mu to 1 mu.
+
\subsubsection{Overkill territory}
Two previous examples illustrate limitations of the algorithm that calculates
the overall order of differentiation: \texttt{2m/2+2n/2} is not simplified
to \texttt{m+n} and \texttt{2km+2m} is not factorised to \texttt{2m(k+1)}.
But there is much that the algorithm \emph{can} handle \textendash{} for
instance, the simple use of parentheses:
+But there is much that the algorithm \emph{can} handle  for instance,
+the simple use of parentheses:
\begin{example}
\textbackslash diffp{[}2m(k+1),2(k+1)m{]}\{F(x,y,z)\}\{x,y,z\} $\Longrightarrow\quad{\displaystyle \diffp[2m(k+1),2(k+1)m]{F(x,y,z)}{x,y,z}}.$
\end{example}
@@ 668,9 +764,9 @@
\paragraph*{Dynamic use of parentheses}
\noindent For parenthetic expressions to be evaluated as in this example
\textendash{} the \emph{dynamic} use of parentheses \textendash{} the left
parenthesis must be preceded at most by a sign or a number; the right parenthesis
must be followed at most by a sign.
+ the \emph{dynamic} use of parentheses  the left parenthesis must
+be preceded at most by a sign or a number; the right parenthesis must be
+followed at most by a sign.
If a right parenthesis is followed by a \emph{variable}, say by \texttt{m}
as in the order spec. \texttt{{[}(2n+1)m,(2n1)m{]}}, it will throw an
@@ 678,18 +774,18 @@
the \LaTeX{} log like the following (which assumes the order spec. was on
line 53 of the document):
\begin{lyxcode}
!~Package~diffcoeff~Error:~Is~this~intended:~)~followed~
+!~Package~diffcoeff~Error:~)~followed~by~m~in~the~
by~m~in~the~order~specification~{[}(2n+1)m,(2n1)m{]}~on~
+order~specification~{[}(2n+1)m,(2n1)m{]}~on~line~53.~
line~53?~Diffcoeff~cannot~calculate~the~overall~order~of~
+Diffcoeff~cannot~calculate~the~overall~order~of~
differentiation~from~the~specification~in~this~case.~Use~
+differentiation~in~this~case.~Use~the~orderoverride~
the~orderoverride~option~to~enter~the~overall~order.
+option~to~enter~the~overall~order.
\end{lyxcode}
This is a limitation on the dynamic use of parentheses \textendash{} but
they \emph{can} be nested.
+This is a limitation on the dynamic use of parentheses  but they \emph{can}
+be nested.
\paragraph*{Static use of parentheses}
@@ 705,7 +801,8 @@
by a variable without generating an error.\emph{ }You can nest them, and
you can include static parentheses within a dynamic pair; for example,
\begin{example}
\textbackslash diffp{[}2(3+f(k))+1,13(f(k)2){]}\{F(x,y)\}\{x,y\} $\Longrightarrow\quad{\displaystyle \diffp[2(3+f(k))+1,13(f(k)2)]{F(x,y)}{x,y}}.$
+\noindent \textbackslash diffp{[}2(3+f(k))+1,13(f(k)2){]}\{F(x,y)\}\{x,y\}
+$\Longrightarrow\quad{\displaystyle \diffp[2(3+f(k))+1,13(f(k)2)]{F(x,y)}{x,y}}.$
\end{example}
\noindent However, the reverse is not possible: you can't have dynamic
@@ 714,7 +811,7 @@
\paragraph*{Other refinements}
Exponents and subscripts on a \emph{variable} are fine in an order specification,
so long as the exponent or subscript consists of a \emph{single} token:
+so long as the exponent or subscript consists of a \emph{single} token:
\begin{example}
\textbackslash diffp{[}m\textasciicircum 2+2(k1),m\textasciicircum 2(k+1){]}F\{x,y,z,w\}
$\Longrightarrow\quad{\displaystyle \diffp[m^{2}+2(k1),m^{2}(k+1)]F{x,y,z,w}}.$
@@ 723,12 +820,8 @@
\noindent Braced arguments containing \emph{multiple} tokens as exponents
or subscripts to variables will generally not halt compilation but will
usually give nonsensical results, as will \emph{signs} treated as superscripts
or subscripts. Neither circumstance is checked for by \texttt{diffcoeff}.
+or subscripts. Neither circumstance is checked for by \texttt{diffcoeff}.
\emph{Numbers} raised to a power will cause a \LaTeX{} error. (The \texttt{l3int}
module of the expl3 language is used to evaluate expressions, and this
does not cater for raising to a power.)

\paragraph*{Override}
There are limitations on what order specifications the \texttt{diffcoeff}
@@ 736,13 +829,13 @@
but it is \emph{not} a computer algebra system. In all those cases where
it fails to calculate or present a correct total order, the orderoverride
option is available. Yes, this is not as convenient as having the overall
order calculated automatically but, let's remind ourselves, we are deep
+order calculated automatically but (let's remind ourselves) we are deep
in overkill territory. Mixed partial derivatives are used far less often
than the pure derivatives, and when they \emph{are} used it is nearly always
to orders 1 or 2 in the variables. Mixed partial derivatives to exotic
orders of differentiation are rarely used, so that the limitations of the
calculational algorithm are of little real moment \textendash{} and the
override option is always available for such cases.
+calculational algorithm are of little real moment  and the override
+option is always available for such cases.
\subsection{Parentheses around multicharacter variables}
@@ 784,40 +877,42 @@
\section{Changing defaults; variant forms\label{sec:Changingdefaults}}
\begin{wraptable}[22]{o}{0.5\columnwidth}%
\vspace{2.5ex}
\caption{{\small{}Defaults (ordinary derivatives})\label{tab:Ordinaryderivatives}}
+\vspace{4.5ex}
+ \caption{{\small{}Defaults (ordinary derivatives})\label{tab:Ordinaryderivatives}}
\centering{}\abovetopsep=.5ex{\small{}}%
+\abovetopsep=.5ex{}%
\begin{tabular}{lr}
\toprule
{\small{}key} & {\small{}default}\tabularnewline
+{\small{}key} & {\small{}default}\tabularnewline
\midrule
{\small{}opsymbol } & \texttt{\small{}d}\tabularnewline
{\small{}opsymbolalt} & \texttt{\small{}= opsymbol}\tabularnewline
{\small{}opordersep } & \texttt{\small{}1 mu}\tabularnewline
{\small{}{*}opleft } & \texttt{\small{}false}\tabularnewline
{\small{}{*}italicnudge} & \texttt{\small{}3 mu}\tabularnewline
{\small{}{*}/opwrap} & \texttt{\small{}true}\tabularnewline
{\small{}longvarwrap } & \texttt{\small{}d(v)}\tabularnewline
{\small{}denomtermsep} & \texttt{\small{}2 mu}\tabularnewline
{\small{}/denomtermsep } & \texttt{\small{}1 mu}\tabularnewline
{\small{}leftdelim} & \texttt{\small{}\textbackslash left .}\tabularnewline
{\small{}rightdelim} & \texttt{\small{}\textbackslash right }\tabularnewline
{\small{}elbowroom} & \texttt{\small{}0 mu}\tabularnewline
{\small{}subscrnudge } & \texttt{\small{}0 mu}\tabularnewline
{\small{}/leftdelim} & \texttt{\small{}(}\tabularnewline
{\small{}/rightdelim } & \texttt{\small{})}\tabularnewline
{\small{}/elbowroom} & \texttt{\small{}0 mu}\tabularnewline
{\small{}/subscrnudge } & \texttt{\small{}0 mu}\tabularnewline
+{\small{}opsymbol } & \texttt{\small{}d}\tabularnewline
+{\small{}opsymbolalt} & \texttt{\small{}= opsymbol}\tabularnewline
+{\small{}opordersep } & \texttt{\small{}1 mu}\tabularnewline
+{\small{}{*}opleft } & \texttt{\small{}false}\tabularnewline
+{\small{}{*}italicnudge} & \texttt{\small{}3 mu}\tabularnewline
+{\small{}{*}/opwrap} & \texttt{\small{}true}\tabularnewline
+{\small{}longvarwrap } & \texttt{\small{}d(v)}\tabularnewline
+{\small{}denomtermsep} & \texttt{\small{}2 mu}\tabularnewline
+{\small{}/denomtermsep } & \texttt{\small{}1 mu}\tabularnewline
+termsepadjust & \texttt{1 mu}\tabularnewline
+{\small{}leftdelim} & \texttt{\small{}\textbackslash left .}\tabularnewline
+{\small{}rightdelim} & \texttt{\small{}\textbackslash right }\tabularnewline
+{\small{}elbowroom} & \texttt{\small{}0 mu}\tabularnewline
+{\small{}subscrnudge } & \texttt{\small{}0 mu}\tabularnewline
+{\small{}/leftdelim} & \texttt{\small{}(}\tabularnewline
+{\small{}/rightdelim } & \texttt{\small{})}\tabularnewline
+{\small{}/elbowroom} & \texttt{\small{}0 mu}\tabularnewline
+{\small{}/subscrnudge } & \texttt{\small{}0 mu}\tabularnewline
\bottomrule
\end{tabular}{\small\par}\end{wraptable}%
+\end{tabular}\end{wraptable}%
+
To write the range of different examples displayed in the Rogues' Gallery
(Section~\ref{sec:Rogues'gallery}) I have had to make extensive use
of forms of derivative other than the default. Version 2 of \texttt{diffcoeff}
(as distinct from version 1) is built around the facilities offered by
the \texttt{xtemplate} package (included in the \LaTeX 3 bundle \texttt{l3packages)}.
These facilities are harnessed by means of a command, \texttt{\textbackslash diffdef},
and a further optional argument of the \texttt{\textbackslash diff} command.\texttt{ }
+of forms of derivative other than the default. \texttt{Diffcoeff} is built
+on the facilities offered by the \texttt{xtemplate} package (included in
+the \LaTeX 3 bundle \texttt{l3packages)}. These facilities are harnessed
+by means of a command, \texttt{\textbackslash diffdef}, and a further
+optional argument of the \texttt{\textbackslash diff} command.\texttt{ }
How a derivative is displayed in a document is determined by specifying
values in a `key = value' list. This is done with the \texttt{\textbackslash diffdef}
@@ 824,7 +919,7 @@
command, which also allows a name to be associated with the list. By using
that name as an argument in the \texttt{\textbackslash diff} command,
a derivative is formed shaped by those values. Examples will make the process
clear.
+clear.
\subsection{Default values: ordinary derivatives}
@@ 831,121 +926,141 @@
Table~\ref{tab:Ordinaryderivatives} lists the keys available for forming
derivatives and the default values\footnote{Note that a mu is a `math unit', 1/18 of an em in the math font used.}
they have been assigned. These default values have been chosen to coincide
with those relevant for \emph{ordinary} derivatives (apart from the keys
\texttt{denomtermsep} and \texttt{/denomtermsep} which are ignored
for ordinary derivatives but apply to the case of mixed partial derivatives
when there is more than one variable of differentiation.) Keys with an
opening slash, /, apply only to the slash form of the derivative; keys
with an opening asterisk, {*}, apply only when the differentiand is appended.
+with those relevant for \emph{ordinary} derivatives  apart from the
+keys \texttt{denomtermsep}, \texttt{/denomtermsep} and \texttt{termsepadjust
+}which are ignored for ordinary derivatives but apply to the case of mixed
+partial derivatives when there is more than one variable of differentiation.
+Keys with an opening slash, /, apply only to the slash form of the derivative;
+keys with an opening asterisk, {*}, apply only when the differentiand is
+appended.
Note that these settings are, in general, font dependent. The values given
are (in the author's opinion) appropriate for the default \LaTeX{} math
fonts, or latin modern fonts. There are also likely to be variations required
for whether a derivative is used in a displaystyle or textstyle or scriptstyle
expression. That matter is discussed below in Subsection~\ref{subsec:Textandscriptstyle}.
+fonts. There are also likely to be variations required for whether a derivative
+is used in a displaystyle or textstyle or scriptstyle expression. That
+matter is discussed below in Subsection~\ref{subsec:Textandscriptstyle}.
+All values specifying a space require the unit (\texttt{mu}) to be given;
+a number alone does not suffice.
\begin{description}
\item [{opsymbol}] the operator symbol; for ordinary derivatives, generally
one of \texttt{d} or \texttt{\textbackslash mathrm\{d\}}, \texttt{D} or
\texttt{\textbackslash mathrm\{D\}}, \texttt{\textbackslash delta} or
\texttt{\textbackslash Delta}; for partial derivatives \texttt{\textbackslash partial}
+\texttt{\textbackslash Delta}; for partial derivatives \texttt{\textbackslash partial};
+default = \texttt{d}
\item [{opsymbolalt}] if different from \textbf{opsymbol} then used in the
denominator while \textbf{opsymbol} is used in the numerator; otherwise
(and usually) defaults to \textbf{opsymbol}; e.g. for $\diff.nabla.{v^{i}}t$,
\texttt{opsymbol = \textbackslash nabla} and \texttt{opsymbolalt =
d}
+denominator while \textbf{opsymbol} is used in the numerator; e.g. for
+$\diff.nabla.{v^{i}}t$, \texttt{opsymbol = \textbackslash nabla} and
+\texttt{opsymbolalt = d}; otherwise (and usually) defaults to \textbf{opsymbol}
\item [{opordersep}] extra horizontal space added between the opsymbol and
the superscripted order of differentiation in higher order derivatives;
compare $d^{2}$ with $d^{\mkern1mu 2}$, $\partial^{2}$ with $\partial^{\mkern1mu 2}$
where the first symbol in each case has no extra space and the second has
an extra 1 mu
+an extra 1 mu; default = \texttt{1 mu}
\item [{{*}opleft}] a choice of \texttt{true} or \texttt{false} indicating
whether the opsymbol is leftaligned or not when the differentiand is
appended; generally it is centred; does not apply to slash forms of the
derivative
+derivative; default = \texttt{false}
\item [{{*}italicnudge}] if \textbf{{*}opleft} is \texttt{true}, makes an
italic adjustment in the numerator, so that the opsymbols in numerator
and denominator align in the same slanting column; for an upright \texttt{d}
this would be set to \texttt{0 mu}
+this would be set to \texttt{0 mu}; default = \texttt{3 mu}
\item [{{*}/opwrap}] a choice of \texttt{true} or \texttt{false} for slash
forms of the derivative when the differentiand is appended, dictating whether
the differential coefficient is wrapped in parentheses or not; the default
is \texttt{true}, as here: $\diffp*{F(x,y)}/x$
+the derivative is wrapped in parentheses, as here $\diffp*{F(x,y)}/x$,
+or not; default = \texttt{true}
\item [{longvarwrap}] to avoid ambiguity in higher order derivatives it may
be advisable to wrap multitoken variables of differentiation in parentheses;
the choices are
+default = \texttt{d(v)}; the choices are
\begin{description}
\item [{\texttt{dv}}] no wrapping, e.g. $dx_{i}^{2}$ or $d\frac{1}{\Theta}^{2}$,
$\partial x_{i}^{2}$ or $\partial\frac{1}{\Theta}^{2}$,
\item [{\texttt{d(v)}}] wrap the variable only, e.g. $d(x_{i})^{2}$ or $d(\frac{1}{\Theta})^{2}$,
$\partial(x_{i})^{2}$ or $\partial(\frac{1}{\Theta})^{2}$,
+$\partial(x_{i})^{2}$ or $\partial(\frac{1}{\Theta})^{2}$
\item [{\texttt{(dv)}}] wrap the opsymbol and variable, e.g. $(dx_{i})^{2}$
or $(d\frac{1}{\Theta})^{2}$, $(\partial x_{i})^{2}$ or $(\partial\frac{1}{\Theta})^{2}$
\end{description}
\item [{denomtermsep}] (mixed partial derivatives only) extra horizontal spacing
+\item [{denomtermsep}] (mixed partial derivatives only) horizontal spacing
inserted between the differentials in the denominator of a mixed partial
derivative
\item [{/denomtermsep}] (mixed partial derivatives only) extra horizontal
spacing inserted between the differentials in the denominator of a slashform
mixed partial derivative
+derivative to avoid a solid cluster like $\partial x\partial y\partial z$;
+with the default 2 mu this is $\dl.p.x\dl.p.2y\dl.p.2z$; default = \texttt{2
+mu}
+\item [{/denomtermsep}] (mixed partial derivatives only) horizontal spacing
+inserted between the differentials in the denominator of a slashform mixed
+partial derivative; because a slashform derivative is already spread out
+horizontally, the default spacing is less than for the \texttt{\textbackslash frac}
+form derivative; default = \texttt{1 mu}
+\item [{termsepadjust}] (mixed partial derivatives only) adjustment (i.e.
+reduction) to \textbf{(/)denomtermsep} when differentiation in a variable
+occurs to an order other than 1; if, e.g., $\dl.p.x^{2}\dl.p.1y\dl.p.2z$
+is the denominator of a mixed partial derivative in three variables, because
+of the superscript the spacing between $\partial x^{2}$ and $\partial y$
+is reduced by\textbf{ termsepadjust} from the spacing between $\partial y$
+and $\partial z$; default = \texttt{1 mu}
\item [{leftdelim}] the left member of a delimiter pair wrapping the derivative,
the right member of which is subscripted to indicate a point of evaluation
or variables held constant
+or variables held constant; default = \texttt{\textbackslash left .}
\item [{rightdelim}] the right member of a delimiter pair wrapping the derivative
and subscripted to indicate a point of evaluation or variables held constant
+and subscripted to indicate a point of evaluation or variables held constant;
+default = \texttt{\textbackslash right }
\item [{elbowroom}] adjustment to the whitespace between the left and right
delimiters and the enclosed derivative; negative values reduce the space
+delimiters and the enclosed derivative; negative values reduce the space;
+default = \texttt{0 mu}
\item [{subscrnudge}] horizontal adjustment of the subscript's placing relative
to the \textbf{rightdelim}iter, e.g., a negative value compensates for
the curving inwards of a large right parenthesis; may be font dependent
+the curving inwards of a large right parenthesis; may be font dependent;
+default = \texttt{0 mu}
\item [{/leftdelim}] for the slash form of derivative, the left member of
a delimiter pair wrapping the derivative and subscripted to indicate a
point of evaluation or variables held constant
+point of evaluation or variables held constant; default = \texttt{(}
\item [{/rightdelim}] for the slash form of derivative, the right member of
a delimiter pair wrapping the derivative, the right member of which is
subscripted to indicate a point of evaluation or variables held constant
+subscripted to indicate a point of evaluation or variables held constant;
+default = \texttt{)}
\item [{/elbowroom}] adjustment to the whitespace between the left and right
delimiters and the enclosed slashform derivative
+delimiters and the enclosed slashform derivative; default = \texttt{0
+mu}
\item [{/subscrnudge}] for the slash form of derivative, horizontal adjustment
of the subscript's placing relative to the /\textbf{rightdelim}iter;
may be font dependent
+may be font dependent; default = \texttt{0 mu}
\end{description}
\subsection{ISO defaults}
+You may not like the default settings that come with \texttt{diffcoeff}.
+The package does not follow ISO 800002  it does not use upright `d's
+nor does it wrap an ordinary differential coefficient in subscripted parentheses
+to indicate a point of evaluation. Both `defects' can be remedied by calling
+the package with the option \texttt{ISO}:\footnote{One can also use \texttt{ISO=true} to turn the option on and \texttt{ISO=false
+}to turn the option off. }
+\begin{lyxcode}
+\textbackslash usepackage{[}ISO{]}\{diffcoeff\}
+\end{lyxcode}
\begin{wraptable}[9]{o}{0.4\columnwidth}%
\centering{}\vspace{5ex}
\caption{{\small{}ISO default changes}\label{tab:ISOsettingchanges}}
\abovetopsep=.5ex%
+\centering{}\vspace{4ex}
+ \caption{{\small{}ISO default changes}\label{tab:ISOsettingchanges}}
+\abovetopsep=.5ex %
\begin{tabular}{lr}
\toprule
{\small{}key} & {\small{}default}\tabularnewline
+{\small{}key} & {\small{}default}\tabularnewline
\midrule
{\small{}opsymbol } & \texttt{\small{}\textbackslash mathrm\{d\}}\tabularnewline
{\small{}opordersep } & \texttt{\small{}0 mu}\tabularnewline
{\small{}leftdelim} & \texttt{\small{}\textbackslash left (}\tabularnewline
{\small{}rightdelim} & \texttt{\small{}\textbackslash right )}\tabularnewline
{\small{}subscrnudge } & \texttt{\small{}6 mu}\tabularnewline
+{\small{}opsymbol} & \texttt{\small{}\textbackslash mathrm\{d\}}\tabularnewline
+{\small{}opordersep} & \texttt{\small{}0 mu}\tabularnewline
+{\small{}leftdelim} & \texttt{\small{}\textbackslash left (}\tabularnewline
+{\small{}rightdelim} & \texttt{\small{}\textbackslash right )}\tabularnewline
+{\small{}subscrnudge} & \texttt{\small{}6 mu}\tabularnewline
\bottomrule
\end{tabular}\end{wraptable}%
\emph{ }You may not like the default settings that come with \texttt{diffcoeff}.
The package does not follow ISO 800002 \textendash{} it does not use upright
`d's nor does it wrap an ordinary differential coefficient in subscripted
parentheses to indicate a point of evaluation. Both `defects' can be
remedied by calling the package with the option \texttt{ISO}:\footnote{One can also use \texttt{ISO=true} to turn the option on and \texttt{ISO=false
}to turn the option off. }
\begin{lyxcode}
\textbackslash usepackage{[}ISO{]}\{diffcoeff\}
\end{lyxcode}
The uppercase is essential \textendash{} an option \texttt{iso} is not
recognised. The \texttt{ISO} option results in changes to the default settings
of Table~\ref{tab:Ordinaryderivatives} as listed in Table~\ref{tab:ISOsettingchanges}.
Any settings not mentioned in Table~\ref{tab:ISOsettingchanges} retain
the values presented in Table~\ref{tab:Ordinaryderivatives}. Note that
the subscript nudge figure specified here is \emph{not} part of the standard,
which makes no recommendation about the subscript's positioning. But: the
\texttt{6 mu} figure with a default or latin modern font gives a better
representation of what is displayed in the standard than a zero figure.
+The uppercase is essential  an option \texttt{iso} is not recognised.
+The \texttt{ISO} option results in changes to the default settings of Table~\ref{tab:Ordinaryderivatives}
+as listed in Table~\ref{tab:ISOsettingchanges}. Any settings not mentioned
+in Table~\ref{tab:ISOsettingchanges} retain the values presented in
+Table~\ref{tab:Ordinaryderivatives}. Note that the subscript nudge figure
+specified here is \emph{not} part of the standard, which makes no recommendation
+about the subscript's positioning. But: the \texttt{6 mu} figure with
+a default or latin modern font gives a better representation of what is
+displayed in the standard than a zero figure.
+
Because the `d' is upright with the \texttt{ISO} option, no extra space
is required between the symbol and the superscript in a higher order derivative.
Hence the zero value for the \texttt{opordersep}. ISO recommends subscripted
@@ 953,7 +1068,7 @@
in the table. Because a large right parenthesis (penultimate setting) bends
inwards, to the left, a negative value for the last entry ensures the subscript
does not become detached from the derivative, looking lost in a sea of
whitespace.
+whitespace.
Note that the \texttt{ISO} option will also produce upright `D's in derivatives
formed from `D'; see Subsection~\ref{subsec:DdeltaDelta} below.
@@ 961,26 +1076,24 @@
\subsection{Partial derivatives}
\begin{wraptable}{o}{0.4\columnwidth}%
\begin{centering}
\vspace{5ex}
\caption{{\small{}Default changes: partial derivatives}\label{tab:Partialderivdefaults}}
\abovetopsep=.5ex%
+\centering{}\vspace{4.5ex}
+ \caption{{\small{}Default changes: partial derivatives}\label{tab:Partialderivdefaults}}
+\abovetopsep=.5ex %
\begin{tabular}{lr}
\toprule
{\small{}key} & {\small{}default}\tabularnewline
+{\small{}key} & {\small{}default}\tabularnewline
\midrule
{\small{}opsymbol } & \texttt{\small{}\textbackslash partial}\tabularnewline
{\small{}leftdelim} & \texttt{\small{}\textbackslash left (}\tabularnewline
{\small{}rightdelim} & \texttt{\small{}\textbackslash right )}\tabularnewline
{\small{}subscrnudge } & \texttt{\small{}6 mu}\tabularnewline
+{\small{}opsymbol } & \texttt{\small{}\textbackslash partial}\tabularnewline
+{\small{}leftdelim} & \texttt{\small{}\textbackslash left (}\tabularnewline
+{\small{}rightdelim} & \texttt{\small{}\textbackslash right )}\tabularnewline
+{\small{}subscrnudge } & \texttt{\small{}6 mu}\tabularnewline
\bottomrule
\end{tabular}
\par\end{centering}
\end{wraptable}%
+\end{tabular}\end{wraptable}%
+
The default values given in Table~\ref{tab:Ordinaryderivatives}, when
they are relevant, apply to \emph{ordinary} derivatives. For partial derivatives,
the defaults are those of Table~\ref{tab:Partialderivdefaults}. All
other keys take ther default values listed in Table~\ref{tab:Ordinaryderivatives}.
+other keys take the default values listed in Table~\ref{tab:Ordinaryderivatives}.
The last three entries here are not an attempt at ISO compatibility but
reflect the use of subscripted parentheses with partial derivatives to
indicate variables held constant, for instance in the Maxwell relations
@@ 992,18 +1105,19 @@
\subsection{Setting your own defaults: \texttt{\textbackslash diffdef\label{subsec:diffdef}}}
Version 2 of the \texttt{diffcoeff} package provides a command, \texttt{\textbackslash diffdef},
that enables users to set their own defaults.\texttt{ }For example, if
you wish to use upright `d's but not follow the ISO's use of subscripted
parentheses to indicate a point of evaluation, enter in the preamble of
your document the command\vspace{2ex}
+Versions 2 and later of the \texttt{diffcoeff} package provide a command,
+\texttt{\textbackslash diffdef}, that enables users to set their own defaults.\texttt{ }For
+example, if you wish to use upright `d's but not follow the ISO's use of
+subscripted parentheses to indicate a point of evaluation, enter in the
+preamble of your document the command\vspace{2ex}
\begin{lyxcode}
+\noindent %
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{lyxcode}
\textbackslash diffdef~\{\}~~~
+\textbackslash diffdef~\{\}~~~~
\begin{lyxcode}
\{~~~~~
+\{~~~~~~
\begin{lyxcode}
opsymbol~~~~=~\textbackslash mathrm\{d\},~~~~
@@ 1018,7 +1132,7 @@
\noindent Since a list of settings, like this one, is a comma\emph{separated}
list, no comma is required for the last entry. That entry is a consequence
of the first: upright symbols do not require any extra separation between
the `d' and the superscript in a higher order derivative.
+the `d' and the superscript in a higher order derivative.
The other point to note is the empty pair of braces after the \texttt{\textbackslash diffdef}
command. \emph{They matter}. Their emptiness is what determines that it
@@ 1026,7 +1140,7 @@
then that content provides a \emph{name} for the particular set of values
in the following list. The \texttt{diffcoeff} package exploits this facility
to cope with the wide variety of forms displayed in the Rogues' Gallery
of Section~\ref{sec:Rogues'gallery}.
+of Section~\ref{sec:Rogues'gallery}.
\subsection{Variant forms}
@@ 1036,6 +1150,7 @@
is \emph{filled} provides one half of the means of doing this. I've given
the singleletter name \texttt{p} to the following settings:
+\noindent %
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{lyxcode}
\textbackslash diffdef~\{~p~\}
@@ 1053,7 +1168,7 @@
~~\}
\end{lyxcode}
%
\end{minipage}
+\end{minipage}
The second half of providing variant forms is to insert this name, \texttt{p},
between dots (periods, full stops) as the \emph{first} argument of the
@@ 1076,8 +1191,9 @@
The dotdelimited argument applies only to \texttt{\textbackslash diff}.
For example, to illustrate the uprightd form of derivative, without changing
the default mathitalic form (which I prefer), one might enter in the preamble
+the default mathitalic form (which I prefer), one might enter in the preamble
\begin{lyxcode}
+\noindent %
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{lyxcode}
\textbackslash diffdef~\{~up~\}~
@@ 1101,15 +1217,15 @@
is to add the name, between dots, to the \texttt{\textbackslash diff}
command:
\begin{example}
\textbackslash diff.up.yx $\Longrightarrow\quad{\displaystyle \diff.up.yx}.$
+\textbackslash diff.up.yx $\Longrightarrow\quad{\displaystyle \diff.up.yx}.$
\end{example}
\noindent Each variant derivative inherits all the default values that
it does not explicitly countermand. Thus a point of evaluation is indicated
by a vertical rule which is the \texttt{diffcoeff} default\footnote{\noindent But not the ISO recommendation.}:
+by a vertical rule which is the \texttt{diffcoeff} default\footnote{\noindent But not the ISO recommendation.}:
\begin{example}
\textbackslash diff.up.{*}\{\textbackslash frac\{F(x)\}\{G(x)\}\}x{[}x=1{]}
$\Longrightarrow\quad{\displaystyle \diff.up.*{\frac{F(x)}{G(x)}}x[x=1]}$
+\noindent \textbackslash diff.up.{*}\{\textbackslash frac\{F(x)\}\{G(x)\}\}x{[}x=1{]}
+$\Longrightarrow\quad{\displaystyle \diff.up.*{\frac{F(x)}{G(x)}}x[x=1]}$
\end{example}
\noindent Dotdelimited arguments must always be the \emph{first} argument
@@ 1119,30 +1235,31 @@
As another example, suppose for the subscripted indication of variables
held constant in a partial derivative that you want to see what things
look like if the subscript is \emph{not }nudged in towards the right parenthesis.
In that case define a variant form
+In that case define a variant form
\begin{lyxcode}
\textbackslash diffdef~\{~padrift~\}~\{~subscrnudge~=~0~mu~\}
\end{lyxcode}
I have attached a name, \texttt{padrift},\texttt{ }to this setting,
+I have attached a name, \texttt{padrift},\texttt{ }to this setting,
\begin{example}
\textbackslash diff.padrift.Fx{[}y{]} $\Longrightarrow{\displaystyle \diff.padrift.Fx[y]}$
\end{example}
\noindent since, to my eye, the subscript seems detached from the expression
it qualifies and `adrift in a sea of whitespace'. Is it perhaps a typo?
+it qualifies  is it perhaps a typo?  and `adrift in a sea of whitespace'.
This is to be compared with the default
\begin{example}
\textbackslash diffpFx{[}y{]} $\Longrightarrow{\displaystyle \diffp Fx[y]}$
+\noindent \textbackslash diffpFx{[}y{]} $\Longrightarrow{\displaystyle \diffp Fx[y]}$
\end{example}
\noindent where the subscript is tucked in close to the right parenthesis
and is clearly connected to it and the expression it delimits.
+and is clearly connected to it and the expression it delimits.
Some might want to distinguish notationally a point of evaluation for a
partial derivative from variables held constant, perhaps using a vertical
rule for the former and (the default) parentheses for the latter. It would
suffice then to add to the preamble
+suffice then to add to the preamble
\begin{lyxcode}
+\noindent %
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{lyxcode}
\textbackslash diffdef~\{~pvrule~\}~\{~opsymbol~=~\textbackslash partial~\}~
@@ 1150,7 +1267,7 @@
%
\end{minipage}
\end{lyxcode}
(or some other name of your choosing). This gives
+(or some other name of your choosing). This gives
\begin{example}
\textbackslash diff.pvrule.\{F(x,y)\}x{[}x=1{]}$\Longrightarrow{\displaystyle \diff.pvrule.{F(x,y)}x[x=1]}$
\end{example}
@@ 1165,8 +1282,9 @@
say \texttt{\textbackslash diffp ST{[}V{]}} displaying as $\diffp ST[V]$,
then some tweaking of settings is necessary: the subscript is obviously
too close to the right parenthesis and, to my eye, there is too much `elbowroom'
between the derivative and the enclosing parentheses:
+between the derivative and the enclosing parentheses. Hence define
+\noindent %
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{lyxcode}
\textbackslash diffdef~\{~ptxt~\}~
@@ 1192,17 +1310,15 @@
This gives, for the same example, \texttt{\textbackslash diff.ptxt.ST{[}V{]}}
displaying as $\diff.ptxt.ST[V]$, where the subscript is better positioned
and there is a better fit between parentheses and derivative. For a mixed
partial derivative, \texttt{\textbackslash diff.ptxt.\{F(x,y,z)\}\{x,y\}{[}z{]}}
displays now as $\diff.ptxt.{F(x,y,z)}{x,y}[z]$.
+and there is a better fit between parentheses and derivative.
\subsubsection{Derivatives from D, \textbackslash delta, \textbackslash Delta\label{subsec:DdeltaDelta}}
In addition to \texttt{\textbackslash diff.p.},\texttt{ diffcoeff} has
three further \emph{builtin} variant forms that are commonly used: \texttt{\textbackslash diff.D.},
+three other \emph{builtin} variant forms that are commonly used: \texttt{\textbackslash diff.D.},
\texttt{\textbackslash diff.delta.}, and \texttt{\textbackslash diff.Delta.},
corresponding to derivatives formed from $D$, $\delta$ and $\Delta$
respectively.
+respectively.
In fluid dynamics the \emph{material }or \emph{substantive} derivative
uses an uppercase $D$ in place of $d$. For example, the continuity equation
@@ 1210,7 +1326,7 @@
\begin{example}
\textbackslash diff.D.\{\textbackslash rho\}t=\textbackslash diffp\textbackslash rho
t + \textbackslash mathbf\{u\textbackslash cdot\}\textbackslash nabla\textbackslash rho
$\Longrightarrow{\displaystyle \diff.D.\rho t=\diffp\rho t+\mathbf{u\cdot}\nabla\rho}$
+$\Longrightarrow{\displaystyle \diff.D.\rho t=\diffp\rho t+\mathbf{u\cdot}\nabla\rho}$
\end{example}
\noindent where \texttt{\textbackslash diff.D.} produces the Dderivative.
@@ 1218,6 +1334,7 @@
that effect. Alternatively, \vspace{2ex}
\begin{lyxcode}
+\noindent %
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{lyxcode}
\textbackslash diffdef~\{~Up~\}~
@@ 1233,7 +1350,7 @@
%
\end{minipage}
\end{lyxcode}
\noindent provides a variant with upright `D's.
+\noindent provides a variant with upright `D's.
In introductory calculus texts the simple $\delta$derivative is used.
This is achieved with the \texttt{\textbackslash diff.delta.} command
@@ 1247,14 +1364,14 @@
Similarly, \texttt{\textbackslash diff.Delta.} forms a derivative from
$\Delta$:
\begin{example}
\textbackslash diff.Delta.y/x $\Longrightarrow{\displaystyle \diff.Delta.y/x,}$
+\textbackslash diff.Delta.y/x $\Longrightarrow{\displaystyle \diff.Delta.y/x,}$
\end{example}
\noindent where the slash form of the derivative is shown in this instance.
+\noindent where the slash form of the derivative is shown in this instance.
Higher order forms of these derivatives, points of evaluation, appending
the differentiand with a star argument, all follow exactly as for the `pure'
\texttt{\textbackslash diff} command.
+\texttt{\textbackslash diff} command.
\paragraph{The commands \textbackslash Diff, \textbackslash diffd, \textbackslash Diffd}
@@ 1267,7 +1384,7 @@
through commands equivalent to\footnote{In fact the actual commands in \texttt{diffcoeff.sty} use the syntax of
the \texttt{xparse} package, e.g. \texttt{\textbackslash NewDocumentCommand
\{ \textbackslash Diff \} \{ \} \{ }\textbackslash diff.D. \}, and similarly
for the others.}
+for the others.}
\begin{lyxcode}
\textbackslash newcommand\{\textbackslash Diff\}\{\textbackslash diff.D.\}
@@ 1291,7 +1408,7 @@
and \texttt{\textbackslash mkern} for example? The reason for making such
definitions is that they can be transferred from document to document.
For instance, definitions placed in the preamble can be copied to the preamble
of another document.
+of another document.
But that is hardly optimal. Instead, \texttt{diffcoeff} allows such definitions
to be placed in a text file with the the extension \texttt{.def} and a
@@ 1298,7 +1415,7 @@
name of your choosing. For the present document the file is called \texttt{diffcoeffdoc.def}
and has been placed in the same directory as \texttt{diffcoeff.tex}. To
use these definitions, the \texttt{diffcoeff} package is called with the
command
+command
\begin{lyxcode}
\textbackslash usepackage{[}deffile=diffcoeffdoc{]}\{diffcoeff\}
\end{lyxcode}
@@ 1310,10 +1427,10 @@
texmf tree.
\texttt{\vspace{2ex}
}
+ }
\noindent %
\noindent\fbox{\begin{minipage}[t]{1\columnwidth  2\fboxsep  2\fboxrule}%
+\noindent\fbox{\begin{minipage}[t]{1\linewidth  2\fboxsep  2\fboxrule}%
\textbf{Personal texmf tree? }
This is a directory for `waifs and strays' of the \TeX{} system that are
@@ 1335,25 +1452,26 @@
\noindent Provided your \LaTeX{} distribution knows about your personal
texmf tree, then a \texttt{.def} file placed within it, will be accessible
to all documents.
+to all documents.
\subsubsection{Structure of the \texttt{.def} file}
The best way to see what a \texttt{.def} file looks like is to view \texttt{diffcoeffdoc.def
}in a text editor.\footnote{This file should be in the same directory as \texttt{diffcoeff.pdf} and
\texttt{diffcoeff.tex} in your \LaTeX{} distribution.}
+\texttt{diffcoeff.tex} in your \LaTeX{} distribution.}
If you want your variant definitions to use defaults different from those
supplied with the \texttt{diffcoeff} package, then the first definition
in the \texttt{.def} file should be the one setting the new defaults, with
an \emph{empty} first argument to the \texttt{\textbackslash diffdef}
command:
+command:
\begin{lyxcode}
+\noindent %
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{lyxcode}
\textbackslash diffdef~\{\}~~~
+\textbackslash diffdef~\{\}~~~~
\begin{lyxcode}
\{~~~~~
+\{~~~~~~
\begin{lyxcode}
key1~=~value1,~~~~
@@ 1378,7 +1496,7 @@
\subsubsection{\texttt{diffcoeff.def}}
Note that if the \texttt{diffcoeff} package is invoked without an explicit
\texttt{deffile= <filename>} option statement, as here,
+\texttt{deffile= <filename>} option statement, as here,
\begin{lyxcode}
\textbackslash usepackage\{diffcoeff\}
\end{lyxcode}
@@ 1389,16 +1507,100 @@
tree (which I've put at \texttt{D:\textbackslash texmf\textbackslash}
on a Windows machine) the file \texttt{diffcoeff.def} is located in the
directory \texttt{D:\textbackslash texmf\textbackslash tex\textbackslash latex\textbackslash diffcoeff\textbackslash}.
(The backslashes are replaced by forward slashes on linux machines.) Variants
likely to be of value only to a specific document should be added to the
preamble of that document, or they can be added to \texttt{diffcoeff.def}
and that file saved to the document directory under a \emph{different}
name \textendash{} e.g. I've saved the variants required for the present
document under the name \texttt{diffcoeffdoc.def}. Many of these variants
were created solely to illustrate points in the present document and I
have no intention of using them in my own work. Consequently my \texttt{diffcoeff.def}
file is smaller, containing only a selection from \texttt{diffcoeffdoc.def}.
+(The backslashes are replaced by forward slashes on linux machines.)
+Variants likely to be of value only to a specific document should be added
+to the preamble of that document. Alternatively, they could be added to
+\texttt{diffcoeff.def} but that addedto file saved to the document directory
+under a \emph{different} name  e.g. I've saved the variants required
+for the present document under the name \texttt{diffcoeffdoc.def}. Many
+of these variants were created solely to illustrate points in the present
+document and I have no intention of using them in my own work. Consequently
+my \texttt{diffcoeff.def} file is smaller, containing only a selection
+from \texttt{diffcoeffdoc.def}.
+
+\section{Differentials in integrals, etc.}
+
+Forms like $dx$ occur not only in derivatives but also in other contexts,\footnote{I thank Sergio Callegari for drawing my attention to this rather obvious
+point, and its omission from previous versions of \texttt{diffcoeff}.} for example, the expression for a total differential like
+\[
+\dl P=\diffp Px\dl x+\diffp Py\dl y+\diffp Pz\dl z,
+\]
+or an integral like $\int\sin x\dl2x$, or a multivariable integral like
+\[
+\iiintop_{\infty}^{\infty}V(x,y,z)\dl3x\dl2y\dl2z.
+\]
+Surely we want the `d's in these expressions to correspond to their form
+(upright or math italic) in derivatives? If, for instance, the \texttt{ISO}
+package option has been set, one doesn't want to be writing \texttt{\textbackslash mathrm\{d\}}
+in every (or indeed any) integral. To this end, \texttt{diffcoeff} provides
+a command \texttt{\textbackslash dl} to write the `d' in a differential
+in a manner consistent with the default form used in derivatives. In the
+present document, the default form is mathitalic and so
+\begin{example}
+\textbackslash dl x $\Longrightarrow\dl x.$
+\end{example}
+
+
+\subsection{Options}
+
+There are two options available with the differential command.
+
+The first is the dotted name option discussed in Section~\ref{sec:Changingdefaults}.
+Thus, to illustrate a differential with an upright `d', write
+\begin{example}
+\textbackslash dl.up.x $\Longrightarrow\dl.up.x.$
+\end{example}
+
+\noindent This presumes that a variant derivative with upright `d's has
+been defined and the definition is available, either in the preamble or
+in an accessible \texttt{.def} file, as discussed in the previous section.
+Alternatively, if you have defined your default derivative to use upright
+`d's (perhaps with the \texttt{ISO} option) then \texttt{\textbackslash dl}
+alone will suffice to produce an upright `d'.
+
+Since the variant \texttt{\textbackslash diff.p.} is defined in \texttt{diffcoeff.sty}
+itself, \texttt{\textbackslash dl.p.} is always available and at 6 keystrokes
+offers a slightly shorter way of writing \texttt{\textbackslash partial}
+(8 keystrokes). But the only reason one might use this variant `in earnest'
+is because of the convenience offered by the second option to the \texttt{\textbackslash dl}
+command.
+
+This second option inserts spacing before the `d'. If \texttt{\textbackslash dl}
+is followed by a digit (0, 1, 2, ..., 9) it will insert a horizontal space
+of that number of mu before the `d'; (\texttt{\textbackslash dl0x} has
+the same effect as \texttt{\textbackslash dl x}.)\texttt{ }Thus, an alternative
+way of writing an example in Chapter~18 of \emph{The \TeX book} is
+\begin{example}
+\textbackslash dl x\textbackslash dl3y=r\textbackslash dl3r\textbackslash dl3\textbackslash theta
+$\Longrightarrow\dl x\dl3y=r\dl3r\dl3\theta.$
+\end{example}
+
+\noindent To my eye this is too much space; I prefer
+\begin{example}
+\noindent \textbackslash dl x\textbackslash dl2y=r\textbackslash dl2r\textbackslash dl2\textbackslash theta
+$\Longrightarrow\dl x\dl2y=r\dl2r\dl2\theta$
+\end{example}
+
+\noindent I used \texttt{\textbackslash dl3x\textbackslash dl2y\textbackslash dl2z}
+when writing the triple integral above, \emph{no} extra spacing when writing
+the total differential expression, since the differentials are already
+distinct from the preceding fraction forms $\diff.ptxt.Px$ etc., and \texttt{\textbackslash dl2x}
+when writing $\int\sin x\dl2x$.
+
+As remarked above, the \texttt{\textbackslash dl.p.} alternative to \texttt{\textbackslash partial
+}is unlikely to be of use except for a document, like the present one,
+illustrating various points of usage. Thus, to illustrate spacing in the
+denominator of a mixed partial derivative, I have earlier used \texttt{\textbackslash dl.p.x\textbackslash dl.p.2y\textbackslash dl.p.2z},
+and the variation to that spacing when a higherorder differentiation occurs:
+\begin{example}
+\textbackslash dl.p.x\textasciicircum 2\textbackslash dl.p.1y\textbackslash dl.p.2z
+$\Longrightarrow\dl.p.x^{2}\dl.p.1y\dl.p.2z.$
+\end{example}
+
+\noindent Note here that the spacing digit option \emph{follows} the dotdelimited
+name option.
+
\section{Rationale}
Version 1 of the \texttt{diffcoeff} package arose from a need to simplify
@@ 1413,11 +1615,11 @@
There are other packages which have commands for the derivative (e.g.,
\texttt{bropd}, \texttt{commath},\texttt{ esdiff}, \texttt{physymb}) but
none quite gave what I wanted \textendash{} although they probably cope
with most users' needs. \texttt{esdiff} came closest to what I was seeking
but failed when it came to combining algebraic and numeric orders of differentation
+none quite gave what I wanted  although they probably cope with most
+users' needs. \texttt{esdiff} came closest to what I was seeking but failed
+when it came to combining algebraic and numeric orders of differentation
in a mixed partial derivative (and made heavier use of braces than I would
like in that case too).
+like in that case too).
\subsection{\texttt{diffcoeff.sty}}
@@ 1424,18 +1626,18 @@
I have tried to make using \texttt{diffcoeff} intuitive. Looking at the
other packages mentioned, writing something like \texttt{\textbackslash diff{[}n{]}\{f\}\{x\}}
(which can be trimmed to \texttt{\textbackslash diff{[}n{]}fx} for singletoken
arguments) seems `natural' \textendash{} only \texttt{physymb} deviates
from the pattern.
+arguments) seems `natural'  only \texttt{physymb} deviates from the
+pattern.
\begin{itemize}
\item It seems consistent with this pattern to use a comma list for specifying
the orders of differentiation of the variables in a higher order mixed
partial derivative (and its suppression when all are of order 1)
+partial derivative (and its suppression when all are of order 1)
\item Having specified the orders, surely the program itself should calculate
the overall order? \texttt{esdiff} does this for numerical orders; \texttt{diffcoeff}
does this for both numeric and algebraic orders,
+does this for both numeric and algebraic orders,
\end{itemize}
\begin{example}
\textbackslash diffp{[}m(k+1),m+(k1){]}\{F(x,y,z)\}\{x,y,z\}
+\textbackslash diffp{[}m(k+1),m+(k1){]}\{F(x,y,z)\}\{x,y,z\}
$\Longrightarrow{\displaystyle \diffp[m(k+1),m+(k1)]{F(x,y,z)}{x,y,z}},$
\end{example}
@@ 1442,7 +1644,7 @@
\begin{itemize}
\item and where it fails, either to calculate at all or to present the result
in a preferred form, offers the orderoverride option:
+in a preferred form, offers the orderoverride option:
\end{itemize}
\begin{example}
\textbackslash diffp{[}m+(k+1),m+(k1){]}{[}2(m+k+1){]}\{F(x,y,z,w)\}\{x,y,z,w\}
@@ 1456,9 +1658,9 @@
are written by the user despite the higherorder differentiation in $x$
and $y$, and only the two inescapable brace pairs are required.
\item The use of a comma list for the second mandatory argument in a partial
derivative \textendash{} the list of variables \textendash{} makes differentiations
in super or subscripted symbols (as occurs prolifically in tensor calculus)
easier to both write and read by avoiding unnecessary brace pairs.
+derivative  the list of variables  makes differentiations in super
+or subscripted symbols (as occurs prolifically in tensor calculus) easier
+to both write and read by avoiding unnecessary brace pairs.
\end{itemize}
\begin{example}
\textbackslash diffp\{A\_i\}\{ x\textasciicircum j,x\textasciicircum k
@@ 1468,24 +1670,24 @@
\begin{itemize}
\item Should a point of evaluation or variables held constant be considered part
of the derivative? Thermodynamic usage was decisive here. The partial derivative
alone is ambiguous \textendash{} the parentheses and subscript are essential
to understand what is being stated:
+alone is ambiguous  the parentheses and subscript are essential to understand
+what is being stated:
\[
\diffp ST[V]
\]
Hence provision for these extra elements was included in the derivative
commands.
+commands.
\item Given the position of the subscripted symbol in the displayed derivative,
it's positioning as the \emph{final} argument in the derivative commands
feels inevitable.
+feels inevitable.
\item Version 1 of \texttt{diffcoeff} used braces for this argument to avoid
any possible confusion with a following mathematical expression. That use
of braces is now deprecated in \texttt{xparse}. Consequently version 2
of \texttt{diffcoeff} uses square brackets, conforming with familiar \LaTeX{}
practice. The only special remembering needed is avoidance of a space before
the argument \textendash{} and if it does slip in, it won't cause a \LaTeX{}
error. It will be treated as part of a following mathematical expression
and displayed as such.
+of braces is now deprecated in \texttt{xparse}. Consequently later versions
+of the package use square brackets, conforming with familiar \LaTeX{} practice.
+The only special remembering needed is avoidance of a space before the
+argument  and if it does slip in, it won't cause a \LaTeX{} error. It
+will be treated as part of a following mathematical expression and displayed
+as such.
\item The star option also prompted the question: is it needed? After all, one
can always leave the first mandatory argument empty and append the differentiand
`by hand'. But once the provision for points of evaluation or variables
@@ 1494,10 +1696,10 @@
for a variable held constant must wrap around the differential operator
\emph{and} differentiand. Once available, it provides a simple way of switching
between (and comparing) the appearance of differentiandinthenumerator
and differentiandappended.
+and differentiandappended.
\item The slash option was added to the derivative commands after seeing how
widely such forms are used in texts at all levels. The placement of the
slash, between the two mandatory arguments, seems moreorless selfevident.
+slash, between the two mandatory arguments, seems moreorless selfevident.
\item The final option added to \texttt{\textbackslash diff} (and not present
in version 1) was the dotdelimited name option. Once \texttt{xtemplate}
was used as the basis of the package this seemed the most straightforward
@@ 1504,11 +1706,11 @@
way of making available, ready to hand, the wealth of variants that \texttt{xtemplate}
makes possible. (It's just a pity that the second dot is needed, and a
singledot naming scheme can't be used, but \texttt{xparse} forces my hand
here.)
+here.)
\item Having added the dotdelimited name option, the use of a \texttt{.def}
file to store variants or preferred defaults is moreorless forced, otherwise
one is faced with making these definitions anew for each new document (or
locating a previous document and copying from that to the new one).
+locating a previous document and copying from that to the new one).
\item To handle possible differences between displaystyle and textstyle (and
scriptstyle) derivatives (see Subsection~\ref{subsec:Textandscriptstyle})
I considered using \TeX 's \texttt{\textbackslash mathchoice} command.
@@ 1520,6 +1722,51 @@
for textstyle use, and the rareness of such use, employing variants seemed
the way to go. It is the one adopted and avoids the computational burden
associated with the use of \texttt{\textbackslash mathchoice}.
+\item After version 2 of the package appeared on CTAN, it was pointed out to
+me that there was an issue of consistency between the form of `d' used
+in a derivative (upright or mathitalic) and the form used in an integral.
+I had overlooked this matter completely and in version 3 of the package
+remedied the omission with the differential command \texttt{\textbackslash dl}.
+A spacing option for \texttt{\textbackslash dl} was almost inevitable.
+The demands of writing the present document forced another, the dotdelimited
+name option.
\end{itemize}
+\section{Commands}
+\begin{description}
+\item [{\texttt{\textbackslash diff}}] options:
+\begin{enumerate}
+\item .\emph{name}. for the given settings
+\item {*} appenddifferentiand switch
+\item {[}\emph{order}{]} or {[}\emph{commalist of orders}{]} of differentiation
+\item {[}\emph{orderoverride}{]}
+\item \{\emph{differentiand}\} (mandatory)
+\item / slashform switch
+\item \{\emph{comma list of differentiation variables}\} (mandatory)
+\item {[}\emph{point of evaluation/variables held constant}{]}
+\item \{as for previous, but using braces\} (deprecated)
+\end{enumerate}
+\item [{\texttt{\textbackslash diffdef}}] options:
+\begin{enumerate}
+\item \{\emph{name}\}
+\item \{\emph{key=value comma list}\}
+\end{enumerate}
+\item [{\texttt{\textbackslash diffp}}] \texttt{= \textbackslash diff.p.}
+\item [{\texttt{\textbackslash dl}}] options:
+\begin{enumerate}
+\item .\emph{name}. (as for \texttt{\textbackslash diff})
+\item \emph{digit} (insert spacing of this number of mu before the `d')
+\end{enumerate}
+\item [{\texttt{\textbackslash negmu}}] insert a $1$ mu space
+\item [{\texttt{\textbackslash nilmu}}] insert a $0$ mu space
+\item [{\texttt{\textbackslash onemu}}] insert a $1$ mu space
+\item [{\texttt{\textbackslash twomu}}] insert a $2$ mu space
+\end{description}
+Deprecated:
+\begin{description}
+\item [{\texttt{\textbackslash Diff}}] preferred form: \texttt{\textbackslash diff.D.}
+\item [{\texttt{\textbackslash diffd}}] preferred form \texttt{\textbackslash diff.delta.}
+\item [{\texttt{\textbackslash Diffd}}] preferred form\texttt{ \textbackslash diff.Delta.}
+\end{description}
+
\end{document}
Modified: trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeffdoc.def
===================================================================
 trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeffdoc.def 20190101 22:50:26 UTC (rev 49570)
+++ trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeffdoc.def 20190101 22:50:44 UTC (rev 49571)
@@ 108,14 +108,13 @@
subscrnudge = 3 mu
}
% partial, scriptstyle
\diffdef { pscr }
+% partial, wide sep of terms
+\diffdef { pwide }
{
 opsymbol = \partial,
 opordersep = 0 mu ,
 denomtermsep = 0 mu ,
 leftdelim = \left ( ,
 rightdelim = \right ),
 subscrnudge = 3 mu
 }

+ opsymbol = \partial,
+ denomtermsep = 3 mu ,
+ /denomtermsep = 3 mu ,
+ leftdelim = \left ( ,
+ rightdelim = \right ),
+ subscrnudge = 6 mu
+ }
\ No newline at end of file
Modified: trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff.sty
===================================================================
 trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff.sty 20190101 22:50:26 UTC (rev 49570)
+++ trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff.sty 20190101 22:50:44 UTC (rev 49571)
@@ 9,7 +9,7 @@
%
\RequirePackage{expl3}
\RequirePackage{xparse,l3keys2e,xtemplate}
\ProvidesExplPackage {diffcoeff} {2018/12/05} {2.1}
+\ProvidesExplPackage {diffcoeff} {2019/01/01} {3}
{Write differential coefficients consistently and easily.}
%
\keys_define:nn { diffcoeff }
@@ 23,15 +23,9 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cs_generate_variant:Nn \tl_if_eq:nnTF { nV }
\tl_new:N \l__diffcoeff_op_tl
\tl_new:N \l__diffcoeff_op_alt_tl
\tl_new:N \l__diffcoeff_ldelim_tl
\tl_new:N \l__diffcoeff_rdelim_tl
\tl_new:N \l__diffcoeff_oporder_tl
\tl_new:N \l__diffcoeff_differentiand_tl
\tl_new:N \l__diffcoeff_type_tl
\tl_new:N \l__diffcoeff_order_spec_tl
\tl_new:N \l__diffcoeff_denom_tl
\tl_new:N \l__diffcoeff_tot_order_tl
\tl_new:N \l__diffcoeff_curr_num_tl
\tl_new:N \l__diffcoeff_curr_var_tl
@@ 50,7 +44,9 @@
\bool_new:N \l__diffcoeff_op_left_bool
\bool_new:N \l__diffcoeff_single_var_bool
\bool_new:N \l__diffcoeff_opwrap_bool
+\bool_new:N \l__diffcoeff_integ_bool
+\int_new:N \l__diffcoeff_vars_int
\int_new:N \l__diffcoeff_format_int
\int_new:N \l__diffcoeff_curr_tok_int
\int_new:N \l__diffcoeff_curr_state_int
@@ 57,20 +53,7 @@
\int_new:N \l__diffcoeff_nos_int
\int_new:N \l__diffcoeff_parenvar_int
\muskip_new:N \l__diffcoeff_oporder_muskip
\muskip_new:N \l__diffcoeff_opnudge_muskip
\muskip_new:N \l__diffcoeff_elbowrm_muskip
\muskip_new:N \l__diffcoeff_subnudge_muskip
\muskip_new:N \l__diffcoeff_varsep_muskip
\muskip_new:N \l_tmpc_muskip
\muskip_new:N \l_tmpd_muskip
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Derivatives
% #1 order spec(seqvar)
% #2 order override(tlvar)
% #3 differentiand(tlvar)
% #4 denominator(seqvar)
% #5 subscript(tlvar)
\DeclareObjectType { derivative } { 5 }
% defaults: ordinary deriv. values
@@ 84,9 +67,10 @@
*italicnudge : muskip = 3 mu ,
*/opwrap : boolean = true ,
longvarwrap : choice { dv, d(v), (dv) }
 = d(v) ,
+ = d(v) ,
denomtermsep : muskip = 2 mu ,
/denomtermsep : muskip = 1 mu ,
+ termsepadjust : muskip = 1 mu ,
leftdelim : tokenlist = \left . ,
rightdelim : tokenlist = \right ,
elbowroom : muskip = 0 mu ,
@@ 94,9 +78,11 @@
/leftdelim : tokenlist = ( ,
/rightdelim : tokenlist = ) ,
/elbowroom : muskip = 0 mu ,
 /subscrnudge : muskip = 0 mu
+ /subscrnudge : muskip = 0 mu
}

+% #1 order spec(seqvar); #2 order override(tlvar)
+% #3 differentiand(tlvar); #4 denominator(seqvar)
+% #5 subscript(tlvar)
\DeclareTemplateCode { derivative } { DERIV } { 5 }
{
opsymbol = \l__diffcoeff_op_tl ,
@@ 107,17 +93,18 @@
*italicnudge = \l__diffcoeff_opnudge_muskip ,
*/opwrap = \l__diffcoeff_opwrap_bool ,
longvarwrap = {
 dv = \cs_set_eq:NN \__diffcoeff_wrap_longvars:NN
 \__diffcoeff_wrap_none:NN,
 d(v) = \cs_set_eq:NN \__diffcoeff_wrap_longvars:NN
 \__diffcoeff_wrap_var:NN ,
 (dv) = \cs_set_eq:NN \__diffcoeff_wrap_longvars:NN
 \__diffcoeff_wrap_dvar:NN,
 unknown = \cs_set_eq:NN \__diffcoeff_wrap_longvars:NN
 \__diffcoeff_wrap_var:NN
+ dv = \cs_set:Npn \__diffcoeff_wrap_longvars:nn #1#2
+ { \l__diffcoeff_op_alt_tl {#2}^{#1} },
+ d(v) = \cs_set:Npn \__diffcoeff_wrap_longvars:nn #1#2
+ { \l__diffcoeff_op_alt_tl {(#2)}^{#1} },
+ (dv) = \cs_set:Npn \__diffcoeff_wrap_longvars:nn #1#2
+ { (\l__diffcoeff_op_alt_tl {#2)}^{#1} },
+ unknown = \cs_set:Npn \__diffcoeff_wrap_longvars:nn #1#2
+ { \l__diffcoeff_op_alt_tl {(#2)}^{#1} }
} ,
denomtermsep = \l__diffcoeff_varsep_muskip ,
/denomtermsep = \l_tmpb_muskip ,
+ termsepadjust = \l__diffcoeff_sep_adj_muskip ,
leftdelim = \l__diffcoeff_ldelim_tl ,
rightdelim = \l__diffcoeff_rdelim_tl ,
elbowroom = \l__diffcoeff_elbowrm_muskip ,
@@ 129,9 +116,13 @@
}
{
\AssignTemplateKeys
 \int_compare:nNnT { \l__diffcoeff_format_int } > { 1 }
 { \__diffcoeff_slash_vals: }
 \__diffcoeff_build:NNNNN #1#2#3#4#5
+
+ \bool_if:NF\l__diffcoeff_integ_bool
+ {
+ \int_compare:nNnT { \l__diffcoeff_format_int } > { 1 }
+ { \__diffcoeff_slash_vals: }
+ \__diffcoeff_build:NNNNN #1#2#3#4#5
+ }
}
%%%%%%%%%%
\cs_new:Npn \__diffcoeff_slash_vals:
@@ 150,9 +141,13 @@
\exp_args:NV\tl_if_novalue:nF #5
{ \l__diffcoeff_ldelim_tl \mkern \l__diffcoeff_elbowrm_muskip }
\bool_if:NTF \l__diffcoeff_single_var_bool
 { \__diffcoeff_single:NNN #2 #3 #4 }
{
 \seq_mapthread_function:NNN #1 #4 \__diffcoeff_map_orders:nn
+ \tl_set:Nx \l_tmpa_tl { \seq_use:Nn #4 { , } }
+ \__diffcoeff_single:NNN #2 #3 \l_tmpa_tl
+ }
+ {
+ \int_zero:N \l_tmpa_int
+ \seq_mapthread_function:NNN #1 #4 \__diffcoeff_map_orders:nn
\__diffcoeff_mixed:NNN #2 #3 \l__diffcoeff_denom_seq
}
\exp_args:NV\tl_if_novalue:nF #5
@@ 166,8 +161,8 @@
}
}
%%%%%%%%%%%%%%%%%%%%
% (ptl) form denom from #1 orders, & #2 vars, seqs
\cs_new:Npn \__diffcoeff_map_orders:nn #1#2
+% (ptl) form denom from #1 orders seq & #2 vars seq
+\cs_new_protected:Npn \__diffcoeff_map_orders:nn #1#2
{
\tl_if_eq:nnTF { #1 } { 1 }
{ \seq_put_right:Nn \l__diffcoeff_denom_seq { \l__diffcoeff_op_alt_tl #2 } }
@@ 178,12 +173,12 @@
{ \l__diffcoeff_op_alt_tl #2^{ #1 } }
}
{
 \seq_put_right:Nx \l__diffcoeff_denom_seq
 { \__diffcoeff_wrap_longvars:NN { #1 } { #2 } }
+ \seq_put_right:Nn \l__diffcoeff_denom_seq
+ { \__diffcoeff_wrap_longvars:nn { #1\vphantom{)} } { #2 } }
}
}
}
% #1 order(tlvar) ; #2 diff'iand(tlvar); % #3 denom(tlvar)
+% #1 order(tlvar) ; #2 diff'iand(tlvar); #3 denom(tlvar)
\cs_new:Npn \__diffcoeff_single:NNN #1#2#3
{
\__diffcoeff_numer:N { #1 }
@@ 192,19 +187,35 @@
\l__diffcoeff_differentiand_tl
{ \__diffcoeff_denom_single:NN #1 #3 }
}
% #1 total order
% #2 differentiand
% #3 denominator seq
\cs_new:Npn \__diffcoeff_mixed:NNN #1#2#3
+% #1 total order; #2 differentiand; #3 denom seq
+\cs_new_protected:Npn \__diffcoeff_mixed:NNN #1#2#3
{
\__diffcoeff_numer:N #1
\__diffcoeff_form_deriv:NNn
\l__diffcoeff_oporder_tl
\l__diffcoeff_differentiand_tl
 { \seq_use:Nn #3 { \mskip \l__diffcoeff_varsep_muskip } }
+ { \__diffcoeff_denom_sep:N #3 }
}
+\cs_new:Npn \__diffcoeff_denom_sep:N #1
+ {
+ \int_zero:N \l_tmpa_int
+ \seq_map_inline:Nn #1
+ {
+ \int_incr:N \l_tmpa_int ##1
+ \int_compare:nNnT { \l_tmpa_int } < { \l__diffcoeff_vars_int }
+ {
+ \seq_pop:NN \l__diffcoeff_orders_seq \l_tmpa_tl
+ \str_if_eq:VnTF \l_tmpa_tl { 1 }
+ { \mkern \l__diffcoeff_varsep_muskip }
+ {
+ \mkern \muskip_eval:n { \l__diffcoeff_varsep_muskip +
+ \l__diffcoeff_sep_adj_muskip }
+ }
+ }
+ }
+ }
% #1(tl) total order
\cs_new:Npn \__diffcoeff_numer:N #1
+\cs_new_protected:Npn \__diffcoeff_numer:N #1
{
\bool_if:NTF \l__diffcoeff_op_left_bool
{
@@ 222,7 +233,7 @@
{ \tl_put_right:Nn \l__diffcoeff_oporder_tl { \hfill } }
}
% #1 order; #2 var
\cs_new:Npn \__diffcoeff_denom_single:NN #1#2
+\cs_new_protected:Npn \__diffcoeff_denom_single:NN #1#2
{
\tl_if_eq:nVTF { 1 } #1
{ \l__diffcoeff_op_alt_tl #2 }
@@ 229,16 +240,9 @@
{
\int_compare:nNnTF { \tl_count:N #2 } = { 1 }
{ \l__diffcoeff_op_alt_tl #2^{ #1 } }
 { \__diffcoeff_wrap_longvars:NN #1 #2 }
+ { \__diffcoeff_wrap_longvars:nn { #1\vphantom) } { #2 } }
}
}
\cs_new:Npn \__diffcoeff_wrap_none:NN #1#2
 { \l__diffcoeff_op_alt_tl #2^{#1} }
\cs_new:Npn \__diffcoeff_wrap_var:NN #1#2
 { \l__diffcoeff_op_alt_tl (#2)^{#1} }
\cs_new:Npn \__diffcoeff_wrap_dvar:NN #1#2
 { (\l__diffcoeff_op_alt_tl #2)^{#1} }

% #1 op+order; #2 diff'iand; #3 denom
% 0 frac; 1 frac append; 2 slash ; 3 slash append
\cs_new:Npn \__diffcoeff_form_deriv:NNn #1#2#3
@@ 252,112 +256,60 @@
{ 4 } { #1 / #3 { #2 } }
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% create new instances or edit existing ones
% #1 = name; #2 = keyvalue list
\NewDocumentCommand \diffdef { > { \TrimSpaces } m m }
 {
 \tl_if_empty:nTF { #1 }
 {
 \EditTemplateDefaults { derivative }
 { DERIV } { #2 }
 \EditInstance { derivative } { ord } { #2 }
 }
 {
 \IfInstanceExistTF { derivative } { ord.#1 }
 { \EditInstance { derivative } { ord.#1 } { #2 } }
 {
 \DeclareInstance { derivative } { ord.#1 }
 { DERIV } { #2 }
 }
 }
 }
% superseded relic from version 1
\NewDocumentCommand \diffset { o }
 { \msg_warning:nn { diffcoeff } { obsolete } }

% ordinary
\DeclareInstance { derivative } { ord } { DERIV } { }
\bool_if:NTF \g__diffcoeff_ISO_bool
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% differential
+% #1 = space before d (09); mu is assumed
+\NewDocumentCommand \dl { d.. m }
{
 \diffdef {}
 {
 opsymbol = \mathrm{d},
 opordersep = 0 mu ,
 leftdelim = \left ( ,
 rightdelim = \right ) ,
 subscrnudge = 6 mu
 }
 \diffdef { D } { opsymbol = \mathrm{D} }
+ \group_begin:
+ \bool_set_true:N \l__diffcoeff_integ_bool
+ \bool_set_true:N \l__diffcoeff_single_var_bool
+ \seq_set_from_clist:Nn \l__diffcoeff_orders_seq { 1 }
+ \tl_set:Nn \l__diffcoeff_tot_order_tl { 1 }
+ \IfValueT { #1 } { \tl_set:Nn \l__diffcoeff_type_tl { .#1 } }
+ \UseInstance { derivative } { ord\l__diffcoeff_type_tl }
+ \l__diffcoeff_orders_seq \l__diffcoeff_tot_order_tl
+ \c_empty_tl \c_empty_seq \c_empty_tl
+ \tl_if_in:NnTF \c__diffcoeff_digits_tl { #2 }
+ { \mkern #2 mu \l__diffcoeff_op_tl }
+ { \l__diffcoeff_op_tl #2 }
+ \group_end:
}
 { \diffdef { D } { opsymbol = D } }

% partial
\diffdef { p }
 {
 opsymbol = \partial ,
 leftdelim = \left ( ,
 rightdelim = \right ) ,
 subscrnudge = 6 mu
 }
\NewDocumentCommand \diffp { } { \diff.p. }

\diffdef { delta }
 {
 opsymbol = \delta ,
 opordersep = 0 mu
 }
\diffdef { Delta }
 {
 opsymbol = \Delta ,
 opordersep = 0 mu
 }
% for compatibility with version 1
\NewDocumentCommand \Diff { } { \diff.D. }
\NewDocumentCommand \diffd { } { \diff.delta. }
\NewDocumentCommand \Diffd { } { \diff.Delta. }

% userdefined variants
\file_if_exist:nT { \g__diffcoeff_def_tl.def }
 { \file_input:n { \g__diffcoeff_def_tl.def } }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\NewDocumentCommand \negmu {} { \mkern 1 mu }
+\NewDocumentCommand \nilmu {} { \mkern 0 mu }
+\NewDocumentCommand \onemu {} { \mkern 1 mu }
+\NewDocumentCommand \twomu {} { \mkern 2 mu }
% derivative
% #1(tl) = name of variant
% #2(*) = append differentiand boolean
% #3(clist) = orders of diff. in each var.
% #4(tl) = order override
% #5(tl) = differentiand
% #6 ( / ) = slash boolean
% #7(clist) = vars of diff. in order
% #8(tl) = pt of eval./vars held constant
% #9(tl) = #8 for backwards compatibility
+% #1(tl) = name of variant; #2(*)= append diff'iand boolean
+% #3(clist) = orders of diff. in each var.; #4(tl) = order override
+% #5(tl) = diff'iand; #6( / ) = slash boolean
+% #7(clist) = vars of diff.; #8(tl) = pt of eval./vars held const
+% #9(tl) = as #8 (for backwards compat)
\NewDocumentCommand \diff{ d.. s O{1} o m t/ m !O{#9} g }
{
\group_begin:
\tl_set:Nn \l__diffcoeff_differentiand_tl { #5 }
\tl_set:Nn \l__diffcoeff_trailing_tl { #8 }

 \tl_set:Nn \l__diffcoeff_denom_tl { #7 }
 \seq_set_split:Nnn \l__diffcoeff_vars_seq { , } { #7 }

+ \seq_set_from_clist:Nn \l__diffcoeff_vars_seq { #7 }
\seq_set_from_clist:Nn \l__diffcoeff_orders_seq { #3 }
 \tl_set:Nn \l__diffcoeff_order_spec_tl { [#3] }
+ \int_set:Nn \l__diffcoeff_vars_int
+ { \seq_count:N \l__diffcoeff_vars_seq }
+ \int_set:Nn \l_tmpb_int { \seq_count:N \l__diffcoeff_orders_seq }
 \int_set:Nn \l_tmpa_int { \seq_count:N \l__diffcoeff_vars_seq }
 \int_set:Nn \l_tmpb_int { \seq_count:N \l__diffcoeff_orders_seq }
 \int_compare:nNnTF { \l_tmpa_int } = { 1 }
+ \int_compare:nNnTF { \l__diffcoeff_vars_int } = { 1 }
{ \bool_set_true:N \l__diffcoeff_single_var_bool }
{
 \int_compare:nNnTF { \l_tmpa_int } < { \l_tmpb_int }
+ \int_compare:nNnTF { \l__diffcoeff_vars_int } < { \l_tmpb_int }
{
 \msg_error:nnxx { diffcoeff } { numbersconflict }
 { \int_use:N \l_tmpa_int } { \int_use:N \l_tmpb_int }
+ \msg_error:nnxxxx { diffcoeff } { numbersconflict }
+ { \int_use:N \l__diffcoeff_vars_int } { \int_use:N \l_tmpb_int }
+ { \seq_use:Nn \l__diffcoeff_orders_seq { , } }
+ { \seq_use:Nn \l__diffcoeff_vars_seq { , } }
}
{ % pad orders seq if nec.
\int_step_inline:nnnn
 { 1 + \l_tmpb_int } { 1 } { \l_tmpa_int }
+ { 1 + \l_tmpb_int } { 1 } { \l__diffcoeff_vars_int }
{ \seq_put_right:Nn \l__diffcoeff_orders_seq { 1 } }
 \tl_set:NV \l__diffcoeff_denom_tl \l__diffcoeff_vars_seq
}
}
% override/calc total order
@@ 381,7 +333,7 @@
\l__diffcoeff_orders_seq
\l__diffcoeff_tot_order_tl
\l__diffcoeff_differentiand_tl
 \l__diffcoeff_denom_tl
+ \l__diffcoeff_vars_seq
\l__diffcoeff_trailing_tl
\group_end:
} % end of \diff
@@ 414,7 +366,7 @@
{ \tl_clear:N \l__diffcoeff_nos_tl }
}
% #1 curr tok (tl); #2 <== curr tok ndx (int)
\cs_new:Npn \__diffcoeff_get_curr_ndx:nN #1#2
+\cs_new_protected:Npn \__diffcoeff_get_curr_ndx:nN #1#2
{
\tl_if_in:NnTF \c__diffcoeff_digits_tl { #1 }
{ \int_set:Nn #2 { 1 } } % digit
@@ 446,9 +398,9 @@
}
% transitions from the signed state
% #1(tl) curr tok; #2(int) 0, curr state; #3 curr tok ndx
\cs_new:Npn \__diffcoeff_sgn_transitions:nNN #1#2#3
+\cs_new_protected:Npn \__diffcoeff_sgn_transitions:nNN #1#2#3
{
 \int_case:nnTF { #3 }
+ \int_case:nnT { #3 }
{
{ 0 } % tok = s
{
@@ 472,27 +424,31 @@
}
}
{ \int_set_eq:NN #2 #3 }
 {
 \msg_error:nnxxx { diffcoeff } { orderspecification }
 { \l__diffcoeff_order_spec_tl } { #1 } { sign }
 }
}
% transitions from the numeric state
% #1 = curr. tok.; #2 = 0, curr. state; #3 curr. tok. index
\cs_new:Npn \__diffcoeff_num_transitions:nNN #1#2#3
+\cs_new_protected:Npn \__diffcoeff_num_transitions:nNN #1#2#3
{
 \int_case:nnTF { #3 }
+ \int_case:nnT { #3 }
{
{ 0 } % tok = s
{
 \__diffcoeff_store_num:NNN \l__diffcoeff_nos_tl
 \l__diffcoeff_paren_tl \l__diffcoeff_curr_num_tl
+ \tl_put_right:NV\l__diffcoeff_nos_tl
+ { \l__diffcoeff_paren_tl * \l__diffcoeff_curr_num_tl }
\tl_set:Nn \l__diffcoeff_curr_num_tl { #1 }
}
{ 1 } % tok = d
{ \tl_put_right:Nn \l__diffcoeff_curr_num_tl { #1 } }
{ 2 } % tok = v
 { \tl_set:Nn \l__diffcoeff_curr_var_tl { #1 } }
+ {
+ \tl_if_in:nnTF { ^ \times * / \div } { #1 }
+ {
+ \msg_error:nnxxx { diffcoeff } { orderspecification }
+ { \seq_use:Nn \l__diffcoeff_orders_seq { , } }
+ { #1 } { number }
+ }
+ { \tl_set:Nn \l__diffcoeff_curr_var_tl { #1 } }
+ }
{ 3 } % tok = (
{
\seq_push:NV \l__diffcoeff_paren_seq \l__diffcoeff_paren_tl
@@ 503,22 +459,18 @@
}
{ 4 } % tok = )
{
 \__diffcoeff_store_num:NNN \l__diffcoeff_nos_tl
 \l__diffcoeff_paren_tl \l__diffcoeff_curr_num_tl
+ \tl_put_right:NV \l__diffcoeff_nos_tl
+ { \l__diffcoeff_paren_tl * \l__diffcoeff_curr_num_tl }
}
}
{
\int_set_eq:NN #2 #3 }
 {
 \msg_error:nnxxx { diffcoeff } { orderspecification }
 { \l__diffcoeff_order_spec_tl } { #1 } { number }
 }
}
% transitions from the algebraic state
% #1 = curr. tok.; #2 = 2, curr. state; #3 curr. tok. index
\cs_new:Npn \__diffcoeff_alg_transitions:nNN #1#2#3
{
 \int_case:nnTF { #3 }
+ \int_case:nnT { #3 }
{
{ 0 } % tok = s
{
@@ 563,11 +515,6 @@
}
}
{ \int_set_eq:NN #2 #3 }
 {
 \msg_error:nnxxx { diffcoeff } { orderspecification }
 { \l__diffcoeff_order_spec_tl } { #1 }
 { variable }
 }
}
% transitions from the ) state
% #1 = curr. tok.; #2 = 4, curr. state; #3 curr. tok. index
@@ 581,64 +528,40 @@
}
{
\msg_error:nnxxx { diffcoeff } { orderspecification }
 { \l__diffcoeff_order_spec_tl } { #1 } { ) }
+ { \seq_use:Nn \l__diffcoeff_orders_seq { , } } { #1 } { ) }
}
}
% #1=store (tlvar); #2=num. coeff. (tlvar); #3=num.(tlvar)
\cs_new:Npn \__diffcoeff_store_num:NNN #1#2#3
 {
 \tl_put_right:NV #1 #2
 \tl_put_right:Nn #1 { * }
 \tl_put_right:NV #1 #3
 }
% #1 is var. (tlvar); #2 is num. (tlvar); #3 num. coeff. (tlvar)
\cs_new:Npn \__diffcoeff_store_var:NNN #1#2#3
{
\prop_get:NVNF \l__diffcoeff_vars_prop #1 \l_tmpa_tl
{ \tl_clear:N \l_tmpa_tl }
 \__diffcoeff_store_num:NNN \l_tmpa_tl #2 #3
+ \tl_put_right:NV \l_tmpa_tl { #2 * #3 }
\prop_put:NVV \l__diffcoeff_vars_prop #1 \l_tmpa_tl
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% #1 (prop) vars (keys) & coeffs (vals); #2 total order
\cs_new:Npn \__diffcoeff_evaluate:NN #1#2
 {
 \prop_map_inline:Nn #1
 {
 \int_compare:nNnF { \int_eval:n { ##2 } } = { 0 }
 {
 \seq_put_right:Nx \l_tmpa_seq
 { { +\int_eval:n { ##2 } } { ##1 } }
 }
 }
+% #1 (propv) key=var, val=coeff; #2 <= total order
+\cs_new_protected:Npn \__diffcoeff_evaluate:NN #1#2
+ {
+ \prop_map_inline:Nn #1 { \seq_put_left:Nn \l_tmpa_seq { ##1 } }
\seq_sort:Nn \l_tmpa_seq
{
 \int_compare:nNnTF
 { \tl_count:V { \use_ii:nn ##1 } } <
 { \tl_count:V { \use_ii:nn ##2 } }
 { \sort_return_swapped: }
 { \sort_return_same: }
+ \int_compare:nNnTF { \tl_count:n { ##1 } } < { \tl_count:n { ##2 } }
+ { \sort_return_same: } { \sort_return_swapped: }
}
 \tl_set:Nx \l_tmpa_tl { \seq_use:Nn \l_tmpa_seq { } }
 \seq_set_split:NnV \l_tmpa_seq {} \l_tmpa_tl
+ \seq_map_inline:Nn \l_tmpa_seq
+ {
+ \prop_pop:NnN #1 { ##1 } \l_tmpb_tl
+ \seq_put_right:Nx \l_tmpb_seq { \int_eval:n \l_tmpb_tl }
+ }
\tl_clear:N \l_tmpa_tl
 \seq_map_inline:Nn \l_tmpa_seq
 {
 \tl_if_eq:nnTF { +1 } { ##1 }
 { \tl_put_right:Nn \l_tmpa_tl {  } }
 {
 \tl_if_eq:nnTF { +1 } { ##1 }
 { \tl_put_right:Nn \l_tmpa_tl { + } }
 { \tl_put_right:Nn \l_tmpa_tl { ##1 } }
 }
 }
 \tl_replace_all:Nnn \l_tmpa_tl { + } {  }
+ \seq_mapthread_function:NNN \l_tmpa_seq \l_tmpb_seq
+ \__diffcoeff_tot_order:nn
\exp_args:NV \tl_if_head_eq_charcode:nNTF \l_tmpa_tl +
{
+ \tl_set:Nx \l_tmpb_tl { \tl_tail:N \l_tmpa_tl }
\int_compare:nNnT { \l__diffcoeff_nos_int } > { 0 }
{ \tl_put_left:Nn \l__diffcoeff_nos_tl { + } }
 \tl_set:Nx \l_tmpb_tl { \tl_tail:N \l_tmpa_tl }
 \tl_concat:NNN #2 \l_tmpb_tl \l__diffcoeff_nos_tl
+ \tl_concat:NNN #2 \l_tmpb_tl \l__diffcoeff_nos_tl
}
{
\int_compare:nNnTF { \l__diffcoeff_nos_int } > { 0 }
@@ 647,6 +570,92 @@
}
\tl_set_rescan:Nno #2 { } #2
}
+\cs_new:Npn \__diffcoeff_tot_order:nn #1#2
+ {
+ \int_compare:nNnTF { #2 } > { 0 }
+ {
+ \int_compare:nNnTF { #2 } = { 1 }
+ { \tl_put_left:Nn \l_tmpa_tl { +#1 } }
+ { \tl_put_left:Nn \l_tmpa_tl { +#2#1 } }
+ }
+ {
+ \int_compare:nNnT { #2 } < { 0 }
+ {
+ \int_compare:nNnTF { #2 } = { 1 }
+ { \tl_put_right:Nn \l_tmpa_tl { #1 } }
+ { \tl_put_right:Nn \l_tmpa_tl { #2#1 } }
+ }
+ }
+ }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% create new instances or edit existing ones
+% #1 = name; #2 = keyvalue list
+\NewDocumentCommand \diffdef { > { \TrimSpaces } m m }
+ {
+ \tl_if_empty:nTF { #1 }
+ {
+ \EditTemplateDefaults { derivative }
+ { DERIV } { #2 }
+ \EditInstance { derivative } { ord } { #2 }
+ }
+ {
+ \IfInstanceExistTF { derivative } { ord.#1 }
+ { \EditInstance { derivative } { ord.#1 } { #2 } }
+ {
+ \DeclareInstance { derivative } { ord.#1 }
+ { DERIV } { #2 }
+ }
+ }
+ }
+% relic from version 1
+\NewDocumentCommand \diffset { o }
+ { \msg_warning:nn { diffcoeff } { obsolete } }
+
+% ordinary & D
+\DeclareInstance { derivative } { ord } { DERIV } { }
+\bool_if:NTF \g__diffcoeff_ISO_bool
+ {
+ \diffdef {}
+ {
+ opsymbol = \mathrm{d},
+ opordersep = 0 mu ,
+ leftdelim = \left ( ,
+ rightdelim = \right ) ,
+ subscrnudge = 6 mu
+ }
+ \diffdef { D } { opsymbol = \mathrm{D} }
+ }
+ { \diffdef { D } { opsymbol = D } }
+
+% partial
+\diffdef { p }
+ {
+ opsymbol = \partial ,
+ leftdelim = \left ( ,
+ rightdelim = \right ) ,
+ subscrnudge = 6 mu
+ }
+\NewDocumentCommand \diffp { } { \diff.p. }
+
+% delta
+\diffdef { delta }
+ {
+ opsymbol = \delta ,
+ opordersep = 0 mu
+ }
+\diffdef { Delta }
+ {
+ opsymbol = \Delta ,
+ opordersep = 0 mu
+ }
+% for compatibility with version 1
+\NewDocumentCommand \Diff { } { \diff.D. }
+\NewDocumentCommand \diffd { } { \diff.delta. }
+\NewDocumentCommand \Diffd { } { \diff.Delta. }
+
+% userdefined
+\file_if_exist:nT { \g__diffcoeff_def_tl.def }
+ { \file_input:n { \g__diffcoeff_def_tl.def } }
%%%%%%%%%%%%%%%%%%%%
% Jacobian
\NewDocumentCommand \jacob { m t/ m }
@@ 657,23 +666,22 @@
{ \frac{ \partial(#1) } { \partial(#3) } }
\group_end:
}
%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%
% messages
\msg_new:nnn { diffcoeff } { orderspecification }
{
 Is~this~intended:~#3~followed~by~#2~in~the~order~
 specification~#1~\msg_line_context:?~Diffcoeff~cannot~calculate~
 the~overall~order~of~differentiation~in~this~case.~
 Use~the~orderoverride~option~to~enter~the~overall~order.
+ #3~followed~by~#2~in~the~order~specification~[#1]~\msg_line_context:.~
+ Diffcoeff~cannot~calculate~the~overall~order~of~differentiation~in~
+ this~case.~Use~the~orderoverride~option~to~enter~the~overall~order.
}
\msg_new:nnn { diffcoeff } { obsolete }
{
 Obsolete~command:~\diffset has~been~superseded~by~the~\diffdef\
+ Obsolete~command:~\diffset is~superseded~by~the~\diffdef\
command.~\msg_see_documentation_text:n { diffcoeff }
}
\msg_new:nnn { diffcoeff } { numbersconflict }
{
 #2~orders~specified~for~#1~variables;~\l__diffcoeff_order_spec_tl
 \ (\msg_line_context:)~for~variables~\l__diffcoeff_denom_tl.
+ #2~orders~of~differentiation~specified~for~#1~variables;~
+ orders~[#3]\ (\msg_line_context:)~for~variables~#4.
}
% end of file diffcoeff.sty
\ No newline at end of file
More information about the texlivecommits
mailing list