texlive[65523] Master/texmfdist: diffcoeff (11jan23)
commits+karl at tug.org
commits+karl at tug.org
Wed Jan 11 21:44:28 CET 2023
Revision: 65523
http://tug.org/svn/texlive?view=revision&revision=65523
Author: karl
Date: 20230111 21:44:28 +0100 (Wed, 11 Jan 2023)
Log Message:

diffcoeff (11jan23)
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
Added Paths:

trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff4.pdf
trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff4.tex
trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff4.sty
trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff5.def
Modified: trunk/Master/texmfdist/doc/latex/diffcoeff/README.txt
===================================================================
 trunk/Master/texmfdist/doc/latex/diffcoeff/README.txt 20230111 20:43:41 UTC (rev 65522)
+++ trunk/Master/texmfdist/doc/latex/diffcoeff/README.txt 20230111 20:44:28 UTC (rev 65523)
@@ 11,19 +11,26 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This is version 4.1 of diffcoeff.sty, and associated files,
and requires the LaTeX3 bundles l3kernel and l3packages. The
package eases the consistent writing of ordinary, partial
and other derivatives of arbitrary order. Version 4.1 resolves
an error arising from changes to xtemplate and some spacing
issues in derivative denominators.
+Version 5.0 of diffcoeff introduces many interface incompat
+ibilities with version 4. For that reason v5.0 and v4.2 are
+are packaged together. Version 4 can always be used to comp
+ile an older document by using the trailing optional argument
+in the \usepackage statement, e.g., \usepackage{diffcoeff}[=v4]
+The aim in both versions is to ease the writing of differential
+coefficients (derivatives) and related quantities (jacobians,
+differentials). Both versions require xtemplate from the
+l3packages bundle. Version 5 also requires the mleftright
+package.
Manifest
%%%%%%%%
README.txt this document
diffcoeff.sty LaTeX .sty file
diffcoeffdoc.def definition file of variant forms
 to be placed with the .sty file
diffcoeff.pdf documentation
diffcoeff.tex LaTeX source of documentation
+diffcoeff.sty LaTeX .sty file (current version, v5.0)
+diffcoeff4.sty LaTeX .sty file (older version, v4.2)
+diffcoeff5.def definition file of variant forms in v5
+diffcoeffdoc.def definition file of variant forms in v4
+diffcoeff.pdf documentation for current version, v5
+diffcoeff.tex LaTeX source of documentation for v5.
+diffcoeff4.pdf documentation for older version, v4
+diffcoeff4.tex LaTeX source of documentation for v4
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 20230111 20:43:41 UTC (rev 65522)
+++ trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff.tex 20230111 20:44:28 UTC (rev 65523)
@@ 1,6 +1,6 @@
%% LyX 2.4.0alpha3 created this file. For more info, see https://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
+\documentclass[english]{report}
\usepackage{lmodern}
\renewcommand{\sfdefault}{lmss}
\renewcommand{\ttdefault}{lmtt}
@@ 7,15 +7,20 @@
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[latin9]{inputenc}
+\setcounter{secnumdepth}{3}
+\setcounter{tocdepth}{3}
\synctex=1
\usepackage{color}
+\definecolor{shadecolor}{rgb}{1, 0.667969, 0.5}
\usepackage{babel}
+\usepackage{cprotect}
\usepackage{wrapfig}
\usepackage{booktabs}
\usepackage{calc}
+\usepackage{framed}
\usepackage{url}
\usepackage{amsmath}
\usepackage{amssymb}
+\usepackage{stmaryrd}
\usepackage{esint}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2,
@@ 33,24 +38,75 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\newenvironment{centred}%
 {\begin{center}\baselineskip=13pt\parskip=1pt}{\end{center}}
+ {\begin{center}\baselineskip=13pt\parskip=1pt }{\end{center}}
\newenvironment{example}%
{\begin{center}\ttfamily}{\end{center}}
\newenvironment{lyxcode}
 {\par\begin{list}{}{
 \setlength{\rightmargin}{\leftmargin}
 \setlength{\listparindent}{0pt}% needed for AMS classes
 \raggedright
 \setlength{\itemsep}{0pt}
 \setlength{\parsep}{0pt}
 \normalfont\ttfamily}%
 \item[]}
 {\end{list}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{babel}
\usepackage[deffile=diffcoeffdoc]{diffcoeff}
+\usepackage[deffile=diffcoeff5,spaced=1]{diffcoeff}
+% nabla in numer, d in denom
+\difdef { f, s } { n }
+ {
+ opsymbol = \nabla,
+ opsymbolalt = \mathrm{d}
+ }
+% no sub nudge (a sea of white space)
+\difdef { fp } { wsp }
+ { subnudge = 0 mu }
+% align op left; no italic nudge
+\difdef { f } { left0 }
+ {
+ *opsetleft = true,
+ *italicnudge = 0 mu
+ }
+% align op left; italic nudge
+\difdef { fp } { left }
+ {
+ opsymbol = \partial,
+ opordernudge = 1 mu,
+ *opsetleft = true,
+ *italicnudge = 3 mu
+ }
+% partial variant of \diff
+\difdef { f } { p }
+ {
+ opsymbol = \partial,
+ opordernudge = 1 mu
+ }
+% partial, 3mu sep of terms
+\difdef { fp, sp } { 3mu }
+ { multitermsep = 3 mu }
+% D jacobian
+\difdef { j } { D }
+ { opsymbol = D }
+% square bracket jabobian
+\difdef { j } { [ }
+ {
+ lvwrapLdelim = \onemu\mleft [,
+ lvwrapRdelim = \mright ]
+ }
+% mimicking the \Braket command
+% of the braket package
+\difdef{ s }{ bk }
+ {
+ slashtok = ,
+ opsymbol = ,
+ multitermsep = 3mu\middle\mskip3mu ,
+ outerLdelim=\left\langle ,
+ outerRdelim=\right\rangle
+ }
+\NewDocumentCommand \Braket { m }
+ {
+ \difoverride {\negmu}
+ \difs.bk.{}{#1}[]
+ }
+
+\ifdefined\showcaptionsetup
+ % Caption package is used. Advise subfig not to load it again.
+ \PassOptionsToPackage{caption=false}{subfig}
+\fi
+\usepackage{subfig}
\makeatother
\begin{document}
@@ 57,128 +113,206 @@
\title{\texttt{diffcoeff}~\\
a \LaTeX{} package to ease\texttt{ }the~\\
writing of differential coefficients \\
 Version 4.1}
+ Version 5.0}
\author{Andrew Parsloe\\
{\small (ajparsloe at gmail.com)}}
\maketitle
\begin{abstract}
\noindent This package eases the 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 in 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.
+\noindent \verb`diffcoeff` is a \LaTeX{} package to ease the 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
+in numerator or appended. Besides $\diff yx$, forms like $\difs yx$
+and $\difcp yx$ are also available, as well as derivatives built
+from $D$, $\Delta$, $\delta$, and configurable jacobians and differentials.
+Other notations like line elements ($\dl.+.{x,y,z}^{2}$) and brakets
+are easily produced.
+
+Version 5 of \verb`diffcoeff` more fully embraces the configurability
+offered by \verb`xtemplate` than earlier versions. Some incompatibilities
+have arisen, but all is not lost: version 4 is still available with
+the command
+
+\verb`\usepackage[<options>]{diffcoeff}[=v4]`
\end{abstract}
\tableofcontents{}
+\noindent\begin{minipage}[t]{1\columnwidth}%
+\begin{shaded}%
\section{Introduction}
+\subsubsection*{For users of version 4}
The \LaTeX{} package \texttt{diffcoeff.sty} is written in the expl3
language of \LaTeX 3\texttt{ }and requires the bundles \texttt{l3kernel}
which is now part of standard \LaTeX{} (since early 2020) and \texttt{l3packages}
(the latter for the \texttt{xparse}, \texttt{l3keys2e} and especially
\texttt{xtemplate} 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.
+The \verb`\diff` and \verb`\diffp` commands of version 4 of \verb`diffcoeff`
+remain, but lack the `spacing switch' \verb`!` (which on reflection
+was a mistake) and, more noticeably, the `slash switch' \verb`/`.
+Slashfraction derivatives are now created with the \verb`\difs`
+and \verb`\difsp` commands. New commands \verb`\difc` and \verb`\difcp`
+produce derivatives in `compact notation' like $\difc yx$ and $\difcp yx$.
+To avoid cluttering formulas with a second squarebracket delimited
+optional argument before the differentiand, the orderoverride option
+has been replaced by a new command \verb`\difoverride`. The order
+of differentiand and variable(s) of differentiation can now be reversed,
+when the differentiand is appended, by using a second star, e.g.,
+\verb`\diffp**`. The twoargument \verb`\diffdef` command of earlier
+versions has been replaced by the threeargument command \verb`\difdef`,
+the additional argument determining which one or more of the \verb`f`,
+\verb`s`, \verb`c`, \verb`fp`, \verb`sp` or \verb`cp` forms the
+defined variant applies to. The differential command \verb`\dl` has
+been rewritten and is now fully templateconfigurable (allowing easy
+writing of line elements like $\dl.+.{x,y,z}^{2}$), and the jacobian
+command \verb`\jacob` is also configurable. Indeed version 5 of \verb`diffcoeff`
+more fully embraces the configurability offered by the \verb`xtemplate`
+package than previous versions, bringing other notations  like
+those of the \verb`braket` package  within its compass.
\subsubsection*{Note on terminology}
+\subsubsection*{ISO defaults}
I refer throughout to the quantity or function being differentiated
as the \emph{differentiand} or \emph{derivand }(in line with \emph{integrand},
\emph{operand}, etc.).
+Unlike the default setup in version 4, the defaults in version 5
+of \verb`diffcoeff` are chosen to reflect ISO recommendations; see
+the standard ISO 800002. In particular this means upright `d's
+and subscripted parentheses enclosing a derivative to indicate a point
+of evaluation. This document is written with those defaults. For those
+(like the author) who prefer mathitalic `d's and a subscripted
+vertical rule to indicate a point of evaluation, the means of creating
+`variant forms' or changing the defaults is readily available; see
+\xA7\xA7\ref{sec:Variantforms}, \ref{sec:ChangingDefaults}.\end{shaded}%
+\end{minipage}
\subsubsection*{New in version 4.0}
+\tableofcontents{}
(See \xA7\ref{sec:Versioncomparison} for a comparison of versions.)
Version 4.0
\begin{enumerate}
\item enables the insertion of a small space before the differentiand, either
as the default behaviour (package option \verb`spaced`) or at explicit
request (argument \verb`!` of the \verb`\diff` command); see \xA7\ref{subsec:Spacingbeforederivand};
\item prevents the ligature $df$ that marred previous versions; this is
now rendered $\dl f$;
\item offers the document command \verb`\dlp` for the \emph{partial} differential;
see \xA7\ref{subsec:Partialdifferential};
\item no longer accepts \emph{the braced form} of the\emph{ }trailing optional
argument specifying a point of evaluation or (for partial derivatives)
variables held constant. This was a relic from version 1 of \texttt{diffcoeff},
and has been deprecated since version 2.
\end{enumerate}
+\chapter{Introduction}
\subsubsection*{New in version 4.1}
\begin{enumerate}
\item changes the code handling the \verb`longvarwrap` setting to avoid
a problem with a change in \verb`xtemplate` (see \url{https://tex.stackexchange.com/questions/646976/errorwithpackagediffcoeff})\footnote{Based on a suggestion from \noun{Joseph Wright}.};
\item prevents (hitherto overlooked) ligatures in the \emph{denominators}
of differential coefficients.
\end{enumerate}
+\verb`diffcoeff.sty` is written in the \verb`expl3` language of
+\LaTeX 3, now part of standard \LaTeX{} since February 2020. A \LaTeX{}
+distribution from or later than that date is assumed. The package
+also requires the packages \verb`xtemplate` (part of the \verb`l3packages`
+bundle) and \verb`mleftright`. The package is loaded in the usual
+way by entering
+\begin{verbatim}
+ \usepackage{diffcoeff}
+\end{verbatim}
+in the preamble of your document or, if package options are being
+used,\footnote{Angle brackets indicate possible user input (\emph{without} the angle
+brackets).}
+\begin{verbatim}
+ \usepackage[<options>]{diffcoeff}
+\end{verbatim}
+The interface of \verb`diffcoeff` with version 5 has changed from
+earlier versions. If you want the familiar behaviour of version 4,
+add to these commands a trailing optional argument like this,
+\begin{verbatim}
+ \usepackage[<options>]{diffcoeff}[=v4]
+\end{verbatim}
+(with no space after the `=' sign!). Of course you will not get
+the new features of version 5. Working with version 4 is described
+in the document \verb`diffcoeff4.pdf`.
\subsection{Package options}
+\section{Package options}
\label{subsec:Packageoptions}There are three package options, which
+\label{sec:Packageoptions}There are four package options, which
are entered in a commaseparated list in the optional argument of
the \texttt{\textbackslash usepackage} command.
+the \verb`\usepackage` command. The \emph{second} and \emph{fourth}
+are new with version 5 of \verb`diffcoeff`.
\begin{enumerate}
\item The first is a switch, \texttt{ISO}, which turns on formatting conforming
to ISO recommendations, principally upright `d's:
\begin{lyxcode}
\textbackslash usepackage{[}ISO{]}\{diffcoeff\}
\end{lyxcode}
The full effect of this option is disscussed in \xA7\ref{sec:Changingdefaults}.
\item The second is another switch, \texttt{spaced}, and \emph{is new with
version 4 }of \texttt{diffcoeff}. This switch ensures a small space
is inserted before the differentiand:
\begin{lyxcode}
\textbackslash usepackage{[}spaced{]}\{diffcoeff\}
\end{lyxcode}
This is discussed in \xA7\ref{subsec:Spacingbeforederivand}.
\item The third requires a filename \texttt{<filename>} for a file \texttt{<filename>.def}
containing definitions of variant forms of derivative:
\begin{lyxcode}
\textbackslash usepackage{[}deffile=<filename>{]}\{diffcoeff\}
\end{lyxcode}
This is discussed in \xA7\ref{subsec:The.deffile}. For the present
document, the call is
\begin{lyxcode}
\textbackslash usepackage{[}deffile=diffcoeffdoc{]}\{diffcoeff\}
\end{lyxcode}
+\item The first package option is the \verb`spaced` option which takes
+three values:
+\begin{enumerate}
+\item \verb`spaced=1` inserts a small space before the differentiand; this
+is the default so that entering \verb`spaced` is equivalent to \verb`spaced=1`;
+\item \verb`spaced=0` inserts no space before the differentiand; \verb`diffcoeff`
+is initialized to \verb`spaced=0` so that if the spaced option is
+not used \verb`spaced=0` is assumed;
+\item \verb`spaced=1` inserts a small space before the differentiand \emph{if
+it contains more than one token}, and no space otherwise. The present
+document uses \verb`spaced=1`.
\end{enumerate}
+This option is discussed in \xA7\ref{subsec:Spacingbeforederivand}.
+\item For the second package option, by entering \verb`mleftright` in the
+options list the command \verb`\mleftright` is automatically inserted
+in the preamble. The effect is to change all occurrences of \verb`\left`,
+\verb`\right` in the document to \verb`\mleft`, \verb`\mright`
+so that the spacing around scalable delimiters modified by \verb`\left`,
+\verb`\right` is reduced; see the box below and \xA7\ref{subsec:mleftright}.
+The present document does not use this package option.
+\item The third package option requires the \verb`<filename>` of a file
+with extension \verb`.def`, \verb`<filename>.def`, containing definitions
+of variant forms (see \xA7\ref{sec:Variantforms}) of derivative:
+\begin{verbatim}
+ \usepackage[deffile=<filename>]{diffcoeff}
+\end{verbatim}
+This is discussed in \xA7\ref{subsec:The.deffile}. The present document
+uses the package option \verb`deffile=diffcoeff5`.
+\item The fourth package option \verb`DIF` is a comma list of \emph{key=value}
+statements amending the builtin defaults for the `grandparent'
+template \verb`DIF`; see \xA7\ref{subsec:ChangingDIFdefaults}. The
+present document does not use this package option.
+\end{enumerate}
+\noindent\begin{minipage}[t]{1\columnwidth}%
+\begin{shaded}%
+To see the effect of the \verb`mleftright` package, consider the
+expression
+\begin{centred}
+\verb`\[ \ln \left(\frac xy\right),\quad\sin\left(x^2\right). \]`
+$\Longrightarrow$ \[ \ln \left(\frac xy\right),\quad\sin\left(x^2\right). \]
+\end{centred}
+in which there is significant whitespace before and after the parentheses.
+The package \verb`mleftright` enables this whitespace to be reduced
+by using \verb`\mleft`, \verb`\mright` in place of \verb`\left`,
+\verb`\right`:
+\begin{centred}
+\verb`\[ \ln \mleft(\frac xy\mright),\quad\sin\mleft(x^2\mright). \]`
+$\Longrightarrow$ \[ \ln \mleft(\frac xy\mright),\quad\sin\mleft(x^2\mright). \]
+\end{centred}
+\end{shaded}%
+\end{minipage}
+\noindent %
+\noindent\begin{minipage}[t]{1\columnwidth}%
+\begin{shaded}%
+If you put \verb`\mleftright` in the preamble, which is what the
+\verb`mleftright` package option does, then all occurrences of \verb`\left`,
+\verb`\right` in the document will be affected. \verb`\left`, \verb`\right`
+can be restored to their normal behaviour by the command \verb`\mleftrightrestore`.
+Rather than use \verb`\mleft`, \verb`\mright` explicitly, as in
+the example, the same effect can be obtained by using \verb`\left`,
+\verb`\right` and preceding the expression with the command \verb`\mleftright`:
+\begin{verbatim}
+ \mleftright
+ \[ \ln \left(\frac xy\right),\quad\sin \left(x^2\right). \]
+ \mleftrightrestore
+\end{verbatim}
+$\Longrightarrow$ \mleftright
+ \[ \ln \left(\frac xy\right),\quad\sin \left(x^2\right). \]
+ \mleftrightrestore \end{shaded}%
+\end{minipage}\medskip{}
+For the present document, the call is
+\begin{verbatim}
+ \usepackage[deffile=diffcoeff5,spaced=1]{diffcoeff}
+\end{verbatim}
+
\section{A Rogues' Gallery of derivatives}
\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'.

Multicharacter variables of differentiation unparenthesized:

+\label{sec:Rogues'gallery}Browsing through some (rather old) calculus
+textbooks and texts on statistical mechanics, relativity and classical
+mechanics I find the following choice examples of derivatives `disporting
+every which way'.
+\begin{itemize}
+\item 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}
+\diffp{\frac{\psi}{\Theta}}{\frac{1}{\Theta}},\quad\diffp{E/T}{1/T},\quad\diff{\ln f}{\ln x_{0}},\quad\diffp\psi{a_{i},\frac{1}{\Theta}},\quad\diffp{\mathcal{L}}{\eta_{,i}^{(r)}}.\label{eq:eg1}
\end{equation}
Multicharacter variables of differentiation parenthesized:
+\item Multicharacter variables of differentiation parenthesized in \emph{higherorder}
+derivatives, where the parentheses do not or (sometimes) do include
+the operator:
\begin{equation}
\diffp H{\displaystyle \diffp S{q_{k}}[]},\quad\diffp\varepsilon{(1/\Theta)}.\label{eq:eg2}
+\diffp[2]q{\frac{1}{\Theta}},\quad\diffp[2]q{1/\Theta},\quad\diffp[2]\varepsilon{a_{i}},\quad\diff.(dv).[2]{\phi^{i}(x^{i})}{x^{i}}.\label{eq:eg3}
\end{equation}
Higherorder derivatives where the parentheses do not or sometimes
do include the 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}
Should the $d$ or $\partial$ be included within the parentheses,
+Should the $\mathrm{d}$ or $\partial$ be included within the parentheses,
as in 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:
+\item 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}
+\diffp..\phi\varepsilon[\varepsilon=\varepsilon_{0}],\quad\diff..[2]\phi\varepsilon[\varepsilon=\varepsilon_{0}],\quad\diffp.].{b^{\beta}}{a^{\alpha}}[b=0],\quad\diff uv[v=0].\label{eq:eg4}
\end{equation}
ISO 800002 (item 2.11.13) favours the last of these  parentheses
 for ordinary derivatives. Presumably, partial derivatives should
@@ 185,1920 +319,2889 @@
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}
+\diffp*{\frac{P}{T}}U[V],\quad\diffp S{N_{2}}[U,V,N_{1}],\quad\difsp ST[V]\,.\label{eq:eg5}
\end{equation}

Other symbols besides $d$ and $\partial$ are used to denote derivativelike
quantities. From introductory calculus and from classical mechanics
and thermodynamics come $\delta$ and $\Delta$, from fluid mechanics
comes $D$:
+\item Other symbols besides $\mathrm{d}$ and $\partial$ are used to denote
+derivativelike quantities. From introductory calculus and from classical
+mechanics and thermodynamics come $\delta$ and $\Delta$, from fluid
+mechanics comes $\mathrm{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}
+\diff.gd.yx,\quad\diff.D'.\rho t,\quad\diff.gD.UT[V],\quad\difs.gD.UT,\quad\diff.gd.{\mathcal{L}}{\eta^{(r)}}.\label{eq:eg6}
\end{equation}

There are those, like the International Organization for Standardization
(ISO), who stipulate (or prefer) an upright `d' for their derivatives:
+\item There are those, like the International Organization for Standardization
+(ISO), who stipulate (or prefer) an upright $\mathrm{d}$ for their
+derivatives, and there are those (like the author, through sixty years
+of habit) who prefer a mathitalic $d$:
\begin{equation}
\diff.up.yx.\label{eq:eg11}
+\diff yx,\qquad\diff.d'.yx,\label{eq:eg11}
\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  but not always. In texts prior to the age
of computerised typesetting one will sometimes find the symbol pushed
to the \emph{left}:
+and of course also in slashfraction form $\difs yx$, $\difs.d'.yx$.
+Subscripted forms of derivative are also used  for example, $\difcp Fx$,
+or in the discussion of differential equations one sometimes comes
+across expressions like
+\[
+\difc.bD.[2]y{x}+2\difc.bD.y{x}4=0.
+\]
+\item When the differentiand is too big or awkward to sit in the numerator
+and is appended to the operator, the $\mathrm{d}$ or $\partial$
+in the numerator is 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}
+\diffp.left.*{\diffp.left.{x^{i^{*}}}{x^{k^{*}}}}{x^{l^{*}}},\quad\diff.left0.*{\left(\frac{m\mathbf{q}_{x}}{\sqrt{1q^{2}}}\right)}{t}.\label{eq:eg12}
\end{equation}
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.

Then there is the case when the operator in the numerator differs
+The keeneyed will note an italic adjustment with the first expression,
+so that the $\partial$s in the numerators are indented a little (to
+line up  more or less  in a slanting column with the $\partial$s
+in the denominators).
+\item Then there is the case when the operator in the numerator differs
from that in the denominator. For instance, in tensor calculus acceleration
is sometimes written
\[
\diff.nabla.{v^{i}}t=\diff{v^{i}}t+\Gamma_{k\hphantom{i}h}^{\hphantom{k}i}v^{h}\diff{y^{k}}t
+\diff.n.{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}$.
+\end{itemize}
+The \verb`diffcoeff` package has the generative power to cope with
+all these variations  see \xA7\ref{sec:Variantforms}  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 \xA7\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.
+\chapter{Syntax and use}
Finally and new with version 4 of \texttt{diffcoeff}, is the ability
to insert space before the differentiand, something that had to be
done explicitly by the user before. One way of thinking of a derivative
is as an operator $\diff{}x$ applied to a function $F(x)$ producing
another function $F'(x)$, a \emph{derived }function, the derivative.
Although the original function is included in the numerator of the
differential coefficient, a small space between the $d$ and $F$
feels natural to separate the thing operated on from the thing operating:
\[
F'(x)=\diff!{F(x)}x.
\]
\texttt{diffcoeff} can now produce such spaced derivatives, either
as the default behaviour or at explicit request; see \xA7\ref{subsec:Spacingbeforederivand}.
+\verb`diffcoeff` aims to ease the writing of derivatives (sometimes
+also called differential coefficients). There are longestablished
+shorthands available in a few cases: $\dot{x}$ and $\ddot{x}$ for
+the time derivatives of a function $x$ of time $t$; $y'$ and $y''$
+for the derivatives of a function $y$ (usually) of $x$. But mostly
+derivatives are expressed in fraction form and require more keystrokes
+to compose. It is here that \verb`diffcoeff` is aimed. It uses three
+pairs of commands: \verb`\diff` and \verb`\diffp` to write (upright)
+fraction forms of ordinary and partial derivatives like $\diff yx$,
+$\diffp yx$, generally intended for displaystyle environments; \verb`\difs`
+and \verb`\difsp` for slashfraction forms of ordinary and partial
+derivatives like $\difs yx$, $\difsp yx$, generally intended for
+textstyle environments; and \verb`\difc` and \verb`\difcp` to write
+compact forms of ordinary and partial derivatives like $\difc yx$
+and $\difcp yx$. (Of these, the `s' forms replace the slash argument
+for the \verb`\diff`, \verb`\diffp` commands in version 4 of \verb`diffcoeff`,
+and the `c' form is new to version 5.\cprotect\footnote{Suggested by a question on \TeX{} StackExchange: \url{https://tex.stackexchange.com/questions/652223/writeaderivativeoperatorwithoutdenominatorusingdiffcoef/652298#652298}})
\newpage{}
+\subsubsection*{Note}
\section{Ordinary derivatives \protect\label{sec:Ordinaryderivatives}}
+I refer throughout to the quantity or function being differentiated
+as the \emph{differentiand} or \emph{derivand }(in line with \emph{integrand},
+\emph{operand}, etc.) and shall sometimes use \verb`\difx` (resp.
+\verb`\difxp`) to make general statements about any or all of \verb`\diff`,
+\verb`\difs` or \verb`\difc` (resp.\verb`\diffp`, \verb`\difsp`,
+\verb`\difcp`).
Writing\textbf{ }\texttt{\textbackslash diff\{y\}\{x\}} will produce
$\diff{y}{x}$ in text style (i.e., placed between \texttt{\textbackslash (
\textbackslash )} or \texttt{\$ \$}) or
+\section{Syntax}
+
+All commands, \verb`\difx`, \verb`\difxp`, share the same syntax.
+With options present the syntax is
+\begin{verbatim}
+ \difx.name.*[orderspec]{differentiand}
+ {variable(s)}[pt of eval]
+
+ \difx.name.**[orderspec]{variable(s)}
+ {differentiand}[pt of eval]
+\end{verbatim}
+The syntax is identical for \verb`\difxp`. The seven arguments have
+the following meanings:
+\begin{itemize}
+\item \verb`name` (optional) A dotdelimited name to distinguish a variant
+form (nondefault form) of derivative; not discussed further until
+\xA7\ref{chap:Templatesdefaultsvariants} below, and specifically,
+\xA7\ref{sec:Variantforms}.
+\item \verb`*` (optional) The presence of a star (asterisk) signals: \emph{append}
+the differentiand; its absence means the differentiand appears in
+the numerator of an upright or slashfraction form derivative; no
+effect for compactform derivatives unless (see next) a second \verb`*`
+is present; see \xA7\ref{subsec:Appendingthedifferentiand}.
+\item \verb`*` (optional) The presence of a \emph{second} star signals
+that the argument specifying the variable(s) of differentiation comes
+\emph{before} the argument specifying the differentiand; this is sometimes
+convenient when a complicated or lengthy differentiand is appended;
+see \xA7\ref{subsec:Transposingtheargument}.
+\item \verb`orderspec` (optional) The order of differentiation when differentiating
+in a single variable, or a comma list of orders of differentiation
+for a mixed partial derivative; see \xA7\ref{subsec:Higherorderderivatives}
+and \xA7\ref{subsec:Mixedpartialderivatives}.
+\item \verb`differentiand` (mandatory) The function being differentiated.
+\item \verb`variable(s)` (mandatory) The variable of differentiation or
+a comma list of variables of differentiation (for a mixed partial
+derivative).
+\item \verb`pt of eval` (optional) Point of evaluation or, for partial
+derivatives, variable or variables held constant; \emph{no space}
+before the left square bracket; see \xA7\ref{subsec:Pointofevaluation}.
+\end{itemize}
+
+\section{General use}
+
+\label{sec:Generaluse}Writing \verb`\diff{y}{x}` will produce $\diff{y}{x}$
+in an inline math environment (i.e., placed between \verb`\( \)`
+or \verb`$ $`) or
\[
\diff{y}{x}
\]
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  the differentiand
or the variable of differentiation  is multitoken.
+in display style (placed, for instance, between {\ttfamily\verb`\[ \]`}
+). In fact \verb`\diff yx` (omitting the braces) will produce these
+results, with a saving on keystrokes. The braces are needed only when
+an argument  the variable of differentiation, or the differentiand
+ is multitoken:
+\begin{centred}
+\verb`\[ \diff{\ln x}x \]` $\Longrightarrow$ \[ \diff{\ln x}x\]
+\end{centred}
\begin{itemize}
\item If you want upright `$\mathrm{d}$'s as default, as ISO 800002 recommends,
rather than the mathitalic `$d$'s used here, this can easily be
done with the package option \texttt{ISO}; see \xA7\ref{sec:Changingdefaults}
on changing default settings.
+\item If you want mathitalic `$\mathrm{d}$'s as default, see \xA7\ref{sec:ChangingDefaults}
+on changing default settings. As noted earlier, upright `d's conform
+to the standard ISO 800002 and are used in this document.
\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
x\}/x} produces $\diff{\ln x}/x$. Braces are required for the numerator
in this case since it contains more than one token.
+form of derivative. That is achieved with the \verb`\difs` command:
+\verb`$ \difs yx $` produces $ \difs yx $. If you want still more
+compactness, you can use the \verb`\difc` (`c' for \emph{compact})
+command: \verb`$ \difc yx $` produces the form $ \difc yx $.
+Partial derivatives follow the same pattern as ordinary derivatives.
+The commands this time are \texttt{\textbackslash}\verb`diffp`,
+\verb`\difsp` and \verb`\difcp` for (upright) fraction, slash fraction
+and compact forms of partial derivative. Thus \verb`\diffp{F}{x}`,
+or \verb`\diffp Fx` with a saving on keystrokes, produce $\diffp Fx$
+in text style and
+\[
+\diffp{F}{x}
+\]
+in display style. (As for \verb`\diff`, the omission of braces is
+possible when dealing with a singletoken differentiand or differentiation
+variable.) For inline use, \verb`\difsp Fx`, displays as $\difsp Fx$
+and \verb`\difcp` displays as $\difcp Fx$. Given that \verb`\partial`
+takes 8 keystrokes to type, all forms\emph{ }economise on keystrokes.
+
\subsection{Spacing before the differentiand}
\label{subsec:Spacingbeforederivand}There are (at least) two different
ways in which we think of derivatives.\footnote{I thank \noun{Hans Sch\xFClein} for first raising this issue with me
and for subsequent thoughtful comments. } We are all familiar with the argument presented in elementary calculus
books where a curve is shown, and a point on the curve through which
a chord has been drawn. The chord is a side  the hypotenuse 
of a small rightangled triangle, the other sides having lengths $\delta x$
and $\delta y$ and being parallel to the coordinate axes. The slope
of the chord is $\diffd yx$. By drawing smaller and smaller chords
through the point, the ratio $\diffd yx$ approaches the slope of
the tangent to the curve at the point. We write
+ways in which we think of derivatives. We are all familiar with the
+argument presented in elementary calculus books where a curve is shown,
+and also a point on the curve through which a chord has been drawn.
+The chord is the hypotenuse of a small rightangled triangle, the
+other sides having lengths $\delta x$ and $\delta y$ and being parallel
+to the coordinate axes. The slope of the chord is $\diff.gd.yx$.
+By drawing smaller and smaller chords through the point, the ratio
+$\diff.gd.yx$ approaches the slope of the tangent to the curve at
+the point. We write
\[
\diff yx
\]
for the limit of $\diffd yx$. It is natural to think of $\dl y$
and $\dl x$ as tiny lengths, like $\delta y$ and $\delta x$, in
which case it would be quite wrong to insert space between the $d$
and the $y$ (let alone the $d$ and the $x$). $dy$ is a single
object, called a differential, and we write expressions like
\begin{centred}
\verb`\[ dy=\diff yx dx \]` $\Longrightarrow$
+for the limit of $\diff.gd.yx$. It is natural following this line
+of argument to think of $\dl y$ and $\dl x$ as tiny lengths, like
+$\delta y$ and $\delta x$, in which case it would be quite wrong
+to insert space between the $\mathrm{d}$ and the $y$ (let alone
+the $\mathrm{d}$ and the $x$). $\dl y$ is a single object, called
+a differential, and we write expressions like
\[
\dl y=\diff yx\dl x
\]
\end{centred}
and justly call the `fraction' in this expression a differential
coefficient.
+and justly call the fraction in this expression a \emph{differential
+coefficient}.
But there is another way of viewing differentiation: as a process
producing (or \emph{deriving}) one function, $f'(x)$, from another,
$f(x)$. Here the sense is of applying $\diff{}x$ to $f(x)$. Although
we include $f(x)$ in the numerator it is not attached to the $d$
and should be separated from it by a small space:
\begin{centred}
\verb`\[ f'(x)=\diff!{f(x)}x \]` $\Longrightarrow$
+producing (or \emph{deriving}) one function, $y'(x)$, from another,
+$y(x)$. Here the sense is of applying $\diff{}x$ to a quite separate
+object, the function $y(x)$. Although we include $y(x)$ in the numerator
+it is distinct from the $d$ and should be separated from it by a
+small space:\footnote{I thank \noun{Hans Sch\xFClein} for first raising this issue with me
+and for subsequent thoughtful comments.}
\[
f'(x)=\diff!{f(x)}x.
+y'(x)=\diff{y(x)}x.
\]
\end{centred}
Here the `fraction' on the right is another name for the derived
function $f'$ and is justly called the derivative of $f$. As you
can see a small space has been inserted between the $d$ and the $f$
in the numerator. By default the space is \texttt{3 mu} but with the
ability to stretch by \texttt{1 mu} or shrink by\texttt{ 2 mu}{\ttfamily\footnote{In \TeX speak, \texttt{3mu plus 1mu minus 2mu}. }}
as \TeX{} adjusts lines to fit on the page. (A `mu' is a `math unit'
and is one eighteenth of a quad.) To achieve this result I have inserted
an exclamation mark \verb`!` before the braces delimiting the differentiand.
+Here the fraction on the right is another name for the derived function
+$y'$ and is justly called the \emph{derivative} of $y$. As you can
+see a small space has been inserted between the $\mathrm{d}$ and
+the $y$ in the numerator. By default the space is \verb`3 mu` but
+with the ability to stretch by \verb`1 mu` or shrink by\texttt{ }\verb`2 mu`
+\texttt{ }\verb`3 mu plus 1 mu minus 2 mu`\texttt{ }in \TeX speak\footnote{Or even \texttt{3muplus1muminus2mu}.}
+ as \TeX{} adjusts lines to fit on the page. (A `mu' is a `math
+unit' and is one eighteenth of a quad.) The size of the space inserted
+by default can be easily changed; see \xA7\ref{sec:Variantforms} and
+\xA7\ref{sec:ChangingDefaults}.
\begin{itemize}
\item You may want all or most of your derivatives to have this space and
therefore will not want to be inserting exclamation marks in every
\texttt{\textbackslash diff} command. The \texttt{spaced} package
option switches the default behaviour to spaced derivatives (in which
case the \texttt{!} switch now creates an \emph{unspaced} derivative).
The size of the space inserted by default can be easily changed; see
\xA7\ref{sec:Changingdefaults}.
+\item You may want all or most of your derivatives to have this space before
+the derivand. The \verb`spaced=1` package option switches this behaviour
+on. However, I have used the \verb`spaced=1` option for the present
+document which inserts space only if the derivand contains \emph{more
+than one token}. Thus \verb`y(x)` will have space inserted before
+it, but \verb`y` alone will not. This (I think) maintains the distinction
+between a differential coefficient, thought of as a ratio of tiny
+lengths, and a derivative, thought of as an operator applied to a
+function. \verb`spaced=0` inserts no space before the derivand.
+\item In version 4 of \verb`diffcoeff` an argument was added to the \verb`\diff`
+command to manually introduce a space (the \verb`!` switch) before
+the differentiand. This was a mistake and has been removed. If you
+wish to adjust the spacing, there are plenty of (short) commands in
+\LaTeX{} and \verb`diffcoeff` to do the job; see immediately below,
+\xA7\ref{subsec:Spacingcommands}.
\end{itemize}
The present document uses the unspaced default. For backwards compatibility
(and perhaps because the author has done this for the last 60 years),
this is the \textquoteleft outofthebox\textquoteright{} default
that \texttt{diffcoeff} uses. Authors should make a habit of using
one form predominantly. (There is also the possibility which I haven't
emphasized of spacing multitoken differentiands and leaving singletoken
differentiands unspaced; see \xA7\ref{subsec:Afinalflourish}.)
+Slashform derivatives also allow space before the derivand. By default
+this is \verb`2 mu plus 1 mu minus 2 mu`, slightly reduced from the
+fractionform value to avoid visually detaching the initial `d'
+operator from the derivative as a whole. The value can be changed;
+see \xA7\ref{sec:Variantforms} and \xA7\ref{sec:ChangingDefaults}. For
+the present document, with \verb`spaced=1`, multitoken derivands
+have the space inserted, singletoken derivands do not:
+\begin{centred}
+\verb`$ \difs{\ln\sin x}x, \quad \difs st $` $\Longrightarrow$ $ \difs{\ln\sin x}x, \quad \difs st $.
+\end{centred}
+For \emph{compactform} derivatives the space before the derivand
+is \emph{always} inserted, irrespective of the setting of the \verb`spaced`
+package option, since the subscript precludes the entire symbol ever
+being viewed as a differential  it is always an operator operating
+on a function. The inserted space, \verb`1 mu plus 1 mu minus 1 mu`
+by default, can be changed should you wish; see \xA7\ref{sec:Variantforms}
+and \xA7\ref{sec:ChangingDefaults}:
+\begin{centred}
+\verb`$ \difc{\ln\sin x}x, \quad \difc st $` $\Longrightarrow$ $ \difc{\ln\sin x}x, \quad \difc st $.
+\end{centred}
+(The space is less for compact forms since the subscript already provides
+some visual separation.) The \verb`spaced` package option has the
+same effects on partial derivatives. Thus with \verb`spaced=1` or
+\verb`spaced=1`, \verb`3 mu plus 1 mu minus 2 mu` of space is inserted
+before the differentiand \verb`F(x,y)` in the first member of the
+following example, space of \verb`2 mu plus 1 mu minus 2 mu` in the
+second, and space of \verb`1 mu plus 1 mu minus 1 mu` in the third:
+\begin{centred}
+\verb`\[ \diffp{F(x,y)}x,\;\difsp{F(x,y)}x,\;\difcp{F(x,y)x, \]`
+\end{centred}
+$\Longrightarrow$ \[ \diffp{F(x,y)}x,\;\difsp{F(x,y)}x,\;\difcp{F(x,y)}x. \]
Slashform derivatives also allow space before the differentiand.
By default this has the same value as applied to the fraction form
of derivative (but can be changed; see \xA7\ref{sec:Changingdefaults}):
+\noindent But for singletoken differentiands in this document the
+space is not inserted for upright and slashform derivatives:
\begin{centred}
\verb`$ \diff!{\ln\sin x}/x $` $\Longrightarrow$ $ \diff!{\ln\sin x}/x$.
+\verb`\[ \diffp Fx,\quad \difsp Fx. \]` $\Longrightarrow$ \[ \diffp Fx,\quad \difsp Fx. \]
\end{centred}
The \verb`\diff` command has other optional arguments (e.g. to specify
the order of differentiation) but always the exclamation mark, if
used, immediately precedes the differentiand. It is the positioning
of the differentiand that it affects after all and its placement immediately
before that argument seems natural.
+If you always want the space present, use \verb`spaced=1`; if you
+never want the space for upright or slashform derivatives, or wish
+to insert such space always `by hand', use \verb`spaced=0`.
\subsubsection{Ligatures: }

Prior to v.4 of \texttt{diffcoeff}, \texttt{\textbackslash diff fx}
produced the tight pairing evident in
\[
\frac{df}{dx}.
\]
This was a bug. From version 4.0 of \texttt{diffcoeff}, such ligatures
are prevented: \verb`\[ \diff fx \]` $\Longrightarrow$ \[ \diff fx.\]

\subsubsection{Spacing commands}
\label{subsec:Spacingcommands}The \texttt{diffcoeff} package also
offers four simple spacing commands to finetune the display of derivatives
and of other quantities. These are
+\label{subsec:Spacingcommands}\LaTeX{} has its own explicit spacing
+commands. In particular \verb`\,` which is \verb`3 mu` (a thin space)
+and \verb`\!` which is \verb`3 mu` (a negative thin space) are
+convenient in math mode. The \verb`diffcoeff` package adds four simple
+spacing commands to `fill in (most of) the gap' between these two.
+These are
\begin{description}
\item [{\texttt{\textbackslash negmu}}] insert spacing of $1$ mu
\item [{\texttt{\textbackslash nilmu}}] insert spacing of $0$ mu (cf.
use of an empty brace pair \texttt{\textbf{\{\}}} )
\item [{\texttt{\textbackslash onemu}}] insert spacing of $1$ mu
\item [{\texttt{\textbackslash twomu}}] insert spacing of $2$ mu
+\item [{\texttt{\textbackslash negmu}}] insert spacing of \verb`1 mu`;
+\item [{\texttt{\textbackslash nilmu}}] insert spacing of \verb`0 mu`
+(cf. use of an empty brace pair \texttt{\textbf{\{\}}} );
+\item [{\texttt{\textbackslash onemu}}] insert spacing of \verb`1 mu`;
+\item [{\texttt{\textbackslash twomu}}] insert spacing of \verb`2 mu`.
\end{description}
+It is also worth recalling here the reduced spacing around scalable
+delimiters that results from using \verb`\mleft`, \verb`\mright`
+in place of \verb`\left`, \verb`\right`; see \xA7\ref{sec:Packageoptions}
+for the \verb`mleftright` package option, and the example at \xA7\ref{subsec:mleftright}.
\subsection{Appending the differentiand: \texttt{\textbackslash diff{*}}}
+\subsection{Higher order derivatives}
Some differentiands are too big or awkward to be placed neatly in
the numerator of a derivative and it is natural to append them to
a preceding differential operator. One way to do this is to leave
the numerator argument empty in the \texttt{\textbackslash diff}
command and follow the command with the 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:
+\label{subsec:Higherorderderivatives}An optional argument allows
+the order of differentiation to be specified. The order need not be
+a number; an algebraic order of differentiation is perfectly acceptable
+as is a mix of the two:
\begin{centred}
\verb`\[ \diff*{(ax^2+bx+c)}x \]` $\Longrightarrow$ \[\diff*{(ax^{2}+bx+c)}x\]
+\verb`\[ \diff[2]yx, \quad \diff[n+1]yx. \]` $\Longrightarrow$ \[ \diff[2]yx, \quad \diff[n+1]yx. \]
\end{centred}
With the \texttt{!} switch or \texttt{spaced} package option, additional
space (by default \texttt{3mu plus 1mu minus 2mu}) is inserted between
the operator and the differentiand:
+As mentioned, the braces can be and have been omitted around the $x$
+and $y$ since they are single tokens. The square brackets around
+the optional orderofdifferentiation argument are essential. In slash
+form,
\begin{centred}
\verb`\[ \diff*!{(ax^2+bx+c)}x \]` $\Longrightarrow$ \[\diff*!{(ax^{2}+bx+c)}x.\]
+\verb`$ \difs[2]yx, \quad \difs[n+1]yx $` $\Longrightarrow$ $ \difs[2]yx, \quad \difs[n+1]yx, $
\end{centred}
A virtue of using an asterisk to append the differentiand 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
 one in which a derivative forms the differentiand of another derivative:
+the latter of which is a bit of an eyesore. In compact form,
\begin{centred}
\verb`\[ \diff[2]yx = \diff*{\diff yx}x \]` $\Longrightarrow$ \[ \diff[2]yx=\diff*{\diff yx}x \]
+\verb`$ \difc[2]yx,\quad\difc[n+1]yx $` $\Longrightarrow$ $\difc[2]yx,\quad\difc[n+1]yx$.
\end{centred}
\noindent which is more elegant to my eye than
+Note that entering \verb`1` as the optional argument has no effect:
\begin{centred}
\noindent \verb`\[ \diff[2]yx = \diff!{\diff yx}x \]` $\Longrightarrow$
\[ \diff[2]yx=\diff!{\diff yx}x \]
+\verb`$ \diff[1]yx,\;\difs[1]yx,\;\difc[1]yx $` $\Longrightarrow$
+$\diff[1]yx,\;\difs[1]yx,\;\difc[1]yx $.
\end{centred}
\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.

In slash style with the star option, the polynomial example becomes
+For partial derivatives when differentiating in only one variable
+the pattern is the same:
\begin{centred}
\verb`\[ \diff*{(ax^2+bx+c)}/x \]` $\Longrightarrow$ \[ \diff*{(ax^2+bx+c)}/x \]
+\verb`\[ \diffp[2]yx, \quad \diffp[n+1]yx. \]` $\Longrightarrow$
+\[ \diffp[2]yx, \quad \diffp[n+1]yx. \]
\end{centred}
\noindent where the parentheses around the differential operator are
automatically inserted by \texttt{diffcoeff}. Like other elements
of automatic formatting, this is useradjustable; see \xA7\ref{sec:Changingdefaults}.

With the \texttt{!} switch or \texttt{spaced} package option, this
becomes
+For the slash forms,
\begin{centred}
\verb`\[ \diff*!{(ax^2+bx+c)}/x \]` $\Longrightarrow$ \[ \diff*!{(ax^2+bx+c)}/x \]
+\verb`$ \difsp[2]yx,\quad \difsp[n+1]yx $` $\Longrightarrow$ $ \difsp[2]yx,\quad \difsp[n+1]yx. $
\end{centred}
+and in compact form,
+\begin{centred}
+\verb`$ \difcp[2]yx,\quad \difcp[n+1]yx $` $\Longrightarrow$ $ \difcp[2]yx,\quad \difcp[n+1]yx. $
+\end{centred}
+For partial differentiation in more than one variable  socalled
+\emph{mixed} partial derivatives  see \xA7\ref{subsec:Mixedpartialderivatives}.
\subsection{Point of evaluation\protect\label{subsec:Pointofevaluation}}
+\subsection{Appending the differentiand}
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:\footnote{In v.1 of \texttt{diffcoeff}, this was bracedelimited. From v.2,
squarebrackets have been used and braces deprecated. From v.4, braces
are no longer accepted.}
+\label{subsec:Appendingthedifferentiand}Some differentiands are
+too big or awkward to be placed neatly in the numerator of a derivative
+and it is natural to \emph{append} them to a preceding differential
+operator. One could leave the numerator argument empty in the \verb`\diff`
+or \verb`\diffp` command and follow the command with the differentiand,
+but \verb`diffcoeff` offers a better way: star the \verb`\diff`
+or \verb`\diffp` command. This tells \verb`diffcoeff` to append
+the differentiand. Thus suppose the differentiand is a polynomial,
+say $ax^{2}+bx+c$. Add a star (an asterisk) to the \verb`\diff`
+command:
\begin{centred}
\verb`\[ \diff[2]yx[0] \]` $\Longrightarrow\quad{\displaystyle \diff[2]yx[0]}$
+\verb`\[ \diff*{(ax^2+bx+c)}x \]` $\Longrightarrow$ \[\diff*{(ax^{2}+bx+c)}x.\]
\end{centred}
\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.
\begin{itemize}
\item If you prefer to use subscripted \emph{parentheses} around the derivative
to indicate a point of evaluation  as ISO 800002 recommends 
then this can easily be done; see \xA7\ref{sec:Changingdefaults} on
changing default settings. Or, more simply, use the \texttt{ISO} package
option.
\end{itemize}
Because the slash form spreads the derivative out horizontally, parentheses
are preferred here to indicate a point of evaluation:
+Or, for a partial derivative, one might want to indicate in the differentiand
+all the variables on which it depends:
\begin{centred}
\verb`$ \diff{\ln sin x}/{sin x}[x=\pi/6] $` $\Longrightarrow$ $ \diff{\ln\sin x}/{\sin x}[x=\pi/6] $.
+\verb`\[ \diffp*[2]{\Phi(x,y,z)}x \]` $\Longrightarrow$ \[ \diffp*[2]{\Phi(x,y,z)}x. \]
\end{centred}
\noindent A vertical rule (or `pipe') can easily 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.
+A virtue of using an asterisk to append the differentiand 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.
\subsubsection{Superscripts}

It is easy to add a superscript to a derivative to indicate evaluation
at two points and the difference between the values:
+For instance, a second derivative is an iterated derivative  one
+in which a derivative forms the differentiand of another . Thus
\begin{centred}
\verb`\[ \diff {\sin x}x[0]^{\pi/2} \]` ${\displaystyle \Longrightarrow}$
\[ \diff{\sin x}x[0]^{\pi/2} \]
+\verb`\[ \diff[2]yx = \diff*{\diff yx}x \]` $\Longrightarrow$ \[ \diff[2]yx=\diff*{\diff yx}x .\]
\end{centred}
\noindent If you want only the superscript, no subscript, include
the final 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:
+\noindent This result is more elegant to my eye than what results
+when removing the asterisk,
\begin{centred}
\noindent \verb`$ \tfrac 12 m \diff x/t[]^2 $` $\Longrightarrow$
$\tfrac{1}{2}m\diff x/t[]^{2}$.
+\noindent \verb`\[ \diff[2]yx = \diff{\diff yx}x \]` $\Longrightarrow$
+\[ \diff[2]yx=\diff{\diff yx}x ,\]
\end{centred}
+\noindent although whether the \emph{meaning} is clearer is moot.
\subsection{Order of differentiation}
+Since the differentiand is appended \emph{by default} in compactform
+derivatives, starring such a derivative has no effect other than when
+a second asterisk is used to transpose the order of arguments.
An optional first argument allows the order of differentiation to
be specified. The order need not be a number; an algebraic order of
differentiation is perfectly acceptable as is a mix of the two:
+\subsubsection{Transposing the argument order}
+
+\label{subsec:Transposingtheargument}If a \emph{second} asterisk
+follows the first, the order of the arguments specifying the differentiand
+on the one hand and variable or variables of differentiation on the
+other are reversed. Thus it is clearer to the eye to write
\begin{centred}
\verb`\[ \diff[2]yx \]` $\Longrightarrow$ \[ \diff[2]yx,\]\verb`\[ \diff[n+1]yx \]`
$\Longrightarrow$ \[ \diff[n+1]yx.\]
+\verb`\[ \diff**x{(ax^2+bxy+cy^2)} \]` $\Longrightarrow$ \[\diff**x{(ax^2+bxy+cy^2)}\]
\end{centred}
As mentioned, the braces can be and have been omitted around the $x$
and $y$; the square brackets around the optional argument, the order
of differentiation, are essential. For a firstorder derivative, no
optional argument is needed and entering \texttt{1} as the optional
argument has no effect:
+than \verb`\[ \diff*{(ax^2+bxy+cy^2)}x \]`, where the eye has to
+search for the variable of differentiation. This is especially the
+case if the differentiand contains more than one variable and commands
+like \verb`\frac` or \verb`\sqrt` requiring braced arguments:
\begin{centred}
\verb`$ \diff[1]yx $` $\Longrightarrow$$\diff[1]yx$.
+\verb`\[ \diffp**x{\frac1{\sqrt{x^2y^2}}} \]` $\Longrightarrow$
+\[ \diffp**x{\frac1{\sqrt{x^2y^2}}} \]
\end{centred}
In slash style, \texttt{\$\textbackslash diff{[}2{]}y/x\$} produces
$\diff[2]y/x$, and \texttt{\$\textbackslash diff{[}n+1{]}y/x\$}
produces $\diff[n+1]y/x$.
+For compactform derivatives the initial, appending asterisk is always
+implicitly present. However, it must be \emph{explicitly} present
+for the second asterisk to take effect:
+\begin{centred}
+\verb`\[ \difcp yx,\quad \difcp*yx,\quad \difcp**yx \]` $\Longrightarrow$
+\[ \difcp yx,\quad \difcp*yx,\quad \difcp**yx \]
+\end{centred}
\subsection{Multicharacter variables of differentiation}
+\subsubsection{Operator parenthesizing}
Differentiating a function of a function may involve a multicharacter
differentiation variable. For instance, to differentiate $\ln\sin x$
in $x$ means forming the product
+In slash style with the star option, the polynomial example becomes
\begin{centred}
\verb`\[ \diff!{\ln\sin x}{\sin x}\diff{\sin x}x \]` $\Longrightarrow$
\[\diff!{\ln\sin x}{\sin x}\diff{\sin x}x.\]
+\verb`$ \difs*{(ax^2+bx+c)}x $` $\Longrightarrow$ $ \difs*{(ax^2+bx+c)}x $
\end{centred}
\noindent (Although I am mainly using unspaced differentiands in
this document, a space before the differentiand in the first of these
derivatives  the \verb`!` switch  improves the appearance of
the expression to my eye.)

Forming the \emph{second} derivative of $\ln\sin x$ will now involve
forming (among other quantities)
+\noindent where parentheses have been automatically inserted around
+the differential operator. Similarly, for slashstyle partial derivatives,
\begin{centred}
\noindent \verb`\[\diff[2]{\ln\sin x}{\sin x}\]` $\Longrightarrow$
\[\diff[2]{\ln\sin x}{\sin x}\]
+\verb`\( \difsp*[n]{f(x)}x \)` $\Longrightarrow$ \( \difsp*[n]{f(x)}x \)
\end{centred}
\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 $x^{2}$.
+\noindent parentheses are again inserted automatically around the
+differential operator. Like other elements of automatic formatting,
+this behaviour is useradjustable; see \xA7\xA7\ref{sec:Variantforms},
+\ref{sec:ChangingDefaults}.
The question is: are the parentheses in the right place? Logically,
no. 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)}.
\]
+\subsection{Point of evaluation/variables held constant}
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 \xA7\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 them yourself:
+\label{subsec:Pointofevaluation}If you want to specify a point
+at which a derivative is evaluated, append a final optional argument:
\begin{centred}
\verb`\[\diff {f(x)}{1/x}, \quad \diff {f(x)}{(1/x)}.\]` $\Longrightarrow$
\[ \diff {f(x)}{1/x}, \quad\diff {f(x)}{(1/x)}.\]
+\verb`\[ \diff[2]yx[0] \]` $\Longrightarrow$ \[ \diff[2]yx[0] \]
\end{centred}

\section{Partial derivatives\protect\label{sec:Partialderivatives}}

\noindent 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
+\noindent Note that there must be \emph{no space} before the left
+square bracket of the trailing argument, otherwise it will be treated
+as part of the wider mathematical expression of which the derivative
+is part and typeset as such. (This should not cause a \LaTeX{} error.)
+\begin{itemize}
+\item If you prefer to use subscripted \emph{square} brackets
\[
\diffp{F}{x}
+\diffp.].{F(x,y)}x[(0,0)]
\]
in display style. (As for \texttt{\textbackslash diff}, the omission
of braces is possible when the differentiand or the differentiation
variable are single tokens.) As for \texttt{\textbackslash diff},
there is a slash 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.
+or a subscripted vertical rule after the derivative
+\[
+\diffp..{F(x,y}x[(0,0)]
+\]
+to indicate a point of evaluation, then this can easily be done; see
+specifically \xA7\ref{subsec:variantPointofevaluation} (or \xA7\ref{sec:ChangingDefaults}
+on changing default settings). Parentheses are the ISO recommendation;
+see ISO 800002.
+\end{itemize}
+Because the slash form spreads the derivative out horizontally, parentheses
+are the natural way in this case to indicate a point of evaluation:
+\begin{centred}
+\verb`$ \difs{\ln sin x}{sin x}[x=\pi/3] $` $\Longrightarrow$ $ \difs{\ln\sin x}{\sin x}[x=\pi/3]$.
+\end{centred}
+\noindent A vertical rule can easily become too remote from the opening
+$\mathrm{d}$ of the differential coefficient: $\difs..{\ln\sin x}{\sin x}[x=\pi/3]$.
+Parentheses tie the whole cluster of symbols together.
With either the \verb`spaced` package option (see \xA7\ref{subsec:Packageoptions})
or the \verb`!` switch a space, defaulting to \verb`3 mu` with some
stretch and shrink, can be inserted before the differentiand: \verb`\[ \diffp!{F(x,y)}x \]`
$\Longrightarrow$ \[ \diffp!{F(x,y)}x. \]

\noindent (But note that if the \verb`spaced` package option is used,
the \verb`!` switch \emph{removes} any extra space.)

Again an optional argument allows the specification of the order of
differentiation which may be numeric or algebraic or a mix of the
two:
+One reason to query the ISO preference for subscripted parentheses
+to indicate a point of evaluation is that subscripted parentheses
+are used with partial derivatives to indicate variables held constant.
+This occurs frequently in thermodynamics for example. In the following
+wellknown relation in thermodynamics, the differentiands are appended
+and the trailing argument is used to indicate the variables held constant:
\begin{centred}
\verb`\[ \diffp[3]F/x , \quad \diffp[n]F/x \]` $\Longrightarrow$
\[\diffp[3]F/x , \quad \diffp[n]F/x\] \verb`\[ \diffp[n+1]Fx. \]`
$\Longrightarrow$ \[ \diffp[n+1]Fx. \]
+\verb`\[ \diffp*{\frac PT}U[V] = \diffp*{\frac 1T}V[U] \]` $\Longrightarrow$
+\[ \diffp*{\frac PT}U[V] = \diffp*{\frac 1T}V[U]. \]
\end{centred}
+\noindent This is much easier to write than building the expressions
+`by hand', starting with \verb`\left(` and finishing with \verb`_U`.
\subsection{Variables held constant}
+\subsubsection{Superscripts}
In a subject like thermodynamics, there is a need to indicate which
variables are held constant when the differentiation occurs. To show
this, append a final squarebracketed optional argument and ensure
that it follows \emph{immediately} on the preceding mandatory argument.
A space here will detach the argument from the derivative and result
in it being treated as a mathematical expression following the derivative.
Thus to differentiate the entropy $S$ in temperature $T$ while holding
the volume $V$ constant, write
+It is easy to add a superscript to a derivative to indicate evaluation
+at two points and the difference between the values:
\begin{centred}
\verb`\[ \diffp ST[V] \]` $\Longrightarrow$ \[ \diffp ST[V]. \]
+\verb`\[ \diff {\sin x}x[0]^{\!\!\pi/2} \]` ${\displaystyle \Longrightarrow}$
+\[ \diff{\sin x}x[0]^{\!\!\pi/2} \]
\end{centred}
\noindent In slash form the same expression looks like
\begin{centred}
\noindent \verb`$ \diffp S/T[V] $` $\Longrightarrow$ $ \diffp S/T[V] $.
\end{centred}
This use of a parenthesised, subscripted form to indicate a variable
or variables held constant, leaves open the question: how do we represent
a point of evaluation? ISO 800002 makes no recommendation for \emph{partial}
derivatives; presumably we follow the same practice as their recommendation
for ordinary derivatives:
\begin{example}
\verb`\[ \diffp {F(x,y)}x[(0,0)] \]` $\Longrightarrow$ \[ \diffp {F(x,y)}x[(0,0)] \]
\end{example}
+but to my eye either square brackets or a vertical rule are clearer
+for this purpose (and do not involve nudging the subscript or superscript
+closer to the right delimiter); see \xA7\ref{sec:Variantforms}.
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 \xA7\ref{sec:Changingdefaults}.
+\subsubsection{Empty trailing argument}
An empty final argument produces a parenthesised derivative with no
subscript,
+\noindent If the trailing argument is included but left empty it will,
+with the default setup, wrap the derivative in parentheses but with
+no subscript. This fact can be exploited. Thus, for a particle of
+mass $m$ moving along a line, distance $x$ at time $t$, the kinetic
+energy is:
\begin{centred}
\verb`\[ \diffp yx[] \]` ${\displaystyle \Longrightarrow}$ \[ \diffp yx[] \]
+\noindent \verb`$ \tfrac 12 m \difs xt[]^2 $` $\Longrightarrow$
+$\tfrac{1}{2}m\difs xt[]^{2}$.
\end{centred}
\noindent which can be useful sometimes. An instance is the writing
of Lagrange's equations of motion in analytic mechanics:
+Or, again exploiting the parentheses resulting from an empty trailing
+argument, Lagrange's equations of motion in analytic mechanics can
+be written,
\begin{centred}
\noindent \verb`\[ \diffp L{q_k}\diff*{\diffp L{\dot{q}_k}[]}t = 0 \]`
$\Longrightarrow$ \[ \diffp L{q_k}\diff*{\diffp L{\dot{q}_k}[]}t = 0. \]
+\verb`\[ \diffp L{q_k}\diff**t{ \diffp L{\dot{q}_k}[] } = 0 \]`
+$\Longrightarrow$\[\diffp L{q_k}\diff**t{\diffp L{\dot{q}_k}[]} = 0. \]
\end{centred}
+\noindent (See \xA7\ref{subsec:Transposingtheargument} for the double
+asterisk.) Like the author, you may feel that there is too much whitespace
+between $\diff{}t$ and the left parenthesis in this expression. One
+obvious remedy is to insert a negative thin space \verb`\!` before
+the second \verb`\diffp` command. Another is to use the package \verb`mleftright`.
\subsubsection{Textstyle derivatives}
+\subsubsection{Use of the package \texttt{mleftright}}
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 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'  see \xA7\ref{subsec:Textandscriptstyle}
below  giving, for our example, $\diff.ptxt.ST[V]$.
+\label{subsec:mleftright}The \verb`mleftright` package `tightens'
+the spacing around \verb`\left`, \verb`\right` delimiters. The user
+either by explicitly replaces \verb`\left`, \verb`\right` by \verb`\mleft`
+and \verb`\mright` or uses the command \verb`\mleftright` which
+effectively turns subsequent occurrences of \verb`\left`, \verb`\right`
+into \verb`\mleft`, \verb`\mright`; \verb`\mleftrightrestore` returns
+\verb`\left`, \verb`\right` to their original selves. This process
+can be `shortcircuited' by using the \verb`diffcoeff` package
+option \verb`mleftright` that inserts \verb`\mleftright` in the
+preamble; see \xA7\ref{sec:Packageoptions}.
\subsection{Appending the differentiand\protect\label{subsec:Partialappending}}
+However, that package option is not used in this document. Nonetheless
+\verb`mleftright` is a required package of version 5 of \verb`diffcoeff`
+and its commands are available for use. Hence to reduce the whitespace
+I can write
+\begin{verbatim}
+ \mleftright
+ \[ \diffp L{q_k}\diff**t{\diffp L{\dot{q}_k}[]} = 0. \]
+ \mleftrightrestore
+\end{verbatim}
+$\Longrightarrow$ \mleftright
+\[ \diffp L{q_k}\diff**t{\diffp L{\dot{q}_k}[]} = 0. \]
+\mleftrightrestore
For a long or awkward differentiand, it is generally better to \emph{append}
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.
\begin{centred}
\verb`\[ \diffp*[2]{\Phi(x,y,z)}x \]` $\Longrightarrow$ \[ \diffp*[2]{\Phi(x,y,z)}x. \]
\end{centred}
With the \verb`spaced` package option, or with the \verb`!` switch
if the package option is not used (which is the case for this document),
one gets
\begin{centred}
\verb`\[ \diffp*[2]!{\Phi(x,y,z)}x \]` $\Longrightarrow$ \[ \diffp*[2]!{\Phi(x,y,z)}x \]
\end{centred}
which is an improvement (to my eye).
+\noindent which is better, but better still to my eye is to also add
+a negative thin space \verb`\!` before the second \verb`\diffp`
+command:
+\begin{verbatim}
+ \mleftright
+ \[ \diffp L{q_k}\diff**t{ \!\diffp L{\dot{q}_k}[] } = 0 \]
+\end{verbatim}
+\noindent $\Longrightarrow$ \mleftright\[\diffp L{q_k}\diff**t{\!\diffp L{\dot{q}_k}[]} = 0. \]
Alternatively you could leave the first mandatory argument empty and
manually append the differentiand, but by deleting or inserting an
asterisk, it is easy to compare the two forms, differentiandinthenumerator,
differentiandappended, and see which is preferable.
+\noindent The problem is that in addition to the space around \verb`\left`,
+\verb`\right` pairs (which is reduced by issuing the command \verb`\mleftright`),
+there is also the space inserted by \verb`diffcoeff` before a multitoken
+differentiand. The user should be aware of this, and may wish to define
+a `variant form' (see \xA7\ref{sec:Variantforms}) that introduces
+no space before an appended differentiand.
In slash form, parentheses are automatically inserted around the differential
operator when the differentiand is appended,
\begin{centred}
\verb`\[ \diffp*[n]{f(x)}/x \]` $\Longrightarrow$ \[ \diffp*[n]{f(x)}/x, \]
\end{centred}
\noindent although this behaviour can be changed (\xA7\ref{sec:Changingdefaults}
again).
+\subsection{Mixed partial derivatives}
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
this. Thus, to express a relation in thermodynamics,
+\label{subsec:Mixedpartialderivatives}The new thing with partial
+derivatives, not present with ordinary derivatives, is socalled \emph{mixed}
+partial derivatives, where differentiation occurs in more than one
+variable. If each variable is differentiated only to the first order,
+then it is easy to specify the derivative. Suppose $F$ is a function
+of three variables, $x$, $y$ and $z$. Then
\begin{centred}
\verb`\[ \diffp*{\frac PT}U[V] = \diffp*{\frac 1T}V[U] \]` $\Longrightarrow$
\[ \diffp*{\frac PT}U[V] = \diffp*{\frac 1T}V[U], \]
+\verb`\[ \diffp F{x,y,z},\quad\diffp{F(x,y,z)}{x,y,z}. \]` $\Longrightarrow$
+\[ \diffp F{x,y,z},\quad \diffp{F(x,y,z)}{x,y,z}. \]
\end{centred}
\noindent where the starring automatically takes care of the parentheses
and subscripts.
+(The \verb`spaced=1` package option inserts space before the multitoken
+differentiand in the second of these.)
\subsection{Iterated derivatives}
+The variables of differentiation are listed in order in a comma list
+ \verb`{x,y,z}`  forming the second mandatory argument. The
+total order of differentiation (3 in this example) was inserted automatically.
+It did not need to be specified or calculated `by hand'  \verb`diffcoeff`
+did the calculation.
Derivatives can be the differentiands of derivatives, as seen above
when writing Lagrange's equations,
+The slash form is
\begin{centred}
\noindent \verb`\[ \diffp L{q_k}\diff*{\diffp L{\dot{q}_k}[]}t = 0 \]`
$\Longrightarrow$ \[ \diffp L{q_k}\diff*{\diffp L{\dot{q}_k}[]}t = 0. \]
+\verb`$ \difsp F{x,y,z} $` $\Longrightarrow$ $ \difsp F{x,y,z}$,
\end{centred}
\noindent However, in versions of \texttt{diffcoeff} before version
3.2, an ordinary derivative within a partial derivative rendered as
a partial derivative. That is now corrected, the ordinary derivative
rendering correctly:
+as expected, and the compact form is
\begin{centred}
\verb`\[ \diffp*{\diff{x^\mu}{\lambda}}{x^\sigma} \]` $\Longrightarrow$
\[ \diffp*{\diff{x^\mu}{\lambda}}{x^\sigma}. \]
+\verb`$ \difcp F{x,y,z} $` $\Longrightarrow$ $ \difcp F{x,y,z}$.
\end{centred}
+One might wonder about even more compact notations like $\partial_{xyz}^{\onemu3}F$
+for this example but it becomes messy if different orders of differentiation
+are involved for different variables.
\subsection{Mixed partial derivatives}

The new thing with partial derivatives, not present with ordinary
derivatives, is \emph{mixed} partial derivatives, where there is more
than one variable of differentiation. If each variable is differentiated
only to the first order, then it is easy to specify the derivative.
Suppose $F$ is a function of three variables, $x$, $y$ and $z$.
Then
+To differentiate variables to higher order, their orders need to be
+specified explicitly. To do so use a comma list for the optional argument:
\begin{centred}
\verb`\[ \diffp F{x,y,z} \]` $\Longrightarrow$ \[ \diffp F{x,y,z}, \]
+\verb`$ \difcp[2,3]F{x,y,z} $` $\Longrightarrow$ $ \difcp[2,3] F{x,y,z}$,
\verb`\[ \diffp !{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$ \[ \diffp !{F(x,y,z)}{x,y,z}. \]
\end{centred}
In the second of these I have inserted space before the differentiand
by using the \verb`!` switch. If the \verb`spaced` package option
was being used, this would have been done automatically.

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  \texttt{diffcoeff}
does the calculation. There is also a slash form:
\begin{centred}
\verb`$ \diffp F/{x,y,z} $` $\Longrightarrow$ $ \diffp F/{x,y,z}$.
\end{centred}
If we want to differentiate variables to higher order, then their
orders need to be specified explicitly. To do so use a comma list
for the optional argument:
\begin{centred}
\verb`\[ \diffp[2,3]F{x,y,z} \]` $\Longrightarrow$ \[ \diffp[2,3]F{x,y,z}. \]
\end{centred}
\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.
+in the second of these is again automatically calculated and inserted
+as a superscript on the $\partial$ symbol in the numerator.
\subsubsection{Minutiae of spacing (again)\protect\label{subsec:Minutiaeofspacing}}
+In the example, the comma list of orders has only \emph{two} members,
+although there are \emph{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 \verb`[,,2]`;
+instead write {\ttfamily\verb`[1,1,2]`} (which is the natural
+thing to do in any case).\textbf{ }It is only the \emph{tail} of an
+order specification which can be omitted.
In Chapter 18 of the \emph{The\TeX book}, Knuth suggests inserting
a thin space, {\ttfamily\verb`\,`} (or {\ttfamily\verb`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 \verb`2 mu` between the differentials in the fraction form
of derivative and \verb`1 mu`\texttt{ }in the slash form.
+In the other direction, if there are more orders of differentiation
+specified than there are variables, the list of orders is truncated
+to match the number of variables.
Should a differentiation occur to higher order and so a variable acquire
a superscript, an adjustment is made to the extra spacing. By default
\verb`1 mu` is subtracted from the default spacing. Thus in
\[
\diffp[2]F{x,y,z},
\]
\verb`2 mu` of spacing is inserted between the $\partial y$ and
$\partial z$, but because the superscript already provides some separation
between them, only \verb`1 mu` is inserted between $\partial x^{2}$
and $\partial y$.
+\subsubsection{Algebraic orders of differentiation}
The values used for the spacing and its adjustment in the presence
of a superscript can be changed by the user; see \xA7\ref{sec:Changingdefaults}.
Some other minutiae of spacing are discussed below in \xA7\ref{subsec:Commalistofvars}
when the variables themselves are super or subscripted (as happens
in tensor calculus, for instance).

Note that the \verb`!` switch, if used, is inserted \emph{immediately
before} the differentiand. It is the placement of the differentiand,
after all, that it is affecting:
+Orders of differentiation do not need to be numerical. They can also
+be algebraic:
\begin{centred}
\verb`\[ \diffp[2]!F{x,y,z} \]` $\Longrightarrow$ \[ \diffp[2]!F{x,y,z}. \]
+\verb`\[ \diffp[2m1,m+1,2]F{x,y,z} \]` $\Longrightarrow$ \[ \diffp[2m1,m+1,2]F{x,y,z}\]
\end{centred}

\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},
+The total order of differentiation is still calculated by \verb`diffcoeff`.
+Or again,
\begin{centred}
\verb`\[ \diffp[1,m+1,m1]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$
\[ \diffp[1,m+1,m1]{F(x,y,z)}{x,y,z}. \]
+\verb`\[ \diffp[1,km+1,m+k1]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$
+\[ \diffp[1,km+1,m+k1]{F(x,y,z)}{x,y,z}. \]
\end{centred}
\subsubsection{Error messages}
+\subsubsection{Orderoverride command: \texttt{\textbackslash difoverride}}
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 (say) line 53 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~of~differentiation~
+\noindent \label{subsec:Orderoverridecommand}$m+k+km+1$ factorizes
+to $(k+1)(m+1)$ and you may prefer to express the total order of
+differentiation in this form. \verb`diffcoeff` is not a computer
+algebra system and does not do such factorizations but the \verb`\difoverride`
+command offers the means to use the factorized form as the total order
+of differentiation in the derivative. (The \verb`\difoverride` command
+replaces the orderoverride option of the \verb`\diff` command in
+version 4 of \verb`diffcoeff`. That option is no longer available.)
+\begin{verbatim}
+ \[
+ \difoverride{(k+1)(m+1)}
+ \diffp[1,km+1,m+k1]{F(x,y,z)}{x,y,z}
+ \]
+\end{verbatim}
+$\Longrightarrow$ \[
+ \difoverride{(k+1)(m+1)}
+ \diffp[1,km+1,m+k1]{F(x,y,z)}{x,y,z}
+ \]
specified~for~3~variables;~orders~{[}1,m+1,m1,2{]}
+\verb`\difoverride` takes only one (mandatory) argument, the total
+order of differentiation, which it stores. When \verb`\difoverride`
+is nonempty, then the algorithm that calculates the total order is
+sidestepped. It does not get called at all. In this way one can present
+not only the total order in whatever manner one wishes but essentially
+arbitrary material as a superscript to the $\partial$ symbol in the
+numerator. (For compactform derivatives, which do not use a total
+order of differentiation, the command is irrelevant.)
(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~
+Note that in the example \verb`\difoverride` has been used \emph{within
+}the math environment. This is good practice. It prevents the contents
+of \verb`\difoverride` erroneously overriding the orders of later
+derivatives:
+\begin{verbatim}
+ $ \difoverride{N} \difsp[m,n]f{x,y} $,\quad
+ $ \difsp[1,2]f{x,y} $.
+\end{verbatim}
+$\Longrightarrow$ $ \difoverride{N} \difsp[m,n]f{x,y} $,\quad
+ $ \difsp[1,2]f{x,y} $.
order~specification~{[}2\textasciicircum n,1,1{]}~on~line~53.~Diffcoeff~
+\noindent There is no spillover here whereas by placing the override
+command outside the math environment the command reaches beyond the
+intended target. To cancel the overreach, I have used \verb`\difoverride`
+with an \emph{empty} argument, :
+\begin{verbatim}
+ \difoverride{K}
+ $ \difsp[m,n]f{x,y} $,\quad
+ $ \difsp[1,2]f{x,y} $,\quad
+ \difoverride{}
+ $ \difsp[1,2]f{x,y}$.
+\end{verbatim}
+$\Longrightarrow$ \difoverride{K} $ \difsp[m,n]f{x,y} $,\quad
+ $ \difsp[1,2]f{x,y} $,\quad
+ \difoverride{} $ \difsp[1,2]f{x,y}$.
cannot~calculate~the~overall~order~of~differentiation~
+\noindent Clearly one should use the override command \emph{within}
+the math environment.
in~this~case.~Use~the~orderoverride~option~to~enter~
+\subsubsection{Parentheses}
the~overall~order.
\end{lyxcode}
The orderoveride option mentioned here is discussed next. 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{]}}:
+Autocalculation of the total order accommodates the simple use of
+parentheses:
\begin{centred}
\noindent \verb`\[ \diffp[2km,m1,m+1]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$
\[ \diffp[2km,m1,m+1]{F(x,y,z)}{x,y,z}. \]
+\verb`\[ \diffp[2m(k+1),2(k+1)m]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$
+\[ \diffp[2m(k+1),2(k+1)m]{F(x,y,z)}{x,y,z} \]
\end{centred}
\noindent Here the overall order is presented as \texttt{2km+2m}.
You might prefer this to be presented as \texttt{2m(k+1)}. Although
\texttt{diffcoeff} takes some steps to present the overall order appropriately,
it is not a computer algebra system and does not factorise expressions.
If you want to present the order in a manner distinct from that presented
by \texttt{diffcoeff}, use the \emph{orderoverride option}.
+This is an example of the use of \emph{dynamic} parentheses: the left
+parenthesis in each case is preceded by a number or a sign. In evaluating
+the total order \verb`diffcoeff` multiplies out the expression (or
+that is the effect).
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:
+On the other hand, an order specification like \verb`[f(n+1),f(n1)]`
+is an example of the use of \emph{static} parentheses where they are
+part of the familiar `function of' notation  in this case a function
+$f$ of some variable, say $x$, evaluated at $x=n\pm1$. \verb`diffcoeff`
+\emph{always} interprets a left parenthesis preceded by something
+that is neither number nor sign in this way. It does not try to multiply
+out such expressions when calculating the total order.
+
+The following example combines both uses  and includes a nested
+pair of (dynamic) parentheses:
\begin{centred}
\verb`\[ \diffp[2km,m1,m+1][2m(k+1)]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$
\[ \diffp[2km,m1,m+1][2m(k+1)]{F(x,y,z)}{x,y,z}. \]
+\verb`\[\diffp[2(f(n)(m1)),5(f(n)+m)]F{x,y}\]` $\Longrightarrow$
+\[\diffp[2(f(n)(m1)),5(f(n)+m)]F{x,y}\]
\end{centred}
\noindent As another example, left to its own devices, \texttt{diffcoeff}
produces
+Where confusion arises is with specifications like \verb`[m(k1)+1,m(k+1)1]`
+where \verb`m` could be interpreted as either a function or a variable.
+As stated, \verb`diffcoeff` \emph{always} interprets a left parenthesis
+preceded by something that is not a number or a sign as signalling
+`function of'. Hence:
\begin{centred}
\noindent \verb`\[ \diffp[m/2+n/2,m/2,n/2]F{x,y,z} \]` $\Longrightarrow$
\[ \diffp[m/2+n/2,m/2,n/2]F{x,y,z}, \]
+\verb`\[\diffp[m(k1)+1,m(k+1)1]F{x,y}\]` $\Longrightarrow$ \[\diffp[m(k1)+1,m(k+1)1]F{x,y}\]
\end{centred}
\noindent whereas we would like the total order to be presented as
$m+n$. Using the override option,
\begin{centred}
\noindent \verb`\[ \diffp[m/2+n/2,m/2,n/2][m+n]F{x,y,z} \]` $\Longrightarrow$
\[ \diffp[m/2+n/2,m/2,n/2][m+n]F{x,y,z}. \]
\end{centred}
The orderoverride option does exactly that: overrides the presentation
of the calculated order with the manually given one. In fact the calculation
algorithm does not get called at all when the override option is used
so that one can in this way present the total order in whatever manner
one wishes or, indeed, add essentially arbitrary material as a superscript
to the $\partial$ symbol in the numerator.
+\noindent If, in fact, \verb`m` is intended as a \emph{variable}
+then the orderoverride command is there to rescue the situation:
+\begin{verbatim}
+ \[
+ \difoverride{2mk}
+ \diffp[m(k1)+1,m(k+1)1]F{x,y}
+ \]
+\end{verbatim}
+$\Longrightarrow$ \[
+ \difoverride { 2mk }
+ \diffp[m(k1)+1,m(k+1)1]F{x,y}
+ \]
\subsubsection{Comma list of variables of differentiation\protect\label{subsec:Commalistofvars}}
+\subsubsection{Error messages}
In tensor calculus the differentiations are almost always in terms
of super or subscripted coordinates. In many other contexts this
is the case too  the reciprocal of the temperature in thermodynamics
or generalized coordinates 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\}} rather than \texttt{\{x,y}\}
when two variables $x$ and $y$ are involved, the extra writing is
trivial and the comma list allows a simpler handling of multicharacter
variables. For instance in tensor calculus we get expressions like
+The orderoverride command is also needed when calculation of the
+total order is beyond the abilities of \verb`diffcoeff`. The package
+is \emph{not} a computer algebra system. It can cope with order specifications
+where variables are followed by diverse arithmetic operators: \verb`n^2`,
+\verb`m\times n`, \verb`m/2` and the like cause no problems. But
+a \emph{number} can be followed \emph{only} by a sign or a variable
+or a left parenthesis. Anything beyond this will raise an error. For
+instance
\begin{centred}
\verb`\[ \diffp{A_i}{ x^j,x^k } \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^j,x^k }. \]
+\verb`\[ \diffp[2^k]F{x,y} \]`
\end{centred}
\noindent It is easier to write \texttt{\{x\textasciicircum j,x\textasciicircum k\}}
here than, say, \texttt{\{\{x\textasciicircum j\}\{x\textasciicircum k\}\}}
to distinguish the variables. It does mean that should the variable
of differentiation include a comma then that comma needs to be enclosed
in 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.
+produces a message beginning `\texttt{! Package diffcoeff Error:}'
+and continuing,
+\begin{verbatim}
+ number followed by ^ in the order spec. [2^k,1] on
+ line xx. Calculation of the total order of
+ differentiation fails in this case. Use the
+ \difoverride command to enter the total order.
+ See the diffcoeff documentation for further
+ information.
+\end{verbatim}
+(The \verb`xx` will be replaced by a specific line number in each
+case. Line breaking may also differ from case to case.) To avoid such
+errors and enable compilation to proceed, use the override command:
+\begin{verbatim}
+ \[
+ \difoverride { 2^{n+1} }
+ \diffp[2^n+1,2^n1]F{x,y}
+ \]
+\end{verbatim}
+$\Longrightarrow$ \[
+ \difoverride { 2^{n+1} }
+ \diffp[2^n+1,2^n1]F{x,y}
+ \]
\paragraph*{Minutiae of spacing (yet again):}
+There are limitations on what order specifications the \verb`diffcoeff`
+package can `digest', but in real life that is unlikely to be significant.
+Mixed partial derivatives are used far less often than the pure derivatives,
+and when they \emph{are} used it is nearly always to low numerical
+orders like 1 or 2. For those rare other cases, \verb`\difoverride`
+is always available.
In \xA7\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 introduced earlier
(\xA7\ref{subsec:Spacingcommands}), which inserts \texttt{1 mu} of
spacing. For our example, in
+\subsubsection{Comma list of variables of differentiation}
+
+\label{subsec:Commalistofvars}In tensor calculus differentiations
+are almost always in terms of super or subscripted coordinates. In
+many other contexts this is the case too  the reciprocal of the
+temperature in thermodynamics or generalized coordinates in analytical
+mechanics. This is why a comma list is used in \verb`diffcoeff` for
+specifying variables of differentiation for mixed partial derivatives.
+Although it would be nice to write the minimal \verb`{xy}` rather
+than \verb`{x,y}` when two variables $x$ and $y$ are involved,
+the extra writing is trivial and the comma list allows a simpler handling
+of multicharacter variables. For instance in tensor calculus we get
+expressions like
\begin{centred}
\verb`\[ \diffp{A_i}{ x^j\negmu,x^k } \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^j\negmu,x^k } \]
+\verb`\[ \diffp{A_i}{x^j,x^k} \]` $\Longrightarrow$ \[ \diffp{A_i}{x^j,x^k}. \]
\end{centred}
\noindent the \texttt{\textbackslash negmu} decreases the spacing
between the terms from the default \verb`2 mu` to \verb`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  for instance, the simple use of parentheses:
+\noindent It is easier to write \verb`{x^j,x^k}` here than, say,
+\verb`{{x^j}{x^k}}` to distinguish the variables. It's also easier
+to read, particularly if the indices themselves get ornamented and
+need surrounding braces:
\begin{centred}
\verb`\[ \diffp[2m(k+1),2(k+1)m]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$
\[ \diffp[2m(k+1),2(k+1)m]{F(x,y,z)}{x,y,z}. \]
+\verb`\[ \diffp{A_i}{x^{j'},x^{k'}} \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^{j'},x^{k'} }. \]
\end{centred}
+\noindent Compare that variable specification with \verb`{{x^{j'}}{x^{k'}}}`.
+Admittedly some extra whitespace would help here, but the point stands:
+the comma list requires fewer nested braces  unless a variable
+of differentiation includes a comma, for then the comma needs to be
+enclosed in 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*{Dynamic use of parentheses}
+\subsubsection{Spacing in the denominator}
\noindent For parenthetic expressions to be evaluated as in this example
 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.
+\label{subsec:Minutiaeofspacing}In Chapter 18 of the \emph{The
+\TeX book}, Knuth suggests inserting a thin space, {\ttfamily\verb`\,`}
+(or {\ttfamily\verb`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  to my eye
+ seems too great, interfering with seeing the derivative `as a
+whole',
+\[
+\diffp.3mu.F{x,y,z},
+\]
+especially for the slashform of derivative: $\difsp.3mu.F{x,y,z}$.
+Some spacing is desirable, but less. By default \verb`diffcoeff`
+inserts \verb`2 mu` (with stretch and shrink) between the differentials:
+$\difsp F{x,y,z}$.
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 error and halt compilation. A message will be sent to the terminal
and the \LaTeX{} log like the following (which assumes the order spec.
was on line 53 of the document):
\begin{lyxcode}
!~Package~diffcoeff~Error:~)~followed~by~m~in~the~
+Should a differentiation occur to higher order and so a variable acquire
+a superscript, an adjustment is made to the extra spacing. By default
+\verb`1 mu` is subtracted from the default spacing. Thus in
+\[
+\diffp[2]F{x,y,z},
+\]
+\verb`2 mu` of spacing is inserted between the $\partial y$ and
+$\partial z$, but because the superscript already provides some separation
+between them, only \verb`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 changed by the user; see Chapter~\ref{chap:Templatesdefaultsvariants}.
order~specification~{[}(2n+1)m,(2n1)m{]}~on~line~53.~
+When the variables themselves are super or subscripted, as happens
+in tensor calculus, no automatic adjustment is made. Any finetuning
+must be done by the user using explicit spacing commands  like
+\verb`\negmu` (a space of \verb`1 mu`); see \xA7\ref{subsec:Spacingcommands}:
+\begin{centred}
+\verb`\[ \diffp{A_i}{ x^j\negmu,x^k } \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^j\negmu,x^k }.\]
+\end{centred}
+\noindent The \verb`\negmu` decreases the spacing between the terms
+from the default \verb`2 mu` (with stretch and shrink) to \verb`1 mu`.
Diffcoeff~cannot~calculate~the~overall~order~of~
+\subsection{Multitoken variables: parenthesizing}
differentiation~in~this~case.~Use~the~orderoverride~

option~to~enter~the~overall~order.
\end{lyxcode}
This is a limitation on the dynamic use of parentheses  but they
\emph{can} be nested.

\paragraph*{Static use of parentheses}

If a left parenthesis is preceded by a \emph{variable} (i.e., not
a sign or a number) this signals to \texttt{diffcoeff} the \emph{static}
use of parentheses, something like $f(k)$, `function of $k$'.
No attempt is made to evaluate what is between them and they are treated
simply as an extension of the variable. For example,
+Differentiating a function of a function may involve a multicharacter
+differentiation variable. For instance, to differentiate $\ln\sin x$
+in $x$ means forming the product
\begin{centred}
\verb`\[ \diffp[f(k+1)+1,f(k1)1]{F(x,y)}{x,y} \]` $\Longrightarrow$
\[ \diffp[f(k+1)+1,f(k1)1]{F(x,y)}{x,y}. \]
+\verb`\[ \diff{\ln\sin x}{\sin x}\diff{\sin x}x \]` $\Longrightarrow$
+\[\diff{\ln\sin x}{\sin x}\diff{\sin x}x.\]
\end{centred}
\noindent In the static case you \emph{can} follow the right parenthesis
by a variable without generating an error.\emph{ }You can nest them,
and you can include static parentheses within a dynamic pair; for
example,
+Forming the \emph{second} derivative of $\ln\sin x$ will now involve
+forming, among other quantities,
\begin{centred}
\noindent \verb`\[ \diffp[2(3+f(k))+1,13(f(k)2)]{F(x,y)}{x,y} \]`
$\Longrightarrow$ \[ \diffp[2(3+f(k))+1,13(f(k)2)]{F(x,y)}{x,y}. \]
+\noindent \verb`\[\diff[2]{\ln\sin x}{\sin x}\]` $\Longrightarrow$
+\[\diff[2]{\ln\sin x}{\sin x}\]
\end{centred}
\noindent However, the reverse is not possible: you can't have dynamic
parentheses within a static pair.
+\noindent Parentheses have been inserted automatically by \verb`diffcoeff`
+around $\sin x$ in the denominator to avoid any visual hint that
+we are differentiating in the sine of $x^{2}$.
\paragraph*{Other refinements}
+\emph{That} is the problem: with a long (multicharacter) variable,
+the superscript in a higher order derivative may look as if it applies
+to only part  the last character  of a multicharacter variable.
+To solve that problem, \verb`diffcoeff` inserts parentheses around
+the variable  for \emph{higherorder} derivatives, but not for
+firstorder derivatives where the problem does not arise. You may
+prefer \verb`diffcoeff` not to parenthesize by default. Changing
+the default setting is easily accomplished; see \xA7\ref{sec:ChangingDefaults}.
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:
+And if you do want parentheses, are they in the right place? Logically,
+no. 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 to show that the `d' symbol
+attaches to the whole variable and not just its \emph{first} character.
+A second, outer pair of parentheses then seems too fussy and detracts
+from comprehending the symbol `at a glance':
+\[
+\diff.(dv).[2]{f(x)}{(x/k)}.
+\]
+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$.
+In any case, the manner of this wrapping in parentheses  if any
+ of long variables for \emph{higher order} derivatives is customisable
+(\xA7\ref{sec:ChangingDefaults}).
+
+For first order derivatives parenthesising does not occur automatically.
+If you want the variable of differentiation to be parenthesised, you
+need to do it yourself:
\begin{centred}
\verb`\[ \diffp[m^2+2(k1),m^2(k+1)]F{x,y,z,w} \]` $\Longrightarrow$
\[ \diffp[m^2+2(k1),m^2(k+1)]F{x,y,z,w}. \]
+\verb`\[\diff {f(x)}{x/k}, \quad \diff {f(x)}{(x/k)}.\]` $\Longrightarrow$
+\[ \diff {f(x)}{x/k}, \quad\diff {f(x)}{(x/k)}.\]
\end{centred}
\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}.

\paragraph*{Override}

There are limitations on what order specifications the \texttt{diffcoeff}
package can `digest'; equally, it can digest a wide variety of such
constructs, 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 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  and the override option is always available
for such cases.

\subsection{Parentheses around multicharacter variables}

In thermodynamics and statistical mechanics one may want to differentiate
in the reciprocal of the temperature, $1/T$ (or $1/\Theta$):
+To my eye, in this particular case, the parenthesized version seems
+necessary. The discussion applies equally to ordinary and partial
+derivatives. In thermodynamics and statistical mechanics one may want
+to differentiate in the reciprocal of the temperature, $1/\Theta$
+say:
\begin{centred}
\verb`\[ \diffp[2]q{\frac 1\Theta} \]` $\Longrightarrow$ \[ \diffp[2]q{\frac 1\Theta}. \]
+\verb`\[ \diffp[2]q{\frac 1\Theta} \]` $\Longrightarrow$ \[ \diffp[2]q{\frac 1\Theta}.\]
\end{centred}
\noindent In this case and for other \emph{higher order} derivatives
of multicharacter variables of differentiation, the parentheses are
inserted automatically by \texttt{diffcoeff}. Precisely where parentheses
should be placed is moot. The placement in this example is not strictly
logical, although it feels intuitive, but the placement can be customised
(\xA7\ref{sec:Changingdefaults}).

Parentheses are automatically inserted like this only for higher order
derivatives. When the differentiation is to first order, parenthesising
+\noindent As noted, when differentiating to first order, parenthesising
is up to the user:
\begin{centred}
\verb`\[ \diffp q{(\frac 1\Theta),V} \]` $\Longrightarrow$ \[ \diffp q{(\frac 1\Theta),V}. \]
\end{centred}
\subsection{Jacobians}
+\chapter{Templates, defaults \& variants}
\texttt{diffcoeff} provides a command \texttt{\textbackslash jacob}
for constructing Jacobians. For example
\begin{centred}
\verb`\[ \jacob{u,v,w}{x,y,z} \]` $\Longrightarrow$ \[ \jacob{u,v,w}{x,y,z}. \]
\end{centred}
The comma lists can contain any number of variables. \texttt{\textbackslash jacob}
does \emph{not} check that the two arguments contain the same number
of variables, so it is perfectly possible to form an object like \texttt{\textbackslash jacob\{u,v,w\}\{x,y\}}
which as far as I know has no meaning.
+\label{chap:Templatesdefaultsvariants} \verb`diffcoeff` is built
+on the facilities offered by the \verb`xtemplate` package (included
+in the \LaTeX 3 bundle {\ttfamily\verb`l3packages`}). The
+stuff of \verb`xtemplate` is \emph{templates}, their definition,
+their manipulation. For \verb`diffcoeff` a template is a list of
+parameter values determining how a derivative looks in the pdf. The
+parameters may be broadbrush settings like whether the derivative
+is built from \verb`\frac` or the slash \verb`/` or in compact form,
+or whether the operator symbol is \verb`d` or \verb`\partial` (or
+\verb`\nabla` or \verb`\delta` or \ldots ), or the parameters may
+be finergrained, determining minutiae of spacing, easily missed at
+a casual glance but giving some cumulative overall effect.\emph{ }Access
+to the parameters is gained through the command \verb`\difdef`\footnote{In version 5; it has \emph{three} arguments and replaces the twoargument
+command \texttt{\textbackslash diffdef} in version 4 of \texttt{diffcoeff}.}, one argument of which is a \emph{key=value} list\emph{ }of parameter
+values. Each such list is given a name (the second argument of \verb`\difdef`)
+and is `turned into a derivative' by placing the name between dots
+as the first argument of the appropriate \verb`\difx`, \verb`\difxp`
+commands\footnote{And  see Chapter~\ref{chap:Differentialsandjacobians}  of
+the differential and jacobian commands, \texttt{\textbackslash dl}
+and \texttt{\textbackslash jacob}.}. All this is discussed in \xA7\ref{sec:Variantforms} below.
\section{Changing defaults; variant forms\protect\label{sec:Changingdefaults}}
+\section{Template structure}
To write the range of different examples displayed in the Rogues'
Gallery (\xA7\ref{sec:Rogues'gallery}) I have had to make extensive
use 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{ }
+To write a derivative one doesn't want to have to type a long list
+of \emph{key=value} statements each time. The \emph{default} values
+given to keys is crucial. Only some of the defaults appropriate for,
+say, an upright fraction ordinary derivative are going to be relevant
+for a slashfraction partial derivative let alone a compact form partial
+derivative. This suggests creating a primary template as a `superrepository'
+of default values and from this creating secondary or child templates
+in which (only) \emph{some }of the defaults are changed  and, if
+necessary, creating from these child templates children of their own
+(grandchild templates) in which again some further defaults are adjusted.
\subsection{Default values: ordinary derivatives}
+In \verb`diffcoeff`, the template that is the `primogenitor' of
+the lines of default inheritance is named \verb`DIF`. It is the repository
+of all possible keys used in all possible forms of derivative (at
+least in \verb`diffcoeff`!) and so has keys appropriate to uprightfraction,
+slashfraction and compact forms of derivative; it has keys appropriate
+to multivariable partial derivatives and singlevariable ordinary
+derivatives, but it is not actually used to form derivatives. That
+is the role of its child templates \verb`DIFF`, \verb`DIFS` and
+\verb`DIFC` corresponding to derivatives of uprightfraction, slashfraction
+and compact forms. These child templates inherit the defaults of \verb`DIF`
+save for some settings explicitly changed in the child template relevant
+to the specific forms of fraction specified by each.
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 a quad.}
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}, \texttt{/denomtermsep},
\texttt{termsepadjust} 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.
+Apart from the operator symbol, most of the settings in the child
+templates \verb`DIFF`, \verb`DIFS` and \verb`DIFC` are also appropriate
+for partial derivatives. From a code design point of view, there is
+a certain neatness at not multiplying the number of templates in
+play, but actual use  for instance, forming the `Rogues' gallery'
+of \xA7\ref{sec:Rogues'gallery}  suggests the further step of creating
+additional templates specifically for \emph{partial} derivatives\emph{
+}in the three fraction forms. Apart from the operator symbol, the
+templates \verb`DIFFP`, \verb`DIFSP` and \verb`DIFCP` inherit nearly
+all the defaults of their parents \verb`DIFF`, \verb`DIFS` and \verb`DIFC`
+respectively.
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. 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 \xA7\ref{subsec:Textandscriptstyle}.
All values specifying a space require the unit (\texttt{mu}) to be
given; a number alone does not suffice.
\noindent \begin{center}
+Again, actual use suggests two further templates, both direct children
+of \verb`DIF`, for the creation of jacobians, template \verb`DIFJ`,
+and differentials, template \verb`DIFL`, with default values appropriate
+to each. In all \verb`diffcoeff` uses nine templates, the arrows
+in Table~\ref{tab:DIFdefaults} indicating lines of inheritance
+of default values. Only the child and grandchild templates of \verb`DIF`
+are used for actual construction of derivatives (and jacobians and
+differentials). \verb`DIF` itself sits `above the fray'.
+
\begin{table}
\centering{}\caption{{\small Defaults (ordinary derivatives})\protect\label{tab:Ordinaryderivatives}}
\begin{tabular}{lr}
+\centering{}\caption{\protect\label{tab:Templateinheritance}Template inheritance}
+\begin{tabular}{ccccc}
+\multicolumn{5}{c}{\texttt{DIF}}\tabularnewline
+$\hphantom{\mathtt{DIF}}$ $\swarrow$ & $\,\,\,\sswarrow$ & $\downarrow$ & $\ssearrow\,\,\,$ & $\searrow$ $\hphantom{\mathtt{IFL}}$\tabularnewline
+\texttt{DIFC} & \texttt{DIFS} & \texttt{DIFF} & \texttt{DIFJ} & \texttt{DIFL}\tabularnewline
+$\downarrow$ & $\downarrow$ & $\downarrow$ & & \tabularnewline
+\texttt{DIFCP} & \texttt{DIFSP} & \texttt{DIFFP} & & \tabularnewline
+\end{tabular}
+\end{table}
+
+
+\section{Default values for template \texttt{DIF}}
+
+\label{sec:DefaultvaluesDIF}Table~\ref{tab:DIFdefaults} lists
+the keys available for forming derivatives and the default values
+assigned in the `grandparent' template, the primogenitor, \verb`DIF`.
+Different forms of derivative demand different defaults for some keys.
+Where a key is relevant for more than one style of derivative the
+default value is chosen according to the following precedence scheme:
+\begin{enumerate}
+\item \emph{ordinary upright}fraction derivatives in \emph{display}style
+environments
+\item \emph{ordinary slash}fraction derivatives in \emph{text}style environments
+\item \emph{ordinary compact}form derivatives in \emph{text}style environments
+\end{enumerate}
+\noindent %
+\noindent\begin{minipage}[t]{1\columnwidth}%
+\begin{shaded}%
+\noindent Users of version 4 of \texttt{diffcoeff} will notice similarities
+with and differences from the earlier version. Some key names remain
+(\verb`opsymbol`), some names have changed (\verb`multitermsep`
+for \verb`denomtermsep`), keys beginning with an asterisk, \verb`*`,
+lack a following hyphen (\verb`*derivandsep` rather than \verb`*derivandsep`),
+some keys have vanished (the \verb`/` keys), and there are some new
+keys (\verb`lvwrapLdelim`, \verb`lvwrapRdelim`). The redesign
+of the user interface  \verb`\difs`, \verb`\difsp` for the \verb`/`
+switch, the new compact form commands \verb`\difc`, \verb`\difcp`,
+and bringing the jacobian and differential within the \verb`DIF`
+template structure  meant revisiting and rethinking the list of
+keys. In the end it seemed simpler (less confusing) to treat this
+as a completely new list rather than an amendment of the earlier one.\end{shaded}%
+\end{minipage}
+
+\medskip{}
+The first column in table~\ref{tab:DIFdefaults} lists key names,
+the second column default values, and the third column to which form
+or forms of derivative the key is \emph{relevant } meaning that
+assigning a different value to the key can change the appearance of
+the corresponding derivative in some way. The identifiers have these
+meanings:
+\begin{description}
+\item [{f,~fp}] upright fraction ordinary derivative, partial derivative;
+\item [{s,~sp}] slash fraction ordinary derivative, partial derivative;
+\item [{c,~cp}] compact ordinary derivative, partial derivative;
+\item [{j}] jacobian;
+\item [{l}] differential.
+\end{description}
+In Table~\ref{tab:DIFdefaults} and following tables, all values
+specifying a space require the unit (\verb`mu`) to be included; a
+number alone does not suffice. (A `mu' is a `math unit', 1/18
+of a quad. A thin space \texttt{\textbackslash ,} is 3 mu.) `Elastic'
+spaces with stretch and shrink can be compacted, like \verb`3muplus1muminus2mu`
+for \verb`3 mu plus 1 mu minus 2 mu`.
+
+Available keys and their defaults are the following (if you are dissatisfied
+with some choices, they can be changed; see the discussion at \xA7\ref{sec:ChangingDefaults}):
+
+\begin{table}
+\centering{}\caption{{\small\texttt{DIF}} {\small defaults}\protect\label{tab:DIFdefaults}}
+\begin{center}
+\begin{tabular}{lrl}
\toprule
{\small key} & {\small default}\tabularnewline
\midrule
{\small opsymbol} & {\small\texttt{d}}\tabularnewline
{\small opsymbolalt} & {\small\texttt{opsymbol}}\tabularnewline
{\small opordersep} & {\small\texttt{1 mu}}\tabularnewline
{\small derivandsep} & {\small\texttt{3 mu plus 1 mu minus 2 mu}}\tabularnewline
{\small /derivandsep} & {\small\texttt{derivandsep}}\tabularnewline
{\small{*}derivandsep} & {\small\texttt{derivandsep}}\tabularnewline
{\small{*}/derivandsep} & {\small\texttt{/derivandsep}}\tabularnewline
{\small denomtermsep} & {\small\texttt{2 mu}}\tabularnewline
{\small /denomtermsep} & {\small\texttt{1 mu}}\tabularnewline
{\small termsepadjust} & {\small\texttt{1 mu}}\tabularnewline
{\small leftdelim} & {\small\texttt{\textbackslash left .}}\tabularnewline
{\small rightdelim} & {\small\texttt{\textbackslash right }}\tabularnewline
{\small /leftdelim} & {\small\texttt{(}}\tabularnewline
{\small /rightdelim} & {\small\texttt{)}}\tabularnewline
{\small elbowroom} & {\small\texttt{0 mu}}\tabularnewline
{\small /elbowroom} & {\small\texttt{0 mu}}\tabularnewline
{\small subscrnudge} & {\small\texttt{0 mu}}\tabularnewline
{\small /subscrnudge} & {\small\texttt{0 mu}}\tabularnewline
{\small longvarwrap} & {\small\texttt{d(v)}}\tabularnewline
{\small{*}/opwrap} & {\small\texttt{true}}\tabularnewline
{\small{*}opleft} & {\small\texttt{false}}\tabularnewline
{\small{*}italicnudge} & {\small\texttt{3 mu}}\tabularnewline
+{\small key} & {\small default} & {\small relevance}\tabularnewline
+\midrule
+{\small style} & {\small\texttt{frac}} & {\small f, fp, s, sp, c, cp, j}\tabularnewline
+slashtok & {\small\texttt{/}} & {\small\phantom{{\small f, fp,}} s, sp, \phantom{{\small c, cp,}}
+j}\tabularnewline
+slashsep & {\small\texttt{0 mu}} & {\small\phantom{{\small f, fp,}} s, sp, \phantom{{\small c, cp,}}
+j}\tabularnewline
+{\small derivandsep} & {\small\texttt{3 mu plus 1 mu minus 2 mu}} & {\small f, fp, s, sp, c, cp}\tabularnewline
+{\small opsymbol} & {\small\texttt{\textbackslash mathrm\{d\}}} & {\small f, fp, s, sp, c, cp, j, l}\tabularnewline
+{\small opsymbolalt} & {\small\texttt{opsymbol}} & {\small f, fp, s, sp, \phantom{{\small c, cp,}} j}\tabularnewline
+{\small opordernudge} & {\small\texttt{0 mu}} & {\small f, fp, s, sp, c, cp}\tabularnewline
+{\small varsupnudge} & {\small\texttt{1 mu}} & {\small f, fp, s, sp, \phantom{{\small c, cp,} j,} l}\tabularnewline
+{\small multitermsep} & {\small\texttt{2 mu plus 1 mu minus 1 mu}} & {\small f, fp, s, sp, c, cp, \phantom{j,} l}\tabularnewline
+{\small termsepadjust} & {\small\texttt{1 mu}} & {\small f, fp, s, sp, c, cp, \phantom{j,} l}\tabularnewline
+{\small longvarwrap} & {\small\texttt{d(v)}} & {\small f, fp, s, sp, \phantom{{\small c, cp,} j,} l}\tabularnewline
+{\small lvwrapLdelim} & {\small\texttt{\textbackslash mleft (}} & {\small f, fp, s, sp, \phantom{{\small c, cp,}} j, l}\tabularnewline
+{\small lvwrapRdelim} & {\small\texttt{\textbackslash mright )}} & {\small f, fp, s, sp, \phantom{{\small c, cp,}} j, l}\tabularnewline
+{\small lvwrapsupnudge} & {\small\texttt{2 mu}} & {\small f, fp, s, sp, \phantom{{\small c, cp, j,}} l}\tabularnewline
+{\small outerLdelim} & {\small\texttt{\textbackslash left (}} & {\small f, fp, s, sp, c, cp, j, l}\tabularnewline
+{\small outerRdelim} & {\small\texttt{\textbackslash right )}} & {\small f, fp, s, sp, c, cp, j, l}\tabularnewline
+{\small elbowroom} & {\small\texttt{0 mu}} & {\small f, fp, s, sp, c, cp, j, l}\tabularnewline
+{\small subnudge} & {\small\texttt{5 mu}} & {\small f, fp, s, sp, c, cp}\tabularnewline
+{\small opsubnudge} & {\small\texttt{0 mu}} & {\small\phantom{{\small f, fp, s, sp,}} c, cp}\tabularnewline
+{\small{*}derivandsep} & {\small\texttt{derivandsep}} & {\small f, fp, s, sp, c, cp}\tabularnewline
+{\small{*}opsetleft} & {\small\texttt{false}} & {\small f, fp, \phantom{{\small s, sp, c, cp,}} j}\tabularnewline
+{\small{*}italicnudge} & {\small\texttt{0 mu}} & {\small f, fp, \phantom{{\small s, sp, c, cp,}} j}\tabularnewline
+{\small{*}innerwrap} & {\small\texttt{false}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
+{\small{*}innerLdelim} & {\small\texttt{(}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
+{\small{*}innerRdelim} & {\small\texttt{)}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
+{\small{*}outerLdelim} & {\small\texttt{\textbackslash big {[}}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
+{\small{*}outerRdelim} & {\small\texttt{\textbackslash big {]}}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
+{\small{*}subnudge} & {\small\texttt{0 mu}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
\bottomrule
\end{tabular}
+\par\end{center}
\end{table}
\par\end{center}
+
\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};
default = \texttt{d}
+\item [{style}] the fraction form of derivative;
+\begin{itemize}
+\item for uprightfraction derivatives, \verb`\diff`, \verb`\diffp`, a
+choice of \verb`frac`, \verb`tfrac` or \verb`dfrac`:
+\begin{itemize}
+\item \verb`frac` results in a fraction formed from \verb`\frac`, scalable
+\item \verb`tfrac` results in a fraction formed from \verb`\tfrac`, not
+scalable
+\item \verb`dfrac` results in a fraction formed from \verb`\dfrac`, not
+scalable
+\item default in templates \verb`DIFF`, \verb`DIFFP` = \verb`frac`
+\end{itemize}
+\item for slashfraction derivatives,\verb`\difs`, \verb`\difsp`, a choice
+of \verb`/`, \verb`auto`, \verb`big`, \verb`Big`, \verb`bigg`
+or \verb`Bigg`
+\begin{itemize}
+\item \verb`/` forms the slash fraction with \verb`/`, not scalable
+\item \verb`auto` forms the slash fraction with \verb`\left. \middle/ \right.`,
+scalable
+\item \verb`big`, \verb`Big`, \verb`bigg` and \verb`Bigg` form the slash
+fraction with \verb`\big/`, \verb`\Big/`, \verb`\bigg/` and \verb`\Bigg/`
+respectively, not scalable
+\item default in templates \verb`DIFS`, \verb`DIFSP` = \verb`/`
+\end{itemize}
+\item for compactform derivatives, \verb`\difc`, \verb`\difcp`, a choice
+of \texttt{\_} or \verb`dl`
+\begin{itemize}
+\item \_ forms derivatives of compact form like $\difc yx$, $\difcp[1,2]{z}{x,y}$
+\item \verb`dl` forms differentials like $\difc.dl.{}x$ and $\difcp.dl.[2]{}{x,y,z}$
+\item default in templates \verb`DIFC`, \verb`DIFCP` = \texttt{\_}
+\end{itemize}
+\item overall default in template \verb`DIF` = \verb`frac`
+\end{itemize}
+\item [{slashtok}] token or tokens used for the slash fraction; (see \xA7\ref{subsec:Othernotations}
+for a different assignment) default \verb`/`
+\item [{slashsep}] space inserted on either side of the \textbf{slashtok};
+ default \verb`0 mu`
+\item [{derivandsep}] horizontal space added before the differentiand
+if the \verb`spaced` package option is set to \verb`1`, or before
+a multitokened differentiand if the \verb`spaced` package option
+is set to \verb`1`; note that compactform derivatives \emph{always
+}have this space inserted; default (appropriate for an uprightfraction
+derivative) = \verb`3mu plus 1mu minus 2mu`
+\item [{opsymbol}] the operator symbol; for ordinary derivatives generally
+one of \verb`d` or \verb`\mathrm{d}`, for partial derivatives \verb`\partial`;
+default = \verb`\mathrm{d}`
\item [{opsymbolalt}] if different from \textbf{opsymbol} then used
in the 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
+in the denominator of a fractionform derivative while \verb`opsymbol`
+is used in the numerator; e.g. for the acceleration $\diff.n.{v^{i}}t$,
+\verb`opsymbol = \nabla` and \verb`opsymbolalt = d`; defaults
+to \textbf{opsymbol} default
+\item [{opordernudge}] extra horizontal space added between the opsymbol
and the superscripted order of differentiation in higher order derivatives;
for the mathitalic forms 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;
default = \texttt{1 mu}
\item [{derivandsep}] horizontal space added before the differentiand
(derivand) if the \verb`spaced` package option is used, or by the
\verb`!` switch if it is not; the default has some stretch and shrink;
default = \verb`3mu plus 1mu minus 2mu`
\item [{/derivandsep}] for the slash form of derivative, horizontal space
added before the differentiand (derivand) if the \verb`spaced` package
option is used, or by the \verb`!` switch if it is not; default =
\verb`derivandsep`
\item [{{*}derivandsep}] when the derivand is appended, horizontal space
added before the differentiand (derivand) if the \verb`spaced` package
option is used, or by the \verb`!` switch if it is not; default =
\verb`derivandsep`
\item [{{*}/derivandsep}] for the slash form of derivative when the derivand
is appended, horizontal space added before the differentiand (derivand)
if the \verb`spaced` package option is used, or by the \verb`!`
switch if it is not; default = \verb`/derivandsep`
\item [{denomtermsep}] (mixed partial derivatives only) horizontal spacing
inserted between the differentials in the denominator of a mixed partial
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} or \textbf{/denomtermsep}
+for mathitalic forms 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 \verb`1 mu`; since
+\textbf{opsymbol }defaults to an upright `d', default = \verb`0 mu`
+\item [{varsupnudge}] extra horizontal space added between a variable
+in the denominator of a derivative and the superscripted order of
+differentiation in higher order derivatives (cf \textbf{opordernudge});
+default = \verb`1 mu`
+\item [{multitermsep}] horizontal spacing inserted between the differentials
+in, for example, the denominator of a mixed partial derivative to
+avoid a solid cluster like $\partial x\partial y\partial z$; with
+the default \verb`2 mu` this is spread a little, $\difcp.dl.{}{x,y,z}$;
+default = \verb`2 mu plus 1 mu minus 1 mu`
+\item [{termsepadjust}] adjustment (usually a reduction) to \textbf{multitermsep}
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
+if, e.g., $\difcp.dl.[2]{}{x,y,z}$ 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; 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; default = \texttt{\textbackslash right }
\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; 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; default = \texttt{)}
\item [{elbowroom}] adjustment to the whitespace between the left and right
delimiters and the enclosed derivative; negative values reduce the
space; default = \texttt{0 mu}
\item [{/elbowroom}] adjustment to the whitespace between the left and
right delimiters and the enclosed slashform derivative; 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; 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; default = \texttt{0 mu}
+and $\partial z$; default = {\ttfamily\verb`1 mu`}
\item [{longvarwrap}] to avoid ambiguity in higher order derivatives
it may be advisable to wrap multitoken variables of differentiation
in parentheses; default = \texttt{d(v)}; the choices are
+it may aid clarity to wrap multitoken variables of differentiation
+in parentheses; 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}$
\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}$
+\item [{\texttt{dv\phantom{()}}}] no wrapping, e.g. $\mathrm{d}x_{i}^{2}$
+or $\partial\frac{1}{\Theta}^{2}$,
+\item [{\texttt{d(v)}}] wrap the variable only, e.g. $\mathrm{d}(x_{i})^{2}$
+or $\partial(\frac{1}{\Theta})^{2}$,
+\item [{\texttt{(dv)}}] wrap both opsymbol and variable, e.g. $(\mathrm{d}x_{i})^{2}$
+or $(\partial\frac{1}{\Theta})^{2}$;
+\item [{\texttt{\phantom{(dv)}}}] default = \verb`d(v)`
\end{description}
\item [{{*}/opwrap}] a choice of \texttt{true} or \texttt{false} for
slash forms of the derivative when the differentiand is appended,
dictating whether the derivative is wrapped in parentheses, as here
$\diffp*{F(x,y)}/x$, or not; default = \texttt{true}
\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; default = \texttt{false}
\item [{{*}italicnudge}] if \textbf{{*}opleft} is \texttt{true}, makes
+\item [{lvwrapLdelim}] left delimiter when wrapping a long variable in
+a higher order derivative; also applies to the left delimiter used
+in a jacobian; default = \verb`\mleft (`
+\item [{lvwrapRdelim}] right delimiter when wrapping a long variable in
+a higher order derivative; also applies to the right delimiter used
+in a jacobian; default = \verb`\mright )`
+\item [{lvwrapsupnudge}] horizontal adjustment to the superscript position
+when a multitoken variable is wrapped in (e.g.) parentheses and its
+order of differentiation is not \verb`1`; default = \verb`2 mu`
+\item [{outerLdelim}] 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; ISO recommends parentheses
+for this purpose, hence default = {\ttfamily\verb`\left (`}
+\item [{outerRdelim}] the right member of a delimiter pair wrapping the
+derivative and subscripted to indicate a point of evaluation or variables
+held constant; ISO recommends parentheses for this purpose, hence
+default = {\ttfamily\verb`\right )`}
+\item [{elbowroom}] adjustment to the whitespace between \textbf{outerLdelim},
+\textbf{outerRdelim }and the enclosed derivative; negative values
+reduce the space; default = {\ttfamily\verb`0 mu`}
+\item [{subnudge}] horizontal adjustment of the subscript's placing relative
+to the \textbf{outerRdelim}iter for a point of evaluation or variable
+held constant; a negative value compensates for the curving inwards
+of a large right parenthesis; default = {\ttfamily\verb`5 mu`}
+\item [{opsubnudge}] horizontal adjustment of the position of the subscript
+in derivatives of compact form relative to the operator; since \verb`\mathrm{d}`
+is the default operator, default = \verb`0 mu`
+\item [{{*}derivandsep}] when the derivand is appended, horizontal space
+added before the differentiand (derivand) depending on the setting
+of the \verb`spaced` package option; default = \textbf{derivandsep}
+default
+\item [{{*}opsetleft}] a choice of {\ttfamily\verb`true`}
+or {\ttfamily\verb`false`} indicating whether the opsymbol
+is leftaligned or not when the differentiand is appended; generally
+it is centred; applies only to uprightfraction forms of the derivative;
+default = {\ttfamily\verb`false`}
+\item [{{*}italicnudge}] if \textbf{{*}opsetleft} is \verb`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}; default = \texttt{3
mu}
+and denominator align in the same slanting column; for \verb`d` or
+\verb`\partial` an appropriate value might be \verb`3 mu`; because
+of the default \verb`\mathrm{d}`, default = \verb`0 mu`
+\item [{{*}innerwrap}] when the differentiand is appended, a choice of
+\verb`true` or \verb`false` dictating whether the differential operator
+is wrapped in parentheses, as here $\difsp*{F(x,y)}x$, or not; for
+a slashfraction derivative \verb`true` is an appropriate default,
+but the overall default, appropriate for an uprightfraction derivative,
+= \verb`false`
+\item [{{*}innerLdelim}] if \textbf{{*}innerwrap} is \verb`true`, the\textbf{
+}left member of a delimiter pair around the differential operator;
+default = \verb`(`
+\item [{{*}innerRdelim}] if \textbf{{*}innerwrap} is \verb`true`, the\textbf{
+}right member of a delimiter pair around the differential operator
+; default = \verb`)`
+\item [{{*}outerLdelim}] if \textbf{{*}innerwrap} is \verb`true`, the
+left member of a delimiter pair around both the differential operator
+and appended differentiand, the right member of which may be subscripted
+to indicate a point of evaluation or variables held constant; to avoid
+too many parentheses, given the default values of {*}\textbf{innerLdelim},
+{*}\textbf{innerRdelim}, default = \verb`\bigl [`
+\item [{{*}outerRdelim}] if \textbf{{*}innerwrap} is \verb`true`, the
+right member of a delimiter pair around the differential operator
+and appended differentiand; may be subscripted to indicate a point
+of evaluation or variables held constant; to avoid too many parentheses,
+given the default values of \textbf{{*}innerLdelim}, \textbf{{*}innerRdelim},
+default = \verb`\bigr ]`
+\item [{{*}subnudge}] if \textbf{{*}innerwrap} is \verb`true`, horizontal
+adjustment of the subscript's placing relative to the \textbf{{*}outerRdelim}iter
+for a point of evaluation or variable held constant; a negative value
+compensates for the curving inwards of a large right parenthesis;
+since the default \textbf{{*}outerRdelim} is a square bracket,\textbf{
+}default = \verb`0 mu`
\end{description}
\subsection{ISO defaults}
+\subsection{Ordinary uprightfraction derivatives; template \texttt{DIFF}}
\label{subsec:ISOdefaults}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}[10]{o}{0.4\columnwidth}%
\centering{}\vspace{4ex}
 \caption{{\small ISO default changes}\protect\label{tab:ISOsettingchanges}}
\abovetopsep=.5ex %
+The defaults assigned in template \verb`DIF` are inherited by template
+\verb`DIFF` without change. Template \verb`DIFF` is therefore strictly
+unnecessary but, with templates \verb`DIFS` and \verb`DIFC` in mind,
+was created for the sake of a consistent naming scheme.
+
+The \verb`\diff` command uses the values in the \verb`DIFF` template
+to form an uprightfraction derivative. Only keys with an `f' in
+the third column of Table~\ref{tab:DIFdefaults} are used in this
+process. Keys without an `f' play no part in the process and their
+default values are ignored. See \xA7\ref{subsec:DIFF(uprightfractionderivative)}
+for the complete list of \emph{relevant} \verb`DIFF` defaults.
+
+\begin{table}
+\caption{Defaults differing from the parent template}
+
+\begin{centering}
+\subfloat[\texttt{DIFS}\label{tab:DIFSdefaults}]{\centering{}%
\begin{tabular}{lr}
\toprule
{\small key} & {\small default}\tabularnewline
+{\small key} & {\small default}\tabularnewline
+\midrule
+{\small style} & {\small\texttt{/}}\tabularnewline
+{\small derivandsep} & {\small\texttt{2muplus1muminus2mu}}\tabularnewline
+{\small outerLdelim} & {\small\texttt{(}}\tabularnewline
+{\small outerRdelim} & {\small\texttt{)}}\tabularnewline
+{\small subnudge} & {\small\texttt{0 mu}}\tabularnewline
+{\small{*}innerwrap} & {\small\texttt{true}}\tabularnewline
+\bottomrule
+\end{tabular}}\hfil\subfloat[\texttt{DIFC}\label{tab:DIFCdefaults}]{\centering{}%
+\begin{tabular}{lr}
+\toprule
+{\small key} & {\small default}\tabularnewline
+\midrule
+{\small style} & {\small\texttt{\_}}\tabularnewline
+{\small derivandsep} & {\small\texttt{1muplus1muminus1mu}}\tabularnewline
+{\small multitermsep} & {\small\texttt{1 mu}}\tabularnewline
+{\small termsepadjust} & {\small\texttt{0 mu}}\tabularnewline
+{\small outerLdelim} & {\small\texttt{\textbackslash bigl (}}\tabularnewline
+{\small outerRdelim} & {\small\texttt{\textbackslash bigr )}}\tabularnewline
+subnudge & {\small\texttt{2 mu}}\tabularnewline
+\bottomrule
+\end{tabular}}
+\par\end{centering}
+\centering{}\subfloat[\texttt{DIFFP}\label{tab:DIFFPdefaults}]{\centering{}%
+\begin{tabular}{lr}
+\toprule
+{\small key} & {\small default}\tabularnewline
\midrule
{\small opsymbol} & {\small\texttt{\textbackslash mathrm\{d\}}}\tabularnewline
{\small opordersep} & {\small\texttt{0 mu}}\tabularnewline
{\small leftdelim} & {\small\texttt{\textbackslash left (}}\tabularnewline
{\small rightdelim} & {\small\texttt{\textbackslash right )}}\tabularnewline
{\small subscrnudge} & {\small\texttt{6 mu}}\tabularnewline
+{\small opsymbol} & {\small\texttt{\textbackslash partial}}\tabularnewline
+{\small opordernudge} & {\small\texttt{1 mu}}\tabularnewline
+{\small{*}italicnudge} & {\small\texttt{3 mu}}\tabularnewline
\bottomrule
\end{tabular}\end{wraptable}%

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 parentheses to indicate a point of evaluation.
Hence the other entries 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.

Note that the \texttt{ISO} option will also produce upright `D's in
derivatives formed from `D'; see \xA7\ref{subsec:DdeltaDelta} below.

\subsection{Partial derivatives}

\begin{wraptable}{o}{0.4\columnwidth}%
\centering{}\vspace{4ex}
 \caption{{\small Default changes for partial derivatives}\protect\label{tab:Partialderivdefaults}}
\abovetopsep=.5ex %
+\end{tabular}}\hfil\subfloat[\texttt{DIFSP, DIFCP}\label{tab:DIFSPDIFCPdefaults}]{\centering{}%
\begin{tabular}{lr}
\toprule
{\small key} & {\small default}\tabularnewline
+{\small key} & {\small default}\tabularnewline
\midrule
{\small opsymbol } & {\small\texttt{\textbackslash partial}}\tabularnewline
{\small leftdelim} & {\small\texttt{\textbackslash left (}}\tabularnewline
{\small rightdelim} & {\small\texttt{\textbackslash right )}}\tabularnewline
{\small subscrnudge } & {\small\texttt{6 mu}}\tabularnewline
+{\small opsymbol} & {\small\texttt{\textbackslash partial}}\tabularnewline
+{\small opordernudge} & {\small\texttt{1 mu}}\tabularnewline
\bottomrule
\end{tabular}\end{wraptable}%
+\end{tabular}}
+\end{table}
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 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
of thermodynamics, one of which is
\[
\diffp SV[T]=\diffp PT[V].
\]
+\subsection{Ordinary slashfraction derivatives; template \texttt{DIFS}}
\subsection{Setting your own defaults: \texttt{\textbackslash diffdef\protect\label{subsec:diffdef}}}
+When you use the command \verb`\difs` to form a slashfraction derivative
+it is the keys in template \verb`DIF` with an `s' in the third
+column of Table~\ref{tab:DIFdefaults} which are used. Table~\ref{tab:DIFSdefaults}
+records those keys used for this purpose which are assigned default
+values \emph{different} from those in \verb`DIF`. See \xA7\ref{subsec:DIFS(slashfractionderivative)}
+for the complete list of \emph{relevant} \verb`DIFS` defaults.
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
\begin{lyxcode}
\textbackslash diffdef~\{\}~~~~
+\subsection{Ordinary compactform derivatives; template \texttt{DIFC}}
~~\{~~~~~~
+When you use the command \verb`\difc` to form a compact derivative
+it is the keys in template \verb`DIF` with a `c' in the third column
+of Table~\ref{tab:DIFdefaults} which are used. Table~\ref{tab:DIFCdefaults}
+records those keys used for this purpose which are assigned default
+values \emph{different} from those in \verb`DIF`. See \xA7\ref{subsec:DIFC(compactderivative)}
+for the complete list of \emph{relevant} \verb`DIFC` defaults.
~~~~opsymbol~~~~=~\textbackslash mathrm\{d\},~~~~
+\subsection{Partial derivatives; templates \texttt{DIFFP}, \texttt{DIFSP}, \texttt{DIFCP}}
~~~~opordersep~=~0~mu
+The default values given in the tables so far apply to ordinary derivatives.
+For \emph{partial} derivatives, only a few defaults change. These
+are listed in Tables~\ref{tab:DIFFPdefaults}, \ref{tab:DIFSPDIFCPdefaults}.
+All other keys take the default values of the respective parent templates,
+\verb`DIFF`, \verb`DIFS` and \verb`DIFC`.
~~\}
\end{lyxcode}
\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.
+\section{Variant forms: the \texttt{\textbackslash difdef} command}
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 is the \emph{default} values that are changed. If they contain
some content, 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 \xA7\ref{sec:Rogues'gallery}.
+\label{sec:Variantforms}You may be dissatisfied with the scheme
+of default values listed in the preceding tables and wish to `Remould
+it nearer to the Heart's Desire'. How to do so is discussed in \xA7\ref{sec:ChangingDefaults}
+below. In \emph{this} section it is assumed that the user is largely
+satisfied with the assigned defaults but has need to write an occasional
+derivative that deviates from the default form. For instance, to write
+the range of different examples displayed in the Rogues' Gallery (\xA7\ref{sec:Rogues'gallery})
+I had to make extensive use of such \emph{variant forms} of derivative.
+I needed forms that displayed different ways of indicating a point
+of evaluation, a form that showed a mathitalic `d' rather than
+the default upright `d', forms that displayed different parenthesizing
+styles for higherorder derivatives with multitoken variable names,
+and so on.
\subsubsection{Space before the differentiand}
+The process of defining and using such variants is a twostep process.
+The `using' part is easy: you simply put the name of the variant
+form between dots and append to the relevant \verb`\difx` or \verb`\difxp`
+command.
\label{subsec:Afinalflourish}\begin{wraptable}{o}{0.6\columnwidth}%
\begin{centering}
\caption{Keys for spacing the derivand}
\medskip{}
\begin{tabular}{lr}
\toprule
{\small key} & {\small default}\tabularnewline
\midrule
{\small derivandsep} & {\small\texttt{3mu plus 1mu minus 2mu}}\tabularnewline
{\small{*}derivandsep} & {\small\texttt{derivandsep}}\tabularnewline
{\small /derivandsep} & {\small\texttt{derivandsep}}\tabularnewline
{\small{*}/derivandsep} & {\small\texttt{ /derivandsep}}\tabularnewline
\bottomrule
\end{tabular}
\par\end{centering}
\end{wraptable}%
The insertion of a small space before the differentiand is effected
by the \verb`!` key inserted immediately before the differentiand
argument in the \verb`\diff` command. You may wish to make the insertion
of this space the \emph{default} behaviour. This is done by using
the \verb`spaced` package option (which makes the \verb`!` switch
now reverse this new default and put \emph{no} extra space before
the derivand). The amount of space inserted is, by default, \verb`3mu plus 1mu minus 2mu`,
meaning the space is generally $3$mu but can stretch to $4$mu or
shrink to $1$mu as \TeX{} strives to fit content in a line or on the
page.
+The `defining' part makes use of a command \verb`\difdef`,
+\begin{verbatim}
+ \difdef{idlist}{variantname}{keyvalue list}
+\end{verbatim}
+which has three \emph{mandatory} arguments:
+\begin{enumerate}
+\item \verb`idlist` A commalist of identifiers, one or more of \verb`f`,
+\verb`s`, \verb`c`, \verb`fp`, \verb`sp`, \verb`cp`, \verb`j`,
+\verb`l` distinguishing the respective templates \verb`DIFF`, \verb`DIFS`,
+\verb`DIFC`, \verb`DIFFP`, \verb`DIFSP`, \verb`DIFCP`, \verb`DIFJ`
+and \verb`DIFL` (for the last two see Chapter~\ref{chap:Differentialsandjacobians}).
+\item \verb`variantname` A (preferably brief) name for the variant form;
+it may include characters other than letters, like numbers, punctuation
+marks (excluding full stops), mathematical symbols like \verb`+`
+and \verb`=`, but not control sequences or active characters, nor
+\verb`%` , \verb`#` or braces.
+\item \verb`keyvalue list` A \emph{key=value} list where the settings
+differ from the default settings for the relevant template or templates
+(as determined by the \verb`idlist`).
+\end{enumerate}
+In the preamble to the present document I have included the following
+definition:
+\begin{verbatim}
+ \difdef { f } { p }
+ {
+ opsymbol = \partial,
+ opordernudge = 1 mu
+ }
+\end{verbatim}
+This defines a variant, with name \verb`p`, of an ordinary uprightfraction
+derivative (the \verb`f` in the first argument) that displays as
+a partial derivative. To use the variant simply append the name, as
+a dotdelimited argument, to the \verb`\diff` command. For instance,
+repeating an earlier example from thermodynamics,
+\begin{centred}
+\verb`\[ \diff.p.*{\frac PT}U[V] = \diff.p.*{\frac 1T}V[U] \]` $\Longrightarrow$
+\[ \diff.p.*{\frac PT}U[V] = \diff.p.*{\frac 1T}V[U]\]
+\end{centred}
+\noindent The effect is exactly the same as previously and it would
+have been possible to define \verb`\diffp` as this variant by following
+the definition of the variant with the statement,
+\begin{verbatim}
+ \NewDocumentCommand \diffp { } { \diff.p. }
+\end{verbatim}
+\verb`diffcoeff` has not followed this path, instead choosing to
+put the status and configurability of partial derivatives on the same
+footing as ordinary derivatives.
Perhaps this doesn't suit. You may want a fixed space here, with no
stretch or shrink. The key to change is \verb`derivandsep`. By default,
this setting applies not only to the fraction form of derivative,
but also to the slash form and to when the derivand is appended.
+\noindent %
+\noindent\begin{minipage}[t]{1\columnwidth}%
+\begin{shaded}%
+The command \verb`\difdef` in version 5 of \verb`diffcoeff` takes
+\emph{three} mandatory arguments for defining variant forms of derivative.
+Do not confuse with the command \verb`\diffdef` of earlier versions
+of \verb`diffcoeff` which took \emph{two }mandatory arguments for
+this purpose. The third argument is required to identify which one
+or more of the fraction forms \verb`f`, \verb`s`, \verb`c`, \verb`fp`,
+\verb`sp`, \verb`cp` of the commands \verb`\difx`, \verb`\difxp`,
+the variant applies to. In earlier versions this was not necessary
+since there was only the one primary derivative command \verb`\diff`.\end{shaded}%
+\end{minipage}
If you feel a little less space should be used for slash derivatives,
then the key to change is \verb`/derivsep`. This changed value
will also be used for an appended derivand in a slash derivative.
+\medskip{}
Thus to meet both wishes you might put in the preamble of your document
something like
\begin{lyxcode}
\textbackslash diffdef~\{\}~~~~
+The present document comes with a number of variant definitions. These
+are divided into two groups. One, in the preamble, contains definitions,
+like the example just given, designed to illustrate various effects
+in this document  as in the Rogues' Gallery. These preamble definitions
+are listed in \xA7\ref{sec:Preambledefinitions}. The other, in the
+associated file \verb`diffcoeff5.def`, contains definitions that
+may be of more general usefulness; these are listed in \xA7\ref{sec:Thefilediffcoeff5.def}.
~~\{~~~~~~
+\subsection{The \texttt{.def} file}
~~~~derivandsep~~~=~3~mu,~~~~
+\label{subsec:The.deffile}A \verb`.def` file (in \verb`diffcoeff`)
+is a text file containing a list of definitions of variant derivatives
+after the fashion of the example above. The reason for placing such
+variant definitions in a file is that they can be easily transferred
+from document to document by means of the \verb`deffile` package
+option. If the name of your \verb`.def` file is \verb`myfile`, then
+invoking \verb`diffcoeff` with the call
+\begin{verbatim}
+ \usepackage[deffile=myfile]{diffcoeff}
+\end{verbatim}
+makes the definitions in \verb`myfile.def` available to your current
+document  provided \verb`diffcoeff` can find the file.
~~~~/derivandsep~=~2~mu
+The question is: where to put the \verb`.def` file? The directory
+of the current document is an obvious candidate and for the current
+document serves well, but it does mean copying the \verb`.def` file
+from directory to directory to work on \emph{different} documents.
+To make a definition file available for \emph{all} documents, place
+it in the \verb`texmf` tree, preferably not the one created by your
+\TeX{} distribution, but your own \emph{personal} \verb`texmf` tree.
+Provided your \TeX{} distribution knows about your personal \verb`texmf`
+tree and the files it contains, then a \verb`.def` file placed within
+it will be accessible to all documents.
+\noindent \begin{center}
+\noindent\begin{minipage}[t]{1\columnwidth}%
+\begin{shaded}%
~~\}
\end{lyxcode}
This will insert a fixed space of $3$mu before the differentiand
in both the numerator and when appended in the fraction form of derivative,
and a fixed space of $2$mu in the slash form of derivative, both
in the numerator and when appended.
+\subsubsection*{Personal \texttt{texmf} tree?}
If you want a different spacing when the derivand is appended, the
keys to change are \verb`*derivandsep` and \verb`*/derivandsep`.
+This is a directory created by you for `waifs and strays' of the \TeX{}
+system that are not included in standard distributions like MiK\TeX{}
+or \TeX Live. For instance, it is the place for personal packages
+designed for your own particular circumstances or preferences, and
+is structured like the standard \texttt{texmf} hierarchy but placed
+in another location so that there is no chance of its being overwritten
+when your \TeX{} distribution is updated. But that distribution needs
+to be alerted to the existence of your personal \texttt{texmf} tree
+and any new files added to it. For MiK\TeX , open the MiK\TeX{} console,
+click on \textsf{Settings} (in the column on the left) and then the
+\textsf{Directories} tab. Click the \textsf{+} button and navigate
+to your personal texmf tree to add it to the MiK\TeX{} search path,
+using the arrow keys to place it as high in the search path as possible.
+Having added it, you will then need to refresh the filename database
+by clicking on the \textsf{Tasks} menu and selecting the obvious entry.
+I am not familiar with \TeX Live but presume an analogous process
+will apply there.\end{shaded}%
+\end{minipage}
+\par\end{center}
\paragraph{Selective spacing}
+\begin{center}
+\medskip{}
+\noindent\begin{minipage}[t]{1\columnwidth}%
+\begin{shaded}%
I have treated the \verb`spaced` package option thus far as if it
were an \verb`ON/OFF` switch and, indeed, the presence of the package
option \verb`spaced` behaves as \verb`ON` and its absence as \verb`OFF`.
Internally, however, \verb`spaced` is equivalent to \verb`spaced=1`
and its absence to \verb`spaced=0`. Entering \verb`spaced=n` in
the package option where \verb`n` is a positive integer is equivalent
to entering \verb`spaced=1` (and hence to simply entering \verb`spaced`),
but if \verb`n` is a negative integer, a new effect is produced.
+\subsubsection*{\texttt{diffcoeff.def}}
Entering \verb`spaced=1` (or any negative integer) will insert a
space (by default \verb`3mu plus 1mu minus 2mu`) before the differentiand
provided the differentiand\emph{ is longer than a single token} but
will insert no space before singletoken differentiands. The switch
\verb`!` reverses this behaviour.
+In earlier versions of \verb`diffcoeff`, if there was no explicit
+\verb`deffile=<filename>` package option statement, then a file
+\verb`diffcoeff.def` was searched for and if found loaded. This is
+no longer the case. Version 5 of file of \verb`diffcoeff` searches
+for a \verb`.def` \emph{only if it is explicitly named} in a package
+option statement. (This decision was made at least in part to avoid
+conflict with a \verb`diffcoeff.def` file from an earlier version
+of \verb`diffcoeff` tucked away in some nonobvious place and producing
+obscure errors in the current version 5.) \end{shaded}%
+\end{minipage}
+\par\end{center}
\subsection{Variant forms}
+\subsubsection{Log file message}
For this package I needed to have a number of variant forms available
to illustrate the wide variety of ways in which derivatives are displayed.
The \texttt{\textbackslash diffdef} command in which the first argument
is \emph{filled} provides one half of the means of doing this. I've
given the singleletter name \texttt{p} to the following settings:
\begin{lyxcode}
\textbackslash diffdef~\{~p~\}
+If the\verb`.def` file named in the package option statement cannot
+be located by \TeX , a message to that effect is sent to the terminal
+and log file, but \verb`diffcoeff` continues loading.
~~\{
+\subsection{Examples of variants}
~~~~opsymbol~~~~=~\textbackslash partial~,
+The dotdelimited name argument must always be the \emph{first} argument
+of the \verb`\difx` or \verb`\difxp` command, even preceding an
+asterisk (star) signalling `append the differentiand'. Now for some
+examples.
~~~~leftdelim~~~=~\textbackslash left~(~~,
+\paragraph{Acceleration}
~~~~rightdelim~~=~\textbackslash right~)~,

~~~~subscrnudge~=~6~mu

~~\}
\end{lyxcode}
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 \texttt{\textbackslash diff} command. Thus, repeating
an example at the end of \xA7\ref{subsec:Partialappending},
+In tensor calculus acceleration is sometimes written $\difs.n.{v^{i}}t$,
+where different operator symbols occur in numerator and denominator.
+In the preamble to this document I have included the definition
+\begin{verbatim}
+ \difdef { f, s } { n }
+ {
+ opsymbol = \nabla,
+ opsymbolalt = \mathrm{d}
+ }
+\end{verbatim}
+to give both upright (the \verb`f`) and slashfraction (the \verb`s`)
+forms of the acceleration. Appending tne dotdelimited name \verb`n`
+to \verb`\difs`, \verb`$ \difs.n.{v^i}t $` $\Longrightarrow$ $ \difs.n.{v^i}t $,
+and appending the dotdelimited name \verb`n` to \verb`\diff`,
\begin{centred}
\verb`\[ \diff.p.*{\frac PT}U[V] = \diff.p.*{\frac 1T}V[U] \]` $\Longrightarrow$
\[ \diff.p.*{\frac PT}U[V] = \diff.p.*{\frac 1T}V[U] \]
+\verb`\[ \diff.n.{v^i}t. \]` $\Longrightarrow$ \[ \diff.n.{v^i}t. \]
\end{centred}
\noindent The effect is exactly the same as previously, when the \texttt{\textbackslash diffp}
command was used. Indeed, \texttt{diffcoeff} identifies \texttt{\textbackslash diffp}
with \texttt{\textbackslash diff.p.}:
\begin{lyxcode}
\textbackslash NewDocumentCommand~\textbackslash diffp~\{~\}~\{~\textbackslash diff.p.~\}
\end{lyxcode}
Note that this identification of \texttt{\textbackslash diffp} with
\texttt{\textbackslash diff.p.} means there is no equivalent dotdelimited
argument available for \texttt{\textbackslash diffp}. The \emph{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
\begin{lyxcode}
\textbackslash diffdef~\{~up~\}~
+\paragraph{Detached subscripts}
~~\{
+To show the effect of the key \verb`subnudge`, the preamble contains
+the definition
+\begin{verbatim}
+ \difdef { fp } { wsp }
+ { subnudge = 0 mu }
+\end{verbatim}
+The name \verb`wsp` is a contraction of `whitespace'. The defintion
+applies only to an uprightfraction form of partial derivative (the
+\verb`fp` in the optional argument). By giving \verb`subnudge`
+a zero value in the \verb`wsp` variant, the subscript is cast adrift
+(perhaps to float away?) on a sea of whitespace. The default setting,
+\verb`subnudge=5 mu`, maintains visual connection between subscript
+and right parenthesis:
~~~~opsymbol~~~~=~\textbackslash mathrm\{d\},
+\verb`\[ \diffp.wsp.Fx[0],\quad \diffp Fx[0] \]` $\Longrightarrow$
+\[ \diffp.wsp.Fx[0],\quad \diffp Fx[0] \]
~~~~opordersep~=~0~mu
+\paragraph{Lagrange's equations}
~~\}
\end{lyxcode}
Apart from the \emph{key = value} settings, the critical feature here
is the name, \texttt{up} (which is at your discretion and could equally
be \texttt{upright} or \texttt{roman} or even \texttt{Fred} if you
so fancied). This ensures that the changed settings apply only to
this particular variant and do not `infect' the overall defaults.
To use this variant, all that is needed is to add the name, between
dots, to the \texttt{\textbackslash diff} command:
+An earlier example used Lagrange's equations of motion, which showed
+a problem with the amount of whitespace introduced before a differentiand
+bounded by a \verb`\left`, \verb`\right` pair. The file \verb`diffcoeff5.def`
+contains the definition
+\begin{verbatim}
+ \difdef { f, fp } { *0 }
+ {
+ *derivandsep = 0 mu ,
+ outerLdelim = \mleft ( ,
+ outerRdelim = \mright )
+ }
+\end{verbatim}
+The first thing to notice is that the name of the variant, \verb`*0`,
+is not formed from letters (there are other examples below). Now Lagrange's
+equations are rendered (just right to my eye!)
\begin{centred}
\verb`\[ \diff.up.yx \]` $\Longrightarrow$ \[ \diff.up.yx. \]
+\verb`\[ \diffp L{q_{k}}\diff.*0.**t{\diffp L{\dot{q}_{k}}[]}=0 \]`
+\[
+\diffp L{q_{k}}\diff.*0.**t{\diffp L{\dot{q}_{k}}[]}=0.
+\]
\end{centred}
\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.}:
\begin{centred}
\noindent \verb`\[ \diff.up.*{\frac{F(x)}{G(x)}}x[x=1] \]` $\Longrightarrow$
\[ \diff.up.*{\frac{F(x)}{G(x)}}x[x=1] \]
\end{centred}
\noindent Dotdelimited arguments must always be the \emph{first}
argument of the \texttt{\textbackslash diff} command, even preceding
an asterisk (star) as in this example.
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
\begin{lyxcode}
\textbackslash diffdef~\{~padrift~\}~\{~subscrnudge~=~0~mu~\}
\end{lyxcode}
I have attached a name, \texttt{padrift},\texttt{ }to this setting,
\begin{centred}
\verb`\[ \diff.padrift.Fx[y] \]` $\Longrightarrow$ \[ \diff.padrift.Fx[y] \]
\end{centred}
\noindent since, to my eye, the subscript seems detached from the
expression it qualifies  is it perhaps a typo?  and `adrift
in a sea of whitespace'. This is to be compared with the default \verb`\[ \diffp Fx[y] \]`
$\Longrightarrow$ \[ \diffp Fx[y] \]
+\subsubsection{Editing variant forms}
\noindent where the subscript is tucked in close to the right parenthesis
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
\begin{lyxcode}
\textbackslash diffdef~\{~pvrule~\}~\{~opsymbol~=~\textbackslash partial~\}~
\end{lyxcode}
(or some other name of your choosing). This gives
\begin{centred}
\verb`\[ \diff.pvrule.{F(x,y)}x[x=1] \]`$\Longrightarrow$ \[ \diff.pvrule.{F(x,y)}x[x=1] \]
\end{centred}

\subsubsection{Textstyle and scriptstyle derivatives\protect\label{subsec:Textandscriptstyle}}

As noted earlier, the \texttt{diffcoeff} package assumes that derivatives
of fractionlike form will be used in displaystyle expressions and
that the slash form will be used for inline use (text style). This
is the usual practice. But if one does want to use the fraction form
in an inline expression, 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. Hence define

\noindent %
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{lyxcode}
\textbackslash diffdef~\{~ptxt~\}~
+\begin{shaded}%
~~\{
+\paragraph*{Bug in \texttt{xtemplate}}
~~~~opsymbol~~~~~~=~\textbackslash partial,
+If you wish to successfully \emph{edit} a variant form that has (already)
+been defined  by you or in \verb`diffcoeff` or in the \verb`.def`
+file\emph{ } then you will need a version of \verb`xtemplate`
+from 20221217 or later. Earlier versions contained a bug that didn't
+otherwise affect the workings of \verb`diffcoeff` but did prevent
+changes being made to already defined variants.\end{shaded}%
+\end{minipage}\medskip{}
~~~~denomtermsep~=~1~mu~~~~,
+You may wish to edit an already defined variant form  perhaps to
+give a \emph{negative} value to \verb`*derivandsep` in the last
+example. You don't need to repeat the full definition. It suffices
+to change the setting only of the relevant key or keys:
+\begin{verbatim}
+ \difdef { f, fp } { *0 }
+ { *derivandsep = 3 mu }
+\end{verbatim}
+which gives for Lagrange's equations (too tight to my eye!)
+\[
+\difdef{f,fp}{*0}{*derivandsep=3mu}\diffp L{q_{k}}\diff.*0.**t{\diffp L{\dot{q}_{k}}[]}=0.
+\]
~~~~leftdelim~~~~~=~\textbackslash left~(~,
~~~~rightdelim~~~~=~\textbackslash right~),
+\subsubsection{Parenthesizing multitoken variables}
~~~~elbowroom~~~~~~=~2~mu~~~,
+To illustrate the different modes of parenthesizing `long' variables
+in higher order derivatives, I have put these two definitions in \verb`diffcoeff5.def`:
+\begin{verbatim}
+ \difdef { f, fp } { (dv) }
+ { longvarwrap = (dv) }
~~~~subscrnudge~~~=~3~mu~~~
+ \difdef { f, fp }{ dv }
+ { longvarwrap = dv }
+\end{verbatim}
+The three possibilities for wrapping multitoken variables can now
+be illustrated:
+\begin{verbatim}
+ \[ \diffp[2]f{x^{i}},\quad
+ \diffp.dv.[2]f{x^{i}},\quad
+ \diffp.(dv).[2]f{x^{i}} \]
+\end{verbatim}
+$\Longrightarrow$ \[ \diffp[2]f{x^i},\quad\diffp.dv.[2]f{x^i},\quad\diffp.(dv).[2]f{x^i} \]
~~\}
\end{lyxcode}
%
\end{minipage}
+To my eye parenthesizing seems unnecessary in this case, but in the
+following desirable (as in the first, default, setting):
+\begin{verbatim}
+ \[ \diffp[2]F{1/T},\quad
+ \diffp.dv.[2]F{1/T},\quad
+ \diffp.(dv).[2]F{1/T} \]
+\end{verbatim}
+$\Longrightarrow$ \[ \diffp[2]F{1/T},\quad\diffp.dv.[2]F{1/T},\quad\diffp.(dv).[2]F{1/T} \]
We can now write, for the same example, \texttt{\textbackslash diff.ptxt.ST{[}V{]}}
which displays as $\diff.ptxt.ST[V]$, where the subscript is better
positioned and there is a better fit between parentheses and derivative.
+\subsubsection{Point of evaluation}
\subsubsection{Derivatives from D, \textbackslash delta, \textbackslash Delta\protect\label{subsec:DdeltaDelta}}
+\label{subsec:variantPointofevaluation}Although ISO recommends
+subscripting parentheses to indicate a point of evaluation, some (like
+the author) prefer to subscript a vertical rule and save subscripted
+parentheses for the case of variables held constant in partial derivatives.
+The file \verb`diffcoeff5.def` contains the definition
+\begin{verbatim}
+ \difdef { f, fp, s, sp } {  }
+ {
+ outerLdelim = \left . ,
+ outerRdelim = \right ,
+ subnudge = 0 mu
+ }
+\end{verbatim}
+where the `pipe' character is used for the name of the variant.
+\begin{centred}
+\verb`\[ \diffp..{F(x,y)}x[x=1] \]` $\Longrightarrow$ \[ \diffp..{F(x,y)}x[x=1] \]
+\end{centred}
+For slash fractions, I think parentheses give a better result than
+a vertical rule:
+\begin{centred}
+\verb`$ \difs yx[0],\quad \difs..yx[0] $` $\Longrightarrow$ $\difs yx[0],\quad \difs..yx[0]$
+\end{centred}
+They tie the whole expression together. However, it is easy to create
+expressions that suffer from `parenthesis overload':
+\begin{centred}
+\verb`$ \difs{F(x)}{(2x)}[x=0],\quad\difs..{F(x)}{(2x)}[x=0] $`
+$\Longrightarrow$ $\difs{F(x)}{(2x)}[x=0],\quad\difs..{F(x)}{(2x)}[x=0]$
+\end{centred}
+The vertical rule is better in this case, but best of all in this
+case (to my eye) is the use of \emph{square} brackets. The file \verb`diffcoeff5.def`
+contains the definition
+\begin{verbatim}
+ \difdef { f, fp, s, sp } { ] }
+ {
+ outerLdelim = \left [ ,
+ outerRdelim = \right ],
+ elbowroom = 1 mu,
+ subnudge = 0 mu
+ }
+\end{verbatim}
+giving the result
+\begin{centred}
+\verb`$ \difs.].{F(x)}{(2x)}[x=0] $` $\Longrightarrow$ $ \difs.].{F(x)}{(2x)}[x=0] $,
+\end{centred}
+which both avoids `parenthesis overload' and is `tied together'
+by the square brackets (and at least gives a nod in the direction
+of the ISO standard).
In addition to \texttt{\textbackslash diff.p.},\texttt{ diffcoeff}
has 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.
+\subsubsection{Upright textstyle derivatives}
In fluid dynamics the \emph{material }or \emph{substantive} derivative
uses an uppercase $D$ in place of $d$. For example, the continuity
equation is,
+\verb`diffcoeff` assumes that derivatives of uprightfraction form
+will be used mainly in displaystyle expressions and that the slash
+form will be used mainly for inline use. But if one does want to use
+the fraction form in an inline expression, then \verb`$ \diffp ST $`
+displaying as $ \diffp ST $ is fine, but adding a trailing optional
+argument, \verb`$ \diffp ST[V] $`, to indicate (in the present example)
+a variable held constant is not: $\diffp ST[V]$. Clearly the subscript
+is too close to the right parenthesis and (to my eye) there is too
+much `elbowroom' between the derivative and the enclosing parentheses.
+Hence the file \verb`diffcoeff5.def` contains the following definition
+for textstyle upright fraction derivatives:
+\begin{verbatim}
+ \difdef { f, fp } { t }
+ {
+ style = tfrac ,
+ derivandsep = 1 mu plus 1 mu minus 1 mu,
+ multitermsep = 0 mu ,
+ termsepadjust = 0 mu ,
+ wrapsupnudge = 0 mu ,
+ outerLdelim = \bigl (,
+ outerRdelim = \bigr ),
+ elbowroom = 2 mu ,
+ subnudge = 3 mu
+ }
+\end{verbatim}
+With this definition, the variant form \verb`$ \diffp.t.ST[V] $`
+displays as $\diffp.t.ST[V]$. The subscript now is better positioned
+and there is a better fit between parentheses and derivative. Note
+that the \verb`style=tfrac` entry in the definition means \verb`\diffp.t.`
+will not scale in a displaystyle environment and may give a ridiculous
+result if used inappropriately:
\begin{centred}
\verb`\[ \diff.D.{\rho}t=\diffp\rho t + \mathbf{u\cdot}\nabla\rho \]`$\Longrightarrow$
\[ \diff.D.{\rho}t=\diffp\rho t + \mathbf{u\cdot}\nabla\rho \]
+\verb`\[ \frac AB\diffp.t.yx \]` $\Longrightarrow$ \[ \frac AB\diffp.t.yx \]
\end{centred}
\noindent where \texttt{\textbackslash diff.D.} produces the Dderivative.
If you want upright `D's, then the \texttt{ISO} package option will
produce that effect. Alternatively,
\begin{lyxcode}
\textbackslash diffdef~\{~Up~\}~
+For a nonscaling displaystyle derivative using \verb`\dfrac`, given
+the defaults in templates \verb`DIFF` and \verb`DIFFP`, the definition
+would be much simpler,
+\begin{verbatim}
+ \difdef { f, fp } { d } { style = dfrac }
+\end{verbatim}
+but there seems little point in so doing.
~~\{
+\subsubsection{Slashfraction styles}
~~~~opsymbol~~~~=~\textbackslash mathrm\{D\},
+The default slashfraction form \verb`$ \difs yx $` displaying as
+$ \difs yx $ does not scale. It is intended for inline use, but sometimes
+you may want a slash fraction of a different size  perhaps a fraction
+is present in the differentiand or in the variable of differentiation.
+The file \verb`diffcoeff5.def` contains a definition of a scaling
+slash fraction (name \verb`0`) and a slightly largerthandefault
+slash fraction (name \verb`1`):
+\begin{verbatim}
+ \difdef { s, sp } { 0 }
+ {
+ style = auto ,
+ outerLdelim = \left [ ,
+ outerRdelim = \right ] ,
+ subnudge = 0 mu ,
+ *innerLdelim = \mleft ( ,
+ *innerRdelim = \mright ),
+ *outerLdelim = \left [ ,
+ *outerRdelim = \right ]
+ }
+ \difdef { s, sp } { 1 }
+ {
+ style = big ,
+ outerLdelim = \bigl (,
+ outerRdelim = \bigr ),
+ subnudge = 2.5 mu,
+ *innerLdelim = \bigl (,
+ *innerRdelim = \bigr ),
+ *outerLdelim = \bigl [,
+ *outerRdelim = \bigr ]
+ }
+\end{verbatim}
+The names arise from the sequence \verb`\big/`, \verb`\Big/`, \verb`\bigg/`,
+\verb`\Bigg/`, hence \verb`1`, \verb`2`, \verb`3`, \verb`4`,
+which leaves \verb`0` for the scaling form (which is built around
+\verb`\left.`, \verb`\middle/`, \verb`\right.`). \verb`diffcoeff5.def`
+does not contain definitions for the \verb`2`, \verb`3`, \verb`4`
+variants, only the two shown, because the larger sizes give ridiculous
+results. For the scaling variant, it is also easy to produce eyesores:
+\begin{centred}
+\verb`\[ \difsp.0.{\frac1Y}{\frac1X} \]` $\Longrightarrow$ \[ \difsp.0.{\frac1Y}{\frac1X} \]
+\end{centred}
+But for small size increases, the results can be pleasing. To the
+author's eye, both \verb`0` and \verb`1` variants give better results
+than the default:
+\begin{centred}
+\verb`$ \difsp.1.{F(x,y)}{\tfrac1x}[0] $` $\Longrightarrow$ $ \difsp.1.{F(x,y)}{\tfrac1x}[0] $
~~~~opordersep~=~0~mu
+\verb`$ \difsp.0.{F(x,y)}{\tfrac1x}[0] $` $\Longrightarrow$ $\difsp.0.{F(x,y)}{\tfrac1x}[0]\vphantom{\bigg} $
~~\}
\end{lyxcode}
\noindent provides a variant with upright `D's.
+\verb`$ \difsp{F(x,y)}{\tfrac1x}[0] $` $\Longrightarrow$ $ \difsp{F(x,y)}{\tfrac1x}[0] $
+\end{centred}
+Subscripted \emph{square} brackets are chosen for the scaling variant
+so that the setting \verb`subnudge=0 mu` is appropriate at all scales.
+They provide good visual contrast with the parentheses of $F(x,y)$.
In introductory calculus texts the simple $\delta$derivative is
used. This is achieved with the \texttt{\textbackslash diff.delta.}
command: \verb`\[ \diff.delta.yx \]` $\Longrightarrow$ \[ \diff.delta.yx. \]
+\subsubsection{Compactform derivatives}
\noindent This form also features in analytical mechanics (in the
Rogues' Gallery, the final example at (\ref{eq:eg6})).

Similarly, \texttt{\textbackslash diff.Delta.} forms a derivative
from $\Delta$:
+Two styles are available for compactform derivatives, derivative
+style \verb`style=_`, and differential style \verb`style=dl`. The
+first is the default style; the orders of differentiation are applied
+to the operator symbol, in this example \verb`\partial`:
\begin{centred}
\verb`$ \diff.Delta.y/x $` $\Longrightarrow$ $ \diff.Delta.y/x $
+\verb`$ \difcp[3,2]{f}{x,y,z} $` $\Longrightarrow$ $ \difcp[3,2]{f}{x,y,z} $
\end{centred}
\noindent where the slash form of the derivative is shown in this
instance.
+But suppose we define a variant form (as is done in \verb`diffcoeff5.def`):
+\begin{verbatim}
+ \difdef { cp } { dl } { style = dl }
+\end{verbatim}
+and use it to form a similar expression but without the differentiand,
+an empty argument in its place:
+\begin{centred}
+\verb`$ \difcp.dl.[3,2]{}{x,y,z} $` $\Longrightarrow$ $ \difcp.dl.[3,2]{}{x,y,z} $
+\end{centred}
+In this \verb`dl` style, the orders of differentiation are applied
+to the \emph{variables}. This allows discussion of, for example, the
+denominator of a mixed partial derivative  perhaps a remark about
+minutiae of spacing.
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.
+\subsubsection{D, \textbackslash delta, \textbackslash Delta derivatives}
\paragraph{The commands \textbackslash Diff, \textbackslash diffd, \textbackslash Diffd}
+\label{subsec:DdeltaDelta}In introductory calculus texts a derivativelike
+symbol is created with the lowercase Greek delta, $\delta$ . An uppercase
+Greek delta, $\Delta$, is often used in a derivativelike symbol
+for an average. In fluid dynamics the \emph{material} (also \emph{substantive}
+or \emph{total}\,) derivative uses an uppercase $\mathrm{D}$ in
+place of $\mathrm{d}$. Texts on differential equations often use
+a $\mathrm{D}$ operator. The file \verb`diffcoeff5.def` contains
+the definitions
+\begin{verbatim}
+ \difdef { f, s } { gd }
+ { opsymbol = \delta }
+ \difdef { f, s } { gD }
+ { opsymbol = \Delta }
+ \difdef { f, s } { D }
+ { opsymbol = \mathrm{D} }
+ \difdef { c } { bD }
+ {
+ opsymbol = \mathbf{D},
+ opsubnudge = 2mu
+ }
+\end{verbatim}
+(where the `g' in the first two suggests `greek'), meaning one
+can write expressions like \verb`$ \difs.gd.yx $` $\Longrightarrow$
+$ \difs.gd.yx $, or \verb`$ \difs.gD.yx $` $\Longrightarrow$ $ \difs.gD.st$
+(for the average speed), or
+\begin{centred}
+\verb`\[ \diff.D.{\rho}t=\diffp\rho t + \mathbf{u\cdot}\nabla\rho \]`$\Longrightarrow$
+\[ \diff.D.{\rho}t=\diffp\rho t + \mathbf{u\cdot}\nabla\rho \]
+\end{centred}
+\noindent for the total derivative of $\rho$ (perhaps in fluid dynamics),
+or
+\begin{centred}
+\noindent \verb`$ \difc.bD.[2]y{x\,}+2\difc.bD.y{x\,}4=0 $` $\Longrightarrow$
+$ \difc.bD.[2]y{x\,}+2\difc.bD.y{x\,}4=0 $
+\end{centred}
+for an example in the study of differential equations.
For compatibility with version 1 of \texttt{diffcoeff}, the commands
\texttt{\textbackslash Diff}, \texttt{\textbackslash diffd} and
\texttt{\textbackslash Diffd} are available and also produce the
$D$, $\delta$ and $\Delta$ derivatives. Just as \texttt{\textbackslash diffp}
is identified with \texttt{\textbackslash diff.p.} for partial derivatives,
these commands are identified with \texttt{\textbackslash diff.D.},
\texttt{\textbackslash diff.delta.}, and \texttt{\textbackslash diff.Delta}
through the commands
\begin{lyxcode}
\textbackslash NewDocumentCommand~\textbackslash Diff~\{\}~~\{\textbackslash diff.D.\}
+\subsection{Other notations}
\textbackslash NewDocumentCommand~\textbackslash diffd~\{\}~\{\textbackslash diff.delta.\}
+\label{subsec:Othernotations}\verb`diffcoeff` and this document
+are about defining \emph{derivatives} but it is worth pointing out
+that other notations can be built from the \verb`diffcoeff` constituents,
+in particular from the slash fraction forms. For example, some other
+token than \verb`/`, or indeed series of tokens, can be used to link
+numerator and denominator. It could be \verb`\vert` or \verb`\Vert`,
+displaying as $\vert$ and $\Vert$ respectively, or \verb`\otimes`
+(requiring for example \verb`\usepackage{stmaryrd}` in the preamble),
+displaying as $\otimes$, or the sequence of tokens \verb`\otimes\ldots\otimes`
+displaying as $\otimes\ldots\otimes$. The critical key is \verb`slashtok`,
+with possible extra spacing on either side through the key \verb`slashsep`.
+Or, one may want to void the \verb`opsymbol` key by giving it an
+empty value or do something like \verb`opsymbol=\mathbf`, or give
+\verb`outerLdelim`, \verb`outerRdelim` special values, e.g.,\verb`\langle`,
+\verb`\rvert`.
\textbackslash NewDocumentCommand~\textbackslash Diffd~\{\}~\{\textbackslash diff.Delta.\}
\end{lyxcode}
Unless one is using such variant forms frequently, it seems simpler
to remember that they are available as dotdelimited arguments to
the \texttt{\textbackslash diff} command, using the obvious name
in each case, rather than having to remember the precise camelcase
form of name of the \texttt{\textbackslash Diff}, \texttt{\textbackslash diffd}
and \texttt{\textbackslash Diffd} commands.
+In the preamble I have included the following definition, in order
+to mimic the \verb`\Braket` command of the \verb`braket` package,
+\begin{verbatim}
+ \difdef{ s }{ bk }
+ {
+ slashtok = ,
+ opsymbol = ,
+ multitermsep = 3mu\middle\mskip3mu ,
+ outerLdelim = \left\langle ,
+ outerRdelim = \right\rangle
+ }
+\end{verbatim}
+and supplemented it with the definition:
+\begin{verbatim}
+ \NewDocumentCommand \Braket { m }
+ {
+ \difoverride {\negmu}
+ \difs.bk.{}{#1}[]
+ }
+\end{verbatim}
+Testing the new command, \verb`\Braket`, gives this display:
+\begin{centred}
+\verb`\[ \Braket{\phi,\diffp[2]{}t,\psi} \]` $\Longrightarrow$ \[\Braket{\phi,\diffp[2]{}t,\psi} \]
+\end{centred}
+Comparison with the \verb`\Braket` command of the \verb`braket`
+package, which uses \verb`` as the separator in the argument rather
+than commas, shows the displayed results to be the same (as far as
+I can judge).
\subsection{The \texttt{.def} file\protect\label{subsec:The.deffile}}
+\section{Defaults: setting your own}
This mechanism of variant formation is how I have been able to illustrate
in the Rogues' Gallery, \xA7\ref{sec:Rogues'gallery}, the wide variety
of different usages culled from the literature. But the thought arises:
if a variant is to be used only once or twice, isn't this a lot of
bother? Why not just construct the variant derivative `by hand' out
of \texttt{\textbackslash frac} and \texttt{\textbackslash mskip}
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.
+\label{sec:ChangingDefaults}The use of variant forms of derivative
+assumes the user is reasonably satisfied with the default values of
+the various templates. The user may not be. You may want different
+defaults. That is again accomplished by means of the \verb`\difdef`
+command. The procedure is identical with that for defining a variant
+except that \emph{no} \verb`variantname` is supplied; an empty argument
+is used instead.
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 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
\begin{lyxcode}
\textbackslash usepackage{[}deffile=diffcoeffdoc{]}\{diffcoeff\}
\end{lyxcode}
But even this process still means copying a definition file from directory
to directory as one works on different documents. The solution is
to make a definition file available for \emph{all} documents and the
way to do that is by placing it in the texmf tree, preferably not
the one created by your \TeX{} distribution (perhaps MiKTeX or TexLive),
but your own \emph{personal} texmf tree.
+For example, suppose you wish to indicate a point of evaluation for
+ordinary uprightfraction derivatives by means of a subscripted vertical
+rule rather than parentheses. In \xA7\ref{subsec:variantPointofevaluation}
+we have seen how to create a variant form with this property but now
+we want to make it the default in the template \verb`DIFF`. That
+is easy  simply omit any content from the second argument:
+\begin{verbatim}
+ \difdef { f } {}
+ {
+ outerLdelim = \left . ,
+ outerRdelim = \right ,
+ subnudge = 0 mu
+ }
+\end{verbatim}
+\noindent If this is placed in the preamble of your document or in
+your \verb`.def` file (see \xA7\ref{subsec:The.deffile}) then the
+command \verb`\diff yx[0]` will produce
+\[
+\diff..yx[0]
+\]
+by default. By leaving the second argument empty the \verb`\difdef`
+command has changed the default value of those templates indicated
+by the list of identifiers in the first argument  in the present
+case only the template \verb`DIFF`. In particular, note that the
+new default is \emph{not} inherited by \verb`DIFFP`. Inheritance
+occurs \emph{only} at load time. How to change defaults that will
+be inherited is discussed below in \xA7\ref{subsec:ChangingDIFdefaults}.
\texttt{\vspace{2ex}
 }
+If you wish to change other defaults of other templates follow the
+same procedure. In the first argument of the \verb`\difdef` command
+insert a commalist of the derivative identifiers (\verb`f`, \verb`s`,
+\verb`c`, \verb`fp`, \verb`sp`, \verb`cp`, \verb`j` or \verb`l`)
+that you want the new defaults to apply to, \emph{leave the second
+argument empty}, and in the third argument provide the \emph{key=value}
+list of new defaults.
\noindent %
\noindent\fbox{\begin{minipage}[t]{1\linewidth  2\fboxsep  2\fboxrule}%
\textbf{Personal texmf tree? }
+For instance, you might prefer mathitalic `d's rather than the
+upright ISO recommendation, and you want this to apply across \emph{all}
+ordinaryderivative templates. The most straightforward way of achieving
+that would be through the definition
+\begin{verbatim}
+ \difdef { f, s, c, l } {}
+ {
+ opsymbol = d ,
+ opordernudge = 1 mu
+ }
+\end{verbatim}
+which includes the list of identifiers \verb`f, s, c, l` in the first
+argument (the \verb`l` referring to the template \verb`DIFL` of
+the differential  see \xA7\ref{sec:Differentials}) and leaves the
+second argument empty. Thereafter, all ordinary derivatives will be
+graced with mathitalic rather than upright `d's.
This is a directory for `waifs and strays' of the \TeX{} system that
are not included in standard distributions like MiK\TeX{} or \TeX Live.
For instance, it is the place for personal packages designed for your
own particular circumstances or preferences, and is structured like
the standard MiK\TeX{} or \TeX Live hierarchy but placed in another
location so that there is no chance of its being overwritten when
MiK\TeX{} or \TeX Live are updated. However, those distributions need
to be alerted to its existence. For MiK\TeX , open the MiK\TeX{} console,
click on \textsf{Settings} and then the \textsf{Directories} tab.
Click the \textsf{+} button and navigate to your personal texmf tree
to add it to the MiK\TeX{} search path. Having added it, you will then
need to refresh the filename database by clicking on the \textsf{Tasks}
menu and selecting the obvious entry. I am not familiar with \TeX Live
but presume an analogous process will apply there.%
\end{minipage}}
+\subsection{Changing defaults in \texttt{DIF}}
\medskip{}
+\label{subsec:ChangingDIFdefaults}You might wonder if this last
+effect could not have been obtained more simply by changing the default
+in the `primogenitor' template \verb`DIF`  perhaps leave both\emph{
+first }and second\emph{ }arguments empty in the \verb`\difdef` command.
+That, however, has no effect. The \verb`\difdef` command does nothing
+if the first argument is empty. Inheritance occurs only once, at time
+of birth  \emph{load time}  and not thereafter. If you want
+to make a change affecting a number of templates by changing a default
+in \verb`DIF`, then it has to be done at the time when \verb`diffcoeff`
+is loaded.
\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.
+There are two ways to do this. The first is to create a text file
+with the specific name \verb`diffcoeff.DIF` with the desired settings.
+For example, if we want mathitalic `d's and a subscripted vertical
+rule for points of evaluation, then the file might look like
+\begin{verbatim}
+ opsymbol = d,
+ opordernudge = 1 mu,
+ outerLdelim = \left . ,
+ outerRdelim = \right ,
+ subnudge = 0 mu
+\end{verbatim}
+By locating the file in a place where your \TeX{} distribution can
+find it  either in the directory of the current document or in
+your personal \verb`texmf` tree (see the earlier discussion at \xA7\ref{subsec:The.deffile},
+and in particular the need to alert your \TeX{} distro to the presence
+of the file)  \verb`diffcoeff.DIF` will be read at load time and
+the new defaults not only incorporated into template \verb`DIF` but
+inherited by all child and grandchild templates unless explicitly
+countermanded (for example by \verb`opsymbol = \partial` and similar
+statements in the definitions of those templates).
\subsubsection{Structure of the \texttt{.def} file}
+The second method is to use the package option \verb`DIF`. For instance
+loading \verb`diffcoeff` with the call
+\begin{verbatim}
+ \usepackage
+ [
+ DIF = { opsymbol = d,
+ opordernudge = 1 mu,
+ outerLdelim = \left . ,
+ outerRdelim = \right ,
+ subnudge = 0 mu }
+ ]{diffcoeff}
+\end{verbatim}
+will overwrite the builtin defaults with these new values, which
+will be inherited by child (and grandchild) templates unless explicitly
+countermanded. Notice that since \verb`DIF` is a comma list it requires
+braces around the list of \emph{key=value} statements\emph{.}
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.}
+If both methods of changing the template \verb`DIF` are employed,
+the order of use is, first, read and act on the file \verb`diffcoeff.DIF`,
+then read and act on the package option \verb`DIF`. (In other words,
+to avoid complicating the preamble, preferably use the file \verb`diffcoeff.DIF`;
+use the package option \verb`DIF` only for finetuning  perhaps
+a setting specific to that particular document.)
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:
\begin{lyxcode}
\textbackslash diffdef~\{\}~~~~
+\chapter{Differentials and jacobians}
~~\{~~~~~~
+\label{chap:Differentialsandjacobians}In addition to the six derivative
+commands, \verb`\difx` and \verb`\difxp`, the \verb`diffcoeff`
+package has two further commands, \verb`\dl` and \verb`\jacob`,
+for writing differentials and jabobian determinants respectively.
+These commands use the settings of the templates \verb`DIFL` and
+\verb`DIFJ`, and both are correspondingly configurable by means of
+the \verb`\difdef` command.
~~~~key1~=~value1,~~~~
+\section{Differentials}
~~~~key2~=~value2,

~~~~...

~~~~keyn~=~valuen

~~\}
\end{lyxcode}
The keyvalue list is a commaseparated list; hence the last entry
doesn't need to end with a comma. Nudge and separation values need
to include the unit, \texttt{mu}; a numerical value alone will result
in error.\texttt{ }Because a \texttt{.def} file\texttt{ }is a \LaTeX{}
file, comments need to start with a \texttt{\%} character.

\subsubsection{\texttt{diffcoeff.def}}

Note that if the \texttt{diffcoeff} package is invoked without an
explicit \texttt{deffile= <filename>} option statement, as here,
\begin{lyxcode}
\textbackslash usepackage\{diffcoeff\}
\end{lyxcode}
then it will search in the texmf tree (the \LaTeX{} distribution's
and your personal one) and the document directory for a file \texttt{diffcoeff.def}
and if found will load that. This file should contain definitions
of those variants you are likely to use in multiple documents. In
my personal texmf tree (which I've put at \texttt{E:\textbackslash texmf\textbackslash}
on a Windows machine) the file \texttt{diffcoeff.def} is located in
the directory \texttt{E:\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. 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 \noun{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
+\label{sec:Differentials}Forms like $\dl x$ occur not only as components
+of derivatives but also in other contexts like the expression for
+a total differential,
\[
\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
+or in integrals, like $\int\sin x\dl x$, or multivariable integrals
like
\[
\iiintop_{\infty}^{\infty}V(x,y,z)\dl3x\dl2y\dl2z.
+\iiintop_{\infty}^{\infty}V(x,y,z)\dl{x,y,z}.
\]
+They also occur in differential geometry and elsewhere in the form
+of line elements like
+\begin{centred}
+$\dl.+.{x,y,z}^2$ \quad{}and\quad{} $c^2\dl..{t,x,y,z}^2$.
+\end{centred}
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
+form (upright or math italic) in derivatives? To this end, \verb`diffcoeff`
+provides a command \verb`\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 upright and so
\begin{centred}
\verb`$ \dl x $` $\Longrightarrow$ $ \dl x. $
\end{centred}
\noindent It is also possible\footnote{\noindent From version 3.1 of \texttt{diffcoeff}; version 3.0 of the
package produced a \LaTeX{} error.} to use the command before, for instance, \texttt{\textbackslash mathbf\{x\}}
or \texttt{\textbackslash vec\{x\}}:
+\noindent To use the command before a multitoken variable of differentiation,
+put the variable in braces:
\begin{centred}
\verb`$ \dl \vec{x} $` $\Longrightarrow$ $ \dl \vec{x} $,~~~~\verb`$ \dl \mathbf{x} $`
$\Longrightarrow$$ \dl \mathbf{x}. $
+\verb`$ \dl{\vec{x}},\quad \dl{\mathbf{x}} $` $\Longrightarrow$
+$ \dl{\vec{x}},\quad \dl{\mathbf{x}} $.
\end{centred}
+For the triple integral above, writing the differentials required
+not three but just the \emph{one} command:
+\begin{centred}
+\verb`$ \dl{x,y,z} $` $\Longrightarrow$ $ \dl{x,y,z} $.
+\end{centred}
+To write the line elements I made use of a dotdelimited argument
+producing a variant form of the differential (see below \xA7\ref{subsec:Lineelements}):
+\begin{centred}
+\verb`$ \dl.+.{x,y,z}^2 $` $\Longrightarrow$ $ \dl.+.{x,y,z}^2 $,
\subsection{Options}
+\verb`$ c^2\dl..{t,x,y,z}^2 $` $\Longrightarrow$ $ c^2\dl..{t,x,y,z}^2 $.
+\end{centred}
There are two options available with the differential command.
+\subsection{Template \texttt{DIFL}}
The first is the dotted name option discussed in \xA7\ref{sec:Changingdefaults}.
Thus, to illustrate a differential with an upright `d', write
\begin{centred}
\verb`$ \dl.up.x $` $\Longrightarrow$ $ \dl.up.x. $
\end{centred}
\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'.
+\begin{wraptable}{o}{0.5\columnwidth}%
\subsubsection{Partial differential}
+\begin{centering}
+\caption{\texttt{DIFL} defaults\protect\label{tab:DIFLdefaults}}
+\begin{center}
+\begin{tabular}{lrr}
+\toprule
+{\small key} & {\small default} & {\small comment}\tabularnewline
+\midrule
+{\small style} & {\small\texttt{dl}} & {\small locked}\tabularnewline
+{\small outerLdelim} & {\small\texttt{\textbackslash ,}} & \tabularnewline
+{\small outerRdelim} & & \tabularnewline
+\bottomrule
+\end{tabular}
+\par\end{center}
+\par\end{centering}
+\end{wraptable}%
+The differential command \verb`\dl` gives access to a template \verb`DIFL`
+which inherits the default values of the fundamental template \verb`DIF`
+with the (few) changes shown in Table~\ref{tab:DIFLdefaults}. Note
+that the \verb`style` key is fixed at the value \verb`dl`; it cannot
+be changed. The \verb`outerLdelim` key inserts a small space before
+the differential; the \verb`outerRdelim` key does nothing. For the
+differential, both \verb`outerLdelim` and \verb`outerRdelim` are
+\emph{always inserted}. This differs from the derivative for which
+\verb`outerLdelim` and \verb`outerRdelim` are inserted only if
+there is a trailing optional argument. It is as if the differential
+command \verb`\dl` had a builtin empty trailing optional argument.
\label{subsec:Partialdifferential}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). However,
there are sufficient contexts where expressions like \verb`\partial_x`
are used, perhaps as a shortcut for a partial derivative, for it to
be worthwhile to define an appropriate command for this variant. From
version 4.0, \texttt{diffcoeff} therefore provides \verb`\dlp`, defined
by
\begin{lyxcode}
\textbackslash NewDocumentCommand~\textbackslash dlp~\{\}~\{~\textbackslash dl.p.~\}
\end{lyxcode}
Thus, for instance, \verb`$ \dlp_x $` $\Longrightarrow$ $ \dlp_x $.
+That so few of the \verb`DIF` defaults are changed in \verb`DIFL`
+indicates that much of the machinery of derivative formation is irrelevant
+for forming a differential. A list of \emph{relevant} keys for the
+creation of differentials  those that have some effect on the appearance
+of the thing  can be found at \xA7\ref{subsec:DIFL(differential)}.
\subsubsection{Spacing}
+\subsection{Syntax and options}
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
+\label{subsec:DifferentialsSyntaxOptions}If all options are present
+the differential command has the syntax
+\begin{verbatim}
+ \dl.name.[orderspec]{variable(s)}^{exponent}
+\end{verbatim}
+where the arguments have the following significance:
+\begin{enumerate}
+\item \verb`name` (optional) A dotdelimited name to distinguish a variant
+form (nondefault form) of differential; see \xA7\ref{subsec:Variantdifferentials}
+below.
+\item \verb`orderspec` (optional) The power or commalist of powers to
+which the differential or differentials will be raised. If all powers
+are \verb`1` then no specification is needed; indeed, if fewer powers
+are specified than there are variables, all `missing' powers are
+assumed to be \verb`1`; see the discussion for mixed partial derivatives,
+\xA7\ref{subsec:Mixedpartialderivatives}.
+\item \verb`variable(s)` (mandatory) The variable or commalist of variables
+the differential operator applies to. \verb`\dl x`, \verb`\dl{\vec{x}}`,
+\verb`\dl{x,y,z}` are all valid variable specifications, displaying
+as $\dl x$, $\dl{\vec{x}}$ and $\dl{x,y,z}$ respectively.
+\item \verb`exponent` (optional) An exponent to which all differentials
+will be raised; overrides the \verb`orderspec` ; see \xA7\ref{subsec:Lineelements}
+for examples of use.
+\end{enumerate}
+Only the third argument is mandatory, although it may be empty.
+
+\subsection{Variant forms of differential}
+
+\label{subsec:Variantdifferentials}The first argument of the differential
+command \verb`\dl` is the optional \verb`name` which is used 
+like the corresponding argument in the derivative commands  to
+define \emph{variant forms}.
+
+To create such variant forms, the \verb`\defdif` command is again
+used, but with \verb`l` (lowercase \verb`L`) used as the identifier
+in the first argument. For example, you may want a `partial' differential,
+using \verb`\partial` in place of \verb`d`. It seems natural to
+give this the name \verb`p`:
+\begin{verbatim}
+ \difdef { l } { p }
+ { opsymbol = \partial }
+\end{verbatim}
+In fact just this definition can be found in the file \verb`diffcoeff5.def`,
+so that
\begin{centred}
\verb`$ \dl x\dl3y=r\dl3r\dl3\theta $` $\Longrightarrow$ $ \dl x\dl3y=r\dl3r\dl3\theta. $
+\verb`$ \dl.p.x $` $\Longrightarrow$ $\dl.p.x$
\end{centred}
\noindent To my eye this is too much space; I prefer
+which is seven keystrokes in all versus ten (space included) for \verb`\partial x`.
+Defining \verb`\dlp` by writing
\begin{centred}
\noindent \verb`$ \dl x\dl2y=r\dl2r\dl2\theta $` $\Longrightarrow$
$ \dl x\dl2y=r\dl2r\dl2\theta. $
+\verb`\NewDocumentCommand \dlp {} { \dl.p. }`.
\end{centred}
\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$.
+saves another keystroke. However, I doubt the few keystrokes saved
+justify the trouble of defining such a variant. The real reason one
+might do so is to ease the writing of expressions like $\dl.p.[3,2]{x,y,z}$
+ perhaps in a document like the present one to discuss the minutiae
+of spacing in the denominators of mixed partial derivatives.
+\begin{centred}
+\verb`$\dl.p.[3,2]{x,y,z}$` $\Longrightarrow$ $\dl.p.[3,2]{x,y,z}$
+\end{centred}
+As you can see from the example, just as for mixed partial derivatives,
+if more than one variable is specified but the \verb`orderspec`
+contains fewer than that number of entries, \verb`diffcoeff` assumes
+the missing entries are \verb`1`.
Note that only \emph{one} digit can be used. If two are used, as here,
\verb`$ \dl20x $` $\Longrightarrow$ $ \dl20x $, the effect is unlikely
to be what is wanted.
+A second example of a variant form of differential is provided by
+the definition
+\begin{verbatim}
+ \difdef { l } { b }
+ { opsymbol = \mathrm{d}\mathbf }
+\end{verbatim}
+which can be found in the file \verb`diffcoeff5.def`. If you distinguish
+vectors, say, by boldface type, then you can avoid writing \verb`\mathbf`
+for differentials of vectors by using the variant form \verb`\dl.b.`:
+\begin{centred}
+\verb`$ \dl.b.x,\quad \dl.b.{x,y,z} $` $\Longrightarrow$ $ \dl.b.x ,\quad \dl.b.{x,y,z} $.
+\end{centred}
From version 3.2 of \texttt{diffcoeff} it is possible to also add
\emph{negative} space before the differential, which might be useful
in special contexts, perhaps to construct a symbol:
+\subsubsection{Line elements}
+
+\label{subsec:Lineelements}Variant forms can be used to write line
+elements of Pythagorean or Minkowskian form. The definition
+\begin{verbatim}
+ \difdef { l } { + }
+ {
+ multitermsep = 0 mu +,
+ termsepadjust = 0 mu ,
+ outerLdelim =
+ }
+\end{verbatim}
+which can be found in the file \verb`diffcoeff5.def`, inserts a \verb`+`
+sign between terms in the variable specification. Notice that the
+value assigned to the key \verb`multitermsep` begins with \verb`0 mu`.
+A dimension here \emph{initially} is essential. Also note that the
+thin space inserted by default before a differential by means of the
+\verb`outerLdelim` setting is now removed. But the intriguing feature
+of the definition is what follows the \verb`0 mu` in the \verb`multitermsep`
+value: a \verb`+` sign. Applying this variant to \verb`{x,y,z}`
+the result is $ \dl.+.{x,y,z} $, which may be mildly interesting
+but definitely becomes so when we add an exponent to the variable
+spec.:
\begin{centred}
\verb`$ /\dl9x $` $\Longrightarrow$ $ /\dl9x. $
+\verb`$ \dl.+.{x,y,z}^2 $` $\Longrightarrow$ $ \dl.+.{x,y,z}^2 $.
\end{centred}
\noindent For negative space before the differential, add a minus
sign before the (single) digit.
+The exponent acts as if an order specification \verb`[2,2,2]` had
+been included. If an order specification \emph{is }included, whatever
+the values listed, the trailing exponent overrides it.
The spacing digit option \emph{follows} the dotdelimited name option.
For example, earlier, in the denominator of a mixed partial derivative,
I have used what is effectively \texttt{\textbackslash dlp x\textbackslash dlp2y\textbackslash dlp2z},
and the variation to that spacing when a higherorder differentiation
occurs:
+Similarly, the file \verb`diffcoeff5.def` contains an identical definition
+save that the plus sign is replaced by a minus. This enables the writing
+of a Minkowski metric:
\begin{centred}
\verb`$ \dlp x^2\dlp1y\dlp2z $` $\Longrightarrow$ $ \dlp x^2\dlp1y\dlp2z. $
+\verb`$ c^2\dl..{t,x,y,z}^2 $` $\Longrightarrow$ $ c^2\dl..{t,x,y,z}^2 $.
\end{centred}
\section{Rationale}
+\subsection{Changing defaults}
Version 1 of the \texttt{diffcoeff} package arose from a need to simplify
the parsing of differential coefficients for another program I was
working on which was struggling to `read' all the possible permutations
of \texttt{\textbackslash frac} or \texttt{\textbackslash tfrac}
or \texttt{\textbackslash dfrac} or slash forms of the derivative,
of \texttt{d} or \texttt{\textbackslash mathrm\{d\}} or \texttt{\textbackslash partial}
or \texttt{D} or \texttt{\textbackslash mathrm\{D\}} or \texttt{\textbackslash nabla},\texttt{
}and of points of evaluation delimited by vertical rules or parentheses.\texttt{ }Although
regular expressions coped with most of these cases, it was \emph{messy}.
+To change the \emph{default} values of the \verb`DIFL` template use
+the \verb`\difdef` command but leave its second argument, the \verb`name`
+argument, empty. For instance if you want slightly less space by default
+before a differential than the thin space (\verb`\,` or \verb`3 mu`)
+specified in the \verb`DIFL` template  say you want \verb`2 mu`
+ then write
+\begin{verbatim}
+ \difdef { l } {} { outerLdelim = \twomu }
+\end{verbatim}
+and ensure that this is in your \verb`.def` file or in the preamble
+of your document. If you want a rubber length, say \verb`3 mu plus 1 mu minus 2 mu`
+(which can also be written more compactly as \verb`3muplus1muminus2mu`),
+then write (notice the \verb`\mskip`)
+\begin{verbatim}
+ \difdef { l } {}
+ { outerLdelim = \mskip 3muplus1muminus2mu }
+\end{verbatim}
+The crucial point is to leave the second argument of \verb`\difdef`,
+the \verb`variant name`, empty. That changes the \emph{default} values
+in \verb`DIFL` of the keys listed in the third argument of \verb`\difdef`.
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  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 liked in that case too).
+\subsection{Rationale}
\subsection{\texttt{diffcoeff.sty}}
+But why bother with the differential command at all? It only seems
+to complicate the simple typing of \verb`d` followed by \verb`x`.
+Admittely typing \verb`\dl x` requires fewer keystrokes than typing
+\verb`\mathrm{d}x` (or even \verb`\mathrm dx`), but there are other,
+more substantive, reasons why one might prefer an explicit command.
+\begin{enumerate}
+\item \emph{Consistency} with the derivative.
+\item \emph{Spacing} is inserted automatically before the differential,
+and between differentials in (e.g.) multiple integrals.
+\item \emph{Parsing integrals} for some other package or program is much
+easier to do when looking for a concluding differential command \verb`\dl`
+than when looking for \verb`d` or \verb`\mathrm{d}` or \verb`\mathnormal{d}`
+(or whatever) followed by an arbitrary variable name.
+\item \emph{Configurability}. There are values other than the defaults that
+can be given to keys to give novel effects for variant forms of differential
+ see the examples \verb`\dl.b.`, \verb`\dl.+.` and \verb`\dl..`
+above.
+\end{enumerate}
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'  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)
\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,
\end{itemize}
+\section{Jacobians}
+
+\label{subsec:Jacobians}\verb`diffcoeff` provides a command {\ttfamily\verb`\jacob`}
+for writing jacobians  not the determinant as such but the symbol
+conventionally used to denote the determinant. For example
\begin{centred}
\verb`\[ \diffp[m(k+1),m+(k1)]{F(x,y,z)}{x,y,z} \]`
+\verb`\[ \jacob{u,v,w}{x,y,z} \]` $\Longrightarrow$ \[ \jacob{u,v,w}{x,y,z} \]
\end{centred}
\begin{example}
$\Longrightarrow$ \[ \diffp[m(k+1),m+(k1)]{F(x,y,z)}{x,y,z} \]
\end{example}

\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:
\end{itemize}
+The comma lists can contain any number of variables, even one or none,
+\[
+\jacob uv,\quad\jacob{}{},
+\]
+nor need the numbers in numerator and denominator be equal. \verb`\jacob`
+does \emph{not} check such things. It is perfectly possible to form
+unbalanced objects like
\begin{centred}
\verb`\[ \diffp[m+(k+1),m+(k1)][2(m+k+1)]{F(x,y,z,w)}{x,y,z,w} \]`
+\verb`\[ \jacob{u,v,w}{x,y},\quad\jacob{u,v}{x,y,z}. \]` $\Longrightarrow$
+\[ \jacob{u,v,w}{x,y},\quad\jacob{u,v}{x,y,z}. \]
\end{centred}
\begin{example}
$\Longrightarrow$ \[ \diffp[m+(k+1),m+(k1)][2(m+k+1)]{F(x,y,z,w)}{x,y,z,w} \]
\end{example}
+Perhaps there are contexts where these are meaningful?
\begin{itemize}
\item I wished to avoid the unnecessary writing of superscripts, subscripts
and brace pairs. In the examples just given, no superscript tokens
\texttt{\textasciicircum} 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  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}
+\subsection{Template \texttt{DIFJ}}
+
+\begin{wraptable}{o}{0.45\columnwidth}%
+\centering{}\caption{\texttt{DIFJ} defaults\protect\label{tab:DIFJdefaults}}
+\begin{center}
+\begin{tabular}{lr}
+\toprule
+{\small key} & {\small default}\tabularnewline
+\midrule
+{\small opsymbol} & {\small\texttt{\textbackslash partial}}\tabularnewline
+{\small outerLdelim} & \tabularnewline
+{\small outerRdelim} & \tabularnewline
+\bottomrule
+\end{tabular}
+\par\end{center}\end{wraptable}%
+Jacobians are configurable. Like other commands of \verb`diffcoeff`,
+\verb`\jacob` gives access to a template, in this case \verb`DIFJ`,
+which is a child of the fundamental template \verb`DIF` and inherits
+most of its default values with only a few changes as shown in Table~\ref{tab:DIFJdefaults}.
+Note that the keys \verb`outerLdelim` and \verb`outerRdelim` are
+both empty and, as with the differential, are \emph{always inserted}
+ which is why they are empty by default.
+
+The lack of entries in Table~\ref{tab:DIFJdefaults} is because
+many keys are irrelevant for forming jacobians  it doesn't matter
+what their default values are. For a list of \emph{relevant} keys
+ ones that have some effect on the appearance of a jacobian 
+see \xA7\ref{subsec:DIFJ(jacobian)}.
+
+\subsection{Syntax and variant forms}
+
+The \verb`\jacob` command has only three arguments. The syntax is
+simple:
+\begin{verbatim}
+ \jacob.name. {numer} {denom}
+\end{verbatim}
+The arguments have the following significance:
+\begin{enumerate}
+\item \verb`name` (optional) The dotdelimited name of a variant form of
+jacobian.
+\item \verb`numer` (mandatory) A comma list of variables forming the numerator
+of the jacobian.
+\item \verb`denom` (mandatory) A comma list of variables forming the denominator
+of the jacobian.
+\end{enumerate}
+The default form of jacobian is an upright fraction with \verb`\partial`
+operators and parentheses around the variable lists in both numerator
+and denominator.
+
+If you want a jacobian in, say, slashfraction form then once again
+the \verb`\difdef` command is used. The file \verb`diffcoeff5.def`
+contains the definition
+\begin{verbatim}
+ \difdef { j } { s } { style = / }
+\end{verbatim}
+To access this style, use the name  which is at your discretion
+but here I have chosen \verb`s` (\verb`/` also suggests itself)
+ between dots after the \verb`\jacob` command:
\begin{centred}
\verb`\[ \diffp{A_i}{ x^j,x^k } \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^j,x^k } \]
+\verb`$ \jacob.s.{u,v,w}{x,y,z} $` $\Longrightarrow$ $ \jacob.s.{u,v,w}{x,y,z}. $
\end{centred}
\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  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.
\item Given the position of the subscripted symbol in the displayed derivative,
it's positioning as the \emph{final} argument in the derivative command
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}, has been deprecated
in \texttt{diffcoeff} since version 2, and is no longer compatible
with version 4. Later versions of \texttt{diffcoeff} 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 held constant was incorporated into the derivative
commands, the star option became the simplest way of handling appended
differentiands since the parentheses 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.
\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.
\item A later 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
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.)
\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).
\item To handle possible differences between displaystyle and textstyle
(and scriptstyle) derivatives (see \xA7\ref{subsec:Textandscriptstyle})
I considered using \TeX 's \texttt{\textbackslash mathchoice} command.
This command takes four arguments, corresponding to display, text,
script and scriptscriptstyles and would require forming four derivatives
each time a derivative is used, `just in case'. In fact fractionform
derivatives are used overwhelmingly in displaystyle expressions,
the slash form being used for inline use. Given the ease of defining
a fractionform variant 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. From version 4 the partial analogue \texttt{\textbackslash dlp}
has been added.
\item Space before the differentiand was requested by a user. Once considered
it became clear that there are (at least) two ways of thinking of
a derivative: as $\diff y/x$, a ratio of differentials where $\dl y$
is a unit and it makes no sense to insert space between the `d'
and the `y', and as
\[
\diff!{F(x)}x
\]
where the function $F(x)$ is being operated on by $\diff{}/x$ and
it is natural to insert space between the `d' and the `F'. With
that realisation came the need for a simple switchlike package option
(\verb`spaced`) to turn spacing on or off, and a switchlike argument
(\verb`!`) to countermand the package option in exceptional cases
(version 4).
\end{itemize}
+If you want to change the operator symbol from \verb`\partial` to
+\verb`D`, as I have seen used, then the definition is:
+\begin{verbatim}
+ \difdef { j } { D } { opsymbol = D }
+\end{verbatim}
+(Again the name is at your discretion but \verb`D` seems obvious.)
+I have added this to the preamble of the present document, so that
+\begin{centred}
+\verb`\[ \jacob.D.{u,v,w}{x,y,z} \]` $\Longrightarrow$ \[ \jacob.D.{u,v,w}{x,y,z}.\]
+\end{centred}
+If you want square brackets rather than parentheses around the variable
+lists, then \verb`lvwrapLdelim` and \verb`lvwrapRdelim` (perhaps
+not intuitively) are the keys to change:
+\begin{verbatim}
+ \difdef { j } { [ }
+ {
+ lvwrapLdelim = \onemu\mleft [,
+ lvwrapRdelim = \mright ]
+ }
+\end{verbatim}
+the \verb`\onemu` giving, to my eye, better spacing between the \verb`\partial`
+symbols and the left brackets. This definition, too, has been added
+to the preamble so that
+\begin{centred}
+\verb`\[ \jacob.[.{u,v,w}{x,y,z} \]` $\Longrightarrow$ \[ \jacob.[.{u,v,w}{x,y,z}. \]
+\end{centred}
\section{Version comparison}
+\subsection{Changing defaults}
\label{sec:Versioncomparison}Unlike version 1, version 2 and later
are built on the the \texttt{xtemplate} package which makes certain
facilities available which it would be silly not to exploit. Hence
the coding in the later versions is completely different and there
are consequences.
+To change the \emph{default} values of the \verb`DIFJ` template leave
+the second argument of the \verb`\difdef` command  the \verb`variantname`
+ empty. For instance, if you want square brackets to be your default
+setting, the \verb`\difdef` command would be
+\begin{verbatim}
+ \difdef { j } {}
+ {
+ lvwrapLdelim = \onemu\mleft [,
+ lvwrapRdelim = \mright ]
+ }
+\end{verbatim}
+The only difference from the previous definition is the absence of
+the name from the second argument, which is now empty. If this definition
+were added to the preamble or to the \verb`.def` file of your current
+document then writing \verb`\jacob{u,v,w}{x,y,z}` would give the
+same result as obtained above with the variant \verb`\jacob.[.{u,v,w}{x,y,z}`.
+
+\chapter{Reference}
+
+\label{chap:Reference}For convenience I list here the commands of
+\verb`diffcoeff`, the template defaults, and the files and preamble
+definitions associated with this document.
+
+\section{Commands}
+
+\verb`\diff`, \verb`\diffp`, \verb`\difs`, \verb`\difsp`, \verb`\difc`,
+\verb`\difcp` (sometimes summarised as \verb`\difx` and \verb`\difxp`),
+ordinary and partial derivatives of uprightfraction, slashfraction
+and compact forms respectively, with arguments (all optional unless
+otherwise indicated) and their delimiters:
\begin{enumerate}
\item From version 2.0
\begin{enumerate}
\item The \texttt{\textbackslash diffset} command, formerly used to tweak
the display of derivatives, has been superseded by the \texttt{\textbackslash diffdef}
command. \texttt{\textbackslash diffset} now sends a message warning
of its obsolescence to the terminal and \LaTeX{} log but is otherwise
functionless. It should not interfere with the compilation of a document
but any intended finetuning of the display by means of the \texttt{\textbackslash diffset}
command\texttt{ }will not eventuate. The warning message is: \texttt{Obsolete
command: \textbackslash diffset has been superseded by the \textbackslash diffdef
command.} \texttt{See the diffcoeff} \texttt{doc\umentation for
further information.} The \texttt{\textbackslash diffdef} command
is discussed in \xA7\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 version 1, versions 2 and 3 still accepted braces to delimit
this argument but from version 4 of \texttt{diffcoeff} only the squarebracket
delimited argument is accepted. (The use of braces around \emph{optional}
arguments while once accepted is now deprecated in \texttt{xparse}
on which \texttt{diffcoeff} depends);
\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 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 \xA7\ref{subsec:DdeltaDelta}.
+\item \verb`.name.` name of variant form of derivative;
+\item \verb`*` appenddifferentiand switch;
+\item \verb`*` reverse order of mandatory arguments 6 and 7 when differentiand
+is appended, available only if first star is also present;
+\item \verb`[order(s)]` order of differentiation, or comma list of orders
+of differentiation (for mixed partial derivatives);
+\item \verb`{differentiand}` (mandatory) function being differentiated;
+\item \verb`{variable(s)}` (mandatory) differentiation variable or, for
+mixed partial derivatives, comma list of differentiation variables;
+\item \verb`[pt of eval/const vars]` point of evaluation or, for partial
+derivatives, variables held constant.
\end{enumerate}
\item Version 3.0
+\begin{description}
+\item [{\texttt{\textbackslash difoverride}}] orderoverride command with
+one mandatory argument:
+\end{description}
\begin{enumerate}
\item 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 provides some simple spacing commands that can be useful for tweaking
standard spacing.
+\item \verb`{total order}` total order of differentiation; may be (and
+generally is) empty.\newpage{}
\end{enumerate}
\item Version 3.1 enables the differential command to be used before forms
like \texttt{\textbackslash vec\{x\}} (an overlooked possibility
causing an error in earlier versions).
\item Version 3.2
+\begin{description}
+\item [{\texttt{\textbackslash jacob}}] jacobian with arguments and delimiters:
+\end{description}
\begin{enumerate}
\item allows negative spacing before the differential command \texttt{\textbackslash dl};
\item fixes a bug in which an ordinary derivative as the differentiand of
a partial derivative displayed as a partial derivative. It now displays,
as it should, as an ordinary derivative.
+\item \verb`.name.` (optional) name of variant form of jacobian;
+\item \verb`{numer}` (mandatory) comma list of variables forming the numerator;
+\item \verb`{denom}` (mandatory) comma list of variables forming the denominator.
\end{enumerate}
\item Version 4.0
\begin{enumerate}
\item enables the insertion of a small space before the differentiand, either
as the default behaviour (package option \verb`spaced`) or at explicit
request (argument \verb`!` of the \verb`\diff` command); see \xA7\ref{subsec:Spacingbeforederivand}.
\item prevents the ligature $df$ that marred previous versions; this is
now rendered $\dl f$.
\item offers the document command \verb`\dlp` for the \emph{partial} differential;
see \xA7\ref{subsec:Partialdifferential};
\item no longer accepts \emph{the braced form} of the\emph{ }trailing optional
argument specifying a point of evaluation or (for partial derivatives)
variables held constant. This was a relic from version 1 of \texttt{diffcoeff},
and has been deprecated since version 2.
\end{enumerate}
\item Version 4.1
\begin{enumerate}
\item changes the code for the \verb`longvarwrap` setting to avoid a
problem arising from a change in \verb`xtemplate`;
\item improves spacing between operator and variable in \emph{denominators}
of differential coefficients (e.g. prevents ligatures).
\end{enumerate}
\end{enumerate}

\section{Commands}
\begin{description}
\item [{\texttt{\textbackslash diff}}] arguments (all optional unless
otherwise indicated):
+\item [{\texttt{\textbackslash dl}}] differential with arguments and delimiters:
\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 ! countermand beforedifferentiand spacing of the \verb`spaced` package
option
\item \{\emph{differentiand}\} (mandatory)
\item / slashform switch
\item \{\emph{comma list of differentiation variables}\} (mandatory)
\item {[}\emph{point of evaluation/variables held constant}{]}
+\item \verb`.name.` (optional) name of variant form of differential;
+\item \verb`[order(s)]` (optional) order of differential or comma list
+of orders of differentials;
+\item \verb`{variable(s)}` (mandatory) variable or comma list of variables;
+\item \verb`^{exponent}` (optional) exponent that overrides the \verb`order(s)`
+specification, raising each differential to this power.
\end{enumerate}
\item [{\texttt{\textbackslash diffdef}}] arguments (all mandatory):
+\item [{\texttt{\textbackslash difdef}}] with arguments (all mandatory)
+and delimiters:
\begin{enumerate}
\item \{\emph{name}\}
\item \{\emph{key=value comma list}\}
+\item \verb`{id(s)}` comma list of one, some or all of the identifiers
+\verb`f`, \verb`s`, \verb`c`, \verb`fp`, \verb`sp`, \verb`cp`,
+\verb`j`, \verb`l` identifying upright fraction, slash fraction
+and compact ordinary derivatives; upright fraction, slash fraction
+and compact partial derivatives, and jacobians and differentials;
+\item \verb`{name}` name for a variant form of derivative; as well as letters
+may include numbers and other keyboard characters, but not braces,
+\verb`%` or \verb`#`;
+\item \verb`{settings}` comma list of changed \emph{key=value} settings.
\end{enumerate}
\item [{\texttt{\textbackslash diffp}}] \texttt{= \textbackslash diff.p.}
\item [{\texttt{\textbackslash dl}}] arguments (all optional):
\begin{enumerate}
\item .\emph{name}. (as for \texttt{\textbackslash diff})
\item \emph{minus sign} (optional, use only if negative spacing before the
`d' is wanted)
\item \emph{digit} (insert spacing of this number of mu before the `d')
\end{enumerate}
\item [{\texttt{\textbackslash dpl}}] \texttt{= \textbackslash dl.p.}
\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 (why try remembering the special names when the forms on
the right are selfexplanatory):
\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}
+\section{Templates}
+
+The following lists record the default values of the templates used
+by \verb`diffcoeff`. A marginal \verb`>` indicates where a setting
+differs from that in \verb`DIF`, \verb`>>` where a setting differs
+from that in \verb`DIFF`, \verb`DIFS` or \verb`DIFC` as the case
+may be. For the latter templates, only \emph{relevant }keys have been
+listed  those which affect the appearance of the derivative (or
+jacobian or differential).
+
+\subsection{\texttt{DIF} (primogenitor)}
+\begin{verbatim}
+ style = frac,
+ slashtok = /,
+ slashsep = 0 mu,
+ derivandsep = 3 mu plus 1 mu minus 2 mu,
+ opsymbol = \mathrm{d},
+ opsymbolalt = \KeyValue{ opsymbol },
+ opordernudge = 0 mu,
+ varsupnudge = 1 mu,
+ multitermsep = 2 mu plus 1 mu minus 1 mu,
+ termsepadjust = 1 mu,
+ longvarwrap = d(v),
+ lvwrapLdelim = \mleft (,
+ lvwrapRdelim = \mright ),
+ lvwrapsupnudge = 2 mu,
+ outerLdelim = \left (,
+ outerRdelim = \right ),
+ elbowroom = 0 mu,
+ subnudge = 5 mu,
+ opsubnudge = 0 mu,
+ *derivandsep = \KeyValue{ derivandsep },
+ *opsetleft = false,
+ *italicnudge = 0 mu,
+ *innerwrap = false,
+ *innerLdelim = (,
+ *innerRdelim = ),
+ *outerLdelim = \big [,
+ *outerRdelim = \big ],
+ *subnudge = 0 mu
+\end{verbatim}
+
+\subsection{\texttt{DIFF} (uprightfraction derivative)}
+
+\label{subsec:DIFF(uprightfractionderivative)}Relevant keys and
+default values for template \verb`DIFF`.
+\begin{verbatim}
+ style = frac,
+ derivandsep = 3 mu plus 1 mu minus 2 mu,
+ opsymbol = \mathrm{d},
+ opsymbolalt = \KeyValue { opsymbol },
+ opordernudge = 0 mu,
+ varsupnudge = 1 mu,
+ multitermsep = 2 mu plus 1 mu minus 1 mu,
+ termsepadjust = 1 mu,
+ longvarwrap = d(v),
+ lvwrapLdelim = \mleft (,
+ lvwrapRdelim = \mright ),
+ lvwrapsupnudge = 2 mu,
+ outerLdelim = \left (,
+ outerRdelim = \right ),
+ elbowroom = 0 mu,
+ subnudge = 5 mu,
+ *derivandsep = \KeyValue { derivandsep },
+ *opsetleft = false,
+ *italicnudge = 0 mu
+\end{verbatim}
+
+\subsubsection{\texttt{DIFFP}}
+
+\verb`DIFF` defaults as above with these changes:
+\begin{verbatim}
+>> opsymbol = \partial,
+>> opordernudge = 1 mu,
+>> *italicnudge = 3 mu
+\end{verbatim}
+
+\subsection{\texttt{DIFS} (slashfraction derivative)}
+
+\label{subsec:DIFS(slashfractionderivative)}Relevant keys and
+default values for template \verb`DIFS`.
+\begin{verbatim}
+> style = /,
+ slashtok = /,
+ slashsep = 0 mu,
+> derivandsep = 2 mu plus 1 mu minus 2 mu,
+ opsymbol = \mathrm{d},
+ opsymbolalt = \KeyValue { opsymbol },
+ opordernudge = 0 mu,
+ varsupnudge = 1 mu,
+ multitermsep = 2 mu plus 1 mu minus 1 mu,
+ termsepadjust = 1 mu,
+ longvarwrap = d(v),
+ lvwrapLdelim = \mleft (,
+ lvwrapRdelim = \mright ),
+ lvwrapsupnudge = 2 mu,
+> outerLdelim = (,
+> outerRdelim = ),
+ elbowroom = 0 mu,
+> subnudge = 0 mu,
+ *derivandsep = \KeyValue { derivandsep },
+> *innerwrap = true,
+ *innerLdelim = (,
+ *innerRdelim = ),
+ *outerLdelim = \big [,
+ *outerRdelim = \big ],
+ *subnudge = 0 mu
+\end{verbatim}
+
+\subsubsection{\texttt{DIFSP}}
+
+\verb`DIFS` defaults as above with these changes:
+\begin{verbatim}
+>> opsymbol = \partial,
+>> opordernudge = 1 mu
+\end{verbatim}
+
+\subsection{\texttt{DIFC} (compact derivative)}
+
+\label{subsec:DIFC(compactderivative)}Relevant keys and default
+values for template \verb`DIFC`.
+\begin{verbatim}
+> style = _ ,
+> derivandsep = 1 mu plus 1 mu minus 2 mu,
+ opsymbol = \mathrm{d},
+ opordernudge = 0 mu,
+> multitermsep = 1 mu,
+> termsepadjust = 0 mu,
+> outerLdelim = \bigl (,
+> outerRdelim = \bigr ),
+ elbowroom = 0 mu,
+> subnudge = 2 mu,
+ opsubnudge = 0 mu,
+ *derivandsep = \KeyValue { derivandsep }
+\end{verbatim}
+
+\subsubsection{\texttt{DIFCP}}
+
+\verb`DIFC` defaults as above with these changes:
+\begin{verbatim}
+>> opsymbol = \partial,
+>> opordernudge = 1 mu
+\end{verbatim}
+
+\subsection{\texttt{DIFJ} (jacobian)}
+
+\label{subsec:DIFJ(jacobian)}Relevant keys and default values for
+template \verb`DIFJ`.
+\begin{verbatim}
+ style = frac,
+ slashtok = /,
+ slashsep = 0 mu,
+> opsymbol = \partial,
+ opsymbolalt = \KeyValue{ opsymbol },
+ lvwrapLdelim = \mleft (,
+ lvwrapRdelim = \mright ),
+> outerLdelim = ,
+> outerRdelim = ,
+ elbowroom = 0 mu ,
+ *opsetleft = false,
+ *italicnudge = 0 mu
+\end{verbatim}
+
+\subsection{\texttt{DIFL} (differential)}
+
+\label{subsec:DIFL(differential)}Relevant keys and default values
+for template \verb`DIFL`.
+\begin{verbatim}
+ opsymbol = \mathrm{d},
+ varsupnudge = 1 mu,
+ multitermsep = 2 mu plus 1 mu minus 1 mu,
+ termsepadjust = 1 mu,
+> longvarwrap = dv,
+ lvwrapLdelim = \mleft (,
+ lvwrapRdelim = \mright ),
+ lvwrapsupnudge = 2 mu,
+> outerLdelim = \, ,
+> outerRdelim = ,
+ elbowroom = 0 mu
+\end{verbatim}
+
+\section{The file \texttt{diffcoeff5.def}}
+
+\label{sec:Thefilediffcoeff5.def}
+\begin{verbatim}
+% file `diffcoeff5.def'
+% definitions for variant forms
+% 2023/01/03
+% Andrew Parsloe ajparsloe at gmail.com
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% material derivative
+\difdef { f, s } { D }
+ { opsymbol = \mathrm{D} }
+% math italic
+\difdef { f, s, c } { d' }
+ {
+ opsymbol = d,
+ opordernudge = 1 mu
+ }
+\difdef { f, s, c } { D' }
+ {
+ opsymbol = D,
+ opordernudge = 1 mu
+ }
+% Greek
+\difdef { f, s } { gd }
+ { opsymbol = \delta }
+\difdef { f, s } { gD }
+ { opsymbol = \Delta }
+% spaceless appending
+\difdef { f, fp } { *0 }
+ {
+ *derivandsep = 0 mu ,
+ outerLdelim = \mleft ( ,
+ outerRdelim = \mright )
+ }
+% tfrac, nonscalable
+\difdef { f, fp } { t }
+ {
+ style = tfrac ,
+ derivandsep = 1 mu plus 1 mu minus 1 mu,
+ multitermsep = 0 mu ,
+ termsepadjust = 0 mu ,
+ lvwrapsupnudge = 0 mu ,
+ outerLdelim = \bigl (,
+ outerRdelim = \bigr ),
+ elbowroom = 2 mu ,
+ subnudge = 3 mu
+ }
+% slash fractions: 0=scalable,
+% 1=big, 2=Big, 3=bigg, 4=Bigg
+% but > 1 gives eyesores
+\difdef { s, sp } { 0 }
+ {
+ style = auto ,
+ outerLdelim = \left [ ,
+ outerRdelim = \right ] ,
+ subnudge = 0 mu ,
+ *innerLdelim = \mleft ( ,
+ *innerRdelim = \mright ),
+ *outerLdelim = \left [ ,
+ *outerRdelim = \right ]
+ }
+\difdef { s, sp } { 1 }
+ {
+ style = big ,
+ outerLdelim = \bigl (,
+ outerRdelim = \bigr ),
+ subnudge = 2.5 mu,
+ *innerLdelim = \bigl (,
+ *innerRdelim = \bigr ),
+ *outerLdelim = \bigl [,
+ *outerRdelim = \bigr ]
+ }
+% vrule point of evaluation
+\difdef { f, fp, s, sp } {  }
+ {
+ outerLdelim = \left . ,
+ outerRdelim = \right ,
+ subnudge = 0 mu
+ }
+% sq. bracket pt of eval.
+\difdef { f, fp, s, sp } { ] }
+ {
+ outerLdelim = \left [ ,
+ outerRdelim = \right ],
+ elbowroom = 1 mu,
+ subnudge = 0 mu
+ }
+% long var wrap
+\difdef { f, fp } { (dv) }
+ { longvarwrap = (dv) }
+\difdef { f, fp } { dv }
+ { longvarwrap = dv }
+% compact, D operator
+\difdef { c } { D }
+ {
+ opsymbol = \mathrm{D},
+ opsubnudge = 2mu
+ }
+\difdef { c } { D' }
+ {
+ opsymbol = D,
+ opsubnudge = 2mu
+ }
+% bold
+\difdef { c } { bD }
+ {
+ opsymbol = \mathbf{D},
+ opsubnudge = 2mu
+ }
+% differential style
+\difdef { c, cp } { dl }
+ { style = dl }
+%%%%%%%%%%% differential %%%%%%%%%%
+% partial
+\difdef { l } { p }
+ { opsymbol = \partial }
+% bold
+\difdef { l } { b }
+ { opsymbol = \mathrm{d}\mathbf }
+
+% line elements: Pythagoras (+)
+\difdef { l } { + }
+ {
+ multitermsep = 0 mu +,
+ termsepadjust = 0 mu ,
+ outerLdelim =
+ }
+% Minkowski ()
+\difdef { l } {  }
+ {
+ multitermsep = 0 mu ,
+ termsepadjust = 0 mu ,
+ outerLdelim =
+ }
+%%%%%%%%%% jacobian %%%%%%%%%%
+% slash fraction
+\difdef { j } { s }
+ { style = / }
+\end{verbatim}
+
+\section{Preamble definitions}
+
+\label{sec:Preambledefinitions}The preamble to the present document
+contains the command
+\begin{verbatim}
+\usepackage[deffile=diffcoeff5,spaced=1]{diffcoeff}
+\end{verbatim}
+and definitions:
+\begin{verbatim}
+% nabla in numer, d in denom
+\difdef { f, s } { n }
+ {
+ opsymbol = \nabla,
+ opsymbolalt = \mathrm{d}
+ }
+% no sub nudge (a sea of white space)
+\difdef { fp } { wsp }
+ { subnudge = 0 mu }
+% align op left; no italic nudge
+\difdef { f } { left0 }
+ {
+ *opsetleft = true,
+ *italicnudge = 0 mu
+ }
+% align op left; italic nudge
+\difdef { fp } { left }
+ {
+ opsymbol = \partial,
+ opordernudge = 1 mu,
+ *opsetleft = true,
+ *italicnudge = 3 mu
+ }
+% partial variant of \diff
+\difdef { f } { p }
+ {
+ opsymbol = \partial,
+ opordernudge = 1 mu
+ }
+% partial, 3mu sep of terms
+\difdef { fp, sp } { 3mu }
+ { multitermsep = 3 mu }
+% D jacobian
+\difdef { j } { D }
+ { opsymbol = D }
+% square bracket jabobian
+\difdef { j } { [ }
+ {
+ lvwrapLdelim = \onemu\mleft [,
+ lvwrapRdelim = \mright ]
+ }
+% mimicking the \Braket command
+% of the braket package
+\difdef{ s }{ bk }
+ {
+ slashtok = ,
+ opsymbol = ,
+ multitermsep = 3mu\middle\mskip3mu ,
+ outerLdelim=\left\langle ,
+ outerRdelim=\right\rangle
+ }
+\NewDocumentCommand \Braket { m }
+ {
+ \difoverride {\negmu}
+ \difs.bk.{}{#1}[]
+ }
+\end{verbatim}
+
+\section{\texttt{\textbackslash DeclareChildTemplate}}
+
+\verb`xtemplate` provides only a single function, \verb`\DeclareRestrictedTemplate`,
+for creating a child template from a parent. \emph{All} the keys of
+the child template are present in the parent. The child inherits not
+only the keys of the parent but the default settings of those keys.
+Some of those settings are `marked' so that they cannot be changed
+by any \emph{instance} of the child (the \emph{restricted} keys) .
+
+Unfortunately there is no similar function available in \verb`xtemplate`
+at present by which one can create a child with \emph{new} as well
+as restricted default values. I found I could achieve this functionality
+with the following code cobbled together from publicly declared functions
+in \verb`xtemplate`.
+\begin{verbatim}
+% Child template with both new and restricted defaults
+% #1 object; #2 parent template; #3 child template;
+% #4 restricted, #5 new defaults (both key=value)
+\NewDocumentCommand \DeclareChildTemplate { m m m m m }
+ {
+ \DeclareRestrictedTemplate {#1} {#2} {#3} {}
+ \EditTemplateDefaults {#1} {#3} {#5}
+ \DeclareRestrictedTemplate {#1} {#3} {#3} {#4}
+ }
+\end{verbatim}
+The first \verb`\DeclareRestrictedTemplate` call creates the child
+template \verb`#3` from the parent template \verb`#2`, inheriting
+all its keys and default values. \emph{No} restrictions are imposed
+at this stage because the following \verb`\EditTemplateDefaults`
+would immediately cancel them. That statement specifies the \emph{new}
+defaults \verb`#5` of the child  those that differ from the parent.
+The default settings \verb`#4` of the parent that are restricted
+to particular values in the child are imposed by the second \verb`\DeclareRestrictedTemplate`
+call through the aritifice of treating the child template \verb`#3`
+as a child of itself. In that way its new defaults are not lost.
\end{document}
Added: trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff4.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff4.pdf
===================================================================
 trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff4.pdf 20230111 20:43:41 UTC (rev 65522)
+++ trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff4.pdf 20230111 20:44:28 UTC (rev 65523)
Property changes on: trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff4.pdf
___________________________________________________________________
Added: svn:mimetype
## 0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff4.tex
===================================================================
 trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff4.tex (rev 0)
+++ trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff4.tex 20230111 20:44:28 UTC (rev 65523)
@@ 0,0 +1,2272 @@
+%% LyX 2.4.0alpha3 created this file. For more info, see https://www.lyx.org/.
+%% Do not edit unless you really know what you are doing.
+\documentclass[english]{article}
+\usepackage{lmodern}
+\renewcommand{\sfdefault}{lmss}
+\renewcommand{\ttdefault}{lmtt}
+\usepackage[T1]{fontenc}
+\usepackage{textcomp}
+\usepackage[latin9]{inputenc}
+\synctex=1
+\usepackage{color}
+\definecolor{shadecolor}{rgb}{1, 0.667969, 0.5}
+\usepackage{babel}
+\usepackage{cprotect}
+\usepackage{wrapfig}
+\usepackage{booktabs}
+\usepackage{calc}
+\usepackage{framed}
+\usepackage{url}
+\usepackage{amsmath}
+\usepackage{amssymb}
+\usepackage{esint}
+\usepackage[unicode=true,pdfusetitle,
+ bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2,
+ breaklinks=true,pdfborder={0 0 1},backref=section,colorlinks=true,pdfpagemode=FullScreen]
+ {hyperref}
+\hypersetup{
+ pdfborderstyle=}
+
+\makeatletter
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
+\newcommand{\noun}[1]{\textsc{#1}}
+%% Because html converters don't know tabularnewline
+\providecommand{\tabularnewline}{\\}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
+\newenvironment{centred}%
+ {\begin{center}\baselineskip=13pt\parskip=1pt }{\end{center}}
+\newenvironment{example}%
+{\begin{center}\ttfamily}{\end{center}}
+\newenvironment{lyxcode}
+ {\par\begin{list}{}{
+ \setlength{\rightmargin}{\leftmargin}
+ \setlength{\listparindent}{0pt}% needed for AMS classes
+ \raggedright
+ \setlength{\itemsep}{0pt}
+ \setlength{\parsep}{0pt}
+ \normalfont\ttfamily}%
+ \item[]}
+ {\end{list}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
+\usepackage[deffile=diffcoeffdoc]{diffcoeff}[=v4]
+
+\makeatother
+
+\begin{document}
+\title{\texttt{diffcoeff}~\\
+ a \LaTeX{} package to ease\texttt{ }the~\\
+ writing of differential coefficients \\
+ Version 4.2}
+\author{Andrew Parsloe\\
+{\small (ajparsloe at gmail.com)}}
+\maketitle
+\begin{abstract}
+\noindent This package eases the 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 in 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.
+\end{abstract}
+\noindent %
+\noindent\begin{minipage}[t]{1\columnwidth}%
+\begin{shaded}%
+
+\subsubsection*{Version 4.2/version 5.0 incompatibility}
+
+Version 4.2 of \verb`diffcoeff` is issued at the same time as version
+5.0. The latter is a complete rewrite of the package with many changes
+to the user interface, arising above all from separating the fraction
+types into separate commands (\verb`\diff`, \verb`\diffp` for upright
+fractions; \verb`\difs`, \verb`\difsp` for slash fractions; and
+\verb`\difc`, \verb`\difcp` for a new, compact style of derivative).
+Although some elements of the earlier version are carried over, most
+documents that use version 4 will fail to compile properly with version
+5. To enable older documents to continue to compile, the \verb`\usepackage`
+statement in the preamble needs a trailing optional argument added
+to it:
+\begin{verbatim}
+ \usepackage[<options>]{diffcoeff}[=v4]
+\end{verbatim}
+The trailing argument \verb`[=v4]` (no spaces!) ensures \verb`diffcoeff4.sty`
+rather than \verb`diffcoeff.sty` is used to compile the document.
+Otherwise, version 4.2 makes no visible change to \verb`diffcoeff`
+version 4.1 other than to documentation. (It also tidies a line of
+code for the differential command \verb`\dl`.)\end{shaded}%
+\end{minipage}
+
+\tableofcontents{}
+
+\section{Introduction}
+
+The \LaTeX{} package \texttt{diffcoeff} is written in the expl3 language
+of \LaTeX 3\texttt{ }and requires the bundles \texttt{l3kernel} which
+is now part of standard \LaTeX{} (since early 2020) and \texttt{l3packages}
+(the latter for the \texttt{xparse}, \texttt{l3keys2e} and especially
+\texttt{xtemplate} packages\texttt{)}. The package is loaded by entering
+\begin{lyxcode}
+\textbackslash usepackage{[}<options>{]}\{diffcoeff\}{[}=v4{]}
+\end{lyxcode}
+in the preamble of your document, where \verb`<options>` are package
+options input by the user; see below. The trailing optional argument,
+\verb`[=v4]`, is necessary to ensure your document compiles with
+version 4 of \verb`diffcoeff` rather than the new version 5 in which
+there are many changes to the user interface.
+
+\subsubsection*{Note on terminology}
+
+I refer throughout to the quantity or function being differentiated
+as the \emph{differentiand} or \emph{derivand }(in line with \emph{integrand},
+\emph{operand}, etc.).
+
+\subsubsection*{New in version 4.0}
+
+(See \xA7\ref{sec:Versioncomparison} for a comparison of versions.)
+Version 4.0
+\begin{enumerate}
+\item enables the insertion of a small space before the differentiand, either
+as the default behaviour (package option \verb`spaced`) or at explicit
+request (argument \verb`!` of the \verb`\diff` command); see \xA7\ref{subsec:Spacingbeforederivand};
+\item prevents the ligature $df$ that marred previous versions; this is
+now rendered $\dl f$;
+\item offers the document command \verb`\dlp` for the \emph{partial} differential;
+see \xA7\ref{subsec:Partialdifferential};
+\item no longer accepts \emph{the braced form} of the\emph{ }trailing optional
+argument specifying a point of evaluation or (for partial derivatives)
+variables held constant. This was a relic from version 1 of \texttt{diffcoeff},
+and has been deprecated since version 2.
+\end{enumerate}
+
+\subsubsection*{New in version 4.1}
+\begin{enumerate}
+\item changes the code handling the \verb`longvarwrap` setting to avoid
+a problem with a change in \verb`xtemplate` (see \url{https://tex.stackexchange.com/questions/646976/errorwithpackagediffcoeff})\footnote{Based on a suggestion from \noun{Joseph Wright}.};
+\item prevents (hitherto overlooked) ligatures in the \emph{denominators}
+of differential coefficients.
+\end{enumerate}
+
+\subsubsection*{New in version 4.2}
+\begin{enumerate}
+\item tidies a line of code in the definition of the differential (has no
+visible effect);
+\item amends documentation in light of the issue of version 5 and the resulting
+interface changes.
+\end{enumerate}
+
+\subsection{Package options}
+
+\label{subsec:Packageoptions}There are three package options, which
+are entered in a commaseparated list in the optional argument of
+the \texttt{\textbackslash usepackage} command.
+\begin{enumerate}
+\item The first is a switch, \texttt{ISO}, which turns on formatting conforming
+to ISO recommendations, principally upright `d's:
+\begin{lyxcode}
+\textbackslash usepackage{[}ISO{]}\{diffcoeff\}{[}=v4{]}
+\end{lyxcode}
+The full effect of this option is disscussed in \xA7\ref{sec:Changingdefaults}.
+\item The second is another switch, \texttt{spaced}, and \emph{is new with
+version 4 }of \texttt{diffcoeff}. This switch ensures a small space
+is inserted before the differentiand:
+\begin{lyxcode}
+\textbackslash usepackage{[}spaced{]}\{diffcoeff\}{[}=v4{]}
+\end{lyxcode}
+This is discussed in \xA7\ref{subsec:Spacingbeforederivand}.
+\item The third requires a filename \texttt{<filename>} for a file \texttt{<filename>.def}
+containing definitions of variant forms of derivative:
+\begin{lyxcode}
+\textbackslash usepackage{[}deffile=<filename>{]}\{diffcoeff\}{[}=v4{]}
+\end{lyxcode}
+This is discussed in \xA7\ref{subsec:The.deffile}. For the present
+document, the call is
+\begin{lyxcode}
+\textbackslash usepackage{[}deffile=diffcoeffdoc{]}\{diffcoeff\}{[}=v4{]}
+\end{lyxcode}
+\end{enumerate}
+
+\section{A Rogues' Gallery of derivatives}
+
+\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'.
+
+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}
+\end{equation}
+Multicharacter variables of differentiation parenthesized:
+\begin{equation}
+\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 sometimes
+do include the 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}
+Should the $d$ or $\partial$ be included within the parentheses,
+as in 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:
+\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  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}
+
+Other symbols besides $d$ and $\partial$ are used to denote derivativelike
+quantities. From introductory calculus and from classical mechanics
+and thermodynamics 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}
+
+There are those, like the International Organization for Standardization
+(ISO), who stipulate (or prefer) an upright `d' for their derivatives:
+\begin{equation}
+\diff.up.yx.\label{eq:eg11}
+\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  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}
+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.
+
+Then there is the case when the operator in the numerator differs
+from that in the denominator. For instance, in tensor calculus acceleration
+is sometimes 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}$.
+
+Version 2 or later of the \texttt{diffcoeff} package has the generative
+power to cope with all these variations  see \xA7\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.
+
+Finally and new with version 4 of \texttt{diffcoeff}, is the ability
+to insert space before the differentiand, something that had to be
+done explicitly by the user before. One way of thinking of a derivative
+is as an operator $\diff{}x$ applied to a function $F(x)$ producing
+another function $F'(x)$, a \emph{derived }function, the derivative.
+Although the original function is included in the numerator of the
+differential coefficient, a small space between the $d$ and $F$
+feels natural to separate the thing operated on from the thing operating:
+\[
+F'(x)=\diff!{F(x)}x.
+\]
+\texttt{diffcoeff} can now produce such spaced derivatives, either
+as the default behaviour or at explicit request; see \xA7\ref{subsec:Spacingbeforederivand}.
+
+\section{Ordinary derivatives }
+
+\label{sec:Ordinaryderivatives}Writing\textbf{ }\texttt{\textbackslash diff\{y\}\{x\}}
+will produce $\diff{y}{x}$ in text style (i.e., placed between \texttt{\textbackslash (
+\textbackslash )} or \texttt{\$ \$}) or
+\[
+\diff{y}{x}
+\]
+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  the differentiand
+or the variable of differentiation  is multitoken.
+\begin{itemize}
+\item If you want upright `$\mathrm{d}$'s as default, as ISO 800002 recommends,
+rather than the mathitalic `$d$'s used here, this can easily be
+done with the package option \texttt{ISO}; see \xA7\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
+x\}/x} produces $\diff{\ln x}/x$. Braces are required for the numerator
+in this case since it contains more than one token.
+
+\subsection{Spacing before the differentiand}
+
+\label{subsec:Spacingbeforederivand}There are (at least) two different
+ways in which we think of derivatives.\footnote{I thank \noun{Hans Sch\xFClein} for first raising this issue with me
+and for subsequent thoughtful comments. } We are all familiar with the argument presented in elementary calculus
+books where a curve is shown, and a point on the curve through which
+a chord has been drawn. The chord is a side  the hypotenuse 
+of a small rightangled triangle, the other sides having lengths $\delta x$
+and $\delta y$ and being parallel to the coordinate axes. The slope
+of the chord is $\diffd yx$. By drawing smaller and smaller chords
+through the point, the ratio $\diffd yx$ approaches the slope of
+the tangent to the curve at the point. We write
+\[
+\diff yx
+\]
+for the limit of $\diffd yx$. It is natural to think of $\dl y$
+and $\dl x$ as tiny lengths, like $\delta y$ and $\delta x$, in
+which case it would be quite wrong to insert space between the $d$
+and the $y$ (let alone the $d$ and the $x$). $dy$ is a single
+object, called a differential, and we write expressions like
+\begin{centred}
+\verb`\[ dy=\diff yx dx \]` $\Longrightarrow$
+\[
+\dl y=\diff yx\dl x
+\]
+\end{centred}
+and justly call the `fraction' in this expression a differential
+coefficient.
+
+But there is another way of viewing differentiation: as a process
+producing (or \emph{deriving}) one function, $f'(x)$, from another,
+$f(x)$. Here the sense is of applying $\diff{}x$ to $f(x)$. Although
+we include $f(x)$ in the numerator it is not attached to the $d$
+and should be separated from it by a small space:
+\begin{centred}
+\verb`\[ f'(x)=\diff!{f(x)}x \]` $\Longrightarrow$
+\[
+f'(x)=\diff!{f(x)}x.
+\]
+\end{centred}
+Here the fraction on the right is another name for the derived function
+$f'$ and is justly called the derivative of $f$. As you can see
+a small space has been inserted between the $d$ and the $f$ in the
+numerator. By default the space is \texttt{3 mu} but with the ability
+to stretch by \texttt{1 mu} or shrink by\texttt{ 2 mu}{\ttfamily\footnote{In \TeX speak, \texttt{3mu plus 1mu minus 2mu}. }}
+as \TeX{} adjusts lines to fit on the page. (A `mu' is a `math unit'
+and is one eighteenth of a quad.) To achieve this result I have inserted
+an exclamation mark \verb`!` before the braces delimiting the differentiand.
+\begin{itemize}
+\item You may want all or most of your derivatives to have this space and
+therefore will not want to be inserting exclamation marks in every
+\texttt{\textbackslash diff} command. The \texttt{spaced} package
+option switches the default behaviour to spaced derivatives (in which
+case the \texttt{!} switch now creates an \emph{unspaced} derivative).
+The size of the space inserted by default can be easily changed; see
+\xA7\ref{sec:Changingdefaults}.
+\end{itemize}
+The present document uses the unspaced default. For backwards compatibility
+(and perhaps because the author has done this for the last 60 years),
+this is the \textquoteleft outofthebox\textquoteright{} default
+that \texttt{diffcoeff} uses. Authors should make a habit of using
+one form predominantly. (There is also the possibility which I haven't
+emphasized of spacing multitoken differentiands and leaving singletoken
+differentiands unspaced; see \xA7\ref{subsec:Afinalflourish}.)
+
+Slashform derivatives also allow space before the differentiand.
+By default this has the same value as applied to the fraction form
+of derivative (but can be changed; see \xA7\ref{sec:Changingdefaults}):
+\begin{centred}
+\verb`$ \diff!{\ln\sin x}/x $` $\Longrightarrow$ $ \diff!{\ln\sin x}/x$.
+\end{centred}
+The \verb`\diff` command has other optional arguments (e.g. to specify
+the order of differentiation) but always the exclamation mark, if
+used, immediately precedes the differentiand. It is the positioning
+of the differentiand that it affects after all and its placement immediately
+before that argument seems natural.
+
+\subsubsection{Ligatures: }
+
+Prior to v.4 of \texttt{diffcoeff}, \texttt{\textbackslash diff fx}
+produced the tight pairing evident in
+\[
+\frac{df}{dx}.
+\]
+This was a bug. From version 4.0 of \texttt{diffcoeff}, such ligatures
+are prevented: \verb`\[ \diff fx \]` $\Longrightarrow$ \[ \diff fx.\]
+
+\subsubsection{Spacing commands}
+
+\label{subsec:Spacingcommands}The \texttt{diffcoeff} package also
+offers four simple spacing commands to finetune the display of derivatives
+and of other quantities. These are
+\begin{description}
+\item [{\texttt{\textbackslash negmu}}] insert spacing of $1$ mu
+\item [{\texttt{\textbackslash nilmu}}] insert spacing of $0$ mu (cf.
+use of an empty brace pair \texttt{\textbf{\{\}}} )
+\item [{\texttt{\textbackslash onemu}}] insert spacing of $1$ mu
+\item [{\texttt{\textbackslash twomu}}] insert spacing of $2$ mu
+\end{description}
+
+\subsection{Appending the differentiand: \texttt{\textbackslash diff{*}}}
+
+Some differentiands are too big or awkward to be placed neatly in
+the numerator of a derivative and it is natural to append them to
+a preceding differential operator. One way to do this is to leave
+the numerator argument empty in the \texttt{\textbackslash diff}
+command and follow the command with the 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:
+\begin{centred}
+\verb`\[ \diff*{(ax^2+bx+c)}x \]` $\Longrightarrow$ \[\diff*{(ax^{2}+bx+c)}x\]
+\end{centred}
+With the \texttt{!} switch or \texttt{spaced} package option, additional
+space (by default \texttt{3mu plus 1mu minus 2mu}) is inserted between
+the operator and the differentiand:
+\begin{centred}
+\verb`\[ \diff*!{(ax^2+bx+c)}x \]` $\Longrightarrow$ \[\diff*!{(ax^{2}+bx+c)}x.\]
+\end{centred}
+A virtue of using an asterisk to append the differentiand 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
+ one in which a derivative forms the differentiand of another derivative:
+\begin{centred}
+\verb`\[ \diff[2]yx = \diff*{\diff yx}x \]` $\Longrightarrow$ \[ \diff[2]yx=\diff*{\diff yx}x \]
+\end{centred}
+\noindent which is more elegant to my eye than
+\begin{centred}
+\noindent \verb`\[ \diff[2]yx = \diff!{\diff yx}x \]` $\Longrightarrow$
+\[ \diff[2]yx=\diff!{\diff yx}x \]
+\end{centred}
+\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.
+
+In slash style with the star option, the polynomial example becomes
+\begin{centred}
+\verb`\[ \diff*{(ax^2+bx+c)}/x \]` $\Longrightarrow$ \[ \diff*{(ax^2+bx+c)}/x \]
+\end{centred}
+\noindent where the parentheses around the differential operator are
+automatically inserted by \texttt{diffcoeff}. Like other elements
+of automatic formatting, this is useradjustable; see \xA7\ref{sec:Changingdefaults}.
+
+With the \texttt{!} switch or \texttt{spaced} package option, this
+becomes
+\begin{centred}
+\verb`\[ \diff*!{(ax^2+bx+c)}/x \]` $\Longrightarrow$ \[ \diff*!{(ax^2+bx+c)}/x \]
+\end{centred}
+
+\subsection{Point of evaluation}
+
+\label{subsec:Pointofevaluation}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:\footnote{In v.1 of \texttt{diffcoeff}, this was bracedelimited. From v.2,
+squarebrackets have been used and braces deprecated. From v.4, braces
+are no longer accepted.}
+\begin{centred}
+\verb`\[ \diff[2]yx[0] \]` $\Longrightarrow\quad{\displaystyle \diff[2]yx[0]}$
+\end{centred}
+\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.
+\begin{itemize}
+\item If you prefer to use subscripted \emph{parentheses} around the derivative
+to indicate a point of evaluation  as ISO 800002 recommends 
+then this can easily be done; see \xA7\ref{sec:Changingdefaults} on
+changing default settings. Or, more simply, use the \texttt{ISO} package
+option.
+\end{itemize}
+Because the slash form spreads the derivative out horizontally, parentheses
+are preferred here to indicate a point of evaluation:
+\begin{centred}
+\verb`$ \diff{\ln sin x}/{sin x}[x=\pi/6] $` $\Longrightarrow$ $ \diff{\ln\sin x}/{\sin x}[x=\pi/6] $.
+\end{centred}
+\noindent A vertical rule (or `pipe') can easily 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}
+
+It is easy to add a superscript to a derivative to indicate evaluation
+at two points and the difference between the values:
+\begin{centred}
+\verb`\[ \diff {\sin x}x[0]^{\pi/2} \]` ${\displaystyle \Longrightarrow}$
+\[ \diff{\sin x}x[0]^{\pi/2} \]
+\end{centred}
+\noindent If you want only the superscript, no subscript, include
+the final 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{centred}
+\noindent \verb`$ \tfrac 12 m \diff x/t[]^2 $` $\Longrightarrow$
+$\tfrac{1}{2}m\diff x/t[]^{2}$.
+\end{centred}
+
+\subsection{Order of differentiation}
+
+An optional first argument allows the order of differentiation to
+be specified. The order need not be a number; an algebraic order of
+differentiation is perfectly acceptable as is a mix of the two:
+\begin{centred}
+\verb`\[ \diff[2]yx \]` $\Longrightarrow$ \[ \diff[2]yx,\]\verb`\[ \diff[n+1]yx \]`
+$\Longrightarrow$ \[ \diff[n+1]yx.\]
+\end{centred}
+As mentioned, the braces can be and have been omitted around the $x$
+and $y$; the square brackets around the optional argument, the order
+of differentiation, are essential. For a firstorder derivative, no
+optional argument is needed and entering \texttt{1} as the optional
+argument has no effect:
+\begin{centred}
+\verb`$ \diff[1]yx $` $\Longrightarrow$$\diff[1]yx$.
+\end{centred}
+In slash style, \texttt{\$\textbackslash diff{[}2{]}y/x\$} produces
+$\diff[2]y/x$, and \texttt{\$\textbackslash diff{[}n+1{]}y/x\$}
+produces $\diff[n+1]y/x$.
+
+\subsection{Multicharacter variables of differentiation}
+
+Differentiating a function of a function may involve a multicharacter
+differentiation variable. For instance, to differentiate $\ln\sin x$
+in $x$ means forming the product
+\begin{centred}
+\verb`\[ \diff!{\ln\sin x}{\sin x}\diff{\sin x}x \]` $\Longrightarrow$
+\[\diff!{\ln\sin x}{\sin x}\diff{\sin x}x.\]
+\end{centred}
+\noindent (Although I am mainly using unspaced differentiands in
+this document, a space before the differentiand in the first of these
+derivatives  the \verb`!` switch  improves the appearance of
+the expression to my eye.)
+
+Forming the \emph{second} derivative of $\ln\sin x$ will now involve
+forming (among other quantities)
+\begin{centred}
+\noindent \verb`\[\diff[2]{\ln\sin x}{\sin x}\]` $\Longrightarrow$
+\[\diff[2]{\ln\sin x}{\sin x}\]
+\end{centred}
+\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 $x^{2}$.
+
+The question is: are the parentheses in the right place? Logically,
+no. 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 
+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 \xA7\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 them yourself:
+\begin{centred}
+\verb`\[\diff {f(x)}{1/x}, \quad \diff {f(x)}{(1/x)}.\]` $\Longrightarrow$
+\[ \diff {f(x)}{1/x}, \quad\diff {f(x)}{(1/x)}.\]
+\end{centred}
+
+\section{Partial derivatives}
+
+\noindent \label{sec:Partialderivatives}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
+\[
+\diffp{F}{x}
+\]
+in display style. (As for \texttt{\textbackslash diff}, the omission
+of braces is possible when the differentiand or the differentiation
+variable are single tokens.) As for \texttt{\textbackslash diff},
+there is a slash 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.
+
+With either the \verb`spaced` package option (see \xA7\ref{subsec:Packageoptions})
+or the \verb`!` switch a space, defaulting to \verb`3 mu` with some
+stretch and shrink, can be inserted before the differentiand: \verb`\[ \diffp!{F(x,y)}x \]`
+$\Longrightarrow$ \[ \diffp!{F(x,y)}x. \]
+
+\noindent (But note that if the \verb`spaced` package option is used,
+the \verb`!` switch \emph{removes} any extra space.)
+
+Again an optional argument allows the specification of the order of
+differentiation which may be numeric or algebraic or a mix of the
+two:
+\begin{centred}
+\verb`\[ \diffp[3]F/x , \quad \diffp[n]F/x \]` $\Longrightarrow$
+\[\diffp[3]F/x , \quad \diffp[n]F/x\] \verb`\[ \diffp[n+1]Fx. \]`
+$\Longrightarrow$ \[ \diffp[n+1]Fx. \]
+\end{centred}
+
+\subsection{Variables held constant}
+
+In a subject like thermodynamics, there is a need to indicate which
+variables are held constant when the differentiation occurs. To show
+this, append a final squarebracketed optional argument and ensure
+that it follows \emph{immediately} on the preceding mandatory argument.
+A space here will detach the argument from the derivative and result
+in it being treated as a mathematical expression following the derivative.
+Thus to differentiate the entropy $S$ in temperature $T$ while holding
+the volume $V$ constant, write
+\begin{centred}
+\verb`\[ \diffp ST[V] \]` $\Longrightarrow$ \[ \diffp ST[V]. \]
+\end{centred}
+\noindent In slash form the same expression looks like
+\begin{centred}
+\noindent \verb`$ \diffp S/T[V] $` $\Longrightarrow$ $ \diffp S/T[V] $.
+\end{centred}
+This use of a parenthesised, subscripted form to indicate a variable
+or variables held constant, leaves open the question: how do we represent
+a point of evaluation? ISO 800002 makes no recommendation for \emph{partial}
+derivatives; presumably we follow the same practice as their recommendation
+for ordinary derivatives:
+\begin{example}
+\verb`\[ \diffp {F(x,y)}x[(0,0)] \]` $\Longrightarrow$ \[ \diffp {F(x,y)}x[(0,0)] \]
+\end{example}
+
+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 \xA7\ref{sec:Changingdefaults}.
+
+An empty final argument produces a parenthesised derivative with no
+subscript,
+\begin{centred}
+\verb`\[ \diffp yx[] \]` ${\displaystyle \Longrightarrow}$ \[ \diffp yx[] \]
+\end{centred}
+\noindent which can be useful sometimes. An instance is the writing
+of Lagrange's equations of motion in analytic mechanics:
+\begin{centred}
+\noindent \verb`\[ \diffp L{q_k}\diff*{\diffp L{\dot{q}_k}[]}t = 0 \]`
+$\Longrightarrow$ \[ \diffp L{q_k}\diff*{\diffp L{\dot{q}_k}[]}t = 0. \]
+\end{centred}
+
+\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 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'  see \xA7\ref{subsec:Textandscriptstyle}
+below  giving, for our example, $\diff.ptxt.ST[V]$.
+
+\subsection{Appending the differentiand}
+
+\label{subsec:Partialappending}For a long or awkward differentiand,
+it is generally better to \emph{append} 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.
+\begin{centred}
+\verb`\[ \diffp*[2]{\Phi(x,y,z)}x \]` $\Longrightarrow$ \[ \diffp*[2]{\Phi(x,y,z)}x. \]
+\end{centred}
+With the \verb`spaced` package option, or with the \verb`!` switch
+if the package option is not used (which is the case for this document),
+one gets
+\begin{centred}
+\verb`\[ \diffp*[2]!{\Phi(x,y,z)}x \]` $\Longrightarrow$ \[ \diffp*[2]!{\Phi(x,y,z)}x \]
+\end{centred}
+which is an improvement (to my eye).
+
+Alternatively you could leave the first mandatory argument empty and
+manually append the differentiand, but by deleting or inserting an
+asterisk, it is easy to compare the two forms, differentiandinthenumerator,
+differentiandappended, and see which is preferable.
+
+In slash form, parentheses are automatically inserted around the differential
+operator when the differentiand is appended,
+\begin{centred}
+\verb`\[ \diffp*[n]{f(x)}/x \]` $\Longrightarrow$ \[ \diffp*[n]{f(x)}/x, \]
+\end{centred}
+\noindent although this behaviour can be changed (\xA7\ref{sec:Changingdefaults}
+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
+this. Thus, to express a relation in thermodynamics,
+\begin{centred}
+\verb`\[ \diffp*{\frac PT}U[V] = \diffp*{\frac 1T}V[U] \]` $\Longrightarrow$
+\[ \diffp*{\frac PT}U[V] = \diffp*{\frac 1T}V[U], \]
+\end{centred}
+\noindent where the starring automatically takes care of the parentheses
+and subscripts.
+
+\subsection{Iterated derivatives}
+
+Derivatives can be the differentiands of derivatives, as seen above
+when writing Lagrange's equations,
+\begin{centred}
+\noindent \verb`\[ \diffp L{q_k}\diff*{\diffp L{\dot{q}_k}[]}t = 0 \]`
+$\Longrightarrow$ \[ \diffp L{q_k}\diff*{\diffp L{\dot{q}_k}[]}t = 0. \]
+\end{centred}
+\noindent However, in versions of \texttt{diffcoeff} before version
+3.2, an ordinary derivative within a partial derivative rendered as
+a partial derivative. That is now corrected, the ordinary derivative
+rendering correctly:
+\begin{centred}
+\verb`\[ \diffp*{\diff{x^\mu}{\lambda}}{x^\sigma} \]` $\Longrightarrow$
+\[ \diffp*{\diff{x^\mu}{\lambda}}{x^\sigma}. \]
+\end{centred}
+
+\subsection{Mixed partial derivatives}
+
+The new thing with partial derivatives, not present with ordinary
+derivatives, is \emph{mixed} partial derivatives, where there is more
+than one variable of differentiation. If each variable is differentiated
+only to the first order, then it is easy to specify the derivative.
+Suppose $F$ is a function of three variables, $x$, $y$ and $z$.
+Then
+\begin{centred}
+\verb`\[ \diffp F{x,y,z} \]` $\Longrightarrow$ \[ \diffp F{x,y,z}, \]
+
+\verb`\[ \diffp !{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$ \[ \diffp !{F(x,y,z)}{x,y,z}. \]
+\end{centred}
+In the second of these I have inserted space before the differentiand
+by using the \verb`!` switch. If the \verb`spaced` package option
+was being used, this would have been done automatically.
+
+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  \texttt{diffcoeff}
+does the calculation. There is also a slash form:
+\begin{centred}
+\verb`$ \diffp F/{x,y,z} $` $\Longrightarrow$ $ \diffp F/{x,y,z}$.
+\end{centred}
+If we want to differentiate variables to higher order, then their
+orders need to be specified explicitly. To do so use a comma list
+for the optional argument:
+\begin{centred}
+\verb`\[ \diffp[2,3]F{x,y,z} \]` $\Longrightarrow$ \[ \diffp[2,3]F{x,y,z}. \]
+\end{centred}
+\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.
+
+\subsubsection{Minutiae of spacing (again)}
+
+\label{subsec:Minutiaeofspacing}In Chapter 18 of the \emph{The\TeX book},
+Knuth suggests inserting a thin space, {\ttfamily\verb`\,`}
+(or {\ttfamily\verb`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 \verb`2 mu` between the differentials in the fraction form
+of derivative and \verb`1 mu`\texttt{ }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
+\verb`1 mu` is subtracted from the default spacing. Thus in
+\[
+\diffp[2]F{x,y,z},
+\]
+\verb`2 mu` of spacing is inserted between the $\partial y$ and
+$\partial z$, but because the superscript already provides some separation
+between them, only \verb`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 changed by the user; see \xA7\ref{sec:Changingdefaults}.
+Some other minutiae of spacing are discussed below in \xA7\ref{subsec:Commalistofvars}
+when the variables themselves are super or subscripted (as happens
+in tensor calculus, for instance).
+
+Note that the \verb`!` switch, if used, is inserted \emph{immediately
+before} the differentiand. It is the placement of the differentiand,
+after all, that it is affecting:
+\begin{centred}
+\verb`\[ \diffp[2]!F{x,y,z} \]` $\Longrightarrow$ \[ \diffp[2]!F{x,y,z}. \]
+\end{centred}
+
+\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{centred}
+\verb`\[ \diffp[1,m+1,m1]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$
+\[ \diffp[1,m+1,m1]{F(x,y,z)}{x,y,z}. \]
+\end{centred}
+
+\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 (say) line 53 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~of~differentiation~
+
+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}
+The orderoveride option mentioned here is discussed next. 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{centred}
+\noindent \verb`\[ \diffp[2km,m1,m+1]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$
+\[ \diffp[2km,m1,m+1]{F(x,y,z)}{x,y,z}. \]
+\end{centred}
+\noindent Here the overall order is presented as \texttt{2km+2m}.
+You might prefer this to be presented as \texttt{2m(k+1)}. Although
+\texttt{diffcoeff} takes some steps to present the overall order appropriately,
+it is not a computer algebra system and does not factorise expressions.
+If you want to present the order in a manner distinct from that presented
+by \texttt{diffcoeff}, use the \emph{orderoverride option}.
+
+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{centred}
+\verb`\[ \diffp[2km,m1,m+1][2m(k+1)]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$
+\[ \diffp[2km,m1,m+1][2m(k+1)]{F(x,y,z)}{x,y,z}. \]
+\end{centred}
+\noindent As another example, left to its own devices, \texttt{diffcoeff}
+produces
+\begin{centred}
+\noindent \verb`\[ \diffp[m/2+n/2,m/2,n/2]F{x,y,z} \]` $\Longrightarrow$
+\[ \diffp[m/2+n/2,m/2,n/2]F{x,y,z}, \]
+\end{centred}
+\noindent whereas we would like the total order to be presented as
+$m+n$. Using the override option,
+\begin{centred}
+\noindent \verb`\[ \diffp[m/2+n/2,m/2,n/2][m+n]F{x,y,z} \]` $\Longrightarrow$
+\[ \diffp[m/2+n/2,m/2,n/2][m+n]F{x,y,z}. \]
+\end{centred}
+The orderoverride option does exactly that: overrides the presentation
+of the calculated order with the manually given one. In fact the calculation
+algorithm does not get called at all when the override option is used
+so that one can in this way present the total order in whatever manner
+one wishes or, indeed, add essentially arbitrary material as a superscript
+to the $\partial$ symbol in the numerator.
+
+\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  the reciprocal of the
+temperature in thermodynamics or generalized coordinates 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\}} rather
+than \texttt{\{x,y}\} when two variables $x$ and $y$ are involved,
+the extra writing is trivial and the comma list allows a simpler handling
+of multicharacter variables. For instance in tensor calculus we get
+expressions like
+\begin{centred}
+\verb`\[ \diffp{A_i}{ x^j,x^k } \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^j,x^k }. \]
+\end{centred}
+\noindent It is easier to write \texttt{\{x\textasciicircum j,x\textasciicircum k\}}
+here than, say, \texttt{\{\{x\textasciicircum j\}\{x\textasciicircum k\}\}}
+to distinguish the variables. It does mean that should the variable
+of differentiation include a comma then that comma needs to be enclosed
+in 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 \xA7\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 introduced earlier
+(\xA7\ref{subsec:Spacingcommands}), which inserts \texttt{1 mu} of
+spacing. For our example, in
+\begin{centred}
+\verb`\[ \diffp{A_i}{ x^j\negmu,x^k } \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^j\negmu,x^k } \]
+\end{centred}
+\noindent the \texttt{\textbackslash negmu} decreases the spacing
+between the terms from the default \verb`2 mu` to \verb`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  for instance, the simple use of parentheses:
+\begin{centred}
+\verb`\[ \diffp[2m(k+1),2(k+1)m]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$
+\[ \diffp[2m(k+1),2(k+1)m]{F(x,y,z)}{x,y,z}. \]
+\end{centred}
+
+\paragraph*{Dynamic use of parentheses}
+
+\noindent For parenthetic expressions to be evaluated as in this example
+ 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 error and halt compilation. A message will be sent to the terminal
+and the \LaTeX{} log like the following (which assumes the order spec.
+was on line 53 of the document):
+\begin{lyxcode}
+!~Package~diffcoeff~Error:~)~followed~by~m~in~the~
+
+order~specification~{[}(2n+1)m,(2n1)m{]}~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}
+This is a limitation on the dynamic use of parentheses  but they
+\emph{can} be nested.
+
+\paragraph*{Static use of parentheses}
+
+If a left parenthesis is preceded by a \emph{variable} (i.e., not
+a sign or a number) this signals to \texttt{diffcoeff} the \emph{static}
+use of parentheses, something like $f(k)$, `function of $k$'.
+No attempt is made to evaluate what is between them and they are treated
+simply as an extension of the variable. For example,
+\begin{centred}
+\verb`\[ \diffp[f(k+1)+1,f(k1)1]{F(x,y)}{x,y} \]` $\Longrightarrow$
+\[ \diffp[f(k+1)+1,f(k1)1]{F(x,y)}{x,y}. \]
+\end{centred}
+\noindent In the static case you \emph{can} follow the right parenthesis
+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{centred}
+\noindent \verb`\[ \diffp[2(3+f(k))+1,13(f(k)2)]{F(x,y)}{x,y} \]`
+$\Longrightarrow$ \[ \diffp[2(3+f(k))+1,13(f(k)2)]{F(x,y)}{x,y}. \]
+\end{centred}
+\noindent However, the reverse is not possible: you can't have dynamic
+parentheses within a static pair.
+
+\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:
+\begin{centred}
+\verb`\[ \diffp[m^2+2(k1),m^2(k+1)]F{x,y,z,w} \]` $\Longrightarrow$
+\[ \diffp[m^2+2(k1),m^2(k+1)]F{x,y,z,w}. \]
+\end{centred}
+\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}.
+
+\paragraph*{Override}
+
+There are limitations on what order specifications the \texttt{diffcoeff}
+package can `digest'; equally, it can digest a wide variety of such
+constructs, 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 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  and the override option is always available
+for such cases.
+
+\subsection{Parentheses around multicharacter variables}
+
+In thermodynamics and statistical mechanics one may want to differentiate
+in the reciprocal of the temperature, $1/T$ (or $1/\Theta$):
+\begin{centred}
+\verb`\[ \diffp[2]q{\frac 1\Theta} \]` $\Longrightarrow$ \[ \diffp[2]q{\frac 1\Theta}. \]
+\end{centred}
+\noindent In this case and for other \emph{higher order} derivatives
+of multicharacter variables of differentiation, the parentheses are
+inserted automatically by \texttt{diffcoeff}. Precisely where parentheses
+should be placed is moot. The placement in this example is not strictly
+logical, although it feels intuitive, but the placement can be customised
+(\xA7\ref{sec:Changingdefaults}).
+
+Parentheses are automatically inserted like this only for higher order
+derivatives. When the differentiation is to first order, parenthesising
+is up to the user:
+\begin{centred}
+\verb`\[ \diffp q{(\frac 1\Theta),V} \]` $\Longrightarrow$ \[ \diffp q{(\frac 1\Theta),V}. \]
+\end{centred}
+
+\subsection{Jacobians}
+
+\texttt{diffcoeff} provides a command \texttt{\textbackslash jacob}
+for constructing Jacobians. For example
+\begin{centred}
+\verb`\[ \jacob{u,v,w}{x,y,z} \]` $\Longrightarrow$ \[ \jacob{u,v,w}{x,y,z}. \]
+\end{centred}
+The comma lists can contain any number of variables. \texttt{\textbackslash jacob}
+does \emph{not} check that the two arguments contain the same number
+of variables, so it is perfectly possible to form an object like \texttt{\textbackslash jacob\{u,v,w\}\{x,y\}}
+which as far as I know has no meaning.
+
+\section{Changing defaults; variant forms}
+
+\label{sec:Changingdefaults}To write the range of different examples
+displayed in the Rogues' Gallery (\xA7\ref{sec:Rogues'gallery}) I have
+had to make extensive use 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{ }
+
+\subsection{Default values: ordinary derivatives}
+
+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 a quad.}
+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}, \texttt{/denomtermsep},
+\texttt{termsepadjust} 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. 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 \xA7\ref{subsec:Textandscriptstyle}.
+All values specifying a space require the unit (\texttt{mu}) to be
+given; a number alone does not suffice.
+\noindent \begin{center}
+\begin{table}
+\centering
+\centering{}\caption{{\small Defaults (ordinary derivatives})\protect\label{tab:Ordinaryderivatives}}
+\begin{tabular}{lr}
+\toprule
+{\small key} & {\small default}\tabularnewline
+\midrule
+{\small opsymbol} & {\small\texttt{d}}\tabularnewline
+{\small opsymbolalt} & {\small\texttt{opsymbol}}\tabularnewline
+{\small opordersep} & {\small\texttt{1 mu}}\tabularnewline
+{\small derivandsep} & {\small\texttt{3 mu plus 1 mu minus 2 mu}}\tabularnewline
+{\small /derivandsep} & {\small\texttt{derivandsep}}\tabularnewline
+{\small{*}derivandsep} & {\small\texttt{derivandsep}}\tabularnewline
+{\small{*}/derivandsep} & {\small\texttt{/derivandsep}}\tabularnewline
+{\small denomtermsep} & {\small\texttt{2 mu}}\tabularnewline
+{\small /denomtermsep} & {\small\texttt{1 mu}}\tabularnewline
+{\small termsepadjust} & {\small\texttt{1 mu}}\tabularnewline
+{\small leftdelim} & {\small\texttt{\textbackslash left .}}\tabularnewline
+{\small rightdelim} & {\small\texttt{\textbackslash right }}\tabularnewline
+{\small /leftdelim} & {\small\texttt{(}}\tabularnewline
+{\small /rightdelim} & {\small\texttt{)}}\tabularnewline
+{\small elbowroom} & {\small\texttt{0 mu}}\tabularnewline
+{\small /elbowroom} & {\small\texttt{0 mu}}\tabularnewline
+{\small subscrnudge} & {\small\texttt{0 mu}}\tabularnewline
+{\small /subscrnudge} & {\small\texttt{0 mu}}\tabularnewline
+{\small longvarwrap} & {\small\texttt{d(v)}}\tabularnewline
+{\small{*}/opwrap} & {\small\texttt{true}}\tabularnewline
+{\small{*}opleft} & {\small\texttt{false}}\tabularnewline
+{\small{*}italicnudge} & {\small\texttt{3 mu}}\tabularnewline
+\bottomrule
+\end{tabular}
+\end{table}
+\par\end{center}
+\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};
+default = \texttt{d}
+\item [{opsymbolalt}] if different from \textbf{opsymbol} then used
+in the 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;
+for the mathitalic forms 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;
+default = \texttt{1 mu}
+\item [{derivandsep}] horizontal space added before the differentiand
+(derivand) if the \verb`spaced` package option is used, or by the
+\verb`!` switch if it is not; the default has some stretch and shrink;
+default = \verb`3mu plus 1mu minus 2mu`
+\item [{/derivandsep}] for the slash form of derivative, horizontal space
+added before the differentiand (derivand) if the \verb`spaced` package
+option is used, or by the \verb`!` switch if it is not; default =
+\verb`derivandsep`
+\item [{{*}derivandsep}] when the derivand is appended, horizontal space
+added before the differentiand (derivand) if the \verb`spaced` package
+option is used, or by the \verb`!` switch if it is not; default =
+\verb`derivandsep`
+\item [{{*}/derivandsep}] for the slash form of derivative when the derivand
+is appended, horizontal space added before the differentiand (derivand)
+if the \verb`spaced` package option is used, or by the \verb`!`
+switch if it is not; default = \verb`/derivandsep`
+\item [{denomtermsep}] (mixed partial derivatives only) horizontal spacing
+inserted between the differentials in the denominator of a mixed partial
+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} or \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; 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; default = \texttt{\textbackslash right }
+\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; 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; default = \texttt{)}
+\item [{elbowroom}] adjustment to the whitespace between the left and right
+delimiters and the enclosed derivative; negative values reduce the
+space; default = \texttt{0 mu}
+\item [{/elbowroom}] adjustment to the whitespace between the left and
+right delimiters and the enclosed slashform derivative; 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; 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; default = \texttt{0 mu}
+\item [{longvarwrap}] to avoid ambiguity in higher order derivatives
+it may be advisable to wrap multitoken variables of differentiation
+in parentheses; 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}$
+\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 [{{*}/opwrap}] a choice of \texttt{true} or \texttt{false} for
+slash forms of the derivative when the differentiand is appended,
+dictating whether the derivative is wrapped in parentheses, as here
+$\diffp*{F(x,y)}/x$, or not; default = \texttt{true}
+\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; 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}; default = \texttt{3
+mu}
+\end{description}
+
+\subsection{ISO defaults}
+
+\label{subsec:ISOdefaults}\begin{wraptable}[10]{o}{0.4\columnwidth}%
+\centering{}\vspace{5.35ex}
+ \caption{{\small ISO default changes}\protect\label{tab:ISOsettingchanges}}
+\abovetopsep=.5ex %
+\begin{tabular}{lr}
+\toprule
+{\small key} & {\small default}\tabularnewline
+\midrule
+{\small opsymbol} & {\small\texttt{\textbackslash mathrm\{d\}}}\tabularnewline
+{\small opordersep} & {\small\texttt{0 mu}}\tabularnewline
+{\small leftdelim} & {\small\texttt{\textbackslash left (}}\tabularnewline
+{\small rightdelim} & {\small\texttt{\textbackslash right )}}\tabularnewline
+{\small subscrnudge} & {\small\texttt{6 mu}}\tabularnewline
+\bottomrule
+\end{tabular}\end{wraptable}%
+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\}{[}=v4{]}
+\end{lyxcode}
+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 parentheses to indicate a point of evaluation.
+Hence the other entries 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.
+
+Note that the \texttt{ISO} option will also produce upright `D's in
+derivatives formed from `D'; see \xA7\ref{subsec:DdeltaDelta} below.
+
+\subsection{Partial derivatives}
+
+\begin{wraptable}{o}{0.4\columnwidth}%
+\centering{}\vspace{5.35ex}
+ \caption{{\small Default changes for partial derivatives}\protect\label{tab:Partialderivdefaults}}
+\abovetopsep=.5ex %
+\begin{tabular}{lr}
+\toprule
+{\small key} & {\small default}\tabularnewline
+\midrule
+{\small opsymbol} & {\small\texttt{\textbackslash partial}}\tabularnewline
+{\small leftdelim} & {\small\texttt{\textbackslash left (}}\tabularnewline
+{\small rightdelim} & {\small\texttt{\textbackslash right )}}\tabularnewline
+{\small subscrnudge} & {\small\texttt{6 mu}}\tabularnewline
+\bottomrule
+\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, some defaults change. These are listed in Table~\ref{tab:Partialderivdefaults}.
+All other keys take the default values of Table~\ref{tab:Ordinaryderivatives}.
+
+The last three entries here reflect the use of subscripted parentheses
+with partial derivatives to indicate variables held constant, for
+instance in the Maxwell relations of thermodynamics, one of which
+is
+\[
+\diffp SV[T]=\diffp PT[V]
+\]
+
+
+\subsection{Setting your own defaults: \texttt{\textbackslash diffdef}}
+
+\label{subsec:diffdef}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 ISO's use of subscripted
+parentheses to indicate a point of evaluation, enter in the preamble
+of your document the command
+\begin{lyxcode}
+\textbackslash diffdef~\{\}~~~~
+
+~~\{~~~~~~
+
+~~~~opsymbol~~~~=~\textbackslash mathrm\{d\},~~~~
+
+~~~~opordersep~=~0~mu
+
+~~\}
+\end{lyxcode}
+\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 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 is the \emph{default} values that are changed. If they contain
+some content, 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 \xA7\ref{sec:Rogues'gallery}.
+
+\subsubsection{Space before the differentiand}
+
+\label{subsec:Afinalflourish}\begin{wraptable}{o}{0.6\columnwidth}%
+\begin{centering}
+\caption{Keys for spacing the derivand}
+\medskip{}
+\begin{tabular}{lr}
+\toprule
+{\small key} & {\small default}\tabularnewline
+\midrule
+{\small derivandsep} & {\small\texttt{3mu plus 1mu minus 2mu}}\tabularnewline
+{\small{*}derivandsep} & {\small\texttt{derivandsep}}\tabularnewline
+{\small /derivandsep} & {\small\texttt{derivandsep}}\tabularnewline
+{\small{*}/derivandsep} & {\small\texttt{ /derivandsep}}\tabularnewline
+\bottomrule
+\end{tabular}
+\par\end{centering}
+\end{wraptable}%
+The insertion of a small space before the differentiand is effected
+by the \verb`!` key inserted immediately before the differentiand
+argument in the \verb`\diff` command. You may wish to make the insertion
+of this space the \emph{default} behaviour. This is done by using
+the \verb`spaced` package option (which makes the \verb`!` switch
+now reverse this new default and put \emph{no} extra space before
+the derivand). The amount of space inserted is, by default, \verb`3mu plus 1mu minus 2mu`,
+meaning the space is generally $3$mu but can stretch to $4$mu or
+shrink to $1$mu as \TeX{} strives to fit content in a line or on the
+page.
+
+Perhaps this doesn't suit. You may want a fixed space here, with no
+stretch or shrink. The key to change is \verb`derivandsep`. By default,
+this setting applies not only to the fraction form of derivative,
+but also to the slash form and to when the derivand is appended.
+
+If you feel a little less space should be used for slash derivatives,
+then the key to change is \verb`/derivsep`. This changed value
+will also be used for an appended derivand in a slash derivative.
+
+Thus to meet both wishes you might put in the preamble of your document
+something like
+\begin{lyxcode}
+\textbackslash diffdef~\{\}~~~~
+
+~~\{~~~~~~
+
+~~~~derivandsep~~~=~3~mu,~~~~
+
+~~~~/derivandsep~=~2~mu
+
+~~\}
+\end{lyxcode}
+This will insert a fixed space of $3$mu before the differentiand
+in both the numerator and when appended in the fraction form of derivative,
+and a fixed space of $2$mu in the slash form of derivative, both
+in the numerator and when appended.
+
+If you want a different spacing when the derivand is appended, the
+keys to change are \verb`*derivandsep` and \verb`*/derivandsep`.
+
+\paragraph{Selective spacing}
+
+I have treated the \verb`spaced` package option thus far as if it
+were an \verb`ON/OFF` switch and, indeed, the presence of the package
+option \verb`spaced` behaves as \verb`ON` and its absence as \verb`OFF`.
+Internally, however, \verb`spaced` is equivalent to \verb`spaced=1`
+and its absence to \verb`spaced=0`. Entering \verb`spaced=n` in
+the package option where \verb`n` is a positive integer is equivalent
+to entering \verb`spaced=1` (and hence to simply entering \verb`spaced`),
+but if \verb`n` is a negative integer, a new effect is produced.
+
+Entering \verb`spaced=1` (or any negative integer) as a package
+option will insert a space (by default \verb`3mu plus 1mu minus 2mu`)
+before the differentiand provided the differentiand\emph{ is longer
+than a single token} but will insert no space before singletoken
+differentiands. The switch \verb`!` reverses this behaviour.
+
+\subsection{Variant forms}
+
+For this package I needed a number of variant forms to illustrate
+the wide variety of ways in which derivatives are displayed. The \texttt{\textbackslash diffdef}
+command in which the first argument is \emph{filled} provides one
+half of the means of doing this. I've given the singleletter name
+\texttt{p} to the following settings:
+\begin{lyxcode}
+\textbackslash diffdef~\{~p~\}
+
+~~\{
+
+~~~~opsymbol~~~~=~\textbackslash partial~,
+
+~~~~leftdelim~~~=~\textbackslash left~(~~,
+
+~~~~rightdelim~~=~\textbackslash right~)~,
+
+~~~~subscrnudge~=~6~mu
+
+~~\}
+\end{lyxcode}
+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 \texttt{\textbackslash diff} command. Thus, repeating
+an example at the end of \xA7\ref{subsec:Partialappending},
+\begin{centred}
+\verb`\[ \diff.p.*{\frac PT}U[V] = \diff.p.*{\frac 1T}V[U] \]` $\Longrightarrow$
+\[ \diff.p.*{\frac PT}U[V] = \diff.p.*{\frac 1T}V[U] \]
+\end{centred}
+\noindent The effect is exactly the same as previously, when the \texttt{\textbackslash diffp}
+command was used. Indeed, \texttt{diffcoeff} identifies \texttt{\textbackslash diffp}
+with \texttt{\textbackslash diff.p.}:
+\begin{lyxcode}
+\textbackslash NewDocumentCommand~\textbackslash diffp~\{~\}~\{~\textbackslash diff.p.~\}
+\end{lyxcode}
+Note that this identification of \texttt{\textbackslash diffp} with
+\texttt{\textbackslash diff.p.} means there is no equivalent dotdelimited
+argument available for \texttt{\textbackslash diffp}. The \emph{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
+\begin{lyxcode}
+\textbackslash diffdef~\{~up~\}~
+
+~~\{
+
+~~~~opsymbol~~~~=~\textbackslash mathrm\{d\},
+
+~~~~opordersep~=~0~mu
+
+~~\}
+\end{lyxcode}
+Apart from the \emph{key = value} settings, the critical feature here
+is the name, \texttt{up} (which is at your discretion and could equally
+be \texttt{upright} or \texttt{roman} or even \texttt{Fred} if you
+so fancied). This ensures that the changed settings apply only to
+this particular variant and do not `infect' the overall defaults.
+To use this variant, all that is needed is to add the name, between
+dots, to the \texttt{\textbackslash diff} command:
+\begin{centred}
+\verb`\[ \diff.up.yx \]` $\Longrightarrow$ \[ \diff.up.yx. \]
+\end{centred}
+\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.}:
+\begin{centred}
+\noindent \verb`\[ \diff.up.*{\frac{F(x)}{G(x)}}x[x=1] \]` $\Longrightarrow$
+\[ \diff.up.*{\frac{F(x)}{G(x)}}x[x=1] \]
+\end{centred}
+\noindent Dotdelimited arguments must always be the \emph{first}
+argument of the \texttt{\textbackslash diff} command, even preceding
+an asterisk (star) as in this example.
+
+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
+\begin{lyxcode}
+\textbackslash diffdef~\{~padrift~\}~\{~subscrnudge~=~0~mu~\}
+\end{lyxcode}
+I have attached a name, \texttt{padrift},\texttt{ }to this setting,
+\begin{centred}
+\verb`\[ \diff.padrift.Fx[y] \]` $\Longrightarrow$ \[ \diff.padrift.Fx[y] \]
+\end{centred}
+\noindent since, to my eye, the subscript seems detached from the
+expression it qualifies  is it perhaps a typo?  and `adrift
+in a sea of whitespace'. This is to be compared with the default \verb`\[ \diffp Fx[y] \]`
+$\Longrightarrow$ \[ \diffp Fx[y] \]
+
+\noindent where the subscript is tucked in close to the right parenthesis
+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
+\begin{centred}
+\verb`\diffdef { pvrule } { opsymbol = \partial }`
+\end{centred}
+This gives
+\begin{centred}
+\verb`\[ \diff.pvrule.{F(x,y)}x[x=1] \]`$\Longrightarrow$ \[ \diff.pvrule.{F(x,y)}x[x=1] \]
+\end{centred}
+
+\subsubsection{Textstyle and scriptstyle derivatives}
+
+\label{subsec:Textandscriptstyle}As noted earlier, the \texttt{diffcoeff}
+package assumes that derivatives of fractionlike form will be used
+in displaystyle expressions and that the slash form will be used
+for inline use (text style). This is the usual practice. But if one
+does want to use the fraction form in an inline expression, 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. Hence define
+
+\noindent %
+\noindent\begin{minipage}[t]{1\columnwidth}%
+\begin{lyxcode}
+\textbackslash diffdef~\{~ptxt~\}~
+
+~~\{
+
+~~~~opsymbol~~~~~~=~\textbackslash partial,
+
+~~~~denomtermsep~=~1~mu~~~~,
+
+~~~~leftdelim~~~~~=~\textbackslash left~(~,
+
+~~~~rightdelim~~~~=~\textbackslash right~),
+
+~~~~elbowroom~~~~~~=~2~mu~~~,
+
+~~~~subscrnudge~~~=~3~mu~~~
+
+~~\}
+\end{lyxcode}
+%
+\end{minipage}
+
+We can now write, for the same example, \texttt{\textbackslash diff.ptxt.ST{[}V{]}}
+which displays as $\diff.ptxt.ST[V]$, where the subscript is better
+positioned 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 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.
+
+In fluid dynamics the \emph{material }or \emph{substantive} derivative
+uses an uppercase $D$ in place of $d$. For example, the continuity
+equation is,
+\begin{centred}
+\verb`\[ \diff.D.{\rho}t=\diffp\rho t + \mathbf{u\cdot}\nabla\rho \]`$\Longrightarrow$
+\[ \diff.D.{\rho}t=\diffp\rho t + \mathbf{u\cdot}\nabla\rho \]
+\end{centred}
+\noindent where \texttt{\textbackslash diff.D.} produces the Dderivative.
+If you want upright `D's, then the \texttt{ISO} package option will
+produce that effect. Alternatively,
+\begin{lyxcode}
+\textbackslash diffdef~\{~Up~\}~
+
+~~\{
+
+~~~~opsymbol~~~~=~\textbackslash mathrm\{D\},
+
+~~~~opordersep~=~0~mu
+
+~~\}
+\end{lyxcode}
+\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: \verb`\[ \diff.delta.yx \]` $\Longrightarrow$ \[ \diff.delta.yx. \]
+
+\noindent This form also features in analytical mechanics (in the
+Rogues' Gallery, the final example at (\ref{eq:eg6})).
+
+Similarly, \texttt{\textbackslash diff.Delta.} forms a derivative
+from $\Delta$:
+\begin{centred}
+\verb`$ \diff.Delta.y/x $` $\Longrightarrow$ $ \diff.Delta.y/x $
+\end{centred}
+\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.
+
+\paragraph{The commands \textbackslash Diff, \textbackslash diffd, \textbackslash Diffd}
+
+For compatibility with version 1 of \texttt{diffcoeff}, the commands
+\texttt{\textbackslash Diff}, \texttt{\textbackslash diffd} and
+\texttt{\textbackslash Diffd} are available and also produce the
+$D$, $\delta$ and $\Delta$ derivatives. Just as \texttt{\textbackslash diffp}
+is identified with \texttt{\textbackslash diff.p.} for partial derivatives,
+these commands are identified with \texttt{\textbackslash diff.D.},
+\texttt{\textbackslash diff.delta.}, and \texttt{\textbackslash diff.Delta}
+through the commands
+\begin{lyxcode}
+\textbackslash NewDocumentCommand~\textbackslash Diff~\{\}~~\{\textbackslash diff.D.\}
+
+\textbackslash NewDocumentCommand~\textbackslash diffd~\{\}~\{\textbackslash diff.delta.\}
+
+\textbackslash NewDocumentCommand~\textbackslash Diffd~\{\}~\{\textbackslash diff.Delta.\}
+\end{lyxcode}
+Unless one is using such variant forms frequently, it seems simpler
+to remember that they are available as dotdelimited arguments to
+the \texttt{\textbackslash diff} command, using the obvious name
+in each case, rather than having to remember the precise camelcase
+form of name of the \texttt{\textbackslash Diff}, \texttt{\textbackslash diffd}
+and \texttt{\textbackslash Diffd} commands.
+
+\subsection{The \texttt{.def} file}
+
+\label{subsec:The.deffile}This mechanism of variant formation is
+how I have been able to illustrate in the Rogues' Gallery, \xA7\ref{sec:Rogues'gallery},
+the wide variety of different usages culled from the literature. But
+the thought arises: if a variant is to be used only once or twice,
+isn't this a lot of bother? Why not just construct the variant derivative
+`by hand' out of \texttt{\textbackslash frac} and \texttt{\textbackslash mskip}
+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.
+
+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 name of your choosing. For the present document the file is
+called \texttt{diffcoeffdoc.def} and should have been placed alongside
+the \verb`.sty` file in your \TeX{} distribution. The contents of
+this file can be seen at \xA7To use these definitions, the \texttt{diffcoeff}
+package is called with the command
+\begin{lyxcode}
+\textbackslash usepackage{[}deffile=diffcoeffdoc{]}\{diffcoeff\}{[}=v4{]}
+\end{lyxcode}
+But even this process still means copying a definition file from directory
+to directory as one works on different documents. The solution is
+to make a definition file available for \emph{all} documents and the
+way to do that is by placing it in the texmf tree, preferably not
+the one created by your \TeX{} distribution (perhaps MiKTeX or TexLive),
+but your own \emph{personal} texmf tree.
+
+\texttt{\vspace{2ex}
+ }
+
+\noindent %
+\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 not included in standard distributions like MiK\TeX{} or \TeX Live.
+For instance, it is the place for personal packages designed for your
+own particular circumstances or preferences, and is structured like
+the standard MiK\TeX{} or \TeX Live hierarchy but placed in another
+location so that there is no chance of its being overwritten when
+MiK\TeX{} or \TeX Live are updated. However, those distributions need
+to be alerted to its existence. For MiK\TeX , open the MiK\TeX{} console,
+click on \textsf{Settings} and then the \textsf{Directories} tab.
+Click the \textsf{+} button and navigate to your personal texmf tree
+to add it to the MiK\TeX{} search path. Having added it, you will then
+need to refresh the filename database by clicking on the \textsf{Tasks}
+menu and selecting the obvious entry. I am not familiar with \TeX Live
+but presume an analogous process will apply there.%
+\end{minipage}}
+
+\medskip{}
+
+\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.
+
+\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.
+
+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:
+\begin{lyxcode}
+\textbackslash diffdef~\{\}~~~~
+
+~~\{~~~~~~
+
+~~~~key1~=~value1,~~~~
+
+~~~~key2~=~value2,
+
+~~~~...
+
+~~~~keyn~=~valuen
+
+~~\}
+\end{lyxcode}
+The keyvalue list is a commaseparated list; hence the last entry
+doesn't need to end with a comma. Nudge and separation values need
+to include the unit, \texttt{mu}; a numerical value alone will result
+in error.\texttt{ }Because a \texttt{.def} file\texttt{ }is a \LaTeX{}
+file, comments need to start with a \texttt{\%} character.
+
+\subsubsection{\texttt{diffcoeff.def}}
+
+Note that if the \texttt{diffcoeff} package is invoked without an
+explicit \texttt{deffile= <filename>} option statement, as here,
+\begin{lyxcode}
+\textbackslash usepackage\{diffcoeff\}{[}=v4{]}
+\end{lyxcode}
+then it will search in the texmf tree (the \LaTeX{} distribution's
+and your personal one) and the document directory for a file \texttt{diffcoeff.def}
+and if found will load that. This file should contain definitions
+of those variants you are likely to use in multiple documents. In
+my personal texmf tree (which I've put at \texttt{E:\textbackslash texmf\textbackslash}
+on a Windows machine) the file \texttt{diffcoeff.def} is located in
+the directory \texttt{E:\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. 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 \noun{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{centred}
+\verb`$ \dl x $` $\Longrightarrow$ $ \dl x. $
+\end{centred}
+\noindent It is also possible\footnote{\noindent From version 3.1 of \texttt{diffcoeff}; version 3.0 of the
+package produced a \LaTeX{} error.} to use the command before, for instance, \texttt{\textbackslash mathbf\{x\}}
+or \texttt{\textbackslash vec\{x\}}:
+\begin{centred}
+\verb`$ \dl \vec{x} $` $\Longrightarrow$ $ \dl \vec{x} $,~~~~\verb`$ \dl \mathbf{x} $`
+$\Longrightarrow$$ \dl \mathbf{x}. $
+\end{centred}
+
+\subsection{Options}
+
+There are two options available with the differential command.
+
+The first is the dotted name option discussed in \xA7\ref{sec:Changingdefaults}.
+Thus, to illustrate a differential with an upright `d', write
+\begin{centred}
+\verb`$ \dl.up.x $` $\Longrightarrow$ $ \dl.up.x. $
+\end{centred}
+\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'.
+
+\subsubsection{Partial differential}
+
+\label{subsec:Partialdifferential}Since the variant \texttt{\textbackslash diff.p.}
+is defined in \texttt{diffcoeff4.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). However,
+there are sufficient contexts where expressions like \verb`\partial_x`
+are used, perhaps as a shortcut for a partial derivative, for it to
+be worthwhile to define an appropriate command for this variant. From
+version 4.0, \texttt{diffcoeff} therefore provides \verb`\dlp`, defined
+by
+\begin{lyxcode}
+\textbackslash NewDocumentCommand~\textbackslash dlp~\{\}~\{~\textbackslash dl.p.~\}
+\end{lyxcode}
+Thus, for instance, \verb`$ \dlp_x $` $\Longrightarrow$ $ \dlp_x $.
+
+\subsubsection{Spacing}
+
+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{centred}
+\verb`$ \dl x\dl3y=r\dl3r\dl3\theta $` $\Longrightarrow$ $ \dl x\dl3y=r\dl3r\dl3\theta. $
+\end{centred}
+\noindent To my eye this is too much space; I prefer
+\begin{centred}
+\noindent \verb`$ \dl x\dl2y=r\dl2r\dl2\theta $` $\Longrightarrow$
+$ \dl x\dl2y=r\dl2r\dl2\theta. $
+\end{centred}
+\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$.
+
+Note that only \emph{one} digit can be used. If two are used, as here,
+\verb`$ \dl20x $` $\Longrightarrow$ $ \dl20x $, the effect is unlikely
+to be what is wanted.
+
+From version 3.2 of \texttt{diffcoeff} it is possible to also add
+\emph{negative} space before the differential, which might be useful
+in special contexts, perhaps to construct a symbol:
+\begin{centred}
+\verb`$ /\dl9x $` $\Longrightarrow$ $ /\dl9x. $
+\end{centred}
+\noindent For negative space before the differential, add a minus
+sign before the (single) digit.
+
+The spacing digit option \emph{follows} the dotdelimited name option.
+For example, earlier, in the denominator of a mixed partial derivative,
+I have used what is effectively \texttt{\textbackslash dlp x\textbackslash dlp2y\textbackslash dlp2z},
+and the variation to that spacing when a higherorder differentiation
+occurs:
+\begin{centred}
+\verb`$ \dlp x^2\dlp1y\dlp2z $` $\Longrightarrow$ $ \dlp x^2\dlp1y\dlp2z. $
+\end{centred}
+
+\subsection{Rationale}
+
+Version 1 of the \texttt{diffcoeff} package arose from a need to simplify
+the parsing of differential coefficients for another program I was
+working on which was struggling to `read' all the possible permutations
+of \texttt{\textbackslash frac} or \texttt{\textbackslash tfrac}
+or \texttt{\textbackslash dfrac} or slash forms of the derivative,
+of \texttt{d} or \texttt{\textbackslash mathrm\{d\}} or \texttt{\textbackslash partial}
+or \texttt{D} or \texttt{\textbackslash mathrm\{D\}} or \texttt{\textbackslash nabla},\texttt{
+}and of points of evaluation delimited by vertical rules or parentheses.\texttt{ }Although
+regular expressions coped with most of these cases, it was \emph{messy}.
+
+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  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 liked in that case too).
+
+\subsubsection{\texttt{diffcoeff.sty}}
+
+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'  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)
+\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,
+\end{itemize}
+\begin{centred}
+\verb`\[ \diffp[m(k+1),m+(k1)]{F(x,y,z)}{x,y,z} \]`
+\end{centred}
+\begin{example}
+$\Longrightarrow$ \[ \diffp[m(k+1),m+(k1)]{F(x,y,z)}{x,y,z} \]
+\end{example}
+
+\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:
+\end{itemize}
+\begin{centred}
+\verb`\[ \diffp[m+(k+1),m+(k1)][2(m+k+1)]{F(x,y,z,w)}{x,y,z,w} \]`
+\end{centred}
+\begin{example}
+$\Longrightarrow$ \[ \diffp[m+(k+1),m+(k1)][2(m+k+1)]{F(x,y,z,w)}{x,y,z,w} \]
+\end{example}
+
+\begin{itemize}
+\item I wished to avoid the unnecessary writing of superscripts, subscripts
+and brace pairs. In the examples just given, no superscript tokens
+\texttt{\textasciicircum} 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  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{centred}
+\verb`\[ \diffp{A_i}{ x^j,x^k } \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^j,x^k } \]
+\end{centred}
+\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  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.
+\item Given the position of the subscripted symbol in the displayed derivative,
+it's positioning as the \emph{final} argument in the derivative command
+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}, has been deprecated
+in \texttt{diffcoeff} since version 2, and is no longer compatible
+with version 4. Later versions of \texttt{diffcoeff} 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 held constant was incorporated into the derivative
+commands, the star option became the simplest way of handling appended
+differentiands since the parentheses 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.
+\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.
+\item A later 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
+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.)
+\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).
+\item To handle possible differences between displaystyle and textstyle
+(and scriptstyle) derivatives (see \xA7\ref{subsec:Textandscriptstyle})
+I considered using \TeX 's \texttt{\textbackslash mathchoice} command.
+This command takes four arguments, corresponding to display, text,
+script and scriptscriptstyles and would require forming four derivatives
+each time a derivative is used, `just in case'. In fact fractionform
+derivatives are used overwhelmingly in displaystyle expressions,
+the slash form being used for inline use. Given the ease of defining
+a fractionform variant 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. From version 4 the partial analogue \texttt{\textbackslash dlp}
+has been added.
+\item Space before the differentiand was requested by a user. Once considered
+it became clear that there are (at least) two ways of thinking of
+a derivative: as $\diff y/x$, a ratio of differentials where $\dl y$
+is a unit and it makes no sense to insert space between the `d'
+and the `y', and as
+\[
+\diff!{F(x)}x
+\]
+where the function $F(x)$ is being operated on by $\diff{}/x$ and
+it is natural to insert space between the `d' and the `F'. With
+that realisation came the need for a simple switchlike package option
+(\verb`spaced`) to turn spacing on or off, and a switchlike argument
+(\verb`!`) to countermand the package option in exceptional cases
+(version 4).
+\end{itemize}
+
+\section{Reference}
+
+\subsection{Commands}
+\begin{description}
+\item [{\texttt{\textbackslash diff}}] arguments (all optional unless
+otherwise indicated):
+\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 ! countermand beforedifferentiand spacing of the \verb`spaced` package
+option
+\item \{\emph{differentiand}\} (mandatory)
+\item / slashform switch
+\item \{\emph{comma list of differentiation variables}\} (mandatory)
+\item {[}\emph{point of evaluation/variables held constant}{]}
+\end{enumerate}
+\item [{\texttt{\textbackslash diffdef}}] arguments (all mandatory):
+\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}}] arguments (all optional):
+\begin{enumerate}
+\item .\emph{name}. (as for \texttt{\textbackslash diff})
+\item \emph{minus sign} (optional, use only if negative spacing before the
+`d' is wanted)
+\item \emph{digit} (insert spacing of this number of mu before the `d')
+\end{enumerate}
+\item [{\texttt{\textbackslash dpl}}] \texttt{= \textbackslash dl.p.}
+\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 (why try remembering the special names when the forms on
+the right are selfexplanatory):
+\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}
+
+\subsection{The file \texttt{diffcoeffdoc.def}}
+
+\label{sec:diffcoeffdoc.def}The file \verb`diffcoeffdoc.def` contains
+the following definitions:
+\begin{verbatim}
+%%%%%%%%%% ordinary %%%%%%%%%%
+% ( ) for pt of eval.
+\diffdef { paren }
+ {
+ leftdelim = \left ( ,
+ rightdelim = \right ),
+ subscrnudge = 6 mu
+ }
+
+% upright
+\diffdef { up }
+ {
+ opsymbol = \mathrm{d},
+ opordersep = 0 mu
+ }
+
+\diffdef { Up }
+ {
+ opsymbol = \mathrm{D},
+ opordersep = 0 mu
+ }
+
+% wrap long vars: (d longvar)
+\diffdef { wrapall } {longvarwrap = (dv)}
+
+% nabla in numerator, d in denominator
+\diffdef { nabla }
+ {
+ opsymbol = \nabla,diffcoeffdoc.def
+ opsymbolalt = d
+ }
+
+% align op left; no italic nudge
+\diffdef { left }
+ {
+ *opleft = true,
+ *italicnudge = 0 mu
+ }
+
+% slashform: vrule for pt of eval
+\diffdef { svrule }
+ {
+ /leftdelim = ,
+ /rightdelim = 
+ }
+
+%%%%%%%%%% partial %%%%%%%%%%
+% partial, vrule for pt of eval.
+\diffdef { pvrule } { opsymbol = \partial }
+
+% partial, no subscr nudge (adrift in a sea of white space)
+\diffdef { padrift }
+ {
+ opsymbol = \partial,
+ leftdelim = \left ( ,
+ rightdelim = \right ),
+ subscrnudge = 0 mu
+ }
+
+% partial, [ ] for pt of eval.
+\diffdef { psqbra }
+ {
+ opsymbol = \partial,
+ leftdelim = \left [ ,
+ rightdelim = \right ],
+ subscrnudge = 0 mu
+ }
+
+% Delta as partial deriv.
+\diffdef { pDelta }
+ {
+ opsymbol = \Delta ,
+ opordersep = 0 mu ,
+ leftdelim = \left ( ,
+ rightdelim = \right ),
+ subscrnudge = 6 mu
+ }
+
+% align op left; italic nudge
+\diffdef { pleft }
+ {
+ opsymbol = \partial,
+ *opleft = true ,
+ *italicnudge = 3 mu ,
+ leftdelim = \left ( ,
+ rightdelim = \right ),
+ subscrnudge = 3 mu
+ }
+
+% partial, textstyle
+\diffdef { ptxt }
+ {
+ opsymbol = \partial,
+ denomtermsep = 1 mu ,
+ leftdelim = \left ( ,
+ rightdelim = \right ),
+ elbowroom = 2 mu ,
+ subscrnudge = 3 mu
+ }
+
+% partial, wide sep of terms
+\diffdef { pwide }
+ {
+ opsymbol = \partial,
+ denomtermsep = 3 mu ,
+ /denomtermsep = 3 mu ,
+ leftdelim = \left ( ,
+ rightdelim = \right ),
+ subscrnudge = 6 mu
+ }
+
+ %%%%%%%%%% differential %%%%%%%%%%
+ \diffdef { up }
+ { opsymbol = \mathrm{d} }
+\end{verbatim}
+
+
+\subsection{Version comparison}
+
+\label{sec:Versioncomparison}Unlike version 1, version 2 and later
+are built on the the \texttt{xtemplate} package which makes certain
+facilities available which it would be silly not to exploit. Hence
+the coding in the later versions is completely different and there
+are consequences.
+\begin{enumerate}
+\item From version 2.0
+\begin{enumerate}
+\item The \texttt{\textbackslash diffset} command, formerly used to tweak
+the display of derivatives, has been superseded by the \texttt{\textbackslash diffdef}
+command. \texttt{\textbackslash diffset} now sends a message warning
+of its obsolescence to the terminal and \LaTeX{} log but is otherwise
+functionless. It should not interfere with the compilation of a document
+but any intended finetuning of the display by means of the \texttt{\textbackslash diffset}
+command\texttt{ }will not eventuate. The warning message is: \texttt{Obsolete
+command: \textbackslash diffset has been superseded by the \textbackslash diffdef
+command.} \texttt{See the diffcoeff} \texttt{doc\umentation for
+further information.} The \texttt{\textbackslash diffdef} command
+is discussed in \xA7\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 version 1, versions 2 and 3 still accepted braces to delimit
+this argument but from version 4 of \texttt{diffcoeff} only the squarebracket
+delimited argument is accepted. (The use of braces around \emph{optional}
+arguments while once accepted is now deprecated in \texttt{xparse}
+on which \texttt{diffcoeff} depends);
+\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 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 \xA7\ref{subsec:DdeltaDelta}.
+\end{enumerate}
+\item Version 3.0
+\begin{enumerate}
+\item 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 provides some simple spacing commands that can be useful for tweaking
+standard spacing.
+\end{enumerate}
+\item Version 3.1 enables the differential command to be used before forms
+like \texttt{\textbackslash vec\{x\}} (an overlooked possibility
+causing an error in earlier versions).
+\item Version 3.2
+\begin{enumerate}
+\item allows negative spacing before the differential command \texttt{\textbackslash dl};
+\item fixes a bug in which an ordinary derivative as the differentiand of
+a partial derivative displayed as a partial derivativ\texttt{diffcoeffdoc.def}e.
+It now displays, as it should, as an ordinary derivative.
+\end{enumerate}
+\item Version 4.0
+\begin{enumerate}
+\item enables the insertion of a small space before the differentiand, either
+as the default behaviour (package option \verb`spaced`) or at explicit
+request (argument \verb`!` of the \verb`\diff` command); see \xA7\ref{subsec:Spacingbeforederivand}.
+\item prevents the ligature $df$ that marred previous versions; this is
+now rendered $\dl f$.
+\item offers the document command \verb`\dlp` for the \emph{partial} differential;
+see \xA7\ref{subsec:Partialdifferential};
+\item no longer accepts \emph{the braced form} of the\emph{ }trailing optional
+argument specifying a point of evaluation or (for partial derivatives)
+variables held constant. This was a relic from version 1 of \texttt{diffcoeff},
+and has been deprecated since version 2.
+\end{enumerate}
+\item Version 4.1
+\begin{enumerate}
+\item changes the code for the \verb`longvarwrap` setting to avoid a
+problem arising from a change in \verb`xtemplate`;
+\item improves spacing between operator and variable in \emph{denominators}
+of differential coefficients (e.g. prevents ligatures).
+\end{enumerate}
+\item Version 4.2
+\begin{enumerate}
+\item see the announcement at the start of this document.
+\end{enumerate}
+\end{enumerate}
+
+\end{document}
Property changes on: trunk/Master/texmfdist/doc/latex/diffcoeff/diffcoeff4.tex
___________________________________________________________________
Added: svn:eolstyle
## 0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeffdoc.def
===================================================================
 trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeffdoc.def 20230111 20:43:41 UTC (rev 65522)
+++ trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeffdoc.def 20230111 20:44:28 UTC (rev 65523)
@@ 114,4 +114,8 @@
leftdelim = \left ( ,
rightdelim = \right ),
subscrnudge = 6 mu
 }
\ No newline at end of file
+ }
+
+ %%%%%%%%%% differential %%%%%%%%%%
+ \diffdef { up }
+ { opsymbol = \mathrm{d} }
\ No newline at end of file
Modified: trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff.sty
===================================================================
 trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff.sty 20230111 20:43:41 UTC (rev 65522)
+++ trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff.sty 20230111 20:44:28 UTC (rev 65523)
@@ 7,96 +7,163 @@
%
% Andrew Parsloe ajparsloe at gmail.com
%
\RequirePackage{expl3}
\RequirePackage{xparse,l3keys2e,xtemplate}
\ProvidesExplPackage {diffcoeff} {2022/06/14} {4.1}
 {Write differential coefficients consistently and easily.}
%
+\DeclareRelease{v4}{}{diffcoeff4.sty}
+\DeclareCurrentRelease{}{2023/01/02}
+
+\RequirePackage{xtemplate,mleftright}
+\ProvidesExplPackage {diffcoeff} {2023/01/02} {5.0}
+ {Write differential coefficients easily and consistently.}
\keys_define:nn { diffcoeff }
{
 ISO .bool_set:N = \l__diffcoeff_ISO_bool,
 spaced .int_set:N = \l__diffcoeff_spaced_int,
 spaced .default:n = 1,
 spaced .initial:n = 0,
 deffile .tl_gset:N = \g__diffcoeff_def_tl,
 deffile .initial:n = diffcoeff,
 deffile .default:n = diffcoeff
+ spaced .int_set:N = \l__diffcoeff_spaced_int,
+ spaced .default:n = 1,
+ spaced .initial:n = 0,
+ mleftright .bool_set:N = \l__diffcoeff_mLR_bool,
+ mleftright .default:n = true,
+ mleftright .initial:n = false,
+ deffile .tl_gset:N = \g__diffcoeff_def_tl,
+ DIF .clist_set:N = \l__diffcoeff_dif_clist
}
\ProcessKeysPackageOptions { diffcoeff }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cs_generate_variant:Nn \tl_if_eq:nnTF { nV }

\tl_new:N \l__diffcoeff_oporder_tl
+\IfFormatAtLeastTF {20201001} {}
+ { \RequirePackage { xparse } }
+\IfFormatAtLeastTF {20220601}
+ { \ProcessKeyOptions [ diffcoeff ] }
+ {
+ \RequirePackage { l3keys2e }
+ \ProcessKeysOptions { diffcoeff }
+ }
+\bool_if:NT \l__diffcoeff_mLR_bool
+ { \mleftright }
+%%%%%%%%%% messages %%%%%%%%%
+\cs_new:Npn \__diffcoeff_msg_autocalc:n #1
+ {
+ in~the~order~spec.~[#1]~\msg_line_context:.~Calculation~of~the~
+ total~order~of~differentiation~fails~in~this~case.~
+ Use~the~\tl_to_str:n { \difoverride }command~to~enter~the~total~order.~
+ \msg_see_documentation_text:n {diffcoeff}
+ }
+\cs_new:Npn \__diffcoeff_msg_style:nnn #1#2#3
+ {
+ The~style~specified~in~the~current~instance,~#1,~
+ \msg_line_context:,~#3~Reverting~to~default~style~#2.
+ }
+\tl_const:Nn \c__diffcoeff_msg_vcon_tl
+ { Version~5~of~diffcoeff~does~not~support~the~use~of~ }
+\tl_const:Nn \c__diffcoeff_msg_revert_tl
+ { Or~revert~to~version~4~by~appending~[=v4]~to~the~preamble~call;~
+ for~example,~\tl_to_str:n{\usepackage}{diffcoeff}[=v4] }
+\msg_new:nnn { diffcoeff } { filenotfound } { File~#1.def~not~found. }
+\msg_new:nnn { diffcoeff } { orderspecgeneral }
+ { #3~followed~by~#2~\__diffcoeff_msg_autocalc:n { #1 } }
+\msg_new:nnn { diffcoeff } { unknownstyle }
+ { \__diffcoeff_msg_style:nnn {#1} {#2} { is~unknown. } }
+\msg_new:nnn { diffcoeff } { wrongstyle }
+ { \__diffcoeff_msg_style:nnn {#1} {#2} { conflicts~with~its~template. } }
+\msg_new:nnn { diffcoeff } { versionconflict }
+ {
+ \c__diffcoeff_msg_vcon_tl #1~\msg_line_context:.~\tl_to_str:n { #2 }
+ \msg_see_documentation_text:n {diffcoeff}~\c__diffcoeff_msg_revert_tl
+ }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\bool_new:N \l__diffcoeff_multitok_bool
+\bool_new:N \l__diffcoeff_append_bool
+\bool_new:N \l__diffcoeff_op_left_bool
+\bool_new:N \l__diffcoeff_dl_bool
+\bool_new:N \l__diffcoeff_exponent_bool
+\tl_new:N \l__diffcoeff_override_tl
+\tl_new:N \l__diffcoeff_frac_tl
\tl_new:N \l__diffcoeff_derivand_tl
\tl_new:N \l__diffcoeff_type_tl
\tl_new:N \l__diffcoeff_tot_order_tl
+\tl_new:N \l__diffcoeff_instance_tl
+\tl_new:N \l__diffcoeff_ord_tl
+\tl_new:N \l__diffcoeff_var_tl
+\tl_new:N \l__diffcoeff_tot_ord_tl
+\tl_new:N \l__diffcoeff_vph_tl
+\tl_new:N \l__diffcoeff_exponent_tl
\tl_new:N \l__diffcoeff_curr_num_tl
\tl_new:N \l__diffcoeff_curr_var_tl
\tl_new:N \l__diffcoeff_paren_tl

\tl_const:Nn \c__diffcoeff_digits_tl { 1234567890 }

\seq_new:N \l__diffcoeff_orders_seq
+\seq_new:N \l__diffcoeff_ords_seq
\seq_new:N \l__diffcoeff_vars_seq
\seq_new:N \l__diffcoeff_denom_seq
\seq_new:N \l__diffcoeff_paren_seq

\prop_new:N \l__diffcoeff_vars_prop

\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
\bool_new:N \l__diffcoeff_spaced_bool
\bool_new:N \l__diffcoeff_altsep_bool

\int_new:N \l__diffcoeff_vars_int
\int_new:N \l__diffcoeff_format_int
+\int_new:N \l__diffcoeff_group_int
+\int_new:N \l__diffcoeff_style_int
\int_new:N \l__diffcoeff_curr_tok_int
\int_new:N \l__diffcoeff_curr_state_int
\int_new:N \l__diffcoeff_nos_int
\int_new:N \l__diffcoeff_parenvar_int

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareObjectType { derivative } { 3 }

% defaults: ordinary deriv. values
\DeclareTemplateInterface { derivative } { DERIV } { 3 }
+\prop_new:N \l__diffcoeff_vars_prop
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\DeclareObjectType { diffcoeff } { 5 }
+% #1 append boolean; #2 order spec(clist); #3 derivand(tl);
+% #4 diff variables(clist); #5 pt of eval(tl)
+\DeclareTemplateInterface { diffcoeff } { DIF } { 5 }
{
 opsymbol : tokenlist = d ,
+ stylegroup : choice { f, s, c, j, l } = f,
+ style : choice { frac, tfrac, dfrac,
+ /, auto, big, Big, bigg, Bigg,
+ _, dl
+ } = frac ,
+ slashtok : tokenlist = / ,
+ slashsep : tokenlist = 0 mu,
+ derivandsep : tokenlist = 3 mu plus 1 mu minus 2 mu,
+ opsymbol : tokenlist = \mathrm{d},
opsymbolalt : tokenlist = \KeyValue { opsymbol },
 opordersep : muskip = 1 mu ,
 derivandsep : muskip = 3 mu plus 1 mu minus 2 mu,
+ opordernudge : tokenlist = 0 mu ,
+ varsupnudge : tokenlist = 1 mu ,
+ multitermsep : tokenlist = 2 mu plus 1 mu minus 1 mu,
+ termsepadjust : tokenlist = 1 mu,
longvarwrap : choice { dv, d(v), (dv) }
 = d(v) ,
 denomtermsep : muskip = 2 mu ,
 termsepadjust : muskip = 1 mu ,
 leftdelim : tokenlist = \left . ,
 rightdelim : tokenlist = \right ,
 elbowroom : muskip = 0 mu ,
 subscrnudge : muskip = 0 mu ,
 *derivandsep : muskip = \KeyValue { derivandsep },
 *opleft : boolean = false ,
 *italicnudge : muskip = 3 mu ,
 /derivandsep : muskip = \KeyValue { derivandsep },
 /denomtermsep : muskip = 1 mu ,
 /leftdelim : tokenlist = ( ,
 /rightdelim : tokenlist = ) ,
 /elbowroom : muskip = 0 mu ,
 /subscrnudge : muskip = 0 mu ,
 */derivandsep : muskip = \KeyValue { /derivandsep },
 */opwrap : boolean = true
+ = d(v) ,
+ lvwrapLdelim : tokenlist = \mleft (,
+ lvwrapRdelim : tokenlist = \mright ),
+ lvwrapsupnudge : tokenlist = 2 mu,
+ outerLdelim : tokenlist = \left ( ,
+ outerRdelim : tokenlist = \right ),
+ elbowroom : tokenlist = 0 mu ,
+ subnudge : tokenlist = 5 mu,
+ opsubnudge : tokenlist = 0 mu ,
+ *derivandsep : tokenlist = \KeyValue { derivandsep },
+ *opsetleft : boolean = false,
+ *italicnudge : tokenlist = 0 mu ,
+ *innerwrap : boolean = false,
+ *innerLdelim : tokenlist = (,
+ *innerRdelim : tokenlist = ),
+ *outerLdelim : tokenlist = \bigl [,
+ *outerRdelim : tokenlist = \bigr ],
+ *subnudge : tokenlist = 0 mu
}
% #1 order spec(seqvar); #2 order override(tlvar)
% #3 derivand(tlvar); #4 denominator(seqvar)
% #5 subscript(tlvar)
\DeclareTemplateCode { derivative } { DERIV } { 3 }
+\DeclareTemplateCode { diffcoeff } { DIF } { 5 }
{
 opsymbol = \l__diffcoeff_op_tl,
 opsymbolalt = \l__diffcoeff_op_alt_tl,
 opordersep = \l__diffcoeff_oporder_muskip,
 derivandsep = \l__diffcoeff_derivsep_muskip,
+ stylegroup = {
+ f = \int_set:Nn \l__diffcoeff_group_int { 0 },
+ s = \int_set:Nn \l__diffcoeff_group_int { 1 },
+ c = \int_set:Nn \l__diffcoeff_group_int { 2 },
+ j = \int_set:Nn \l__diffcoeff_group_int { 3 },
+ l = \int_set:Nn \l__diffcoeff_group_int { 4 }
+ },
+ style = {
+ frac = \__diffcoeff_style:nn { 0 } {},
+ tfrac = \__diffcoeff_style:nn { 1 } {},
+ dfrac = \__diffcoeff_style:nn { 2 } {},
+ / = \__diffcoeff_style:nn { 3 } {},
+ auto = \__diffcoeff_style:nn { 4 } {},
+ big = \__diffcoeff_style:nn { 5 } { big },
+ Big = \__diffcoeff_style:nn { 5 } { Big },
+ bigg = \__diffcoeff_style:nn { 5 } { bigg },
+ Bigg = \__diffcoeff_style:nn { 5 } { Bigg },
+ _ = \__diffcoeff_style:nn { 6 } {},
+ dl = \__diffcoeff_style:nn { 7 } {},
+ unknown = \__diffcoeff_style:nn { 9 } {}
+ },
+ slashtok = \l__diffcoeff_slashtok_tl,
+ slashsep = \l__diffcoeff_slashsep_tl,
+ derivandsep = \l__diffcoeff_derivsep_tl,
+ opsymbol = \l__diffcoeff_opi_tl,
+ opsymbolalt = \l__diffcoeff_opii_tl,
+ opordernudge = \l__diffcoeff_opordsep_tl,
+ varsupnudge = \l__diffcoeff_varsupnudge_tl,
+ multitermsep = \l__diffcoeff_termsep_tl,
+ termsepadjust = \l__diffcoeff_sep_adj_tl,
longvarwrap = {
dv = \cs_set_eq:NN \__diffcoeff_wrap_longvars:nn
\__diffcoeff_wrap_longvars_dv:nn,
@@ 105,307 +172,164 @@
(dv) = \cs_set_eq:NN \__diffcoeff_wrap_longvars:nn
\__diffcoeff_wrap_longvars_dvii:nn,
unknown = \cs_set_eq:NN \__diffcoeff_wrap_longvars:nn
 \__diffcoeff_wrap_longvars_dvi:nn
+ \__diffcoeff_wrap_longvars_dvi:nn
},
 denomtermsep = \l__diffcoeff_varsep_muskip,
 termsepadjust = \l__diffcoeff_sep_adj_muskip,
 leftdelim = \l__diffcoeff_ldelim_tl,
 rightdelim = \l__diffcoeff_rdelim_tl,
 elbowroom = \l__diffcoeff_elbowrm_muskip ,
 subscrnudge = \l__diffcoeff_subnudge_muskip,
 *derivandsep = \l__diffcoeff_derivsepi_muskip,
 *opleft = \l__diffcoeff_op_left_bool,
 *italicnudge = \l__diffcoeff_opnudge_muskip,
 /derivandsep = \l__diffcoeff_derivsepii_muskip,
 /denomtermsep = \l_tmpb_muskip,
 /leftdelim = \l__diffcoeff_ldelimi_tl,
 /rightdelim = \l__diffcoeff_rdelimi_tl,
 /elbowroom = \l_tmpc_muskip,
 /subscrnudge = \l_tmpd_muskip,
 */derivandsep = \l__diffcoeff_derivsepiii_muskip,
 */opwrap = \l__diffcoeff_opwrap_bool
+ lvwrapLdelim = \l__diffcoeff_lvw_ldelim_tl,
+ lvwrapRdelim = \l__diffcoeff_lvw_rdelim_tl,
+ lvwrapsupnudge = \l__diffcoeff_lvsupnudge_tl,
+ outerLdelim = \l__diffcoeff_ldelim_tl,
+ outerRdelim = \l__diffcoeff_rdelim_tl,
+ elbowroom = \l__diffcoeff_elbowrm_tl ,
+ subnudge = \l__diffcoeff_subnudge_tl,
+ opsubnudge = \l__diffcoeff_opsubnudge_tl,
+ *derivandsep = \l__diffcoeff_derivsepi_tl,
+ *opsetleft = \l__diffcoeff_op_left_bool,
+ *italicnudge = \l__diffcoeff_opleftnudge_tl,
+ *innerwrap = \l__diffcoeff_innerwrap_bool,
+ *innerLdelim = \l__diffcoeff_lopwrap_tl,
+ *innerRdelim = \l__diffcoeff_ropwrap_tl,
+ *outerLdelim = \l__diffcoeff_ldelimapp_tl,
+ *outerRdelim = \l__diffcoeff_rdelimapp_tl,
+ *subnudge = \l__diffcoeff_subnudgeapp_tl
}
{
\AssignTemplateKeys

 \bool_if:NF\l__diffcoeff_integ_bool
 {
 \int_compare:nNnT { \l__diffcoeff_format_int } > { 1 }
 { \__diffcoeff_slash_vals: }
 \__diffcoeff_build:nnn { #1 } { #2 } { #3 }
 }
+ \__diffcoeff_check_style:nn
+ { \l__diffcoeff_group_int } { \l__diffcoeff_style_int }
+ \__diffcoeff_append:n { #1 }
+ \exp_args:Nx \__diffcoeff_orders:nn { \clist_count:n {#4} } { #2 }
+ \__diffcoeff_override:N \l__diffcoeff_override_tl
+ \__diffcoeff_derivand:n { #3 }
+ \__diffcoeff_build:nn { #4 } { #5 }
}
%%%%%%%%%%
\cs_new:Npn \__diffcoeff_slash_vals:
 {
 \muskip_set:Nn \l__diffcoeff_varsep_muskip \l_tmpb_muskip
 \muskip_set:Nn \l__diffcoeff_elbowrm_muskip \l_tmpc_muskip
 \muskip_set:Nn \l__diffcoeff_subnudge_muskip \l_tmpd_muskip
 \tl_set:NV \l__diffcoeff_ldelim_tl \l__diffcoeff_ldelimi_tl
 \tl_set:NV \l__diffcoeff_rdelim_tl \l__diffcoeff_rdelimi_tl
 }
% #1 diff'and; #2 vars clist; #3 trailing arg
\cs_new:Npn \__diffcoeff_build:nnn #1#2#3
+\cs_new_protected:Npn \__diffcoeff_style:nn #1#2
{
 \tl_set:Nn \l__diffcoeff_derivand_tl { #1 }
 \seq_set_from_clist:Nn \l__diffcoeff_vars_seq { #2 }
 \bool_if:nT
 {
 !\l__diffcoeff_opwrap_bool &&
 \int_compare_p:nNn { \l__diffcoeff_format_int } > { 1 }
 }
 { \int_set:Nn \l__diffcoeff_format_int { 4 } }
 \__diffcoeff_spaced:n { \l__diffcoeff_spaced_int }
 \bool_if:nTF
 {
 ( \l__diffcoeff_altsep_bool && !\l__diffcoeff_spaced_bool )
  ( !\l__diffcoeff_altsep_bool && \l__diffcoeff_spaced_bool )
 }
 { \__diffcoeff_derivsep: }
 { \tl_put_left:Nn \l__diffcoeff_derivand_tl { \mskip 0 mu } }
 \tl_if_novalue:nF { #3 }
 { \l__diffcoeff_ldelim_tl \mskip \l__diffcoeff_elbowrm_muskip }
 \bool_if:NTF \l__diffcoeff_single_var_bool
+ \int_set:Nn \l__diffcoeff_style_int { #1 }
+ \tl_set:Nn \l__diffcoeff_frac_tl { \prg_do_nothing: }
+ \int_case:nn { #1 }
{
 \tl_set:Nx \l_tmpa_tl { \seq_use:Nn \l__diffcoeff_vars_seq { , } }
 \__diffcoeff_single:NNN \l__diffcoeff_tot_order_tl \l__diffcoeff_derivand_tl \l_tmpa_tl
 }
 {
 \int_zero:N \l_tmpa_int
 \seq_mapthread_function:NNN \l__diffcoeff_orders_seq
 \l__diffcoeff_vars_seq \__diffcoeff_map_orders:nn
 \__diffcoeff_mixed:NNN \l__diffcoeff_tot_order_tl
 \l__diffcoeff_derivand_tl \l__diffcoeff_denom_seq
 }
 \tl_if_novalue:nF { #3 }
 {
 \mskip \l__diffcoeff_elbowrm_muskip \l__diffcoeff_rdelim_tl
 \tl_if_empty:nF { #3 }
 {
 \c_math_subscript_token
 { \mskip \l__diffcoeff_subnudge_muskip { #3 } }
+ { 0 } { \tl_set:Nn \l__diffcoeff_frac_tl { \frac } }
+ { 1 } { \tl_set:Nn \l__diffcoeff_frac_tl { \tfrac } }
+ { 2 } { \tl_set:Nn \l__diffcoeff_frac_tl { \dfrac } }
+ { 3 } { \tl_set:Nn \l__diffcoeff_frac_tl { \difstfrac } }
+ { 4 } { \tl_set:Nn \l__diffcoeff_frac_tl { \difsafrac } }
+ { 5 } { \tl_set:Nn \l__diffcoeff_frac_tl { \difsbfrac[#2] } }
+ { 6 } { \tl_set:Nn \l__diffcoeff_frac_tl {} }
+ { 7 } { \bool_set_true:N \l__diffcoeff_dl_bool }
+ { 9 }
+ {
+ \msg_error:nnxx { diffcoeff } { unknownstyle }
+ { \l__diffcoeff_instance_tl }
+ { \__diffcoeff_style_group:n { \l__diffcoeff_group_int } }
}
}
}
%%%%%%%%%%%%%%%%%%%%
\cs_new_protected:Npn \__diffcoeff_spaced:n #1
 {
 \int_case:nn { \int_sign:n { #1 } }
 {
 { 1 } { \bool_set_true:N \l__diffcoeff_spaced_bool }
 { 0 } { \bool_set_false:N \l__diffcoeff_spaced_bool }
 { 1 }
 {
 \int_compare:nNnTF { 1 } <
 { \tl_count:N \l__diffcoeff_derivand_tl }
 { \bool_set_true:N \l__diffcoeff_spaced_bool }
 { \bool_set_false:N \l__diffcoeff_spaced_bool }
 }
 }
 }
\cs_new_protected:Npn \__diffcoeff_derivsep:
 {
 \tl_put_left:Nx \l__diffcoeff_derivand_tl
 {
 \int_case:nn { \l__diffcoeff_format_int }
 {
 { 0 } { \mskip \l__diffcoeff_derivsep_muskip }
 { 1 } { \mskip \l__diffcoeff_derivsepi_muskip }
 { 2 } { \mskip \l__diffcoeff_derivsepii_muskip }
 { 3 } { \mskip \l__diffcoeff_derivsepiii_muskip }
 { 4 } { \mskip \l__diffcoeff_derivsepiii_muskip }
 }
+% #1 group int; #2 style int
+\cs_new_protected:Npn \__diffcoeff_check_style:nn #1#2
+ {
+ \bool_if:nF
+ {
+ ( \int_compare_p:nNn { \int_div_truncate:nn {#2} {3} } = { #1 }
+ && \int_compare_p:nNn { #1 } < { 3 } ) % f,s,c
+  ( \int_compare_p:nNn { \int_div_truncate:nn {#2} {2} } < { #1 }
+ && \int_compare_p:nNn { #1 } = { 3 } ) % j
+  \int_compare_p:nNn { #1 + #2 } = { 11 } % l
}
 }
\cs_new:Npn \__diffcoeff_wrap_longvars_dv:nn #1#2
 { \l__diffcoeff_op_alt_tl { {}#2 }^{ #1 } }
\cs_new:Npn \__diffcoeff_wrap_longvars_dvi:nn #1#2
 { \l__diffcoeff_op_alt_tl { {}(#2) }^{ #1 } }
\cs_new:Npn \__diffcoeff_wrap_longvars_dvii:nn #1#2
 { (\l__diffcoeff_op_alt_tl { {}#2) }^{ #1 } }
% (ptl) form denom #1 from orders seq & #2 from 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 } } }
{
 \int_compare:nNnTF { \tl_count:n { #2 } } = { 1 }
+ \msg_warning:nnxx { diffcoeff } { wrongstyle }
+ { \l__diffcoeff_instance_tl }
+ { \__diffcoeff_style_group:n { #1 } }
+ \int_compare:nNnTF { #1 } = { 3 }
+ { \__diffcoeff_style:nn { 0 } {} }
{
 \seq_put_right:Nn \l__diffcoeff_denom_seq
 { \l__diffcoeff_op_alt_tl { #2 }^{ #1 } }
+ \int_compare:nNnTF { #1 } = { 4 }
+ { \__diffcoeff_style:nn { 7 } {} }
+ { \__diffcoeff_style:nn { 3*#1 } {} }
}
 {
 \seq_put_right:Nn \l__diffcoeff_denom_seq
 { \__diffcoeff_wrap_longvars:nn { #1\vphantom{)} } { #2 } }
 }
}
+ \bool_if:nT
+ { \int_compare_p:nNn { #1 } > { 0 } && \int_if_even_p:n { #1 } }
+ { \tl_set_eq:NN \l__diffcoeff_opii_tl \l__diffcoeff_opi_tl }
+ \int_compare:nNnF { #1 } = { 1 }
+ { \bool_set_false:N \l__diffcoeff_innerwrap_bool }
}
% #1 order(tlvar) ; #2 diff'iand(tlvar); #3 denom(tlvar)
\cs_new:Npn \__diffcoeff_single:NNN #1#2#3
 {
 \__diffcoeff_numer:N { #1 }
 \__diffcoeff_form_deriv:NNn
 \l__diffcoeff_oporder_tl
 \l__diffcoeff_derivand_tl
 { \__diffcoeff_denom_single:NN #1 #3 }
 }
% #1 total order; #2 derivand; #3 denom seq
\cs_new_protected:Npn \__diffcoeff_mixed:NNN #1#2#3
+\cs_new:Npn \__diffcoeff_style_group:n #1
+ { \clist_item:nn { frac, /, _, frac, dl } { #1 + 1 } }
+\cs_new:Npn \__diffcoeff_style_aux:n #1
{
 \__diffcoeff_numer:N #1
 \__diffcoeff_form_deriv:NNn
 \l__diffcoeff_oporder_tl
 \l__diffcoeff_derivand_tl
 { \__diffcoeff_denom_sep:N #3 }
+ \int_compare:nNnTF { #1 } = { 3 } { { 0 } {} }
+ {
+ \int_compare:nNnTF { #1 } = { 4 } { { 7 } {} }
+ { { 3*#1 } {} }
+ }
}
\cs_new:Npn \__diffcoeff_denom_sep:N #1
+%%%%%%%%% append? (& wrap slash diff operator?)
+\cs_new_protected:Npn \__diffcoeff_append: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 }
 { \mskip \l__diffcoeff_varsep_muskip }
 {
 \mskip \muskip_eval:n { \l__diffcoeff_varsep_muskip +
 \l__diffcoeff_sep_adj_muskip }
 }
 }
+ \bool_if:nTF
+ { #1  \int_compare_p:nNn { \l__diffcoeff_group_int } = {2} }
+ {
+ \bool_set_true:N \l__diffcoeff_append_bool
+ \bool_if:NT \l__diffcoeff_innerwrap_bool
+ { \tl_put_right:Nn \l__diffcoeff_frac_tl { * } }
}
+ { \bool_set_false:N \l__diffcoeff_append_bool }
}
% #1(tl) total order
\cs_new_protected:Npn \__diffcoeff_numer:N #1
 {
 \bool_if:NTF \l__diffcoeff_op_left_bool
+%%%%%%%%%
+% #1(int) no. of vars; #2(clist) orders spec
+\cs_new_protected:Npn \__diffcoeff_orders:nn #1#2
+ {
+ \bool_if:NTF \l__diffcoeff_exponent_bool
{
 \tl_set:Nn \l__diffcoeff_oporder_tl
 { \mskip \l__diffcoeff_opnudge_muskip }
+ \exp_args:NNx \seq_set_from_clist:Nn \l__diffcoeff_ords_seq
+ { \prg_replicate:nn { #1 } { \l__diffcoeff_exponent_tl, } }
}
 { \tl_clear:N \l__diffcoeff_oporder_tl }
 \tl_put_right:No \l__diffcoeff_oporder_tl \l__diffcoeff_op_tl
 \exp_args:NnV \tl_if_eq:nnF { 1 } #1
 {
 \tl_put_right:Nn \l__diffcoeff_oporder_tl
 { \mskip \l__diffcoeff_oporder_muskip ^ { #1 } }
 }
 \bool_if:NT \l__diffcoeff_op_left_bool
 { \tl_put_right:Nn \l__diffcoeff_oporder_tl { \hfill } }
 }
% #1 order; #2 var
\cs_new_protected:Npn \__diffcoeff_denom_single:NN #1#2
 {
 \tl_if_eq:nVTF { 1 } #1
 { \l__diffcoeff_op_alt_tl {}#2 }
{
 \int_compare:nNnTF { \tl_count:N #2 } = { 1 }
 { \l__diffcoeff_op_alt_tl {}#2^{ #1 } }
 { \__diffcoeff_wrap_longvars:nn { #1\vphantom) } { #2 } }
+ \seq_set_from_clist:Nn \l__diffcoeff_ords_seq { #2 }
+ \exp_args:Nnx\__diffcoeff_adj_ords_seq:nn { #1 }
+ { \seq_count:N \l__diffcoeff_ords_seq }
}
+ \tl_set:Nx \l__diffcoeff_vph_tl {\seq_use:Nn\l__diffcoeff_ords_seq {} }
}
% #1 op+order; #2 diff'iand; #3 denom
% 0 frac; 1 frac append; 2 slash ; 3 ( slash ) append; 4 slash append
\cs_new:Npn \__diffcoeff_form_deriv:NNn #1#2#3
+\cs_new_protected:Npn \__diffcoeff_adj_ords_seq:nn #1#2
{
 \int_case:nn { \l__diffcoeff_format_int }
 {
 { 0 } { \frac { #1 #2 } { #3 } }
 { 1 } { \frac { #1 } { #3 } #2 }
 { 2 } { #1 #2 / #3 }
 { 3 } { ( #1 / #3 ) #2 }
 { 4 } { #1 / #3 #2 }
+ \int_compare:nNnTF { #1 } < { #2 }
+ { % truncate
+ \int_step_inline:nn { #2  #1 }
+ { \seq_pop_right:NN \l__diffcoeff_ords_seq \l_tmpa_tl }
}
+ { % pad
+ \int_step_inline:nnnn { 1 + #2 } { 1 } { #1 }
+ { \seq_put_right:Nn \l__diffcoeff_ords_seq { 1 } }
+ }
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% differential
% #1 variant; #2 = space in mu before d (09)
% note \group_end placement for \vec{x} etc
\NewDocumentCommand \dl { d.. t m }
+\cs_new_protected:Npn \__diffcoeff_override:N #1
{
 \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 }
 \IfValueTF { #1 }
 { \tl_set:Nn \l__diffcoeff_type_tl { .#1 } }
 { \tl_set:Nn \l__diffcoeff_type_tl { } }
 \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 { #3 }
 { \mskip \IfBooleanT #2 {  }#3 mu \l__diffcoeff_op_tl \group_end: }
 { \l__diffcoeff_op_tl \group_end: {} #3 }
 }
\NewDocumentCommand \negmu {} { \mskip 1 mu }
\NewDocumentCommand \nilmu {} { \mskip 0 mu }
\NewDocumentCommand \onemu {} { \mskip 1 mu }
\NewDocumentCommand \twomu {} { \mskip 2 mu }
% derivative
% #1(tl) = name of variant; #2(*)= append diff'iand boolean
% #3(clist) = orders of diff. in each var.; #4(tl) = order override
% #5(bool) spacing switch; #6(tl) = diff'iand; #7( / ) = slash boolean
% #8(clist) = vars of diff.; #9(tl) = pt of eval./vars held const
\NewDocumentCommand \diff { d.. s O{1} o t! >{\TrimSpaces} m t/ m !o }
 {
 \group_begin:
 \IfBooleanTF #5
 { \bool_set_true:N \l__diffcoeff_altsep_bool }
 { \bool_set_false:N \l__diffcoeff_altsep_bool }
 \seq_set_from_clist:Nn \l__diffcoeff_orders_seq { #3 }
 \int_set:Nn \l_tmpb_int { \seq_count:N \l__diffcoeff_orders_seq }
 \int_set:Nn \l__diffcoeff_vars_int { \clist_count:n { #8 } }
 \int_compare:nNnTF { \l__diffcoeff_vars_int } = { 1 }
 { \bool_set_true:N \l__diffcoeff_single_var_bool }
 {
 \int_compare:nNnTF { \l__diffcoeff_vars_int } < { \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 { , } }
 { \clist_use:nn { #8 } { , } }
 }
 { % pad orders seq if nec.
 \int_step_inline:nnnn
 { 1 + \l_tmpb_int } { 1 } { \l__diffcoeff_vars_int }
 { \seq_put_right:Nn \l__diffcoeff_orders_seq { 1 } }
 }
 }
 % override/calc total order
 \IfValueTF { #4 }
 { \tl_set:Nn \l__diffcoeff_tot_order_tl { #4 } }
+ \tl_if_empty:NTF { #1 }
{
 \bool_if:NTF \l__diffcoeff_single_var_bool
 { \tl_set:Nn \l__diffcoeff_tot_order_tl { #3 } }
 {
 \__diffcoeff_calc_tot_order:NN \l__diffcoeff_orders_seq
 \l__diffcoeff_tot_order_tl
 }
+ \__diffcoeff_calc_tot_order:NN \l__diffcoeff_ords_seq
+ \l__diffcoeff_tot_ord_tl
}
 \IfValueTF { #1 }
 { \tl_set:Nn \l__diffcoeff_type_tl { .#1 } }
 { \tl_set:Nn \l__diffcoeff_type_tl { } }
 % append? slash?
 \int_zero:N \l__diffcoeff_format_int
 \IfBooleanT #2 { \int_incr:N \l__diffcoeff_format_int }
 \IfBooleanT #7 { \int_add:Nn \l__diffcoeff_format_int { 2 } }
 \UseInstance { derivative } { ord\l__diffcoeff_type_tl } {#6}{#8}{#9}
 \group_end:
 } % end of \diff
%%%%%%%%%%%%%%%%%%%
% #2(seq) expr in; #1(tlv) expr out
\cs_new:Npn \__diffcoeff_calc_tot_order:NN #1 #2
+ { \tl_set:Nn \l__diffcoeff_tot_ord_tl { #1 } }
+ \seq_pop_right:NN \l__diffcoeff_ords_seq \l__diffcoeff_ord_tl
+ }
+%%%%%%%%%% calc. total order %%%%%%%%%%
+% #1(seq) expr in; #2(tl) expr out
+\cs_new_protected:Npn \__diffcoeff_calc_tot_order:NN #1 #2
{
\tl_clear:N \l__diffcoeff_nos_tl
 \exp_args:Nx\__diffcoeff_digest_expr:n { \seq_use:Nn #1 { + } }
+ \exp_args:Nx \__diffcoeff_digest_expr:n { \seq_use:Nn #1 { + } }
\prop_if_empty:NTF \l__diffcoeff_vars_prop
{ \tl_set:NV #2 \l__diffcoeff_nos_tl }
 { \__diffcoeff_evaluate:NN \l__diffcoeff_vars_prop #2 }
+ {
+ \int_compare:nNnT { \l__diffcoeff_nos_int } = { 0 }
+ { \tl_clear:N \l__diffcoeff_nos_tl }
+ \__diffcoeff_evaluate:NN \l__diffcoeff_vars_prop #2
+ }
}
\cs_new:Npn \__diffcoeff_digest_expr:n #1
 {
+\cs_new_protected:Npn \__diffcoeff_digest_expr:n #1
+ {
\tl_set:Nn \l__diffcoeff_curr_num_tl { + }
\tl_set:Nn \l__diffcoeff_paren_tl { +1 }
\tl_set:Nn \l__diffcoeff_nos_tl { 0 }
@@ 419,13 +343,11 @@
}
\int_set:Nn \l__diffcoeff_nos_int { \l__diffcoeff_nos_tl }
\tl_set:Nx \l__diffcoeff_nos_tl { \int_use:N \l__diffcoeff_nos_int }
 \int_compare:nNnT { \l__diffcoeff_nos_int } = { 0 }
 { \tl_clear:N \l__diffcoeff_nos_tl }
}
% #1 curr tok (tl); #2 <== curr tok ndx (int)
\cs_new_protected:Npn \__diffcoeff_get_curr_ndx:nN #1#2
{
 \tl_if_in:NnTF \c__diffcoeff_digits_tl { #1 }
+ \tl_if_in:nnTF { 1234567890 } { #1 }
{ \int_set:Nn #2 { 1 } } % digit
{
\str_case:nnF { #1 }
@@ 461,7 +383,7 @@
{
{ 0 } % tok = s
{
 \tl_if_eq:nVTF { #1 } \l__diffcoeff_curr_num_tl
+ \str_if_eq:nVTF { #1 } \l__diffcoeff_curr_num_tl
{ \tl_set:Nn \l__diffcoeff_curr_num_tl { + } }
{ \tl_set:Nn \l__diffcoeff_curr_num_tl {  } }
}
@@ 497,11 +419,11 @@
{ 1 } % tok = d
{ \tl_put_right:Nn \l__diffcoeff_curr_num_tl { #1 } }
{ 2 } % tok = v
 {
 \tl_if_in:nnTF { ^ \times * / \div } { #1 }
 {
 \msg_error:nnxxx { diffcoeff } { orderspecification }
 { \seq_use:Nn \l__diffcoeff_orders_seq { , } }
+ {
+ \tl_if_in:nnTF { ^ \times * / } { #1 }
+ {
+ \msg_error:nnxxx { diffcoeff } { orderspecgeneral }
+ { \seq_use:Nn \l__diffcoeff_ords_seq { , } }
{ #1 } { number }
}
{ \tl_set:Nn \l__diffcoeff_curr_var_tl { #1 } }
@@ 511,7 +433,7 @@
\seq_push:NV \l__diffcoeff_paren_seq \l__diffcoeff_paren_tl
\tl_put_left:Nn \l__diffcoeff_paren_tl { * }
\tl_put_left:NV \l__diffcoeff_paren_tl \l__diffcoeff_curr_num_tl
 \tl_set:Nn \l__diffcoeff_curr_num_tl { + }
+ \tl_set:Nn \l__diffcoeff_curr_num_tl { + }
\int_set:Nn #3 { 0 }
}
{ 4 } % tok = )
@@ 584,8 +506,8 @@
\int_set_eq:NN #2 #3
}
{
 \msg_error:nnxxx { diffcoeff } { orderspecification }
 { \seq_use:Nn \l__diffcoeff_orders_seq { , } } { #1 } { ) }
+ \msg_error:nnxxx { diffcoeff } { orderspecgeneral }
+ { \seq_use:Nn \l__diffcoeff_ords_seq { , } } { #1 } { ) }
}
}
% #1 is var. (tlvar); #2 is num. (tlvar); #3 num. coeff. (tlvar)
@@ 598,7 +520,7 @@
}
% #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
{
@@ 610,15 +532,17 @@
\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_mapthread_function:NNN \l_tmpa_seq \l_tmpb_seq
 \__diffcoeff_tot_order:nn
+ \tl_set:Nx \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_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 }
@@ 630,116 +554,367 @@
\cs_new:Npn \__diffcoeff_tot_order:nn #1#2
{
\int_compare:nNnTF { #2 } > { 0 }
+ { \int_compare:nNnTF { #2 } = { 1 } { +#1 } { +#2#1 } }
+ {
+ \int_compare:nNnT { #2 } < { 0 }
+ { \int_compare:nNnTF { #2 } = { 1 } { #1 } { #2#1 } }
+ }
+ }
+%%%%%%%%% derivand
+\cs_new_protected:Npn \__diffcoeff_derivand:n #1
+ {
+ \tl_set:Nn \l__diffcoeff_derivand_tl { #1 }
+ \int_compare:nNnTF { \tl_count:N \l__diffcoeff_derivand_tl } > { 1 }
+ { \bool_set_true:N \l__diffcoeff_multitok_bool }
{
 \int_compare:nNnTF { #2 } = { 1 }
 { \tl_put_left:Nn \l_tmpa_tl { +#1 } }
 { \tl_put_left:Nn \l_tmpa_tl { +#2#1 } }
+ \str_if_eq:VnTF \l__diffcoeff_derivand_tl { ! }
+ { \msg_error:nnnn { diffcoeff } { versionconflict } { #1 } {} }
+ {
+ \str_if_eq:VnT \l__diffcoeff_derivand_tl { [ }
+ { \msg_error:nnnn { diffcoeff } { versionconflict } { the~
+ orderoverride~argument } { Use~\difoverride instead.~ } }
+ }
}
+ }
+%%%%%%%%% build #1 vars clist; #2 trailing arg
+\cs_new_protected:Npn \__diffcoeff_build:nn #1#2
+ {
+ \str_if_eq:nnT { #1 } { / }
+ {
+ \msg_error:nnnn { diffcoeff } { versionconflict } { / }
+ { Use~\difs or~\difsp instead.~ }
+ }
+ \seq_set_from_clist:Nn \l__diffcoeff_vars_seq { #1 }
+ \seq_pop_right:NN \l__diffcoeff_vars_seq \l__diffcoeff_var_tl
+ \tl_put_left:Nx \l__diffcoeff_derivand_tl
+ { \__diffcoeff_spaced:n { \l__diffcoeff_spaced_int } }
+ \tl_if_novalue:nF { #2 }
+ { \__diffcoeff_delim:N l \mskip \l__diffcoeff_elbowrm_tl }
+ \__diffcoeff_form_deriv:xNN
+ { \__diffcoeff_build_numer:Vn \l__diffcoeff_tot_ord_tl
+ { \l__diffcoeff_style_int } }
+ \__diffcoeff_build_denom:
+ \l__diffcoeff_derivand_tl
+ \tl_if_novalue:nF { #2 }
+ { \__diffcoeff_trailing_arg:n { #2 } }
+ }
+\cs_new:Npn \__diffcoeff_delim:N #1
+ {
+ \bool_if:nTF { \l__diffcoeff_innerwrap_bool && \l__diffcoeff_append_bool }
+ { \use:c { l__diffcoeff_#1 delimapp_tl } }
+ { \use:c { l__diffcoeff_#1 delim_tl } }
+ }
+\cs_new:Npn \__diffcoeff_subnudge:
+ {
+ \bool_if:nTF { \l__diffcoeff_innerwrap_bool && \l__diffcoeff_append_bool }
+ { \l__diffcoeff_subnudgeapp_tl } { \l__diffcoeff_subnudge_tl }
+ }
+\cs_new:Npn \__diffcoeff_trailing_arg:n #1
+ {
+ \mskip \l__diffcoeff_elbowrm_tl \__diffcoeff_delim:N r
+ \tl_if_empty:nF { #1 }
+ { \c_math_subscript_token { \mskip \__diffcoeff_subnudge: #1 } }
+ }
+\cs_new:Npn \__diffcoeff_spaced:n #1
+ {
+ \int_case:nn { \int_sign:n { #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 } }
+ { 1 } { \__diffcoeff_derivsep: }
+ { 0 } { \mskip 0 mu }
+ {1 }
+ {
+ \bool_lazy_or:nnT { \l__diffcoeff_multitok_bool }
+ { \int_compare_p:nNn { \l__diffcoeff_group_int } = { 2 } }
+ { \__diffcoeff_derivsep: }
}
+ }
+ }
+\cs_new:Npn \__diffcoeff_derivsep:
+ {
+ \bool_if:NTF \l__diffcoeff_append_bool
+ { \mskip \l__diffcoeff_derivsepi_tl }
+ { \mskip \l__diffcoeff_derivsep_tl }
+ }
+%%%%%%%%% numerator #1 total order tl #2 style int
+\cs_new:Npn \__diffcoeff_build_numer:nn #1#2
+ {
+ \int_compare:nNnF { #2 } > { 5 }
+ {
+ \bool_if:NT \l__diffcoeff_op_left_bool
+ { \mskip \l__diffcoeff_opleftnudge_tl }
+ \exp_not:o \l__diffcoeff_opi_tl
+ \str_if_eq:nnF {#1} {1}
+ { ^ { \mskip \l__diffcoeff_opordsep_tl \exp_not:o {#1} } }
+ \bool_if:NT \l__diffcoeff_op_left_bool
+ { \exp_not:o { \hfill } }
}
+ }
+\cs_generate_variant:Nn \__diffcoeff_build_numer:nn { V }
+%%%%%%%%%% denominator %%%%%%%%%
+\cs_new:Npn \__diffcoeff_build_denom:
+ {
+ \seq_mapthread_function:NNN \l__diffcoeff_ords_seq
+ \l__diffcoeff_vars_seq \__diffcoeff_build_denom_items:nn
+ \__diffcoeff_build_denom_item:VV \l__diffcoeff_ord_tl \l__diffcoeff_var_tl
+ \str_if_eq:VnF \l__diffcoeff_ord_tl { 1 }
+ {
+ \int_compare:nNnT { \l__diffcoeff_group_int } < { 2 }
+ { \mskip \l__diffcoeff_sep_adj_tl}
+ }
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% create new instances or edit existing ones
% #1 = name; #2 = keyvalue list
\NewDocumentCommand \diffdef { > { \TrimSpaces } m m }
+\cs_new:Npn \__diffcoeff_build_denom_items:nn#1#2
{
 \tl_if_empty:nTF { #1 }
+ \__diffcoeff_build_denom_item:nn {#1} {#2}
+ \mskip \l__diffcoeff_termsep_tl
+ }
+% #1 order #2 var
+\cs_new:Npn \__diffcoeff_build_denom_item:nn #1#2
+ {
+ \int_compare:nNnTF { \l__diffcoeff_style_int } = { 6 }
+ { \__diffcoeff_build_denom_difc:onn \l__diffcoeff_vph_tl {#1}{#2} }
+ { \__diffcoeff_build_denom_dif:nn {#1} {#2} }
+ }
+\cs_generate_variant:Nn \__diffcoeff_build_denom_item:nn { VV }
+% #1 vphantom orders #2 order #3 var
+\cs_new:Npn \__diffcoeff_build_denom_difc:nnn #1#2#3
+ {
+ \exp_not:o \l__diffcoeff_opii_tl \c_math_subscript_token
+ { \mskip \l__diffcoeff_opsubnudge_tl {}#3 } ^
+ {
+ \mskip \l__diffcoeff_opordsep_tl \exp_not:o { \vphantom{#1} }
+ \str_if_eq:nnF { #2 } { 1 }
+ { \exp_not:o {#2} \mskip \l__diffcoeff_sep_adj_tl }
+ }
+ }
+\cs_generate_variant:Nn \__diffcoeff_build_denom_difc:nnn { o }
+% #1 order #2 var
+\cs_new:Npn \__diffcoeff_build_denom_dif:nn #1#2
+ {
+ \str_if_eq:nnTF { #1 } { 1 }
+ { \exp_not:o { \l__diffcoeff_opii_tl #2 } }
{
 \EditTemplateDefaults { derivative }
 { DERIV } { #2 }
 \EditInstance { derivative } { ord } { #2 }
+ \int_compare:nNnTF { \tl_count:n { #2 } } = { 1 }
+ { \exp_not:o { \l__diffcoeff_opii_tl {}#2^
+ { \mskip \l__diffcoeff_varsupnudge_tl #1 } } }
+ { \__diffcoeff_wrap_longvars:nn { #1 } { #2 } }
+ \mskip \l__diffcoeff_sep_adj_tl
}
+ }
+\cs_new:Npn \__diffcoeff_wrap_longvars_dv:nn #1#2
+ { \exp_not:o { \l__diffcoeff_opii_tl {{}#2 }^
+ { \mskip \l__diffcoeff_varsupnudge_tl #1 } } }
+\cs_new:Npn \__diffcoeff_wrap_longvars_dvi:nn #1#2
+ {
+ \exp_not:o { \l__diffcoeff_opii_tl \l__diffcoeff_lvw_ldelim_tl #2
+ \l__diffcoeff_lvw_rdelim_tl^{ \mskip \l__diffcoeff_lvsupnudge_tl #1 } }
+ }
+\cs_new:Npn \__diffcoeff_wrap_longvars_dvii:nn #1#2
+ {
+ \exp_not:o { \l__diffcoeff_lvw_ldelim_tl \l__diffcoeff_opii_tl {}#2
+ \l__diffcoeff_lvw_rdelim_tl^{ \mskip \l__diffcoeff_lvsupnudge_tl #1 } }
+ }
+%%%%%%%%%%
+% #1 op+order; #2 denom; #3 diff'iand
+\cs_new:Npn \__diffcoeff_form_deriv:nNN #1#2#3
+ {
+ \bool_if:NTF \l__diffcoeff_append_bool
+ { \l__diffcoeff_frac_tl { #1 } { #2 } #3 }
+ { \l__diffcoeff_frac_tl { #1 #3 } { #2 } }
+ }
+\cs_generate_variant:Nn \__diffcoeff_form_deriv:nNN { x }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\file_get:nnNT { diffcoeff.DIF } {} \l_tmpa_tl
+ { \exp_args:Nnno \EditTemplateDefaults { diffcoeff } { DIF } \l_tmpa_tl }
+\exp_args:Nnno \EditTemplateDefaults { diffcoeff } { DIF }
+ \l__diffcoeff_dif_clist
+% Child template with some restricted, some new defaults.
+% #1 object type #2 parent template #3 child template
+% #4 restricted defaults (key=value) #5 new defaults (key=value)
+\NewDocumentCommand \DeclareChildTemplate { m m m m m }
+ {
+ \DeclareRestrictedTemplate {#1} {#2} {#3} {}
+ \EditTemplateDefaults {#1} {#3} {#5}
+ \DeclareRestrictedTemplate {#1} {#3} {#3} {#4}
+ }
+% create new, edit existing templates/instances;
+% #1 edit defaults with (no *) or without (*) inheritance;
+% #2 id: f,s,c,fp, sp, cp, j,l; #3 name; #4 keyvalue list
+\NewDocumentCommand \difdef { >{ \TrimSpaces } m >{ \TrimSpaces } m m }
+ {
+ \clist_map_inline:nn { #1 }
{
 \IfInstanceExistTF { derivative } { ord.#1 }
 { \EditInstance { derivative } { ord.#1 } { #2 } }
+ \tl_if_empty:nTF { #2 }
{
 \DeclareInstance { derivative } { ord.#1 }
 { DERIV } { #2 }
+ \DeclareChildTemplate { diffcoeff }
+ { DIF\str_uppercase:n {##1} } { DIF\str_uppercase:n {##1} }
+ { stylegroup = \use_i:nn ##1 \c_empty_tl } { #3 }
+ \DeclareInstance { diffcoeff } { dif##1 }
+ { DIF\str_uppercase:n {##1} } {}
}
+ {
+ \IfInstanceExistTF { diffcoeff } { dif##1.#2 }
+ { \EditInstance { diffcoeff } { dif##1.#2 } { #3 } }
+ { \exp_args:Nnnx
+ \DeclareInstance { diffcoeff } { dif##1.#2 }
+ { DIF\str_uppercase:n {##1} } { #3 }
+ }
+ }
}
}
% relic from version 1
\NewDocumentCommand \diffset { o }
 { \msg_warning:nn { diffcoeff } { obsolete } }

% ordinary & D
\DeclareInstance { derivative } { ord } { DERIV } { }
\bool_if:NTF \l__diffcoeff_ISO_bool
+\DeclareDocumentCommand \diffdef { m m }
+ {
+ \msg_error:nnnn { diffcoeff } { versionconflict } { \diffdef~(two~
+ arguments) } { Use~\difdef~(three~arguments)~instead.~ }
+ }
+\DeclareChildTemplate { diffcoeff } { DIF } { DIFF }
+ { stylegroup = f } {}
+\DeclareChildTemplate { diffcoeff } { DIFF } { DIFFP }
+ { stylegroup = f }
+ {
+ opsymbol = \partial,
+ opordernudge = 1 mu,
+ *italicnudge = 3 mu
+ }
+\DeclareChildTemplate { diffcoeff } { DIF } { DIFS }
+ { stylegroup = s }
{
 \diffdef { }
 {
 opsymbol = \mathrm{d},
 opordersep = 0 mu ,
 leftdelim = \left ( ,
 rightdelim = \right ) ,
 subscrnudge = 6 mu
 }
 \diffdef { D } { opsymbol = \mathrm{D} }
+ style = /,
+ derivandsep = 2 mu plus 1 mu minus 2 mu,
+ outerLdelim = (,
+ outerRdelim = ),
+ subnudge = 0 mu,
+ *innerwrap = true
}
 { \diffdef { D } { opsymbol = D } }

% partial
\diffdef { p }
+\DeclareChildTemplate { diffcoeff } { DIFS } { DIFSP }
+ { stylegroup = s }
{
 opsymbol = \partial ,
 leftdelim = \left ( ,
 rightdelim = \right ) ,
 subscrnudge = 6 mu
+ opsymbol = \partial,
+ opordernudge = 1 mu
}
\NewDocumentCommand \diffp {} { \diff.p. }
\NewDocumentCommand \dlp {} { \dl.p. }

% delta
\diffdef { delta }
 {
 opsymbol = \delta ,
 opordersep = 0 mu
+\DeclareChildTemplate { diffcoeff } { DIF } { DIFC }
+ { stylegroup = c }
+ {
+ style = _ ,
+ derivandsep = 1 mu plus 1 mu minus 1 mu ,
+ multitermsep = 1 mu ,
+ termsepadjust = 0 mu ,
+ outerLdelim = \bigl (,
+ outerRdelim = \bigr ),
+ subnudge = 2 mu
}
\diffdef { Delta }
+\DeclareChildTemplate { diffcoeff } { DIFC } { DIFCP }
+ { stylegroup = c }
+ {
+ opsymbol = \partial,
+ opordernudge = 1 mu
+ }
+\DeclareInstance { diffcoeff } { diff } { DIFF } {}
+\DeclareInstance { diffcoeff } { diffp } { DIFFP } {}
+\DeclareInstance { diffcoeff } { difs } { DIFS } {}
+\DeclareInstance { diffcoeff } { difsp } { DIFSP } {}
+\DeclareInstance { diffcoeff } { difc } { DIFC } {}
+\DeclareInstance { diffcoeff } { difcp } { DIFCP } {}
+% jacobian
+\DeclareChildTemplate { diffcoeff } { DIF } { DIFJ }
+ { stylegroup = j }
{
 opsymbol = \Delta ,
 opordersep = 0 mu
+ opsymbol = \partial,
+ outerLdelim = ,
+ outerRdelim =
}
% for compatibility with version 1
\NewDocumentCommand \Diff { } { \diff.D. }
\NewDocumentCommand \diffd { } { \diff.delta. }
\NewDocumentCommand \Diffd { } { \diff.Delta. }
+\DeclareInstance { diffcoeff } { difj } { DIFJ } {}
+% differential
+\DeclareChildTemplate { diffcoeff } { DIF } { DIFL }
+ { stylegroup = l }
+ {
+ style = dl ,
+ derivandsep = 0 mu,
+ longvarwrap = dv ,
+ outerLdelim = {\,},
+ outerRdelim =
+ }
+\DeclareInstance { diffcoeff } { difl } { DIFL } {}
% userdefined
\file_if_exist:nT { \g__diffcoeff_def_tl.def }
+\file_if_exist:nTF { \g__diffcoeff_def_tl.def }
{ \file_input:n { \g__diffcoeff_def_tl.def } }
%%%%%%%%%%%%%%%%%%%%
% Jacobian
\NewDocumentCommand \jacob { m t/ m }
 {
 \group_begin:
 \IfBooleanTF #2
 { \partial(#1) / \partial(#3) }
 { \frac{ \partial(#1) } { \partial(#3) } }
 \group_end:
+ {
+ \tl_if_empty:NF \g__diffcoeff_def_tl
+ { \msg_note:nnx { diffcoeff } { filenotfound }
+ { \g__diffcoeff_def_tl } }
}
%%%%%%%%%%%%%%%%%%%%
% messages
\msg_new:nnn { diffcoeff } { orderspecification }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\NewDocumentCommand \negmu {} { \mskip 1 mu }
+\NewDocumentCommand \nilmu {} { \mskip 0 mu }
+\NewDocumentCommand \onemu {} { \mskip 1 mu }
+\NewDocumentCommand \twomu {} { \mskip 2 mu }
+\NewDocumentCommand \difstfrac { s m m }
+ { \__diffcoeff_slashfracs:Nnnn #1 { #2 } { #3 } {} }
+\NewDocumentCommand \difsbfrac { o s m m }
+ { \__diffcoeff_slashfracs:Nnnn #2 { #3 } { #4 } { \use:c{#1} } }
+\NewDocumentCommand \difsafrac { s m m }
+ { \__diffcoeff_slashfracs:Nnnn #1 { \left. #2\vphantom{#3} }
+ { #3\right.} { \middle } }
+\cs_new:Npn \__diffcoeff_slashfracs:Nnnn #1#2#3#4
{
 #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.
+ \bool_if:NT #1 { \l__diffcoeff_lopwrap_tl }
+ #2 \mskip \l__diffcoeff_slashsep_tl
+ #4 \l__diffcoeff_slashtok_tl
+ \mskip \l__diffcoeff_slashsep_tl #3
+ \bool_if:NT #1 { \l__diffcoeff_ropwrap_tl }
}
\msg_new:nnn { diffcoeff } { obsolete }
 {
 Obsolete~command:~\diffset is~superseded~by~the~\diffdef\
 command.~\msg_see_documentation_text:n { diffcoeff }
+% derivatives
+% #1(tl) variant name; #2(*) append boolean; #3(*) switch #5#6 order;
+% #4(clist) diff. orders; #5(tl) = derivand; #6(clist) = diff. vars;
+% #7(tl) = pt of eval./vars held const
+\clist_map_inline:nn { f,s,c, fp, sp, cp }
+ {
+ \exp_args:Nc \NewDocumentCommand {dif#1}
+ { >{\TrimSpaces} D..{} s s O{1} >{\TrimSpaces} m m !o }
+ {
+ \IfBooleanTF ##3
+ { \__diffcoeff_inputs:nnnnnnn {#1}
+ {##1} {##2} {##4} {##6} {##5} {##7} }
+ { \__diffcoeff_inputs:nnnnnnn {#1}
+ {##1} {##2} {##4} {##5} {##6} {##7} }
+ }
}
\msg_new:nnn { diffcoeff } { numbersconflict }
+\cs_new_protected:Npn \__diffcoeff_inputs:nnnnnnn #1#2#3#4#5#6#7
{
 #2~orders~of~differentiation~specified~for~#1~variables;~
 orders~[#3]\ (\msg_line_context:)~for~variables~#4.
+ \group_begin:
+ \tl_set:Nx \l__diffcoeff_instance_tl
+ { dif#1 \tl_if_empty:nF { #2 } { .#2 } }
+ \UseInstance { diffcoeff } { \l__diffcoeff_instance_tl }
+ {#3} {#4} {#5} {#6} {#7}
+ \group_end:
}
+\NewDocumentCommand \difoverride { >{\TrimSpaces} m }
+ { \tl_set:Nn \l__diffcoeff_override_tl { #1 } }
+% Jacobian
+\NewDocumentCommand \jacob { >{\TrimSpaces} D..{} m m }
+ {
+ \group_begin:
+ \int_zero:N \l__diffcoeff_spaced_int
+ \tl_set:Nx \l__diffcoeff_instance_tl
+ { difj \tl_if_empty:nF { #1 } { .#1 } }
+ \UseInstance { diffcoeff } { \l__diffcoeff_instance_tl }
+ { \c_false_bool } {}
+ { \l__diffcoeff_lvw_ldelim_tl #2 \l__diffcoeff_lvw_rdelim_tl }
+ { {\l__diffcoeff_lvw_ldelim_tl #3\l__diffcoeff_lvw_rdelim_tl } } {}
+ \group_end:
+ }
+% differential; #1 variant ; #2 ord(s); #3 vars; #4 exponent
+\NewDocumentCommand \dl { >{ \TrimSpaces } D..{} O{1} m e{^} }
+ {
+ \group_begin:
+ \tl_set:Nx \l__diffcoeff_instance_tl
+ { difl \tl_if_empty:nF { #1 } { .#1 } }
+ \difoverride {}
+ \tl_set:Nn \l__diffcoeff_exponent_tl { #4 }
+ \tl_if_novalue:nTF {#4}
+ { \bool_set_false:N \l__diffcoeff_exponent_bool }
+ { \bool_set_true:N \l__diffcoeff_exponent_bool }
+ \UseInstance { diffcoeff } { \l__diffcoeff_instance_tl }
+ {\c_false_bool} {#2} {} {#3} {}
+ \group_end:
+ }
% end of file diffcoeff.sty
\ No newline at end of file
Added: trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff4.sty
===================================================================
 trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff4.sty (rev 0)
+++ trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff4.sty 20230111 20:44:28 UTC (rev 65523)
@@ 0,0 +1,744 @@
+% This is file `diffcoeff4.sty'.
+%
+% This work may be distributed and/or modified under the conditions
+% of the LaTeX Project Public License, either version 1.3c
+% (20080504) of this license or any later version; see
+% http://www.latexproject.org/lppl.txt
+%
+% Andrew Parsloe ajparsloe at gmail.com
+%
+\RequirePackage{expl3}
+\RequirePackage{xparse,l3keys2e,xtemplate}
+\ProvidesExplPackage {diffcoeff4} {2022/07/30} {4.2}
+ {Write differential coefficients easily and consistently.}
+%
+\keys_define:nn { diffcoeff4 }
+ {
+ ISO .bool_set:N = \l__diffcoeff_ISO_bool,
+ spaced .int_set:N = \l__diffcoeff_spaced_int,
+ spaced .default:n = 1,
+ spaced .initial:n = 0,
+ deffile .tl_gset:N = \g__diffcoeff_def_tl,
+ deffile .initial:n = diffcoeff,
+ deffile .default:n = diffcoeff
+ }
+\ProcessKeysPackageOptions { diffcoeff4 }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\cs_generate_variant:Nn \tl_if_eq:nnTF { nV }
+
+\tl_new:N \l__diffcoeff_oporder_tl
+\tl_new:N \l__diffcoeff_derivand_tl
+\tl_new:N \l__diffcoeff_type_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
+\tl_new:N \l__diffcoeff_paren_tl
+
+\tl_const:Nn \c__diffcoeff_digits_tl { 1234567890 }
+
+\seq_new:N \l__diffcoeff_orders_seq
+\seq_new:N \l__diffcoeff_vars_seq
+\seq_new:N \l__diffcoeff_denom_seq
+\seq_new:N \l__diffcoeff_paren_seq
+
+\prop_new:N \l__diffcoeff_vars_prop
+
+\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
+\bool_new:N \l__diffcoeff_spaced_bool
+\bool_new:N \l__diffcoeff_altsep_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
+\int_new:N \l__diffcoeff_nos_int
+\int_new:N \l__diffcoeff_parenvar_int
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\DeclareObjectType { derivative } { 3 }
+
+% defaults: ordinary deriv. values
+\DeclareTemplateInterface { derivative } { DERIV } { 3 }
+ {
+ opsymbol : tokenlist = d ,
+ opsymbolalt : tokenlist = \KeyValue { opsymbol },
+ opordersep : muskip = 1 mu ,
+ derivandsep : muskip = 3 mu plus 1 mu minus 2 mu,
+ longvarwrap : choice { dv, d(v), (dv) }
+ = d(v) ,
+ denomtermsep : muskip = 2 mu ,
+ termsepadjust : muskip = 1 mu ,
+ leftdelim : tokenlist = \left . ,
+ rightdelim : tokenlist = \right ,
+ elbowroom : muskip = 0 mu ,
+ subscrnudge : muskip = 0 mu ,
+ *derivandsep : muskip = \KeyValue { derivandsep },
+ *opleft : boolean = false ,
+ *italicnudge : muskip = 3 mu ,
+ /derivandsep : muskip = \KeyValue { derivandsep },
+ /denomtermsep : muskip = 1 mu ,
+ /leftdelim : tokenlist = ( ,
+ /rightdelim : tokenlist = ) ,
+ /elbowroom : muskip = 0 mu ,
+ /subscrnudge : muskip = 0 mu ,
+ */derivandsep : muskip = \KeyValue { /derivandsep },
+ */opwrap : boolean = true
+ }
+% #1 order spec(seqvar); #2 order override(tlvar)
+% #3 derivand(tlvar); #4 denominator(seqvar)
+% #5 subscript(tlvar)
+\DeclareTemplateCode { derivative } { DERIV } { 3 }
+ {
+ opsymbol = \l__diffcoeff_op_tl,
+ opsymbolalt = \l__diffcoeff_op_alt_tl,
+ opordersep = \l__diffcoeff_oporder_muskip,
+ derivandsep = \l__diffcoeff_derivsep_muskip,
+ longvarwrap = {
+ dv = \cs_set_eq:NN \__diffcoeff_wrap_longvars:nn
+ \__diffcoeff_wrap_longvars_dv:nn,
+ d(v) = \cs_set_eq:NN \__diffcoeff_wrap_longvars:nn
+ \__diffcoeff_wrap_longvars_dvi:nn,
+ (dv) = \cs_set_eq:NN \__diffcoeff_wrap_longvars:nn
+ \__diffcoeff_wrap_longvars_dvii:nn,
+ unknown = \cs_set_eq:NN \__diffcoeff_wrap_longvars:nn
+ \__diffcoeff_wrap_longvars_dvi:nn
+ },
+ denomtermsep = \l__diffcoeff_varsep_muskip,
+ termsepadjust = \l__diffcoeff_sep_adj_muskip,
+ leftdelim = \l__diffcoeff_ldelim_tl,
+ rightdelim = \l__diffcoeff_rdelim_tl,
+ elbowroom = \l__diffcoeff_elbowrm_muskip ,
+ subscrnudge = \l__diffcoeff_subnudge_muskip,
+ *derivandsep = \l__diffcoeff_derivsepi_muskip,
+ *opleft = \l__diffcoeff_op_left_bool,
+ *italicnudge = \l__diffcoeff_opnudge_muskip,
+ /derivandsep = \l__diffcoeff_derivsepii_muskip,
+ /denomtermsep = \l_tmpb_muskip,
+ /leftdelim = \l__diffcoeff_ldelimi_tl,
+ /rightdelim = \l__diffcoeff_rdelimi_tl,
+ /elbowroom = \l_tmpc_muskip,
+ /subscrnudge = \l_tmpd_muskip,
+ */derivandsep = \l__diffcoeff_derivsepiii_muskip,
+ */opwrap = \l__diffcoeff_opwrap_bool
+ }
+ {
+ \AssignTemplateKeys
+
+ \bool_if:NF\l__diffcoeff_integ_bool
+ {
+ \int_compare:nNnT { \l__diffcoeff_format_int } > { 1 }
+ { \__diffcoeff_slash_vals: }
+ \__diffcoeff_build:nnn { #1 } { #2 } { #3 }
+ }
+ }
+%%%%%%%%%%
+\cs_new:Npn \__diffcoeff_slash_vals:
+ {
+ \muskip_set:Nn \l__diffcoeff_varsep_muskip \l_tmpb_muskip
+ \muskip_set:Nn \l__diffcoeff_elbowrm_muskip \l_tmpc_muskip
+ \muskip_set:Nn \l__diffcoeff_subnudge_muskip \l_tmpd_muskip
+ \tl_set:NV \l__diffcoeff_ldelim_tl \l__diffcoeff_ldelimi_tl
+ \tl_set:NV \l__diffcoeff_rdelim_tl \l__diffcoeff_rdelimi_tl
+ }
+% #1 diff'and; #2 vars clist; #3 trailing arg
+\cs_new:Npn \__diffcoeff_build:nnn #1#2#3
+ {
+ \tl_set:Nn \l__diffcoeff_derivand_tl { #1 }
+ \seq_set_from_clist:Nn \l__diffcoeff_vars_seq { #2 }
+ \bool_if:nT
+ {
+ !\l__diffcoeff_opwrap_bool &&
+ \int_compare_p:nNn { \l__diffcoeff_format_int } > { 1 }
+ }
+ { \int_set:Nn \l__diffcoeff_format_int { 4 } }
+ \__diffcoeff_spaced:n { \l__diffcoeff_spaced_int }
+ \bool_if:nTF
+ {
+ ( \l__diffcoeff_altsep_bool && !\l__diffcoeff_spaced_bool )
+  ( !\l__diffcoeff_altsep_bool && \l__diffcoeff_spaced_bool )
+ }
+ { \__diffcoeff_derivsep: }
+ { \tl_put_left:Nn \l__diffcoeff_derivand_tl { \mskip 0 mu } }
+ \tl_if_novalue:nF { #3 }
+ { \l__diffcoeff_ldelim_tl \mskip \l__diffcoeff_elbowrm_muskip }
+ \bool_if:NTF \l__diffcoeff_single_var_bool
+ {
+ \tl_set:Nx \l_tmpa_tl { \seq_use:Nn \l__diffcoeff_vars_seq { , } }
+ \__diffcoeff_single:NNN \l__diffcoeff_tot_order_tl \l__diffcoeff_derivand_tl \l_tmpa_tl
+ }
+ {
+ \int_zero:N \l_tmpa_int
+ \seq_mapthread_function:NNN \l__diffcoeff_orders_seq
+ \l__diffcoeff_vars_seq \__diffcoeff_map_orders:nn
+ \__diffcoeff_mixed:NNN \l__diffcoeff_tot_order_tl
+ \l__diffcoeff_derivand_tl \l__diffcoeff_denom_seq
+ }
+ \tl_if_novalue:nF { #3 }
+ {
+ \mskip \l__diffcoeff_elbowrm_muskip \l__diffcoeff_rdelim_tl
+ \tl_if_empty:nF { #3 }
+ {
+ \c_math_subscript_token
+ { \mskip \l__diffcoeff_subnudge_muskip { #3 } }
+ }
+ }
+ }
+%%%%%%%%%%%%%%%%%%%%
+\cs_new_protected:Npn \__diffcoeff_spaced:n #1
+ {
+ \int_case:nn { \int_sign:n { #1 } }
+ {
+ { 1 } { \bool_set_true:N \l__diffcoeff_spaced_bool }
+ { 0 } { \bool_set_false:N \l__diffcoeff_spaced_bool }
+ { 1 }
+ {
+ \int_compare:nNnTF { 1 } <
+ { \tl_count:N \l__diffcoeff_derivand_tl }
+ { \bool_set_true:N \l__diffcoeff_spaced_bool }
+ { \bool_set_false:N \l__diffcoeff_spaced_bool }
+ }
+ }
+ }
+\cs_new_protected:Npn \__diffcoeff_derivsep:
+ {
+ \tl_put_left:Nx \l__diffcoeff_derivand_tl
+ {
+ \int_case:nn { \l__diffcoeff_format_int }
+ {
+ { 0 } { \mskip \l__diffcoeff_derivsep_muskip }
+ { 1 } { \mskip \l__diffcoeff_derivsepi_muskip }
+ { 2 } { \mskip \l__diffcoeff_derivsepii_muskip }
+ { 3 } { \mskip \l__diffcoeff_derivsepiii_muskip }
+ { 4 } { \mskip \l__diffcoeff_derivsepiii_muskip }
+ }
+ }
+ }
+\cs_new:Npn \__diffcoeff_wrap_longvars_dv:nn #1#2
+ { \l__diffcoeff_op_alt_tl { {}#2 }^{ #1 } }
+\cs_new:Npn \__diffcoeff_wrap_longvars_dvi:nn #1#2
+ { \l__diffcoeff_op_alt_tl { {}(#2) }^{ #1 } }
+\cs_new:Npn \__diffcoeff_wrap_longvars_dvii:nn #1#2
+ { (\l__diffcoeff_op_alt_tl { {}#2) }^{ #1 } }
+% (ptl) form denom #1 from orders seq & #2 from 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 } } }
+ {
+ \int_compare:nNnTF { \tl_count:n { #2 } } = { 1 }
+ {
+ \seq_put_right:Nn \l__diffcoeff_denom_seq
+ { \l__diffcoeff_op_alt_tl { #2 }^{ #1 } }
+ }
+ {
+ \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)
+\cs_new:Npn \__diffcoeff_single:NNN #1#2#3
+ {
+ \__diffcoeff_numer:N { #1 }
+ \__diffcoeff_form_deriv:NNn
+ \l__diffcoeff_oporder_tl
+ \l__diffcoeff_derivand_tl
+ { \__diffcoeff_denom_single:NN #1 #3 }
+ }
+% #1 total order; #2 derivand; #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_derivand_tl
+ { \__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 }
+ { \mskip \l__diffcoeff_varsep_muskip }
+ {
+ \mskip \muskip_eval:n { \l__diffcoeff_varsep_muskip +
+ \l__diffcoeff_sep_adj_muskip }
+ }
+ }
+ }
+ }
+% #1(tl) total order
+\cs_new_protected:Npn \__diffcoeff_numer:N #1
+ {
+ \bool_if:NTF \l__diffcoeff_op_left_bool
+ {
+ \tl_set:Nn \l__diffcoeff_oporder_tl
+ { \mskip \l__diffcoeff_opnudge_muskip }
+ }
+ { \tl_clear:N \l__diffcoeff_oporder_tl }
+ \tl_put_right:No \l__diffcoeff_oporder_tl \l__diffcoeff_op_tl
+ \exp_args:NnV \tl_if_eq:nnF { 1 } #1
+ {
+ \tl_put_right:Nn \l__diffcoeff_oporder_tl
+ { \mskip \l__diffcoeff_oporder_muskip ^ { #1 } }
+ }
+ \bool_if:NT \l__diffcoeff_op_left_bool
+ { \tl_put_right:Nn \l__diffcoeff_oporder_tl { \hfill } }
+ }
+% #1 order; #2 var
+\cs_new_protected:Npn \__diffcoeff_denom_single:NN #1#2
+ {
+ \tl_if_eq:nVTF { 1 } #1
+ { \l__diffcoeff_op_alt_tl {}#2 }
+ {
+ \int_compare:nNnTF { \tl_count:N #2 } = { 1 }
+ { \l__diffcoeff_op_alt_tl {}#2^{ #1 } }
+ { \__diffcoeff_wrap_longvars:nn { #1\vphantom) } { #2 } }
+ }
+ }
+% #1 op+order; #2 diff'iand; #3 denom
+% 0 frac; 1 frac append; 2 slash ; 3 ( slash ) append; 4 slash append
+\cs_new:Npn \__diffcoeff_form_deriv:NNn #1#2#3
+ {
+ \int_case:nn { \l__diffcoeff_format_int }
+ {
+ { 0 } { \frac { #1 #2 } { #3 } }
+ { 1 } { \frac { #1 } { #3 } #2 }
+ { 2 } { #1 #2 / #3 }
+ { 3 } { ( #1 / #3 ) #2 }
+ { 4 } { #1 / #3 #2 }
+ }
+ }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% differential
+% #1 variant; #2 = space in mu before d (09)
+% note \group_end placement for \vec{x} etc
+\NewDocumentCommand \dl { d.. t m }
+ {
+ \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 }
+ \IfValueTF { #1 }
+ { \tl_set:Nn \l__diffcoeff_type_tl { .#1 } }
+ { \tl_set:Nn \l__diffcoeff_type_tl { } }
+ \UseInstance { derivative } { ord\l__diffcoeff_type_tl }
+ \c_empty_tl \c_empty_seq \c_empty_tl
+ \tl_if_in:NnTF \c__diffcoeff_digits_tl { #3 }
+ { \mskip \IfBooleanT #2 {  }#3 mu \l__diffcoeff_op_tl \group_end: }
+ { \l__diffcoeff_op_tl \group_end: {} #3 }
+ }
+\NewDocumentCommand \negmu {} { \mskip 1 mu }
+\NewDocumentCommand \nilmu {} { \mskip 0 mu }
+\NewDocumentCommand \onemu {} { \mskip 1 mu }
+\NewDocumentCommand \twomu {} { \mskip 2 mu }
+% derivative
+% #1(tl) = name of variant; #2(*)= append diff'iand boolean
+% #3(clist) = orders of diff. in each var.; #4(tl) = order override
+% #5(bool) spacing switch; #6(tl) = diff'iand; #7( / ) = slash boolean
+% #8(clist) = vars of diff.; #9(tl) = pt of eval./vars held const
+\NewDocumentCommand \diff { d.. s O{1} o t! >{\TrimSpaces} m t/ m !o }
+ {
+ \group_begin:
+ \IfBooleanTF #5
+ { \bool_set_true:N \l__diffcoeff_altsep_bool }
+ { \bool_set_false:N \l__diffcoeff_altsep_bool }
+ \seq_set_from_clist:Nn \l__diffcoeff_orders_seq { #3 }
+ \int_set:Nn \l_tmpb_int { \seq_count:N \l__diffcoeff_orders_seq }
+ \int_set:Nn \l__diffcoeff_vars_int { \clist_count:n { #8 } }
+ \int_compare:nNnTF { \l__diffcoeff_vars_int } = { 1 }
+ { \bool_set_true:N \l__diffcoeff_single_var_bool }
+ {
+ \int_compare:nNnTF { \l__diffcoeff_vars_int } < { \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 { , } }
+ { \clist_use:nn { #8 } { , } }
+ }
+ { % pad orders seq if nec.
+ \int_step_inline:nnnn
+ { 1 + \l_tmpb_int } { 1 } { \l__diffcoeff_vars_int }
+ { \seq_put_right:Nn \l__diffcoeff_orders_seq { 1 } }
+ }
+ }
+ % override/calc total order
+ \IfValueTF { #4 }
+ { \tl_set:Nn \l__diffcoeff_tot_order_tl { #4 } }
+ {
+ \bool_if:NTF \l__diffcoeff_single_var_bool
+ { \tl_set:Nn \l__diffcoeff_tot_order_tl { #3 } }
+ {
+ \__diffcoeff_calc_tot_order:NN \l__diffcoeff_orders_seq
+ \l__diffcoeff_tot_order_tl
+ }
+ }
+ \IfValueTF { #1 }
+ { \tl_set:Nn \l__diffcoeff_type_tl { .#1 } }
+ { \tl_set:Nn \l__diffcoeff_type_tl { } }
+ % append? slash?
+ \int_zero:N \l__diffcoeff_format_int
+ \IfBooleanT #2 { \int_incr:N \l__diffcoeff_format_int }
+ \IfBooleanT #7 { \int_add:Nn \l__diffcoeff_format_int { 2 } }
+ \UseInstance { derivative } { ord\l__diffcoeff_type_tl } {#6}{#8}{#9}
+ \group_end:
+ } % end of \diff
+%%%%%%%%%%%%%%%%%%%
+% #2(seq) expr in; #1(tlv) expr out
+\cs_new:Npn \__diffcoeff_calc_tot_order:NN #1 #2
+ {
+ \tl_clear:N \l__diffcoeff_nos_tl
+ \exp_args:Nx\__diffcoeff_digest_expr:n { \seq_use:Nn #1 { + } }
+ \prop_if_empty:NTF \l__diffcoeff_vars_prop
+ { \tl_set:NV #2 \l__diffcoeff_nos_tl }
+ { \__diffcoeff_evaluate:NN \l__diffcoeff_vars_prop #2 }
+ }
+\cs_new:Npn \__diffcoeff_digest_expr:n #1
+ {
+ \tl_set:Nn \l__diffcoeff_curr_num_tl { + }
+ \tl_set:Nn \l__diffcoeff_paren_tl { +1 }
+ \tl_set:Nn \l__diffcoeff_nos_tl { 0 }
+ \int_zero:N \l__diffcoeff_curr_state_int
+ \int_zero:N \l__diffcoeff_curr_tok_int
+ \tl_map_inline:nn { #1+ }
+ {
+ \__diffcoeff_get_curr_ndx:nN { ##1 } \l__diffcoeff_curr_tok_int
+ \__diffcoeff_transitions:nNN { ##1 }
+ \l__diffcoeff_curr_state_int \l__diffcoeff_curr_tok_int
+ }
+ \int_set:Nn \l__diffcoeff_nos_int { \l__diffcoeff_nos_tl }
+ \tl_set:Nx \l__diffcoeff_nos_tl { \int_use:N \l__diffcoeff_nos_int }
+ \int_compare:nNnT { \l__diffcoeff_nos_int } = { 0 }
+ { \tl_clear:N \l__diffcoeff_nos_tl }
+ }
+% #1 curr tok (tl); #2 <== curr tok ndx (int)
+\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
+ {
+ \str_case:nnF { #1 }
+ {
+ { + } { \int_set:Nn #2 { 0 } }
+ {  } { \int_set:Nn #2 { 0 } }
+ { ( } { \int_set:Nn #2 { 3 } }
+ { ) } { \int_set:Nn #2 { 4 } }
+ }
+ { \int_set:Nn #2 { 2 } } % var
+ }
+ }
+% #1(tl) curr tok; #2(int) curr state; #3(int) curr tok ndx
+\cs_new:Npn \__diffcoeff_transitions:nNN #1#2#3
+ {
+ \int_case:nn { #2 }
+ {
+ { 0 } % sgn + 
+ { \__diffcoeff_sgn_transitions:nNN { #1 }#2#3 }
+ { 1 } % num
+ { \__diffcoeff_num_transitions:nNN { #1 }#2#3 }
+ { 2 } % alg
+ { \__diffcoeff_alg_transitions:nNN { #1 }#2#3 }
+ { 4 } % )
+ { \__diffcoeff_rpar_transitions:nNN { #1 }#2#3 }
+ }
+ }
+% transitions from the signed state
+% #1(tl) curr tok; #2(int) 0, curr state; #3 curr tok ndx
+\cs_new_protected:Npn \__diffcoeff_sgn_transitions:nNN #1#2#3
+ {
+ \int_case:nnT { #3 }
+ {
+ { 0 } % tok = s
+ {
+ \tl_if_eq:nVTF { #1 } \l__diffcoeff_curr_num_tl
+ { \tl_set:Nn \l__diffcoeff_curr_num_tl { + } }
+ { \tl_set:Nn \l__diffcoeff_curr_num_tl {  } }
+ }
+ { 1 } % tok = d
+ { \tl_put_right:Nn \l__diffcoeff_curr_num_tl { #1 } }
+ { 2 } % tok = v
+ {
+ \tl_put_right:Nn \l__diffcoeff_curr_num_tl { 1 }
+ \tl_set:Nn \l__diffcoeff_curr_var_tl { #1 }
+ }
+ { 3 } % tok = (
+ {
+ \seq_push:NV \l__diffcoeff_paren_seq \l__diffcoeff_paren_tl
+ \tl_put_left:NV \l__diffcoeff_paren_tl \l__diffcoeff_curr_num_tl
+ \tl_set:Nn \l__diffcoeff_curr_num_tl { + }
+ \int_set:Nn #3 { 0 }
+ }
+ }
+ { \int_set_eq:NN #2 #3 }
+ }
+% transitions from the numeric state
+% #1 = curr. tok.; #2 = 0, curr. state; #3 curr. tok. index
+\cs_new_protected:Npn \__diffcoeff_num_transitions:nNN #1#2#3
+ {
+ \int_case:nnT { #3 }
+ {
+ { 0 } % tok = s
+ {
+ \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_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
+ \tl_put_left:Nn \l__diffcoeff_paren_tl { * }
+ \tl_put_left:NV \l__diffcoeff_paren_tl \l__diffcoeff_curr_num_tl
+ \tl_set:Nn \l__diffcoeff_curr_num_tl { + }
+ \int_set:Nn #3 { 0 }
+ }
+ { 4 } % tok = )
+ {
+ \tl_put_right:NV \l__diffcoeff_nos_tl
+ { \l__diffcoeff_paren_tl * \l__diffcoeff_curr_num_tl }
+ }
+ }
+ {
+ \int_set_eq:NN #2 #3 }
+ }
+% 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:nnT { #3 }
+ {
+ { 0 } % tok = s
+ {
+ \int_compare:nNnTF { \l__diffcoeff_parenvar_int } = { 0 }
+ {
+ \__diffcoeff_store_var:NNN \l__diffcoeff_curr_var_tl
+ \l__diffcoeff_paren_tl \l__diffcoeff_curr_num_tl
+ \tl_clear:N \l__diffcoeff_curr_var_tl
+ \tl_set:Nn \l__diffcoeff_curr_num_tl { #1 }
+ }
+ {
+ \tl_put_right:Nn \l__diffcoeff_curr_var_tl { #1 }
+ \int_set:Nn #3 { 2 }
+ }
+ }
+ { 1 } % tok = d
+ {
+ \tl_put_right:Nn \l__diffcoeff_curr_var_tl { #1 }
+ \int_set:Nn #3 { 2 }
+ }
+ { 2 } % tok = v
+ { \tl_put_right:Nn \l__diffcoeff_curr_var_tl { #1 } }
+ { 3 } % tok = (
+ {
+ \tl_put_right:Nn \l__diffcoeff_curr_var_tl { #1 }
+ \int_set:Nn #3 { 2 }
+ \int_incr:N \l__diffcoeff_parenvar_int
+ }
+ { 4 } % tok = )
+ {
+ \int_compare:nNnTF { \l__diffcoeff_parenvar_int } = { 0 }
+ {
+ \__diffcoeff_store_var:NNN \l__diffcoeff_curr_var_tl
+ \l__diffcoeff_paren_tl \l__diffcoeff_curr_num_tl
+ \tl_clear:N \l__diffcoeff_curr_var_tl
+ }
+ {
+ \tl_put_right:Nn \l__diffcoeff_curr_var_tl { #1 }
+ \int_set:Nn #3 { 2 }
+ \int_decr:N \l__diffcoeff_parenvar_int
+ }
+ }
+ }
+ { \int_set_eq:NN #2 #3 }
+ }
+% transitions from the ) state
+% #1 = curr. tok.; #2 = 4, curr. state; #3 curr. tok. index
+\cs_new:Npn \__diffcoeff_rpar_transitions:nNN #1#2#3
+ {
+ \int_compare:nNnTF { \int_mod:nn { #3 } { 4} } = { 0 }
+ {
+ \tl_set:Nn \l__diffcoeff_curr_num_tl { #1 }
+ \seq_pop:NN \l__diffcoeff_paren_seq \l__diffcoeff_paren_tl
+ \int_set_eq:NN #2 #3
+ }
+ {
+ \msg_error:nnxxx { diffcoeff } { orderspecification }
+ { \seq_use:Nn \l__diffcoeff_orders_seq { , } } { #1 } { ) }
+ }
+ }
+% #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 }
+ \tl_put_right:NV \l_tmpa_tl { #2 * #3 }
+ \prop_put:NVV \l__diffcoeff_vars_prop #1 \l_tmpa_tl
+ }
+% #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:n { ##1 } } < { \tl_count:n { ##2 } }
+ { \sort_return_same: } { \sort_return_swapped: }
+ }
+ \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_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_concat:NNN #2 \l_tmpb_tl \l__diffcoeff_nos_tl
+ }
+ {
+ \int_compare:nNnTF { \l__diffcoeff_nos_int } > { 0 }
+ { \tl_concat:NNN #2 \l__diffcoeff_nos_tl \l_tmpa_tl }
+ { \tl_concat:NNN #2 \l_tmpa_tl \l__diffcoeff_nos_tl }
+ }
+ \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 \l__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. }
+\NewDocumentCommand \dlp {} { \dl.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 }
+ {
+ \group_begin:
+ \IfBooleanTF #2
+ { \partial(#1) / \partial(#3) }
+ { \frac{ \partial(#1) } { \partial(#3) } }
+ \group_end:
+ }
+%%%%%%%%%%%%%%%%%%%%
+% messages
+\msg_new:nnn { diffcoeff } { orderspecification }
+ {
+ #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 is~superseded~by~the~\diffdef\
+ command.~\msg_see_documentation_text:n { diffcoeff }
+ }
+\msg_new:nnn { diffcoeff } { numbersconflict }
+ {
+ #2~orders~of~differentiation~specified~for~#1~variables;~
+ orders~[#3]\ (\msg_line_context:)~for~variables~#4.
+ }
+% end of file diffcoeff4.sty
\ No newline at end of file
Property changes on: trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff4.sty
___________________________________________________________________
Added: svn:eolstyle
## 0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff5.def
===================================================================
 trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff5.def (rev 0)
+++ trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff5.def 20230111 20:44:28 UTC (rev 65523)
@@ 0,0 +1,136 @@
+% file `diffcoef5.def'
+% definitions for variant forms
+% 2023/01/03
+% Andrew Parsloe ajparsloe at gmail.com
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% material derivative
+\difdef { f, s } { D }
+ { opsymbol = \mathrm{D} }
+% math italic
+\difdef { f, s, c } { d' }
+ {
+ opsymbol = d,
+ opordernudge = 1 mu
+ }
+\difdef { f, s, c } { D' }
+ {
+ opsymbol = D,
+ opordernudge = 1 mu
+ }
+% Greek
+\difdef { f, s } { gd }
+ { opsymbol = \delta }
+\difdef { f, s } { gD }
+ { opsymbol = \Delta }
+% spaceless appending
+\difdef { f, fp } { *0 }
+ {
+ *derivandsep = 0 mu ,
+ outerLdelim = \mleft ( ,
+ outerRdelim = \mright )
+ }
+% tfrac, nonscalable
+\difdef { f, fp } { t }
+ {
+ style = tfrac ,
+ derivandsep = 1 mu plus 1 mu minus 1 mu,
+ multitermsep = 0 mu ,
+ termsepadjust = 0 mu ,
+ lvwrapsupnudge = 0 mu ,
+ outerLdelim = \bigl (,
+ outerRdelim = \bigr ),
+ elbowroom = 2 mu ,
+ subnudge = 3 mu
+ }
+% slash fractions: 0=scalable,
+% 1=big, 2=Big, 3=bigg, 4=Bigg
+% but > 1 gives eyesores
+\difdef { s, sp } { 0 }
+ {
+ style = auto ,
+ outerLdelim = \left [ ,
+ outerRdelim = \right ] ,
+ subnudge = 0 mu ,
+ *innerLdelim = \mleft ( ,
+ *innerRdelim = \mright ),
+ *outerLdelim = \left [ ,
+ *outerRdelim = \right ]
+ }
+\difdef { s, sp } { 1 }
+ {
+ style = big ,
+ outerLdelim = \bigl (,
+ outerRdelim = \bigr ),
+ subnudge = 2.5 mu,
+ *innerLdelim = \bigl (,
+ *innerRdelim = \bigr ),
+ *outerLdelim = \bigl [,
+ *outerRdelim = \bigr ]
+ }
+% vrule point of evaluation
+\difdef { f, fp, s, sp } {  }
+ {
+ outerLdelim = \left . ,
+ outerRdelim = \right ,
+ subnudge = 0 mu
+ }
+% sq. bracket pt of eval.
+\difdef { f, fp, s, sp } { ] }
+ {
+ outerLdelim = \left [ ,
+ outerRdelim = \right ],
+ elbowroom = 1 mu,
+ subnudge = 0 mu
+ }
+% long var wrap
+\difdef { f, fp } { (dv) }
+ { longvarwrap = (dv) }
+\difdef { f, fp } { dv }
+ { longvarwrap = dv }
+% compact, D operator
+\difdef { c } { D }
+ {
+ opsymbol = \mathrm{D},
+ opsubnudge = 2mu
+ }
+\difdef { c } { D' }
+ {
+ opsymbol = D,
+ opsubnudge = 2mu
+ }
+% bold
+\difdef { c } { bD }
+ {
+ opsymbol = \mathbf{D},
+ opsubnudge = 2mu
+ }
+% differential style
+\difdef { c, cp } { dl }
+ { style = dl }
+%%%%%%%%%%% differential %%%%%%%%%%
+% partial
+\difdef { l } { p }
+ { opsymbol = \partial }
+% bold
+\difdef { l } { b }
+ { opsymbol = \mathrm{d}\mathbf }
+
+% line elements: Pythagoras
+\difdef { l } { + }
+ {
+ multitermsep = 0 mu +,
+ termsepadjust = 0 mu ,
+ outerLdelim =
+ }
+% Minkowski
+\difdef { l } {  }
+ {
+ multitermsep = 0 mu ,
+ termsepadjust = 0 mu ,
+ outerLdelim =
+ }
+%%%%%%%%%% jacobian %%%%%%%%%%
+% slash fraction
+\difdef { j } { s }
+ { style = / }
\ No newline at end of file
Property changes on: trunk/Master/texmfdist/tex/latex/diffcoeff/diffcoeff5.def
___________________________________________________________________
Added: svn:eolstyle
## 0,0 +1 ##
+native
\ No newline at end of property
More information about the texlivecommits
mailing list.