%% LyX 2.5.0~RC2 created this file.  For more info, see https://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,hyphens]{report}
\usepackage{lmodern}
\renewcommand{\sfdefault}{lmss}
\renewcommand{\ttdefault}{lmtt}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[utf8]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\synctex=-1
\usepackage{xcolor}
\definecolor{lyxboxbgcolor}{rgb}{1, 0.667969, 0.5}
\colorlet{shadecolor}{lyxboxbgcolor}
\usepackage{colortbl}
\usepackage{babel}
\usepackage{cprotect}
\usepackage{wrapfig}
\usepackage{booktabs}
\usepackage{framed}
\usepackage{url}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{stmaryrd}
\usepackage{esint}
\usepackage[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}}
%% Special footnote code from the package 'stblftnt.sty'
%% Author: Robin Fairbairns -- Last revised Dec 13 1996
\let\SF@@footnote\footnote
\def\footnote{\ifx\protect\@typeset@protect
    \expandafter\SF@@footnote
  \else
    \expandafter\SF@gobble@opt
  \fi
}
\expandafter\def\csname SF@gobble@opt \endcsname{\@ifnextchar[%]
  \SF@gobble@twobracket
  \@gobble
}
\edef\SF@gobble@opt{\noexpand\protect
  \expandafter\noexpand\csname SF@gobble@opt \endcsname}
\def\SF@gobble@twobracket[#1]#2{}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\newenvironment{example}%
{\begin{center}\ttfamily}{\end{center}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[def-file=E:/Documents/LyX_tex/tex/latexercises/diffcoeff5,%
            spaced=-1]{diffcoeff}
% no sub nudge (a sea of white space)
\difdef { f, fp } { wsp }
  { sub-nudge = 0 mu }
% align op left; no italic nudge
\difdef { f,fp } { left0 }
  {
    *op-set-left  = true,
    *italic-nudge = 0 mu
  }
% align op left; italic nudge
\difdef { f,fp } { left }
  { *op-set-left  = true }
% partial variant of \diff
\difdef { f } { p }
  {
    op-symbol      = \partial,
    op-order-nudge = 1 mu
  }
% partial, 3mu sep of terms
\difdef { fp, sp } { 3mu }
  {  multi-term-sep  = 3 mu }
% partial, compact, -2 mu subscr. var. adjustment
\difdef { cp } { 2 } { term-sep-adjust = -2 mu }
% partial, use \ldots
\difdef { fp } { ld } { dots = \!\ldots }
% differential d^n x
\NewDocumentCommand \dn { m m } { \dl.dn.[#1] #2 }
% D jacobian
\difdef { j } { D }
  { op-symbol = D }
% square bracket jabobian
\difdef { j } { [ }
  {
    lvwrap-Ldelim = \onemu\mleft [,
    lvwrap-Rdelim = \mright ]
  }

\ifdefined\showcaptionsetup
 % Caption package is used. Advise subfig not to load it again.
 \PassOptionsToPackage{caption=false}{subfig}
\fi
\usepackage{subfig}
\makeatother

\begin{document}
\title{\texttt{diffcoeff}~\\
 a \LaTeX{} package to ease\texttt{ }the~\\
 writing of differential coefficients \\
 Version 5.6}
\author{Andrew Parsloe\\
{\small (ajparsloe@gmail.com)}}
\maketitle
\begin{abstract}
\noindent\texttt{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 the numerator or appended. Besides $\diff yx$, forms like $\difs.s.yx$,
$\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 bra-kets are easily produced. 
\end{abstract}
\begin{center}
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{shaded}%

\subsubsection*{Version 5.6}

Version 5.6 resolves a conflict that arises with version 5.5 and packages
still using \texttt{xtemplate}.\footnote{My thanks to \noun{Jensen Tan} for pointing out the conflict.}
Otherwise the versions are the same.

\subsubsection*{Version 5.5}

Since 2024/06/01, the functionality of \texttt{xtemplate} has been
incorporated into the \LaTeX{} kernel. Version 5.5 of \texttt{diffcoeff}
does not require or load \texttt{xtemplate} unless your \LaTeX{} system
is earlier than 2024/06/01. In addition to some corrections and additions
to documentation, new features of version 5.5 are 
\begin{itemize}
\item the ability to write a generic mixed partial derivative $\difsp.s.<n>F{x_{1},...,x_{n}}$
`with dots' in the straightforward way (§\ref{par:Generic-derivatives});
\item the ability to write a `split level' inline derivative like $\difs.s.yx$
(or the example in the previous item); see §\ref{subsec:variantSplit-level-text-style};
\item the ability to write a `doubly compact' derivative like $\difccp F{x:2,y,z:3}$;
see §\ref{par:Doubly-compact-forms}.
\end{itemize}

\subsubsection*{{\small For users of version 4}}

{\small Version 5 of }{\small\texttt{diffcoeff}}{\small{} more fully
embraces the configurability offered by templates than earlier versions,
at the cost of some incompatibilities with version 4. That version
is still available with the command }{\small\verb`\usepackage[<options>]{diffcoeff}[=v4]`}{\small .
In version 5, the }{\small\verb`\diff`}{\small{} and }{\small\verb`\diffp`}{\small{}
commands of version 4 remain, but lack the `spacing switch' }{\small\verb`!`}{\small{}
and `slash switch' }{\small\verb`/`}{\small . Slash-fraction
derivatives are now created with the }{\small\verb`\difs`}{\small{}
and }{\small\verb`\difsp`}{\small{} commands. New commands }{\small\verb`\difc`}{\small{}
and }{\small\verb`\difcp`}{\small{} produce derivatives in `compact
notation' like }{\small $\difc yx$}{\small{} and }{\small $\difcp yx$}{\small .
The two-argument }{\small\verb`\diffdef`}{\small{} command of
earlier versions has been replaced by the three-argument command }{\small\verb`\difdef`}{\small ,
the additional argument determining which of the }{\small\verb`f`}{\small ,
}{\small\verb`s`}{\small , }{\small\verb`c`}{\small ,
}{\small\verb`fp`}{\small , }{\small\verb`sp`}{\small{}
or }{\small\verb`cp`}{\small{} forms the defined variant applies
to. The differential command }{\small\verb`\dl`}{\small{} has
been rewritten and is now fully template-configurable (allowing easy
writing of line elements like $\dl.+.{x,y,z}^{2}$), and the jacobian
command }{\small\verb`\jacob`}{\small{} is also configurable. }{\small\par}

\subsubsection*{{\small ISO defaults}}

{\small The }{\small\verb`ISO`}{\small{} package option is redundant.
Version 5 of }\texttt{diffcoeff}{\small{} follows ISO recommendations
(see the standard ISO 80000-2). 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.
But the defaults can be readily changed; see §§\ref{sec:Variant-forms},
\ref{sec:ChangingDefaults}.}{\small\par}\end{shaded}%
\end{minipage}
\par\end{center}

\tableofcontents{}

\chapter{Introduction}

\subsubsection*{Requirements}

A \TeX{} distribution from or later than February 2020 is assumed.
\texttt{diffcoeff} uses the \verb`xtemplate` functionality of the
\LaTeX 3 project. Since June 2024 that has become part of the \LaTeX{}
base -- see \verb`lttemplates-doc.pdf` which can be found in the
\verb`doc\latex\base` or \verb`doc/latex/base` folder (depending
on your operating system) of your \TeX{} distribution. Consequently
from  version 5.5 of \texttt{diffcoeff}, \verb`xtemplate` is a required
package only if your \TeX{} distribution is earlier than June 2024.
The package \verb`mleftright` is required (but is loaded by \texttt{diffcoeff}),
and for some optional features (\verb`style=tfrac` and \verb`style=sfrac`)
that use the \verb`\tfrac` and \verb`\text` commands of \verb`amsmath`,
you will need to load that package (which in any case is likely to
have already been done). 

\subsubsection*{Version 4}

Version 5 of \texttt{diffcoeff} marked a significant change from previous
versions. If you want the behaviour of version 4, add to the \verb`\usepackage`
command a trailing optional argument like this,
\begin{verbatim}
    \usepackage[<options>]{diffcoeff}[=v4]
\end{verbatim}
(with no space after the `=' sign!). Working with version 4 is described
in the document \texttt{diffcoeff4.pdf}.

\section{Package options}

\label{sec:Package-options}The package is loaded in the usual way
by entering 
\begin{verbatim}
    \usepackage[<options>]{diffcoeff}
\end{verbatim}
in the preamble of your document.\footnote{Angle brackets indicate possible user input (\emph{without} the angle
brackets).}

From version 5.5 of \texttt{diffcoeff}, there are five possible package
options. If none are being used, omit the square-bracket term in the
\verb`\usepackage` call, otherwise the options are entered in a comma
list in the square-bracket argument of the \verb`\usepackage` command. 
\begin{enumerate}
\item The \verb`spaced` option takes one of three values:
\begin{enumerate}
\item \verb`spaced=1` inserts a small space before the differentiand; this
is the default so that entering \verb`spaced` alone is equivalent
to \verb`spaced=1`;
\item \verb`spaced=0` inserts no space before the differentiand; \texttt{diffcoeff}
is initialized to this value so that if the \verb`spaced` option
is not used \verb`spaced=0` is assumed;
\item \verb`spaced=-1` inserts no space before the differentiand\emph{
}if it is a single token but otherwise inserts a small space; the
present document uses \verb`spaced=-1`;
\end{enumerate}
Space before the differentiand is discussed further in §\ref{subsec:Spacing-before-derivand},
where the commands \verb`\spacedone`, \verb`\spacednil` and \verb`\spacedneg`
are introduced, enabling local (within group) deviations from the
global setting.
\item The second package option \verb`def-file` takes as value the \verb`<filename>`
(which may include the path) of a file containing definitions of variant
forms of derivative (see §\ref{sec:Variant-forms}). The file has
extension \verb`.def`, \verb`<filename>.def`; this is discussed
in §\ref{subsec:The-def-file}. If \verb`<filename>` includes the
path, any backslashes \verb`\` (as used in windows systems) must
be changed to forward slashes \verb`/` (as in linux systems) to avoid
`Undefined control sequence' errors when compiling. (Because of
the presence of earlier versions of \verb`diffcoeff5.def` on the
author's computer, the present document includes the path in the package
option call: \verb`def-file=<path to>/diffcoeff5`.)
\item The third package option \verb`dif**` (from version 5.5 of \texttt{diffcoeff})
takes as value a comma list of identifiers drawn from \verb`f`, \verb`fp`,
\verb`s`, \verb`sp`, \verb`c`, \verb`cp` (e.g. \verb`dif**={c,cp}`).
For the corresponding derivative commands (e.g. \verb`\difc`, \verb`\difcp`)
specified by the identifiers the order of entry of the differentiand
and differentiation variable(s) arguments is reversed; see §\ref{subsec:Transposing-the-argument}.
The present document does not use this package option.
\item By entering \verb`mleftright` (no value required) 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 §\ref{subsec:mleftright} immediately
below. The present document does not use this option. 
\item The final package option \verb`DIF` is a comma list of \emph{key=value}
statements amending the built-in defaults for the `grandparent'
template \verb`DIF`; see §\ref{subsec:Changing-DIF-defaults}. The
present document does not use this option. 
\end{enumerate}
\noindent For the present document, the call is
\begin{verbatim}
 \usepackage[def-file=<path to>/diffcoeff5,spaced=-1]{diffcoeff}
\end{verbatim}

\subsection{\texttt{mleftright}}

\label{subsec:mleftright}To see the effect of the \verb`mleftright`
option, consider the expression
\begin{example}
\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{example}

\noindent 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{example}
\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{example}

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 

\section{A Rogues' Gallery of derivatives}

\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 Upright fraction, slash fraction and compact form ordinary and partial
derivatives,
\[
\diff[2]yx,\quad\difs yx,\quad\difcp yx.
\]
\item Multi-character variables of differentiation, un-parenthesized:
\[
\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^{(r)}_{,i}}.
\]
\item Multi-character variables of differentiation parenthesized (or sometimes
not) in \emph{higher-order} derivatives, where the parentheses do
not (or sometimes do) include the operator: \[
\diffp[2]q{\frac{1}{\Theta}},\quad
\diffp[2]q{1/\Theta},\quad 
\diffp.dv.[2]\varepsilon{a_{i}},\quad
\diff.(dv).[2]{\phi^{i}(x^{i})}{x^{i}}.
\]Should the $\mathrm{d}$ or $\partial$ be included within the parentheses,
as in the last of these, or not, as in the first two? Logic says `yes';
practice suggests (generally) `no'; see §\ref{subsec:Multi-tok-vars-parenth}
and  §\ref{subsec:variantMulti-token-vars-parenth}.
\item Indicating a point of evaluation is similarly varied (see §\ref{subsec:Point-of-evaluation},
§\ref{subsec:variantPt-of-eval}): \[
\difdef{f,fp}{x}{outer-Ldelim=\left.,outer-Rdelim=\right|,sub-nudge=0 mu}
\diffp.x.\phi\varepsilon[\varepsilon=\varepsilon_{0}],\quad \diff.x.[2]\phi\varepsilon[\varepsilon=\varepsilon_{0}],\quad
\difdef{fp}{x}{outer-Ldelim=\left[,outer-Rdelim=\right],sub-nudge=0 mu}
\diffp.x.{b^{\beta}}{a^{\alpha}}[b=0],\quad
\diff uv[v=0].
\difdef{f,fp}{x}{outer-Ldelim=\left(,outer-Rdelim=\right),sub-nudge=-5 mu}
\]ISO 80000-2 (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: 
\[
\diffp*{\frac{P}{T}}U[V],\quad\diffp S{N_{2}}[U,V,N_{1}],\quad\difsp ST[V]\,.
\]
\item We might want to write a generic mixed partial derivative (see §\ref{par:Generic-derivatives}),
\[
\diffp<n>F{x_{1},x_{2},{...},x_{n}},\quad\diffp.dv.F{x_{1}:k_{1},{...}:\cdots,x_{n}:\nilmu k_{n}},
\]
or use a compact abbreviated notation like $\difcp F{ij}$ for $\difsp F{x_{i},x_{j}}$,
or $\difccp F{x:3,y,z:2}$ for $\difsp F{x:3,y,z:2}$.
\item Other symbols besides $\mathrm{d}$ and $\partial$ are used to denote
derivative-like quantities. From introductory calculus and from classical
mechanics and thermodynamics come $\delta$ and $\Delta$, from fluid
mechanics comes $\mathrm{D}$: \[
\difdef{f}{x}{op-symbol=\delta} 
\diff.x.yx,\quad \diff.x.{\!\mathcal{L}}{\eta^(r)},\quad
\difdef{f}{x}{op-symbol=D}
\diff.x.\rho t,\quad 
\difdef{f,s}{x}{op-symbol=\Delta}
\diff.x.UT[V],\quad \difs.x.UT .
\difdef{f,s}{x}{op-symbol=\mathrm{d}}
\]See §\ref{subsec:variantD-delta-Delta} for these and for the $\difc.bD.{}x$
operator used sometimes in the discussion of differential equations:
\[
\difdef{c}{x}{op-symbol=\mathbf{D}}
\difc.x.[2]yx+2\difc.x. yx -4=0.
\]
\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 math-italic $d$ (see §\ref{subsec:variantMath-italic-ds}):
\[
\diff yx,\qquad
\difdef fx{op-symbol=d}
\diff.x.yx,
\difdef fx{op-symbol=\mathrm{d}}
\]and of course also in slash-fraction form $\difs yx$, $\difs.d'.yx$. 
\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}: \[ \spacednil
    \diffp.left.*{\diffp{x^{i^*}}{x^{k^*}}}{x^{l^*}},\quad
    \diff.left.*{\left(\frac{m\mathbf{q}_x}
                {\sqrt{1-q^2}}\right)}t. \]The observant will note an italic adjustment with the first expression,
so that the $\partial$ in the numerator and the $\partial$ in the
denominator of the first term of the first example line up in a slanting
column and the upright `d's line up in the second example, rather
than the operator symbols being centred as seems to be general modern
practice.
\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 \[\spacednil
\diff.n.{v^{i}}t=\diff{x^{i}}{t:2}+\Gamma^{\hphantom{k}i}_{k\hphantom{i}h}\diff{x^{h}}t\diff{x^{k}}t
\]where $\nabla v^{i}$ is the `absolute differential' of the velocity
$v^{i}$; see §\ref{subsec:Examples-of-variants}. (The $x^{i}$ are
the coordinates.)
\end{itemize}
The \texttt{diffcoeff} package has the generative power to cope with
all these variations -- see §\ref{sec:Variant-forms} -- 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}

\texttt{diffcoeff} aims to ease the writing of derivatives (sometimes
also called differential coefficients). There are long-established
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 \texttt{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,\quad\diffp yx,
\]
generally intended for display-style environments; \verb`\difs` and
\verb`\difsp` for slash-fraction forms of ordinary and partial derivatives
like $\difs yx$, $\difsp yx$, generally intended for text-style
environments; and \verb`\difc` and \verb`\difcp` to write compact
forms\cprotect\footnote{Suggested by a question on \TeX{} StackExchange: \url{https://tex.stackexchange.com/questions/652223/write-a-derivative-operator-without-denominator-using-diffcoef/652298\#652298}}
of ordinary and partial derivatives like $\difc yx$ and $\difcp yx$. 

\subsubsection*{Note}

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`).

\section{Syntax}

All commands \verb`\difx`, \verb`\difxp`, share the same syntax.
With all arguments present the syntax is
\begin{verbatim}
    \difx.name.**[order-spec]<override>{variable(s)}
        {differentiand}[pt of eval]
\end{verbatim}
The syntax is identical for \verb`\difxp`. The eight arguments have
the following meanings:
\begin{enumerate}
\item \verb`name` (optional) A dot-delimited name to distinguish a variant
form (non-default form) of derivative; not discussed further until
§\ref{chap:Templates-defaults-variants} below, and specifically,
§\ref{sec:Variant-forms}.
\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 slash-fraction form derivative; no
effect for compact-form derivatives unless (see next) a second \verb`*`
is present; see §\ref{subsec:Appending-the-differentiand}.
\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 §\ref{subsec:Transposing-the-argument}.
\item \verb`order-spec` (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 §\ref{subsec:Higher-order-derivatives}
and §\ref{subsec:Mixed-partial-derivatives}. Not necessary if orders
are specified with the colon notation in the variable list; see §§\ref{subsec:Colon-notation} and \ref{subsec:AlgebraicOrders-ColonNotation}.
\item \verb`override` (optional) The total order of differentiation when
it cannot be calculated by \texttt{diffcoeff} or is wanted in a different
form from that calculated by \texttt{diffcoeff}; see §\ref{subsec:Order-override-command}.
\item \verb`differentiand/derivand` (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); also, with the colon notation (see §§\ref{subsec:Colon-notation},
\ref{subsec:AlgebraicOrders-ColonNotation}), provides an alternative
method of specifying orders of differentiation.
\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 §\ref{subsec:Point-of-evaluation}.
\end{enumerate}
Both mandatory arguments may be empty, but require empty brace pairs
to indicate as much. (Omitting the differentiand makes sense for all
forms of derivative, \verb`\difx`, \verb`\difxp`, but omitting the
variable or variables of differentiation is sensible only for the
compact forms, \verb`\difc`, \verb`\difcp` -- see §\ref{subsec:variantCompact=002013forms}.)

\section{General use}

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 (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
a \LaTeX{} argument -- the variable of differentiation, or the differentiand
-- is multi-token:
\begin{example}
\verb`\[ \diff{f(x)}x \]` $\Longrightarrow$ \[ \diff{f(x)}x\]
\end{example}

\begin{itemize}
\item The keen-eyed will note a space before the `d' operator and the
differentiand in this example. See §\ref{subsec:Spacing-before-derivand}
immediately below.
\item Although conforming to the ISO standard (ISO 80000-2) the upright
`d's are not everyone's preference. If you want math-italic `$\mathrm{d}$'s
as default, see §\ref{sec:ChangingDefaults} on changing default settings. 
\end{itemize}
General usage seems to favour \verb`\diff` for display-style use
and a slash fraction for inline text-style use. Slash fraction derivatives
are produced with the \verb`\difs` command: \verb`$ \difs yx $`
$\Longrightarrow$ $ \difs yx $. From version 5.5 of \texttt{diffcoeff}
(provided the \verb`amsmath` package is loaded) it is also possible
to produce a split level alternative, $\difs.s.yx$, by employing
a `variant form' (\verb`\difs.s.yx`; see §\ref{subsec:variantSplit-level-text-style}).
This scales to the smaller $e^{{\difs.s.yx}}$ when used as a superscript
and to the author's eye is neater than \verb`$e^{\diff yx}$` $\Longrightarrow$
$e^{\diff yx}$. If you want still more compactness, you can use the
\verb`\difc` (`c' for \emph{compact}) command: \verb`$ \difc yx $`
$\Longrightarrow$ $ \difc yx $. 

\emph{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`) produces $\diffp Fx$ in text style; \verb`\diffp{F(x,y)}{x}`
produces
\[
\diffp{F(x,y)}{x}
\]
in display style. For inline use, \verb`\difsp Fx`, displays as $\difsp Fx$
and \verb`\difcp Fx` displays as $\difcp Fx$. Given that \verb`\partial`
takes 8 keystrokes to type, all forms\emph{ }economise on keystrokes. 

\subsection{Spacing before the differentiand\protect\footnote{I thank \noun{Hans Schülein} for first raising this issue with me
and for subsequent thoughtful comments.}}

\label{subsec:Spacing-before-derivand}There are (at least) two different
ways in which to 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 right-angled triangle, the
other sides having lengths $\delta x$ and $\delta y$ parallel to
the coordinate axes. The slope of the chord is $\diff.gd.yx$. By
drawing shorter and shorter 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 $\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$. $\dl y$ is
a single object, called a differential, and we write expressions like
\[
\dl y=\diff yx\dl x
\]
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, $y'(x)$, from another,
$y(x)$. Here the sense is of applying an operator $\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:
\[
y'(x)=\diff{y(x)}x.
\]
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 `d' and the $y$
in the numerator. By default the space is \verb`3 mu` 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` -- 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 §\ref{sec:Variant-forms} and §\ref{sec:ChangingDefaults}. 
\begin{itemize}
\item You may want all your derivatives to have this space before the derivand.
The \verb`spaced=1` package option switches this behaviour on. 
\begin{itemize}
\item Note however that commands like \verb`\sin`, \verb`\cosh`, \verb`\ln`
and similar, including those defined by the user with \verb`\DeclareMathOperator`
from the \verb`amsmath` package, come with a preceding space built
in. You may want to insert a \emph{negative} thin space, \verb`\!`,
before the command, to avoid \emph{too much} space being inserted
before the derivand, or use the \verb`\spacednil` command -- see
§\ref{subsec:Spacing-commands} immediately below:
\end{itemize}
\begin{example}
\verb`\[ \diff{\sin x}x, \quad \diff{\!\sin x}x \]` $\Longrightarrow$
\[ \diff{\sin x}x, \quad \diff{\!\sin x}x \]
\end{example}

\item I have used the \verb`spaced=-1` package option (§\ref{sec:Package-options})
for the present document which inserts space only if the derivand
contains \emph{more than one token}. Thus $y(x)$ will have space
inserted before it, but $y$ alone will not. This (generally) 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. 
\begin{itemize}
\item If the derivand is \emph{appended} when \verb`spaced=-1`, $\diff*yx$,
then indisputably we have an operator operating on a function, and
the space is inserted. (Note that version 5.4 of \texttt{diffcoeff}
did not insert the space in this case; that was an error, corrected
in version 5.5.)
\item A vector component $x_{i}$, say, of a vector $\mathbf{x}=(x_{1},x_{2},x_{3})$
is multi-token but might well be thought of (e.g. by the author) as
if it were a single-token variable and yet, when \verb`spaced=-1`,
a space is inserted. \LaTeX{} provides some spacing shorthands like
\verb`\!` (a negative thin space) to adjust things; \texttt{diffcoeff}
provides others; see §\ref{subsec:Spacing-commands} below. 
\end{itemize}
\item If \verb`spaced=0` no space is inserted before the derivand, single
token or multi-token, under any circumstances. If a space is wanted
in a particular case, it is up to the user  to insert it -- perhaps
by using \verb`\,` (a thin space) within the braces defining the
differentiand, e.g. \verb`{\,f(x)}`. As noted, there are a number
of (short) commands in \LaTeX{} (like \verb`\,`) to do the job and
\texttt{diffcoeff} provides others; see §\ref{subsec:Spacing-commands}
immediately below.
\end{itemize}
Slash-form derivatives also allow space before the derivand. By default
this is \verb`2 mu plus 1 mu minus 2 mu`, slightly reduced from the
fraction-form value to avoid visually detaching the initial `d'
operator from the derivative as a whole. The value can be changed;
see §\ref{sec:Variant-forms} and §\ref{sec:ChangingDefaults}. 
\begin{example}
\verb`$ \difs{s(t)}t, \quad \difs st $` $\Longrightarrow$ $ \difs{s(t)}t, \quad \difs st $.
\end{example}

For \emph{compact-form} derivatives the space before the derivand
is \emph{always} inserted when \verb`spaced` is non-zero, 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 §\ref{sec:Variant-forms} and §\ref{sec:ChangingDefaults}.
It is less for compact forms since the subscript already provides
some visual separation. In the example the negative thin space \verb`\!`
cancels the positive thin space that comes with \verb`\ln`:
\begin{example}
\verb`$ \difc{\!\ln\sin x}x, \quad \difc st $` $\Longrightarrow$
$ \difc{\!\ln\sin x}x, \quad \difc st $.
\end{example}

The \verb`spaced` package option has the same effect on partial derivatives
as ordinary derivatives. Thus with \verb`spaced=1` or \verb`spaced=-1`,
\verb`3 mu` of space (with some stretch and shrink) is inserted before
the differentiand \verb`F(x,y)` in the first member of the following
example, space of \verb`2 mu` (with stretch and shrink) in the second,
and space of \verb`1 mu` (with  stretch and shrink) in the third:
\begin{example}
\verb`\[ \diffp{F(x,y)}x,\;\difsp{F(x,y)}x,\;\difcp{F(x,y)}x, \]`
\end{example}

$\Longrightarrow$ \[ \diffp{F(x,y)}x,\;\difsp{F(x,y)}x,\;\difcp{F(x,y)}x. \]

\noindent But for single-token differentiands in this document (using
\verb`spaced=-1`) the space is not inserted for upright and slash-form
derivatives:
\begin{example}
\verb`\[ \diffp Fx,\quad \difsp Fx. \]` $\Longrightarrow$ \[ \diffp Fx,\quad \difsp Fx. \]
\end{example}


\subsubsection{Spacing commands}

\label{subsec:Spacing-commands}\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 \texttt{diffcoeff} package adds four
simple spacing commands to fill in the gap between these two. These
are 
\begin{description}
\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}
From version 5.5 of \texttt{diffcoeff}, each of these commands can
be starred to produce a space of opposite sign but the same magnitude.
Thus \verb`\onemu*` is equivalent to \verb`\negmu` and vice versa.
The most useful is likely to be  \verb`\twomu*` which fills in the
missing \verb`-2 mu` negative space in the range between \verb`\,`
(\verb`3 mu`) and \verb`\!` (\verb`-3 mu`). Thus if you do \emph{not}
want a vector component to be spaced, \verb`$ \difs{\twomu*y_i}t $`
$\Longrightarrow$ $ \difs{\twomu*y_i}t $, to be compared with the
spaced version in which the \verb`\twomu*` is omitted, $\difs{y_{i}}t$.

From version 5.5, \texttt{diffcoeff} also supports three commands
which switch on one of the \verb`spaced` package option values \emph{within
the current group}.
\begin{description}
\item [{\textbackslash\texttt{spacedone}}] is equivalent to \verb`spaced=1`
within the current group;
\item [{\texttt{\textbackslash spacednil}}] is equivalent to \verb`spaced=0`
within the current group;
\item [{\texttt{\textbackslash spacedneg}}] is equivalent to \verb`spaced=-1`
within the current group.
\end{description}
This document uses the package option \verb`spaced=-1`. That means
that a multi-token differentiand like $x^{k}$ will be separated from
the $\partial$ symbol in the numerator of a partial differential
coefficient by a noticeable whitespace. In the transformation coefficients
of tensor calculus that is not desirable (in the author's opinion);
\verb`\spacednil` comes to the rescue -- compare the first instance
with the second in the following example: 
\begin{verbatim}
    \[  
        \spacednil 
        \bar{g}_{ij}=\diffp{x^k}{\bar{x}^i}
            \diffp{x^l}{\bar{x}^j}g_{kl},
    \]
    \[ 
        \bar{g}_{ij}=\diffp{x^k}{\bar{x}^i}
            \diffp{x^l}{\bar{x}^j}g_{kl}.
    \]
\end{verbatim}
$\Longrightarrow$ \[\spacednil 
        \bar{g}_{ij}=\diffp{x^k}{\bar{x}^i}
            \diffp{x^l}{\bar{x}^j}g_{kl}
    \]
    \[ 
        \bar{g}_{ij}=\diffp{x^k}{\bar{x}^i}
            \diffp{x^l}{\bar{x}^j}g_{kl}
    \]The effect of \verb`\spacednil` has been confined to the first expression;
the package option setting \verb`spaced=-1` has taken effect in the
second and the multi-token differentiands are noticeably spaced from
the $\partial$ operator.

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 §\ref{sec:Package-options}
on package options and specifically §\ref{subsec:mleftright}.

\subsection{Higher order derivatives}

\label{subsec:Higher-order-derivatives}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{example}
\verb`\[ \diff[2]yx, \quad \diff[n+1]yx. \]` $\Longrightarrow$ \[ \diff[2]yx, \quad \diff[n+1]yx. \]
\end{example}

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 order-of-differentiation argument are essential. In slash
form, 
\begin{example}
\verb`$ \difs[2]yx, \quad \difs[n+1]yx $` $\Longrightarrow$ $ \difs[2]yx, \quad \difs[n+1]yx, $
\end{example}

\noindent the latter of which is a bit of an eyesore. In compact form, 
\begin{example}
\verb`$ \difc[2]yx,\quad\difc[n+1]yx $` $\Longrightarrow$ $\difc[2]yx,\quad\difc[n+1]yx$.
\end{example}

\noindent Note that entering \verb`1` as the optional argument has
no effect: 
\begin{example}
\verb`$ \diff[1]yx,\;\difs[1]yx,\;\difc[1]yx $` $\Longrightarrow$
$\diff[1]yx,\;\difs[1]yx,\;\difc[1]yx $.
\end{example}

For partial derivatives when differentiating in only one variable
the pattern is the same, e.g.
\begin{example}
\verb`\[ \diffp[2]yx, \quad \difsp[n+1]yx, \quad \difcp[2]yx. \]`
$\Longrightarrow$ \[ \diffp[2]yx, \quad \difsp[n+1]yx, \quad \difcp[2]yx. \]
\end{example}

\noindent For partial differentiation in more than one variable --
so-called \emph{mixed} partial derivatives -- see §\ref{subsec:Mixed-partial-derivatives}. 

\subsubsection{Alternative ( : ) notation\protect\footnote{I thank \noun{Christophe Bal} for this suggestion.}}

\label{subsec:Colon-notation}From version 5.3 of \texttt{diffcoeff}
it is also possible to specify the order of differentiation by appending
a colon and the order to the differentiation variable:
\begin{example}
\verb`\[ \diff y{x:2},\quad\difsp y{x:n+1},\quad\difcp y{x:2}. \]`
$\Longrightarrow$ \[ \diff y{x:2}, \quad \difsp y{x:n+1}, \quad \difcp y{x:2}. \]
\end{example}

\noindent This is more relevant for mixed partial derivatives when
there is more than one variable, each potentially  to a different
order of differentiation; see §\ref{subsec:AlgebraicOrders-ColonNotation}.\footnote{Note that there was a bug in version 5.4 of \texttt{diffcoeff} --
fixed in 5.5 -- with the implementation of this feature when the
differentiation variable was subscripted, or when the order of differentiation
was algebraic and subscripted.}

\subsection{Appending the differentiand}

\label{subsec:Appending-the-differentiand}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`\difx`
or \verb`\difxp` command and follow the command with the differentiand,
but \texttt{diffcoeff} offers a better way: star the \verb`\difx`
or \verb`\difxp` 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 \verb`\diff`
command:
\begin{example}
\verb`\[ \diff*{(ax^2+bx+c)}x. \]` $\Longrightarrow$ \[ \diff*{(ax^{2}+bx+c)}x. \]
\end{example}

\noindent Or, for a partial derivative, one might want to indicate
in the differentiand all the variables on which it depends:
\begin{example}
\verb`\[ \diffp*[2]{\Phi(x,y,z)}x \]` $\Longrightarrow$ \[ \diffp*[2]{\Phi(x,y,z)}x. \]
\end{example}

A virtue of using an asterisk to append the differentiand is that
if one isn't sure whether to append or not, it is an easy matter to
simply insert or delete the asterisk to compare the results. For instance,
a second derivative is an iterated derivative -- one in which a derivative
forms the differentiand of another . Thus
\begin{example}
\verb`\[ \diff[2]yx = \diff*{\diff yx}x \]` $\Longrightarrow$ \[ \diff[2]yx=\diff*{\diff yx}x .\]
\end{example}

\noindent This result is more elegant to my eye than what results
when removing the asterisk,
\begin{example}
\noindent\verb`\[ \diff[2]yx = \diff{\diff yx}x \]` $\Longrightarrow$
\[ \diff[2]yx=\diff{\diff yx}x ,\]
\end{example}

\noindent although whether the \emph{meaning} is clearer is moot.

\subsubsection{Operator parenthesizing}

For slash fraction derivatives, when the derivand is appended, the
operator is parenthesized:
\begin{example}
\verb`$ \difs*{(ax^2+bx+c)}x $` $\Longrightarrow$ $\difs*{(ax^2+bx+c)}x $.
\end{example}

\noindent Similarly, for slash-style partial derivatives,
\begin{example}
\verb`$ \difsp*[2]{\Phi(x,y,z)}x $` $\Longrightarrow$ $\difsp*[2]{\Phi(x,y,z)}x $
\end{example}

\noindent parentheses are again inserted automatically around the
differential operator. If you don't want the parentheses, like other
elements of automatic formatting this behaviour can be changed; see
§\ref{sec:Variant-forms}, §\ref{sec:ChangingDefaults}.

Since the differentiand is appended \emph{by default} in compact-form
derivatives, starring has no effect and \verb`\difcp`, \verb`\difcp*`
produce identical results.

\subsubsection{Transposing the argument order}

\label{subsec:Transposing-the-argument}If a \emph{second} asterisk
follows the first, the order of the arguments specifying the differentiand
and variable(s) of differentiation is reversed. Thus it is clearer
to the eye to write
\begin{example}
\verb`\[ \diffp**x{(ax^2+2bxy+cy^2)} \]` $\Longrightarrow$ \[\diffp**x{(ax^2+2bxy+cy^2)}\]
\end{example}

\noindent than \verb`\[ \diffp*{(ax^2+2bxy+cy^2)}x \]`, where the
eye has to search for the variable of differentiation. This is especially
the case if the differentiand contains multiple variables and includes
commands like \verb`\frac` or \verb`\sqrt` requiring braced arguments.
Compare \verb`\diffp*{\frac1{\sqrt{x_i^2-x_j^2}}}{x_i}` with
\begin{verbatim}
    \[ \diffp**{x_i}{\frac1{\sqrt{x_i^2-x_j^2}}}. \] 
\end{verbatim}
$\Longrightarrow$ \[ \diffp**{x_i}{\frac1{\sqrt{x_i^2-x_j^2}}}. \]

For compact-form derivatives the initial, appending asterisk is always
implicitly present. However, it must be \emph{explicitly} present
for the second asterisk to take effect:
\begin{example}
\verb`$ \difcp yx,\quad\difcp*yx,\quad\difcp**yx $` $\Longrightarrow$
$ \difcp yx,\quad \difcp*yx,\quad \difcp**yx $.
\end{example}


\paragraph{The \texttt{dif{*}{*}} package option}

Since the natural inclination is to read $\difc yx$ as (something
like) \emph{d sub x y}, and yet the arguments of \verb`\difc yx`
are presented in the reverse order, you might wish to make the double
asterisk state the default and \emph{always} present the variable(s)
of differentiation before the differentiand, at least for compact
derivatives. This can be done with the package option \verb`dif**`.
By entering \verb`dif**={c,cp}` in the optional argument of the \verb`\usepackage`
command when calling \texttt{diffcoeff}, 
\begin{verbatim}
    \usepackage[dif**={c,cp}]{diffcoeff}
\end{verbatim}
the reversed order of arguments, first the differentiation variable(s)
then the differentiand, becomes the default condition for \verb`\difc`
and \verb`\difcp`. \emph{Now} appending two asterisks to \verb`\difc`
and \verb`\difcp` means reversing this \emph{new} default, a double
reversal overall, returning to the original state in which the differentiand
precedes the variable(s) of differentiation. If you want to extend
the reversed argument order also to, say, \verb`\difs`, \verb`\difsp`,
set \verb`dif**={c,cp,s,sp}`, or to extend it to all derivatives
set \verb`\dif**={c,cp,s,sp,f,fp}`.

\subsection{Point of evaluation/variables held constant}

\label{subsec:Point-of-evaluation}If you want to specify a point
at which a derivative is evaluated, append a final square-bracketed
optional argument:
\begin{example}
\verb`\[ \diff[2]yx[0] \]` $\Longrightarrow$ \[ \diff[2]yx[0] \]
\end{example}

\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. (But this should not cause a \LaTeX{}
error.) 
\begin{itemize}
\item If you prefer to use subscripted \emph{square} brackets 
\[
\diffp.].{F(x,y)}x[(0,0)]
\]
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
§\ref{subsec:variantPt-of-eval}. Parentheses are the ISO recommendation;
see ISO 80000-2. 
\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{example}
\verb`$ \difs{\!\ln sin x}{sin x}[x=\pi/3] $` $\Longrightarrow$
$ \difs{\!\ln\sin x}{\sin x}[x=\pi/3]$.
\end{example}

\noindent A vertical rule can easily become too remote from the opening
`d' of the differential coefficient: $\difs.|.{\!\ln\sin x}{\sin x}[x=\pi/3]$.
Parentheses tie the whole cluster of symbols together.

Parentheses are also used with partial derivatives to indicate variables
held constant, particularly in thermodynamics. In the following well-known
relation in the subject, the differentiands are appended and the trailing
argument is used to indicate the variables held constant: 
\begin{example}
\verb`\[ \diffp*{\frac PT}U[V] = \diffp*{\frac 1T}V[U] \]` $\Longrightarrow$
\[ \diffp*{\frac PT}U[V] = \diffp*{\frac 1T}V[U]. \]
\end{example}

\noindent This is much easier to write than building the expressions
`by hand', starting with \verb`\left(` and finishing with \verb`_U`.

\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{example}
\verb`\[ \diff {\!\sin x}x[0]^{\mkern-11mu\pi/2} \]` ${\displaystyle \Longrightarrow}$
\[ \diff{\!\sin x}x[0]^{\mkern-11mu\pi/2} \]
\end{example}

\noindent 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 §\ref{sec:Variant-forms}.

\subsubsection{Empty trailing argument}

\noindent If the trailing argument is included but left empty it will,
with the default set-up, 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, distant $x$ from the origin at time
$t$, the kinetic energy is:
\begin{example}
\noindent\verb`$ \tfrac 12 m \difs xt[]^2 $` $\Longrightarrow$
$\tfrac{1}{2}m\difs xt[]^{2}$.
\end{example}

Or, again exploiting the parentheses resulting from an empty trailing
argument, Lagrange's equations of motion in analytic mechanics can
be written,
\begin{example}
\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{example}

\noindent (See §\ref{subsec:Transposing-the-argument} for the double
asterisk.) 

You may feel that there is too much whitespace before the large left
parenthesis in this expression. The present document uses the \verb`spaced=-1`
package option which inserts a thin space before a multi-token differentiand.
The \verb`\spacednil` command (see §\ref{subsec:Spacing-commands})
cancels that, just leaving the built-in spacing of \verb`\left(`:
\begin{verbatim}
    \[ 
       \spacednil
       \diffp L{q_k}-\diff**t{ \diffp L{\dot{q}_k}[] } = 0. 
    \]
\end{verbatim}
\noindent$\Longrightarrow$ \[\spacednil \diffp L{q_k}-\diff**t{\diffp L{\dot{q}_k}[]} = 0.  \]

\subsection{Mixed partial derivatives}

\label{subsec:Mixed-partial-derivatives}The new thing with partial
derivatives, not present with ordinary derivatives, is the possibility
of differentiation in more than one variable, so-called \emph{mixed}
partial derivatives. 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$, $z$. Then
\begin{example}
\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{example}

\noindent 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 the example) was
calculated by \texttt{diffcoeff} and was inserted automatically. (The
effect of the \verb`spaced=-1` package option can be seen in the
second member of this example.)

The slash form is
\begin{example}
\verb`$ \difsp F{x,y,z} $` $\Longrightarrow$ $ \difsp F{x,y,z}$,
\end{example}

\noindent and the compact form is 
\begin{example}
\verb`$ \difcp F{x,y,z} $` $\Longrightarrow$ $ \difcp F{x,y,z}$.
\end{example}

\noindent One might wonder about an even more compact notation like
$ \difcp.cc.<3>F{x,y,z}$ or $\difccp F{x,y,z}$? These can be readily
achieved by means of a variant form; see §\ref{subsec:variantCompact=002013forms}.

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{example}
\verb`\[ \diffp[2,3]F{x,y,z},\quad \difsp[2,3]F{x,y,z}. \]` $\Longrightarrow$
\[ \diffp[2,3]F{x,y,z},\quad \difsp[2,3]F{x,y,z}. \]
\end{example}

\noindent The overall order of the derivative -- 6 -- is again automatically
calculated and inserted as a superscript on the $\partial$ symbol
in the numerator. 

In these examples, 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 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
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. 

For compact-form derivatives, and using the colon notation to specify
the orders of differentiation (available since version 5.3 of \texttt{diffcoeff}),
\begin{example}
\verb`$ \difcp F{x:2,y:3,z} $` $\Longrightarrow$ $ \difcp F{x:2,y:3,z}$.
\end{example}

\noindent A `doubly compact' notation is also possible, producing
$\difccp F{x:2,y:3,z}$ -- see §\ref{subsec:variantCompact=002013forms}. 

\subsubsection{Algebraic orders}

\label{subsec:AlgebraicOrders-ColonNotation}Orders of differentiation
can be algebraic as well as numerical:
\begin{example}
\verb`\[ \diffp[2m-1,m+1,2]F{x,y,z} \]` $\Longrightarrow$ \[ \diffp[2m-1,m+1,2]F{x,y,z}\]
\end{example}

The total order of differentiation is still calculated by \texttt{diffcoeff}.
Or again,
\begin{example}
\verb`\[ \diffp[1,km+1,m+k-1]{F(x,y,z)}{x,y,z} \]` $\Longrightarrow$
\[ \diffp[1,km+1,m+k-1]{F(x,y,z)}{x,y,z}. \]
\end{example}

\noindent Algebraic orders are sorted according to increasing number
of characters -- hence $km$ after $m$ and $k$ in the example --
then followed by the total numeric order. 

When there are two or more variables of differentiation, particularly
when subject to different orders of differentiation, the colon notation
(see §\ref{subsec:Colon-notation}) is clearer to both writer and
reader; it avoids a lot of clutter:
\begin{example}
\verb`\[ \diffp{F(x,y,z)}{x,y:km+1,z:m+k-1} \]` $\Longrightarrow$
\[ \diffp{F(x,y,z)}{x,y:km+1,z:m+k-1}. \]
\end{example}

Note that it suffices to write \verb`x` rather than \verb`x:1`.
If, in a fit of absent-mindedness, one specifies the orders of differentiation
by both methods, it is the colon notation that prevails:
\begin{example}
\verb`\[ \diffp[1,2,3]{F(x,y,z)}{x:4,y:5,z:6} \]` $\Longrightarrow$
\[ \diffp[1,2,3]{F(x,y,z)}{x:4,y:5,z:6} \]
\end{example}


\subsubsection{Parentheses}

Auto-calculation of the total order can also handle the simple use
of parentheses:
\begin{example}
\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{example}

The left parenthesis in each case is preceded by a \emph{number} or
a \emph{sign}. In evaluating the total order \texttt{diffcoeff} multiplies
out the expression (or that is the effect). However, an order specification
like \verb`[f(n+1),f(n-1)]` is interpreted as the familiar `function
of' notation -- in this case a function $f$ evaluated at $n\pm1$.
\texttt{diffcoeff} \emph{always} interprets a left parenthesis preceded
by something that is \emph{not} a number or a sign in this way. It
does not try to multiply out such expressions when calculating the
total order. The following example combines both uses:
\begin{example}
\verb`\[\diffp[2(f(n)-(m-1)),5-(f(n)+m)]F{x,y}\]` $\Longrightarrow$
\[\diffp[2(f(n)-(m-1)),5-(f(n)+m)]F{x,y}\]
\end{example}


\subsubsection{Order-override option}

\label{subsec:Order-override-command}Sometimes the total order of
differentiation may not be calculable by \texttt{diffcoeff}. For instance,
an order specification like \verb`[m(k-1)+1,m(k+1)-1]` may not be
meant in the `function of' sense, but rather that \verb`m` multiplies
\verb`k-1` and \verb`k+1`. To cope with such situations, \texttt{diffcoeff}
provides the \emph{order-override option}.\footnote{I thank \noun{Christophe Bal} for urging the availability of this
argument and the use of angle brackets.} This is an \emph{angle-bracket }delimited (using the `less than'
and `greater than' symbols, \verb`< >`) optional argument between
the order specification (if it is used) and the differentiand, in
which is entered the desired form of the total order of differentiation.
Angle brackets provide a necessary distinction from the square-bracket
delimited order specification.

In an earlier example, the total order of differentiation $m+k+km+1$
factorizes to $(k+1)(m+1)$. \texttt{diffcoeff} is not a computer
algebra system and does not do such factorizations but if you would
like to express the total order in that form, use the override option:
\begin{verbatim}
    \[ \diffp<(k+1)(m+1)>{F(x,y,z)}{x,y:km+1,z:m+k-1}. \]
\end{verbatim}
$\Longrightarrow$     \[ \diffp<(k+1)(m+1)>{F(x,y,z)}{x,y:km+1,z:m+k-1}. \]

When the override option is used, the algorithm that calculates the
total order does not get called at all In this way not only can the
total order be presented in whatever manner you wish but essentially
arbitrary material can be attached as a superscript to the $\partial$
(or other) symbol in the numerator. 

(Note that for compact-form derivatives, prior to version 5.5 of \texttt{diffcoeff},
the override option was irrelevant. Version 5.5 introduced a `doubly
compact' notation and that is no longer so; see §\ref{subsec:variantCompact=002013forms}.)

\paragraph{Order-override command (deprecated):}

\noindent As an alternative to the override option, you can use the
\verb`\difoverride` command, although\emph{ this is now deprecated}.
(It was introduced to avoid cluttered expressions, but that is reduced
with the introduction of the colon notation and an angle-bracketed
override optional argument.) The command takes one (mandatory) argument,
the total order of differentiation, which it stores: 
\begin{verbatim}
    \[
      \difoverride{(k+1)(m+1)}
      \diffp[1,km+1,m+k-1]{F(x,y,z)}{x,y,z}
    \]
\end{verbatim}
$\Longrightarrow$     \[
      \difoverride{(k+1)(m+1)}
      \diffp[1,km+1,m+k-1]{F(x,y,z)}{x,y,z}
    \]

\noindent Note that in the example \verb`\difoverride` has been used
\emph{within }the math environment. This is good practice. It prevents
the contents of the command erroneously overriding the orders of later
derivatives in other math environments, but it does mean that if you
want to include a later derivative within \emph{this} mathematical
environment then you will need to precede the second derivative with
the statement \verb`\difoverride{}`.

\subsubsection{Error messages}

The order-override option is also needed when calculating the total
order is beyond the abilities of \texttt{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{example}
\verb`\[ \diffp[2^k]F{x,y} \]`
\end{example}

\noindent 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 differentiation
    order fails in this case. Use the order override
    option 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, do as the message suggests
-- use the override option. 

There are limitations on what order specifications the \texttt{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, the override option
is always available. 

\subsubsection{Generic mixed partial derivatives}

\label{par:Generic-derivatives}The question was posed on \TeX{} StackExchange\footnote{\url{https://tex.stackexchange.com/questions/745070/partial-derivatives-with-n- variables-in-diffcoeff}}
about how to write a generic mixed partial derivative. In version
5.4 of \texttt{diffcoeff}, the answer provided looked like this, \verb`\diffp<n>{y}{x_1,x_2\dots,x_n}`,
in which the \verb`\dots` command (from \texttt{amsmath}) has been
adjoined to the variable \verb`x_2` in the specification. However,
the enquirer's first instinct had been to insert \verb`\dots` between
commas in the variable list, as one would with a proper differentiation
variable. The problem was that a $\partial$ operator was inserted
immediately before the dots. From version 5.5 of \texttt{diffcoeff}
one can achieve the desired effect in that `first instinct' way
but, rather than inserting \verb`\dots` or \verb`\ldots` or \verb`\cdots`,
one enters three dots (periods, full stops). These are converted by
\texttt{diffcoeff} into a chosen dots command. By default \texttt{diffcoeff}
uses \verb`\cdots` for upright fraction derivatives (\verb`\diffp`),
and \verb`\ldots` for slash-fraction (\verb`\difsp`) and compact
form (\verb`\difcp`) derivatives.

\noindent{}%
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{shaded}%

\paragraph{A dissertation on dots}

To justify the \texttt{diffcoeff} defaults, the understanding is that
one uses \verb`\ldots` in a list-like context, $a,b,\ldots,k$, and
\verb`\cdots` between binary relations, $a+b+\cdots+k$. In that
sense, the clearest case with relevance for \texttt{diffcoeff} is
a product of differentials (see §\ref{sec:Differentials}) of the
kind that might occur in a multiple integral: 
\[
\int\dotsi\int F(x_{1},\ldots,x_{n})\dl{x_{1}\!,...,x_{n}}
\]
The relevant dots here are those between the differentials. (An explicit
\verb`\dotsi` from \texttt{amsmath} has been used between the integral
signs and an explicit \verb`\ldots` in the list of arguments of $F$.)
Here $\dl{x_{1}\!,...,x_{n}}$ is an element of volume in an $n$-dimensional
space, a product of $n$ infinitesimal lengths $\dl{x_{i}}$. Between
the $\mathrm{d}{x_{i}}$ is an implicit product sign, a \verb`\cdot`
( $\cdot$ ), and so three dots entered in the argument of a \verb`\dl`
command are rightly converted to \verb`\cdots`. Also clear to my
mind is the compact form partial derivative, $\difcp{F(\mathbf{x})}{x_{1},x_{2},...,x_{n}}$,
which is not a product but a sequence of operators $\difcp{}{x_{i}}$
applied one after the other. Using \verb`\ldots` in this case seems
appropriate. \end{shaded}%
\end{minipage}

\noindent{}%
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{shaded}%
Generic slash- and upright fraction derivatives are also sequences
of operations but the construction of the derivatives, distributed
over numerator and denominator, disguises the fact. Since the slash
in a slash fraction tends to isolate the denominator and so \emph{visually}
brings \verb`\difsp` closer to \verb`\difcp`, there seems no reason
not to use \verb`\ldots` in this case: $\difsp<n>{F(\mathbf{x})}{x_{1},x_{2},...,x_{n}}$.
But what to make of
\[
\diffp<n>{F(\mathbf{x})}{x_{1},x_{2},...,x_{n}}\,?
\]
In an upright fraction like this, \verb`\cdots` breaks up the whitespace
better than \verb`\ldots`, which leaves too much whitespace between
the dots near the bottom of the denominator and the total order of
differentiation $n$ near the top of the numerator, producing a `hollowed
out' symbol:
\[
\difdef{fp}{ldots}{dots=\ldots}\diffp.ldots.<n>F{x_{1},...,x_{n}},\quad\diffp<n>F{x_{1},...,x_{n}}.
\]
Hence \verb`\cdots` is the \texttt{diffcoeff} default. If you prefer
different choices, see §\ref{subsec:variantGeneric-cdot-/} on how
to make them \emph{your} defaults.\end{shaded}%
\end{minipage}\medskip{}
In the following examples, note the use of the override option. 
\begin{verbatim}
    \[ \diffp<n>F{x_1,x_2,...,x_n},\quad
       \diffp<n>F{u:a,v:b,...,z:k}. \]
\end{verbatim}
$\Longrightarrow$ \[ \diffp<n>F{x_1,x_2,...,x_n},\quad
       \diffp<n>F{u:a,v:b,...,z:k}.\]

For slash-fraction and compact form derivatives,
\begin{verbatim}
    \[ \difcp<n>F{x_1,x_2,...,x_n},\quad
       \difsp<n>F{u:a,v:b,...,z:k}. \]
\end{verbatim}
$\Longrightarrow$ \[ \difcp<n>F{x_1,x_2,...,x_n},\quad 
       \difsp<n>F{u:a,v:b,...,z:k}.\]

It is sometimes possible to omit the override option by assigning
an appropriate order to the dots:
\begin{verbatim}
     \[ \diffp[1,1,n-3]F{x_1,x_2,...,x_n}. \]
\end{verbatim}
$\Longrightarrow$ \[ \diffp[1,1,n-3]F{x_1,x_2,...,x_n},\]

\noindent where the order $n-3$ has been assigned to the dots, or
even 
\begin{verbatim}
    \[ \diffp F{u:a,v:b,...:\cdots,z:k\relax }, \]
\end{verbatim}
$\Longrightarrow$ \[ \diffp F{u:a,v:b,...:\cdots,z:k\relax },\]

\noindent where the dots have been assigned the `order' \verb`\cdots`.
\texttt{diffcoeff} stores the algebraic orders of differentiation
as \emph{strings} -- sequences of characters. Since they are sorted
by number of characters and \verb`\cdots` (including the backslash)
has $6$, I have padded \verb`k` with \verb`\relax` which also has
$6$ characters and has no visual effect to ensure that $\cdots$
sorts \emph{between} $b$ and $k$; (\verb`\empty` would have served
equally well).

\subsubsection{Comma list of variables of differentiation}

\label{subsec:Comma-list-of-vars}In tensor calculus or analytic mechanics
differentiations are almost always in terms of super- or subscripted
coordinates. In many other contexts multi-token variables of differentiation
are common too -- the reciprocal of the temperature for instance
in thermodynamics. 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 \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 multi-character variables. Thus in tensor calculus we find expressions
like
\begin{example}
\verb`\[ \diffp{A_i}{x^j,x^k} \]` $\Longrightarrow$ \[ \diffp{A_i}{x^j,x^k}. \]
\end{example}

\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{example}
\verb`\[ \diffp{A_i}{x^{j'},x^{k'}} \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^{j'},x^{k'} }. \]
\end{example}

\noindent Compare that variable specification, already requiring some
care, with the thicket of braces of \verb`{{x^{j'}}{x^{k'}}}`. Some
extra whitespace would help here, but the point stands: the comma
list requires fewer nested braces. Of course braces \emph{are} required
if a variable of differentiation includes a comma, for then the comma
needs to be enclosed in them. 

\subsubsection{Spacing in the denominator}

\label{subsec:Minutiae-of-spacing}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$. To my eye,
that degree of extra spacing in the denominator of a derivative seems
too great, interfering with seeing the derivative `as a whole',
\[
\diffp.3mu.F{x,y,z},
\]
especially for the slash-form: $\difsp.3mu.F{x,y,z}$. Some spacing
is desirable, but less. By default \texttt{diffcoeff} inserts \verb`2 mu`
(with stretch and shrink) between the terms, $\difsp F{x,y,z}$, bringing
the extremities into the overall symbol.

Should a differentiation occur to higher order and so a variable acquire
a superscript, an adjustment is made to the extra spacing because
the superscript itself has a spacing effect. By default \verb`1 mu`
is subtracted from the default spacing. Thus in 
\[
\diffp[2]F{x,y,z},
\]
spacing of \verb`2 mu` 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:Templates-defaults-variants}. 

When the variables themselves are superscripted, as happens in tensor
calculus, no automatic adjustment is made. Any fine-tuning must be
done by the user using explicit spacing commands:
\begin{example}
\verb`\[ \diffp{A_i}{ x^j\negmu,x^k } \]` $\Longrightarrow$ \[ \diffp{A_i}{ x^j\negmu,x^k }.\]
\end{example}

\noindent The \verb`\negmu` reduces the space between the terms from
the default \verb`2 mu` to \verb`1 mu`. 

\subsection{Multi-token variables: parenthesizing}

\label{subsec:Multi-tok-vars-parenth}Differentiating a function of
a function may involve a multi-character differentiation variable
-- e.g. to differentiate $\ln\sin x$ in $x$ means forming the product
\begin{example}
\verb`\[ \diff{\!\ln\sin x}{\twomu*\sin x}\diff{\!\sin x}x \]` $\Longrightarrow$
\[\diff{\!\ln\sin x}{\twomu*\sin x}\diff{\!\sin x}x.\]
\end{example}

\noindent (I have inserted preceding negative spaces  to counteract
the thin space built-in to \verb`\sin`.) Forming the \emph{second}
derivative of $\ln\sin x$ will now involve forming, among other quantities,
\begin{example}
\noindent\verb`\[\diff[2]{\!\ln\sin x}{\sin x}\]` $\Longrightarrow$
\[ \diff[2]{\!\ln\sin x}{\sin x} \]
\end{example}

\noindent Parentheses have been inserted automatically  around $\sin x$
in the denominator to avoid any visual hint that we are differentiating
in the sine of $x^{2}$:
\[
\diff.dv.{\!\ln\sin x}{\twomu*\sin x:\twomu2}
\]
\emph{That} is the problem with a long (multi-character) variable:
the superscript in a higher order derivative may look as if it applies
to only part -- the last character -- of a multi-character variable.
Hence the parenthesizing; for first-order derivatives the problem
does not arise and so there is no automatic parenthesizing -- you
need to do it yourself if you want it. In some cases it seems necessary:
\begin{example}
\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{example}

You may prefer \texttt{diffcoeff} not to parenthesize by default in
higher order derivatives. Changing the default setting is easily accomplished;
see §\ref{sec:ChangingDefaults}.

But if you do want parentheses, are they in the right place? Logically,
they should include the `d': $(\!\dl{\twomu*\sin x})^{2}$ -- it
is the differential $\!\dl{\twomu*\sin x}$ that is of the second
order. But as the examples in the Rogues' Gallery show the inclination
seems to be to do otherwise. This may be because one wants in any
case to parenthesize 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,
\[
\diff.(dv).[2]{f(x)}{(x/k)},
\]
like this, then seems too fussy and detracts from comprehending the
symbol `at a glance'. 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$.

The discussion applies equally to partial derivatives. In thermodynamics
and statistical mechanics one may want to differentiate in the reciprocal
of the temperature, $1/\Theta$ say:
\begin{example}
\verb`\[ \diffp[2]q{\frac 1\Theta} \]` $\Longrightarrow$ \[ \diffp[2]q{\frac 1\Theta}.\]
\end{example}

\noindent As noted, when differentiating to first order, parenthesizing
is up to the user:
\begin{example}
\verb`\[ \diffp q{\bigl(\frac 1\Theta\bigr),V} \]` $\Longrightarrow$
\[ \diffp q{\bigl(\frac 1\Theta\bigr),V}. \]
\end{example}

\noindent In tensor calculus, indices are sometimes attached to variables
as superscripts, leading in the default set-up to constructs like
\[
\sum^{3}_{i=1}\diffp V{x^{i}:\onemu2}=\diffp V{x^{1}:\onemu2}+\diffp V{x^{2}:\onemu2}+\diffp V{x^{3}:\onemu2}.
\]
If you prefer no parentheses (see §\ref{subsec:variantMulti-token-vars-parenth}),
although the resulting expression is understandable to the experienced
eye, it is not elegant and potentially ambiguous ($i^{2}=-1$ anyone?):
\[
\sum^{3}_{i=1}\diffp.dv.V{x^{i}:\onemu2}=\diffp.dv.V{x^{1}:\onemu2}+\diffp.dv.V{x^{2}:\onemu2}+\diffp.dv.V{x^{3}:\onemu2}.
\]


\chapter{Templates, defaults \& variants}

\label{chap:Templates-defaults-variants} \texttt{diffcoeff} was built
on the facilities offered by the \verb`xtemplate` package (included
in the \LaTeX 3 bundle {\ttfamily\verb`l3packages`}). These
capabilities have now been absorbed into the \LaTeX{} base (see \texttt{lttemplates-doc.pdf}).
For \texttt{diffcoeff} a template is a list of parameter values determining
what a derivative looks like in the pdf. The parameters may be broad-brush
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 finer-grained, 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 two-argument
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`
command\footnote{And -- see Chapter~\ref{chap:Differentials-and-jacobians} -- of
the differential and jacobian commands, \texttt{\textbackslash dl}
and \texttt{\textbackslash jacob}.}. All this is discussed in §\ref{sec:Variant-forms} below.

\section{Template structure}

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 slash-fraction partial derivative let alone a compact form partial
derivative. This suggests creating a primary template as a `super-repository'
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. 

In \texttt{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 in \texttt{diffcoeff}
and so has keys appropriate to upright-fraction, slash-fraction and
compact forms of derivative; it has keys appropriate to multi-variable
partial derivatives and single-variable 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 upright-fraction, slash-fraction 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 each. 

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 §\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. 

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 \texttt{diffcoeff} uses nine templates, the arrows
in Table~\ref{tab:DIF-defaults} 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{\label{tab:Template-inheritance}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:Default-values-DIF}Table~\ref{tab:DIF-defaults} lists
the keys available for forming derivatives and the default values
assigned in the `grandparent' template, the primogenitor \verb`DIF`.
What values are appropriate will change with the math font used and
the font size. The values shown have been chosen for 
\begin{itemize}
\item $10$pt, Computer Modern or Latin Modern fonts.
\end{itemize}
Other math fonts and sizes will require different defaults. Also,
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 that earlier version. Some key names remain
(\verb`op-symbol`), some names have changed (\verb`multi-term-sep`
for \verb`denom-term-sep`), keys beginning with an asterisk, \verb`*`,
meaning they apply only when the derivand is appended, lack a following
hyphen (\verb`*derivand-sep` rather than \verb`*-derivand-sep`),
some keys have vanished (the \verb`/` keys), and there are some new
keys (\verb`lvwrap-Ldelim`, \verb`lvwrap-Rdelim`). 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:DIF-defaults} lists key names,
the second column lists default values, and the third column lists
the form or forms of derivative for which 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:DIF-defaults} 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 written compactly like \verb`3muplus1muminus2mu`
or with spaces like \verb`3 mu plus 1 mu minus 2 mu`.

Available keys and their defaults are listed in Table~\ref{tab:DIF-defaults}.
If you are dissatisfied with various choices they can be changed;
see the discussion at §\ref{sec:ChangingDefaults}.

\pagebreak{}

\begin{table}
\centering{}\caption{{\small\texttt{DIF}} {\small defaults}\label{tab:DIF-defaults}}
\begin{center}
\begin{tabular}{lrl}
\toprule 
{\small key} & {\small default} & {\small relevance}\tabularnewline
\midrule
{\small style} & {\small\texttt{frac}} & {\small f, fp, s, sp, c, cp, j}\tabularnewline
{\small slash-tok} & {\small\texttt{/}} & {\small\phantom{{\small f, fp,}} s, sp, \phantom{{\small c, cp,}}
j}\tabularnewline
{\small slash-sep} & {\small\texttt{0 mu}} & {\small\phantom{{\small f, fp,}} s, sp, \phantom{{\small c, cp,}}
j}\tabularnewline
{\small sfrac-scaling} & {\small\texttt{0.7}} & {\small\phantom{{\small f, fp,}} s, sp, \phantom{{\small c, cp,}}
j}\tabularnewline
{\small derivand-sep} & {\small\texttt{3 mu plus 1 mu minus 2 mu}} & {\small f, fp, s, sp, c, cp}\tabularnewline
{\small op-symbol} & {\small\texttt{\textbackslash mathrm\{d\}}} & {\small f, fp, s, sp, c, cp, j, l}\tabularnewline
{\small op-symbol-alt} & {\small\texttt{op-symbol}} & {\small f, fp, s, sp, \phantom{{\small c, cp,}} j}\tabularnewline
{\small op-order-nudge} & {\small\texttt{0 mu}} & {\small f, fp, s, sp, c, cp, \phantom{j,} l }\tabularnewline
{\small op-sub-nudge} & {\small\texttt{0 mu}} & {\small\phantom{{\small f, fp, s, sp,}} c, cp}\tabularnewline
{\small var-sup-nudge} & {\small\texttt{1 mu}} & {\small f, fp, s, sp, \phantom{{\small c, cp,} j,} l}\tabularnewline
{\small multi-term-sep} & {\small\texttt{2 mu plus 1 mu minus 1 mu}} & {\small f, fp, s, sp, c, cp, \phantom{j,} l}\tabularnewline
{\small term-sep-adjust} & {\small\texttt{-1 mu}} & {\small f, fp, s, sp, c, cp, \phantom{j,} l}\tabularnewline
{\small dots} & {\small\texttt{\textbackslash cdots}} & {\small f, fp, s, sp, c, cp, \phantom{j,} l}\tabularnewline
{\small long-var-wrap} & {\small\texttt{d(v)}} & {\small f, fp, s, sp, \phantom{{\small c, cp,} j,} l}\tabularnewline
{\small lvwrap-Ldelim} & {\small\texttt{\textbackslash mleft (}} & {\small f, fp, s, sp, \phantom{{\small c, cp,}} j, l}\tabularnewline
{\small lvwrap-Rdelim} & {\small\texttt{\textbackslash mright )}} & {\small f, fp, s, sp, \phantom{{\small c, cp,}} j, l}\tabularnewline
{\small lvwrap-sup-nudge} & {\small\texttt{-2 mu}} & {\small f, fp, s, sp, \phantom{{\small c, cp, j,}} l}\tabularnewline
{\small outer-Ldelim} & {\small\texttt{\textbackslash left (}} & {\small f, fp, s, sp, c, cp, j, l}\tabularnewline
{\small outer-Rdelim} & {\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 sub-nudge} & {\small\texttt{-5 mu}} & {\small f, fp, s, sp, c, cp}\tabularnewline
{\small difcc-var-ord} & {\small\texttt{\textasciicircum\{\#1\}}} & \hphantom{{\small f, fp, s, sp, }}{\small c, cp}\tabularnewline
{\small{*}derivand-sep} & {\small\texttt{derivand-sep}} & {\small f, fp, s, sp, c, cp}\tabularnewline
{\small{*}op-set-left} & {\small\texttt{false}} & {\small f, fp, \phantom{{\small s, sp, c, cp,}} j}\tabularnewline
{\small{*}italic-nudge} & {\small\texttt{0 mu}} & {\small f, fp, \phantom{{\small s, sp, c, cp,}} j}\tabularnewline
{\small{*}slash-sep} & {\small\texttt{slash-sep}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
{\small{*}inner-wrap} & {\small\texttt{false}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
{\small{*}inner-Ldelim} & {\small\texttt{(}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
{\small{*}inner-Rdelim} & {\small\texttt{)}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
{\small{*}outer-Ldelim} & {\small\texttt{\textbackslash big {[}}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
{\small{*}outer-Rdelim} & {\small\texttt{\textbackslash big {]}}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
{\small{*}sub-nudge} & {\small\texttt{0 mu}} & {\small\phantom{{\small f, fp,}} s, sp}\tabularnewline
\bottomrule
\end{tabular}
\par\end{center}
\end{table}

\begin{description}
\item [{style}] the fraction form of the derivative; 
\begin{itemize}
\item for upright-fraction 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 slash-fraction derivatives,\verb`\difs`, \verb`\difsp`, a choice
of \verb`/`, \verb`sfrac`, \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`sfrac` forms a split-level inline fraction like $\difs.s.yx$;
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 compact-form derivatives, \verb`\difc`, \verb`\difcp`,  and
differentials, a choice of \verb`_`, \verb`cc`, \verb`dl` or \verb`d^`
\begin{itemize}
\item \verb`_` or \verb`d^` form derivatives of compact form like $\difc yx$,
$\difcp[1,2]{z}{x,y}$ 
\item \verb`dl` with no differentiand, forms differentials like $\difc.dl.{}x$
and $\difcp.dl.[2]{}{x,y,z}$
\item \verb`cc` forms derivatives in `doubly compact' form like $\difccp y{x:2,y,z:3}$
\item default in templates \verb`DIFC`, \verb`DIFCP` = \verb`_`
\end{itemize}
\item overall default in template \verb`DIF` = \verb`frac`
\end{itemize}
\item [{slash-tok}] token or tokens used for the slash fraction; (see §\ref{subsec:Other-notations}
for an assignment different from \verb`/`); default = \verb`/`
\item [{slash-sep}] space inserted on either side of the \textbf{slash-tok};
if two values are given (in a comma list), the first is inserted to
the left of \textbf{slash-tok}, the second to the right; if only one
value is provided, it is inserted on both sides of \textbf{slash-tok};
default = \verb`0 mu`
\item [{sfrac-scaling}] used only for the \verb`sfrac` variant of a slash-form
derivative to enable scaling. For $10$pt text-style characters, $0.7\times10=7$pt
for script-style characters, and $0.7\times7=0.49\approx5$pt for
scriptscript-style characters; default = 0.7
\item [{derivand-sep}] horizontal space added before the differentiand
if the \verb`spaced` package option is set to \verb`1`, or before
a multi-tokened differentiand if the \verb`spaced` package option
is set to \verb`-1`; note that compact-form derivatives \emph{always
}have this space inserted; default (appropriate for an upright-fraction
derivative) = \verb`3mu plus 1mu minus 2mu`
\item [{op-symbol}] 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 [{op-symbol-alt}] if different from \textbf{op-symbol} then used
in the denominator of a fraction-form derivative while \verb`op-symbol`
is used in the numerator; e.g. for acceleration $\diff.n.{v^{i}}t$,
\verb`op-symbol = \nabla`, \verb`op-symbol-alt = \mathrm{d}`; default
= \textbf{op-symbol}
\item [{op-order-nudge}] extra horizontal space added between the operator
symbol and the superscripted order of differentiation in higher order
derivatives; for  math-italic forms compare $d^{2}$ (no extra space)
with $d^{\mkern1mu 2}$ (\verb`1 mu` of extra space) ; since \textbf{op-symbol
}defaults to an upright `d', default = \verb`0 mu`
\item [{op-sub-nudge}] horizontal adjustment of the position of the subscript
in derivatives of compact form relative to the operator; e.g. if \verb`\nabla`
is the operator you might prefer \difdef{c,cp}x{op-symbol=\nabla,op-sub-nudge=-4 mu}$\difcp.x.yx$
(\verb`-4 mu`) to \difdef{c,cp}x{op-symbol=\nabla,op-sub-nudge=0 mu}$\difcp.x.yx$
(\verb`0 mu`); since \verb`\mathrm{d}` is the default operator,
default = \verb`0 mu`
\item [{var-sup-nudge}] extra horizontal space added between a variable
in the denominator of a derivative and the superscripted order of
differentiation in higher order derivatives; compare $\dl{T:\negmu2}$
(\verb`0 mu`) with$\dl{T:2}$ (\verb`1 mu`); default = \verb`1 mu`
\item [{multi-term-sep}] 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 [{term-sep-adjust}] adjustment (usually a reduction) to \textbf{multi-term-sep}
when differentiation in a variable occurs to an order other than 1;
e.g. the spacing between $\partial x^{2}$ and $\partial y$ in $\difsp[2]{F}{x,y,z}$
is reduced by\textbf{ term-sep-adjust}, because of the superscript,
from the spacing between $\partial y$ and $\partial z$; default
= {\ttfamily\verb`-1 mu`}
\item [{dots}] dot command (e.g. \verb`\ldots`, \verb`\cdots`, \ldots )
to use in a generic mixed partial derivative ($\difsp<n>F{x_{1},...,x_{n}}$).
Because an upright fraction is the default form of derivative, default
= \verb`\cdots`
\item [{long-var-wrap}] it may aid clarity and avoid ambiguity in higher
order derivatives to wrap multi-token variables of differentiation
in parentheses; the choices are 
\begin{description}
\item [{\texttt{dv\phantom{()}}}] no wrapping, e.g. $\mathrm{d}x^{\,2}_{i}$
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 op-symbol 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 [{lvwrap-Ldelim}] 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 [{lvwrap-Rdelim}] 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 [{lvwrap-sup-nudge}] horizontal adjustment to the superscript position
in the denominator of a higher order derivative when a multi-token
variable is wrapped in (e.g.) parentheses; default = \verb`-2 mu`
\item [{outer-Ldelim}] 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 [{outer-Rdelim}] 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 the delimiter
pair \textbf{outer-Ldelim}, \textbf{outer-Rdelim }and the enclosed
derivative; negative values reduce the space; default = {\ttfamily\verb`0 mu`}
\item [{sub-nudge}] horizontal adjustment of the subscript's placing relative
to the \textbf{outer-Rdelim}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 [{difcc-var-ord}] how the order of differentiation is indicated in
the `doubly compact' form of a compact form derivative (see §\ref{subsec:variantCompact=002013forms});
default = \verb`^{#1}`
\item [{{*}derivand-sep}] when the derivand is appended, horizontal space
added before the differentiand (derivand) depending on the setting
of the \verb`spaced` package option; default = \textbf{derivand-sep}
\item [{{*}op-set-left}] a choice of {\ttfamily\verb`true`}
or {\ttfamily\verb`false`} indicating whether the op-symbol
is left-aligned or not when the differentiand is appended; generally
it is centred; applies only to upright-fraction forms of the derivative;
default = {\ttfamily\verb`false`}
\item [{{*}italic-nudge}] if \textbf{{*}op-set-left} is \verb`true`, makes
an italic adjustment in the numerator, so that the op-symbols in numerator
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 [{{*}slash-sep}] when the derivand is appended, space inserted on
either side of the \textbf{slash-tok}; if two values are given (in
a comma list), the first is inserted to the left of \textbf{slash-tok},
the second to the right; if only one value is provided, it is inserted
on both sides of \textbf{slash-tok}; default = \textbf{slash-sep}
\item [{{*}inner-wrap}] 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 slash-fraction derivative \verb`true` is an appropriate default,
but the overall default, appropriate for an upright-fraction derivative
= \verb`false`
\item [{{*}inner-Ldelim}] if \textbf{{*}inner-wrap} is \verb`true`, the\textbf{
}left member of a delimiter pair around the differential operator;
default = \verb`(`
\item [{{*}inner-Rdelim}] if \textbf{{*}inner-wrap} is \verb`true`, the\textbf{
}right member of a delimiter pair around the differential operator
; default = \verb`)`
\item [{{*}outer-Ldelim}] if \textbf{{*}inner-wrap} 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{inner-Ldelim},
{*}\textbf{inner-Rdelim}, default = \verb`\bigl [`
\item [{{*}outer-Rdelim}] if \textbf{{*}inner-wrap} 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{{*}inner-Ldelim}, \textbf{{*}inner-Rdelim},
default = \verb`\bigr ]`
\item [{{*}sub-nudge}] if \textbf{{*}inner-wrap} is \verb`true`, horizontal
adjustment of the subscript's placing relative to the \textbf{{*}outer-Rdelim}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{{*}outer-Rdelim} is a square bracket,\textbf{
}default = \verb`0 mu`
\end{description}

\subsection{Ordinary upright-fraction derivatives; template \texttt{DIFF}}

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 upright-fraction derivative. Only keys with an `f' in
the third column of Table~\ref{tab:DIF-defaults} are used in this
process. Keys without an `f' play no part in the process and their
default values are ignored. See §\ref{subsec:DIFF-(upright-fraction-derivative)}
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:DIFS-defaults}]{\centering{}%
\begin{tabular}{lr}
\toprule 
{\small key} & {\small default}\tabularnewline
\midrule
{\small style} & {\small\texttt{/}}\tabularnewline
{\small derivand-sep} & {\small\texttt{2 mu plus 1 mu minus 2 mu}}\tabularnewline
{\small dots} & {\small\texttt{\textbackslash ldots}}\tabularnewline
{\small outer-Ldelim} & {\small\texttt{(}}\tabularnewline
{\small outer-Rdelim} & {\small\texttt{)}}\tabularnewline
{\small sub-nudge} & {\small\texttt{0 mu}}\tabularnewline
{\small{*}inner-wrap} & {\small\texttt{true}}\tabularnewline
\bottomrule
\end{tabular}}\hfil\subfloat[\texttt{DIFC}\label{tab:DIFC-defaults}]{\centering{}%
\begin{tabular}{lr}
\toprule 
{\small key} & {\small default}\tabularnewline
\midrule
{\small style} & {\small\texttt{\_}}\tabularnewline
{\small derivand-sep} & {\small\texttt{1 mu plus 1 mu minus 1 mu}}\tabularnewline
{\small multi-term-sep} & {\small\texttt{1 mu}}\tabularnewline
{\small term-sep-adjust} & {\small\texttt{0 mu}}\tabularnewline
{\small outer-Ldelim} & {\small\texttt{\textbackslash bigl (}}\tabularnewline
{\small outer-Rdelim} & {\small\texttt{\textbackslash bigr )}}\tabularnewline
sub-nudge & {\small\texttt{-2 mu}}\tabularnewline
\bottomrule
\end{tabular}}
\par\end{centering}
\centering{}\subfloat[\texttt{DIFFP}\label{tab:DIFFP-defaults}]{\centering{}%
\begin{tabular}{lr}
\toprule 
{\small key} & {\small default}\tabularnewline
\midrule 
{\small op-symbol} & {\small\texttt{\textbackslash partial}}\tabularnewline
{\small op-order-nudge} & {\small\texttt{1 mu}}\tabularnewline
{\small{*}italic-nudge} & {\small\texttt{3 mu}}\tabularnewline
\bottomrule
\end{tabular}}\hfil\subfloat[\texttt{DIFSP\label{tab:DIFSP-defaults}}]{
\centering{}%
\begin{tabular}{lr}
\toprule 
{\small key} & {\small default}\tabularnewline
\midrule 
{\small op-symbol} & {\small\texttt{\textbackslash partial}}\tabularnewline
{\small op-order-nudge} & {\small\texttt{1 mu}}\tabularnewline
\bottomrule
\end{tabular}} \hfil\subfloat[\texttt{DIFCP}\label{tab:DIFCP-defaults}]{\centering{}%
\begin{tabular}{lr}
\toprule 
{\small key} & {\small default}\tabularnewline
\midrule 
{\small op-symbol} & {\small\texttt{\textbackslash partial}}\tabularnewline
{\small op-order-nudge} & {\small\texttt{1 mu}}\tabularnewline
\bottomrule
\end{tabular}}
\end{table}


\subsection{Ordinary slash-fraction derivatives; template \texttt{DIFS}}

When you use the command \verb`\difs` to form a slash-fraction derivative
it is the keys in template \verb`DIF` with an `s' in the third
column of Table~\ref{tab:DIF-defaults} which are used. Table~\ref{tab:DIFS-defaults}
records those keys assigned default values \emph{different} from those
in \verb`DIF` which are used for this purpose. See §\ref{subsec:DIFS-(slash-fraction-derivative)}
for the complete list of \emph{relevant} \verb`DIFS` defaults.

\subsection{Ordinary compact-form 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:DIF-defaults} which are used. Table~\ref{tab:DIFC-defaults}
records those keys assigned default values \emph{different} from those
in \verb`DIF` which are used for this purpose. See §\ref{subsec:DIFC-(compact-derivative)}
for the complete list of \emph{relevant} \verb`DIFC` defaults.

\subsection{Partial derivatives; templates \texttt{DIFFP}, \texttt{DIFSP}, \texttt{DIFCP}}

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:DIFFP-defaults}, \ref{tab:DIFSP-defaults},
\ref{tab:DIFCP-defaults}. All other keys take the default values
of the respective parent templates, \verb`DIFF`, \verb`DIFS` and
\verb`DIFC`. 

\section{Defining variants, changing defaults}

\label{sec:Variant-forms}You may well have the need to write an occasional
derivative that deviates from the default form -- a \emph{variant}
form. That was what I needed to do to write the range of different
examples displayed in the Rogues' Gallery (§\ref{sec:Rogues'-gallery}).
Alternatively, you may be dissatisfied with the scheme of default
values listed in the preceding tables and wish to `Re-mould it nearer
to the Heart's Desire'. Both processes -- changing a default, defining
and using a variant -- are very similar and make use of a command
\verb`\difdef` which has three \emph{mandatory} arguments:
\begin{verbatim}
    \difdef{id-list}{variant-name}{key-value list}
\end{verbatim}
\begin{enumerate}
\item \verb`id-list` A comma-list 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:Differentials-and-jacobians}).
\item \verb`variant-name` 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`%` , \verb`#` or braces.
\begin{enumerate}
\item If a name is not provided -- if the \verb`variant-name` braces are
left empty -- then the changes signalled in \verb`key-value list`,
the third argument, become the new \emph{default values} of the derivatives
identified in the first argument, \verb`id-list`.
\end{enumerate}
\item \verb`key-value list` A \emph{key=value} list of settings differing
from the default settings for the relevant template or templates (as
determined by the \verb`id-list`).
\end{enumerate}
The present document comes with a number of variant definitions. These
are divided into two groups. One, in the preamble (and reproduced
at §\ref{sec:Preamble-definitions}), contains definitions designed
to illustrate various effects for this document -- as in the Rogues'
Gallery. The other, in the associated file \texttt{diffcoeff5.def,}
contains definitions that may be of more general use. (For use of
a \verb`.def` file see §\ref{subsec:The-def-file}; \texttt{diffcoeff5.def}
is reproduced at §\ref{sec:The-file-diffcoeff5.def}.)

\noindent{}%
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{shaded}%
The command \verb`\difdef` in version 5 of \texttt{diffcoeff} takes
\emph{three} mandatory arguments. Do not confuse with the command
\verb`\diffdef` of version 4 and earlier which took \emph{two }mandatory
arguments for this purpose. The additional argument is required to
identify which one or more of the fraction forms 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}

\subsection{Creating and using a variant}

To illustrate the process of creating and using a variant consider
the definition in the file \texttt{diffcoeff5.def} enabling the writing
of the acceleration in tensor calculus. This has \verb`\nabla` in
the numerator and \verb`\mathrm{d}` in the denominator:
\begin{verbatim}
    \difdef { f, s } { n } 
      {
        op-symbol     = \nabla,
        op-symbol-alt = \mathrm{d},
        *slash-sep    = { -2mu, 0mu }
      }
\end{verbatim}
The second argument shows that this variant has been given the name
\verb`n`, obviously from `nabla', and can be used with both upright
and slash fraction derivatives -- the \verb`f` and the \verb`s`
in the first argument. Using the new variant is as simple as writing
\verb`\diff.n.` or \verb`\difs.n.` followed by the usual arguments:
\begin{verbatim}
    \[ \diff.n.{v^{i}}t,\quad \difs.n.{v^{i}}t,\quad
       \diff.n.*{v^{i}}t,\quad \difs.n.*{v^{i}}t. \]
\end{verbatim}
$\Longrightarrow$ \[\diff.n.{v^{i}}t,\quad \difs.n.{v^{i}}t,\quad
       \diff.n.*{v^{i}}t,\quad \difs.n.*{v^{i}}t.\](In the Rogues' Gallery I also included the command \verb`\spacednil`
inside the \verb`\[` to cancel the extra space inserted before the
differentiand (§\ref{subsec:Spacing-before-derivand}) with the \verb`spaced=-1`
package option used for this document.) 

The fourth of these derivatives makes use of the \verb`*slash-sep`
setting which applies only when the differentiand is appended and
only to slash-fraction derivatives. Like \verb`slash-sep`, it takes
either a single value which is applied to both sides of the slash
token or, as here, a comma list (hence between braces) of two values
applied respectively to the left and the right side of the slash token.
By default it is set to the value of the \verb`slash-sep` setting
but for this variant the \verb`-2 mu` avoids the appearance of too
much whitespace between the similarly sloping $\nabla$ and $/$ symbols.

A second example shows the effect of the key \verb`sub-nudge` which
adjusts the positioning of the subscript denoting a point of evaluation.
The preamble contains the definition,
\begin{verbatim}
    \difdef { f, fp } { wsp } { sub-nudge = 0 mu }
\end{verbatim}
the name \verb`wsp` derived from `whitespace'. The definition applies
only to upright fraction forms of derivative (the \verb`f, fp` in
the first argument). The default value of \verb`sub-nudge` is \verb`-5 mu`
which has the effect of moving the point-of-evaluation subscript in
towards the in-curling right parenthesis. By giving \verb`sub-nudge`
a zero value, the subscript is cast adrift in a sea of whitespace.
Compare the two settings, using \verb`\diffp` and \verb`\diffp.wsp.`
side-by-side: 
\begin{verbatim}
    \[ \diffp Fx[0],\quad \diffp.wsp.Fx[0]. \]
\end{verbatim}
$\Longrightarrow$ \[ \diffp Fx[0],\quad \diffp.wsp.Fx[0]. \]

\subsection{Changing a default}

\label{sec:ChangingDefaults}The process of changing a default is
even simpler than creating a variant: the second argument of the \verb`\difdef`
command is left empty and no dot-delimited name is required for the
\verb`\difx`, \verb`\difxp` commands. 

By default, \texttt{diffcoeff} parenthesizes multi-token variables
in the denominators of higher order derivatives -- this sort of thing
\[
\diff[2]{\!\ln\sin x}{\sin x}
\]
in order to avoid this sort of thing\[ \diff.dv.{\!\ln\sin x}{\sin x:2}, \]where
the superscript in the denominator looks as if it is attached to $x$
rather than $\sin x$ (or $\mathrm{d}\sin x$). Nonetheless you may
still prefer to have \emph{no} parentheses inserted, the superscript
in the numerator resolving any ambiguity in the denominator. To make
this the default behaviour, all you need is the following definition
\begin{verbatim}
    \difdef { f, fp, s, sp } {} { long-var-wrap = dv }
\end{verbatim}
placed either in the preamble of your document or your \verb`.def`
file (see below). Then when you next form a derivative like \verb`\diff[2]{\!\ln\sin x}{\sin x}`
involving a multi-token variable in a higher-order derivative, no
parenthesizing will occur; see §\ref{subsec:variantMulti-token-vars-parenth}
for more on this.

The procedure is general if you wish to change a default: use \verb`\difdef`
with an \emph{empty} second argument.

\subsection{The \texttt{.def} file}

\label{subsec:The-def-file}The problem with the procedures just discussed
is that if you want the new definitions of variants or defaults to
also apply in other documents, you are faced with either entering
them anew or copying and pasting from one preamble to another. 

It is much easier to use a \verb`.def` file. This is a text file
containing a list of definitions of variant derivatives or new defaults
after the fashion of the examples 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`def-file` package
option. If the name of your \verb`.def` file is \verb`myfile`, then
invoking \texttt{diffcoeff} with the call
\begin{verbatim}
    \usepackage[def-file=myfile]{diffcoeff}
\end{verbatim}
makes the definitions in \verb`myfile.def` available to your current
document -- provided \texttt{diffcoeff} can find \verb`myfile.def`. 

One obvious way is to include the full path in the name. If you are
using a windows operating system then the path separator is the backslash
\verb`\`, e.g. \verb`E:\MyDocuments\...`. To avoid `Undefined control
sequence' errors when compiling, these backslashes must be changed
to forward slashes, as on linux systems: \verb`E:/MyDocuments/...`.
Including the full path in the filename means the file can be placed
anywhere you like.

If you don't use the full path in the filename, then the question
is where to put the file so that \texttt{diffcoeff} can find it? 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 -- which may mean explicitly refreshing
the filename database of your \TeX{} distribution -- then a \verb`.def`
file placed within it will be accessible to all documents.
\begin{center}
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{shaded}%

\subsubsection*{Personal \texttt{texmf} tree?}

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. \TeX{} distributions should have information
accessible on how to add your personal \verb`texmf` tree to its search
path and how to refresh its filename database when you add a file
to your \verb`texmf` tree. \end{shaded}%
\end{minipage}\medskip{}
\par\end{center}

Be aware that it is best to place any particular \verb`.def` file
in no more than \emph{one} place in the search path -- no copies
with the same name in different places. It is too easy to change only
one such copy and forget to update the others and then wonder why
the change you made is not reflected in your document -- \texttt{diffcoeff}
has found a file with the same name, just not the one with the changed
definitions.

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 \texttt{diffcoeff} continues loading.

\noindent{}%
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{shaded}%

\subsubsection*{\texttt{diffcoeff.def}}

In version 4 of \texttt{diffcoeff}, if there was no explicit \verb`def-file=<filename>`
package option statement, then a file \texttt{diffcoeff.def} was sought
and if found loaded. This is no longer the case. Version 5 of \texttt{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 \texttt{diffcoeff.def} file from an
earlier version of  \texttt{diffcoeff} tucked away in some non-obvious
place and producing obscure errors in the current version 5.) \end{shaded}%
\end{minipage}\medskip{}

The present document uses a \verb`.def` file \texttt{diffcoeff5.def},
reproduced in §\ref{sec:The-file-diffcoeff5.def}. Because the author
has a number of files with this name on his computer, the full path
to the file was included in the \verb`\usepackage` statement in the
preamble.

\subsection{Examples of variants}

\label{subsec:Examples-of-variants}The dot-delimited 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.

\subsubsection{Point of evaluation}

\label{subsec:variantPt-of-eval}Although ISO recommends subscripting
parentheses to indicate a point of evaluation, some (like the author)
prefer to use a vertical rule with a subscript and save parentheses
for the case of variables held constant in partial derivatives. The
file \texttt{diffcoeff5.def} contains the definition 
\begin{verbatim}
    \difdef { f, fp, s, sp } { | } 
      {
        outer-Ldelim  = \left . ,
        outer-Rdelim = \right |,
        sub-nudge   = 0 mu
      }
\end{verbatim}
where the `pipe' character is used for the name of the variant: 
\begin{example}
\verb`\[ \diffp.|.{F(x,y)}x[x=1] \]` $\Longrightarrow$     \[ \diffp.|.{F(x,y)}x[x=1] \]
\end{example}

\noindent By omitting the `pipe' symbol name from the second argument
in the \verb`\difdef` command, this variant would become the default
(for \verb`\diff`, \verb`\diffp`, \verb`\difs`, \verb`\difsp`)
for indicating a point of evaluation. For slash fractions, 
\begin{example}
\verb`$ \difs yx[0],\quad \difs.|.yx[0] $` $\Longrightarrow$ $\difs yx[0],\quad \difs.|.yx[0]$.
\end{example}

\noindent As a \emph{default}, you might prefer to limit use of the
`pipe' to \verb`\diff`, \verb`\diffp` (by omitting the \verb`s, sp`
identifiers from the first argument of the \verb`\difdef` command).
Parentheses neatly tie the whole expression together. Conversely,
it is easy to create expressions that suffer from `parenthesis overload':
\begin{example}
\verb`$ \difs{F(x)}{(1/x)}[x=1],\quad\difs.|.{F(x)}{(1/x)}[x=1] $`
$\Longrightarrow$ $\difs{F(x)}{(1/x)}[x=1],\quad\difs.|.{F(x)}{(1/x)}[x=1]$
\end{example}

\noindent The vertical rule is clearer in this case. The solution
may be to use \emph{square} brackets. The file \texttt{diffcoeff5.def}
contains the definition
\begin{verbatim}
    \difdef { f, fp, s, sp } { ] } 
      {
        outer-Ldelim = \left [ ,
        outer-Rdelim = \right ],
        elbowroom    = 1 mu,
        sub-nudge    = 0 mu
      }
\end{verbatim}
giving the result 
\begin{example}
\verb`$ \difs.].{F(x)}{(2x)}[x=0] $` $\Longrightarrow$ $ \difs.].{F(x)}{(2x)}[x=0] $,
\end{example}

\noindent 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. If you want more separation between
the square brackets and the differential coefficient they enclose,
increase the value of the \verb`elbowroom` key -- perhaps to \verb`2 mu`.

\subsubsection{Math-italic \textquoteleft d\textquoteright s}

\label{subsec:variantMath-italic-ds}If you prefer math-italic `d's
rather than the upright ISO recommendation, then the file \texttt{diffcoeff5.def}
contains the definition
\begin{verbatim}
    \difdef { f, s, c, l } { d' } 
      {
        op-symbol      = d ,
        op-order-nudge = 1 mu,
        *slash-sep    = { 0 mu, -1 mu }
      }
\end{verbatim}
The list of identifiers includes \verb`l` in the first argument;
this refers to the template \verb`DIFL` of the differential -- see
§\ref{sec:Differentials}.
\begin{verbatim}
    \[ \diff.d'.yx,\quad \difs.d'.yx,\quad \difc.d'.yx. \]
\end{verbatim}
$\Longrightarrow$ \[ \diff.d'. yx,\quad \difs.d'.yx,\quad \difc.d'.yx. \]If
you want this form of `d' to be the \emph{default} leave the second
argument of the \verb`\difdef` command empty.

\subsubsection{Generic slash fraction with \texttt{\textbackslash cdots}}

\label{subsec:variantGeneric-cdot-/}In §\ref{par:Generic-derivatives}
it was remarked that it was not clear whether to use \verb`\ldots`
or \verb`\cdots` as default in a generic \emph{slash-fraction} form
of mixed partial derivative. In fact \verb`\ldots` has been chosen
as the \texttt{diffcoeff} default, $\difsp<n>F{x_{1},...,x_{n}}$,
but it is easy to provide a variant that uses \verb`\cdots`:
\begin{verbatim}
    \difdef { sp } { cd } { dots = \cdots }
\end{verbatim}
Indeed, just this definition can be found in the file \texttt{diffcoeff5.def}
so let's try it:
\begin{example}
\verb`$ \difsp.cd.<n>F{x_{1},...,x_{n}} $` $\Longrightarrow$ $ \difsp.cd.<n>F{x_{1},...,x_{n}} $.
\end{example}


\subsubsection{Parenthesizing multi-token variables}

\label{subsec:variantMulti-token-vars-parenth}To illustrate the different
modes of parenthesizing `long' variables in higher order derivatives,
I have put these two definitions in \texttt{diffcoeff5.def}:
\begin{verbatim}
    \difdef { f, fp } { (dv) } 
      { long-var-wrap = (dv) } 

    \difdef { f, fp }{ dv } 
      { long-var-wrap = dv }
\end{verbatim}
The three possibilities for wrapping multitoken variables can now
be illustrated:
\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} \]

\noindent The first is the default setting; it takes a moment to decipher
$T^{2}$ in the second and the third is unfamiliar. In other cases
it is less clear-cut. 

\paragraph{Subscripted variables}

\label{subsec:variantSubscripted-vars}Consider the following example,
where the `out of the box' default means multi-token variables,
and hence the subscripted variables in the example, are parenthesized:
\begin{verbatim}
    \[ \sum_{i=0}^3 \diffp[2]V{x_i}=\diffp[2]V{x_1}
       +\diffp[2]V{x_2}+\diffp[2]V{x_3}. \]
\end{verbatim}
$\Longrightarrow$ \[ \sum_{i=0}^3\diffp[2]V{x_i}=\diffp[2]V{x_1}+\diffp[2]V{x_2}+\diffp[2]V{x_3}. \]

\noindent You may well prefer no parenthesizing here -- the \verb`dv`
variant:
\begin{verbatim}
    \[ \sum_{i=0}^3 \diffp.dv.[2]V{x_i}=\diffp.dv.[2]V{x_1}
       +\diffp.dv.[2]V{x_2}+\diffp.dv.[2]V{x_3}. \]
\end{verbatim}
$\Longrightarrow$ \[ \sum_{i=0}^3\diffp.dv.[2]V{x_i}=\diffp.dv.[2]V{x_1}
       +\diffp.dv.[2]V{x_2}+\diffp.dv.[2]V{x_3}. \]

\noindent But are the superscripts in the denominators too detached
now? 

When there is no parenthesizing, the \verb`var-sup-nudge` setting
is used to adjust this spacing. The default value, \verb`1 mu`, is
intended for differentiation variables which are \emph{not} subscripted.
So let's adjust the setting for variables which \emph{are }subscripted
and define a variant with name, \verb`dv_`, say, the name suggesting
`not parenthesized and subscripted': 
\begin{verbatim}
    \difdef { f, fp, s, sp } {dv_} 
      { 
        long-var-wrap = dv,
        var-sup-nudge = -1 mu
      }
\end{verbatim}
This definition can be found in the file \texttt{diffcoeff5.def},
giving the result 
\begin{verbatim}
    \[ \sum_{i=0}^3 \diffp.dv_.[2]V{x_i}=
           \diffp.dv_.[2]V{x_1}+\diffp.dv_.[2]V{x_2}+
               \diffp.dv_.[2]V{x_3}. \] 
\end{verbatim}
$\Longrightarrow$    \[\sum_{i=0}^3\diffp.dv_.[2]V{x_i}=\diffp.dv_.[2]V{x_1}
       +\diffp.dv_.[2]V{x_2}+\diffp.dv_.[2]V{x_3}. \]The superscripts are no longer detached from the variables. 

\paragraph{Superscripted variables}

\emph{Super}scripted variables, as you get in tensor calculus, unavoidably
give less elegant results. The three possibilities are
\begin{verbatim}
    \[ \diffp[2]f{x^1},\quad
           \diffp.dv.[2]f{x^1},\quad
               \diffp.(dv).[2]f{x^1}. \] 
\end{verbatim}
$\Longrightarrow$ \[ \diffp[2]f{x^1},\quad
           \diffp.dv.[2]f{x^1},\quad
               \diffp.(dv).[2]f{x^1}. \] 

\noindent The third of these is unlikely to be favoured. The first
(the default) to my eye gives a noticeably better result for the Laplacian
than the second:
\begin{verbatim}
   \[ \sum_{i=1}^3\diffp[2]V{x^i}=
          \diffp V{x^1:2}+\diffp V{x^2:2}+
              \diffp V{x^3:2}, \]
   \[ \sum_{i=1}^3\diffp.dv.[2]V{x^i}=
          \diffp.dv.V{x^1:2}+\diffp.dv.V{x^2:2}+
              \diffp.dv.V{x^3:2}. \]
\end{verbatim}
$\Longrightarrow$    \[ \sum_{i=1}^3\diffp[2]V{x^i}=
          \diffp V{x^1:2}+\diffp V{x^2:2}+
              \diffp V{x^3:2}, \]
   \[ \sum_{i=1}^3\diffp.dv.[2]V{x^i}=
          \diffp.dv.V{x^1:2}+\diffp.dv.V{x^2:2}+
              \diffp.dv.V{x^3:2}. \]

\subsubsection{Upright text-style derivatives}

\texttt{diffcoeff} assumes that derivatives of upright-fraction form
will be used mainly in display-style expressions and that the slash
form will be used mainly for inline (text-style) use. But if one does
want to use the upright 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 \texttt{diffcoeff5.def} contains the following definition
for text-style upright fraction derivatives (note that since the \verb`\tfrac`
command is used here, this requires the \verb`amsmath` package to
have been loaded):
\begin{verbatim}
    \difdef { f, fp } { t }
      {
        style           = tfrac  ,
        derivand-sep    = 1 mu plus 1 mu minus 1 mu,
        multi-term-sep  = 0 mu   ,
        term-sep-adjust = 0 mu   ,
        wrap-sup-nudge  = 0 mu   ,
        outer-Ldelim    = \bigl (,
        outer-Rdelim    = \bigr ),
        elbowroom       = -2 mu  ,
        sub-nudge       = -3 mu
      }
\end{verbatim}
Now the variant form \verb`$ \diffp.t.ST[V] $` displays as $\diffp.t.ST[V]$;
the subscript is better positioned and there is a better fit between
parentheses and derivative. Note that \verb`style=tfrac` in the definition
means \verb`\diffp.t.` will not scale.

\subsubsection{Split-level text-style derivative}

\label{subsec:variantSplit-level-text-style}A `halfway house' between
upright and slash-fraction forms for inline derivatives is a split-level
slash fraction, available from version 5.5 of \texttt{diffcoef}.\footnote{I have copied and modified code defining the \texttt{\textbackslash sfrac}
command from the \texttt{xfrac} package; hence the \texttt{style=sfrac}
line in the definition. } (This requires the \verb`amsmath` package to have already been loaded.)
Then 
\begin{verbatim}
    \difdef { s, sp } { s }
      {
        style             = sfrac,
        slash-sep         = { -2 mu, -1 mu },
        derivand-sep      = 0 mu ,
        multi-term-sep    = 0 mu ,
        term-sep-adjust   = 0 mu ,
        var-sup-nudge     = 0 mu ,
        lvwrap-sup-nudge  = 0 mu
      }
\end{verbatim}
defines inline derivatives of the form 
\begin{verbatim}
    \[ \difs.s.yx,\quad\difs.s.yx[0],\quad
         \difsp.s.*yx,\quad\difsp.s.*yx[0]. \]
\end{verbatim}
$\Longrightarrow$ \[ \difs.s.yx,\quad\difs.s.yx[0],\quad\difsp.s.*yx,\quad\difsp.s.*yx[0]. \]

\noindent The $y$ in the first two is \verb`\scriptstyle` size but
when appended and hence outside the fraction it is normal size. Since
it remains within the fraction in all four examples, the $x$ is \verb`\scriptstyle`
size. Should you need to write a derivative as an exponent, this split-level
slash fraction form gives a neater result than a pure slash fraction
or an upright fraction:
\begin{verbatim}
    $ e^{\difs.s.yx},\quad e^{\difs yx},\quad e^{\diff yx} $
\end{verbatim}
$\Longrightarrow$ $ e^{\difs.s.yx},\quad e^{\difs yx},\quad e^{\diff yx} $.

In \LaTeX{} if your default font size is $10$pt, then script-style
size is $7$pt ($=10\times0.7$) and script-script-style size is $5$pt
($\approx10\times0.7\times0.7$), which explains the default value
$0.7$ of \textbf{sfrac-scaling}. If your default font size is $11$pt
or $12$pt then in either case the script-style size is $8$pt and
script-script-style size is $6$pt. 

\paragraph{Editing a variant form}

\label{par:variantEditing}If you wish to edit an already defined
variant form, you don't need to repeat the full definition. It suffices
to change the setting only of the relevant key or keys -- but please
ensure your \TeX{} distribution is from 2022-12-17 or later. Earlier
versions of \texttt{xtemplate} contained a bug that didn't otherwise
affect the workings of \texttt{diffcoeff} but did prevent changes
being made to already defined variants.

Thus, to the definition just given, in \texttt{diffcoeff5.def} I have
made the change 
\begin{verbatim}
    \difdef { s } { s } { *slash-sep = { -1 mu, -1 mu } }
\end{verbatim}
to accommodate the different way the upright $\mathrm{d}$ relates
to the slash symbol in the numerator of an appended derivative compared
with the math-italic $\partial$:
\begin{example}
\verb`$ \difs.s.*yx,\quad\difs.s.*yx[0] $` $\Longrightarrow$ $ \difs.s.*yx,\quad\difs.s.*yx[0] $.
\end{example}


\paragraph{\textbackslash sfrac analogue}

\label{par:variant-sfrac-analogue}The \verb`xfrac` package defines
a command \verb`\sfrac` that produces split-level fractions. The
thought arises that perhaps by omitting the operator symbol in \verb`\difs.s.`
we could create an analogue of \verb`\sfrac`. Indeed, from version
5.5 of \texttt{diffcoeff},  the file \texttt{diffcoeff5.def} contains
the definition
\begin{verbatim}
    \NewDocumentCommand \difsfrac { O{-2mu,-1mu} m m } 
      {{ 
         \difdef { s } { s } { op-symbol= , slash-sep={#1} }
         \difs.s.{#2}{#3}
      }}
\end{verbatim}
The reason for the double braces in the definition is so that the
changes to \verb`\difs.s.` do not `leak' beyond \verb`\difsfrac`
and affect a later use of \verb`\difs.s.`. Indeed, \verb`$ \difsfrac yx,\ \difs.s.yx $`
$\Longrightarrow$ $ \difsfrac yx,\ \difs.s.yx $, so that there is
no `leakage'. \verb`\difsfrac` can be used within or without math
delimiters, 
\begin{example}
\verb`\difsfrac 34, $\difsfrac 1{16}$` $\Longrightarrow$ \difsfrac 34, $\difsfrac 1{16}$.
\end{example}

If you want to adjust the spacing of numerator or denominator from
the slash, an initial optional argument is available taking two math
lengths in mu, separated by a comma. Generally these lengths will
be negative to bring numerator and denominator closer to the slash;
positive lengths push them away, like this: \verb`\difsfrac[10mu,10mu] 34`
$\Longrightarrow$ \difsfrac[10mu,10mu] 34.

\subsubsection{Slash-fraction styles}

The default slash-fraction 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 \texttt{diffcoeff5.def} contains a definition of a scaling
slash fraction (name \verb`0`) and a slightly larger-than-default
slash fraction (name \verb`1`):
\begin{verbatim}
 \difdef { s, sp } { 0 }           \difdef { s, sp } { 1 }
   {                                 {
     style         = auto     ,        style          =  big   ,
     outer-Ldelim  = \left [  ,        outer-Ldelim   = \bigl (,
     outer-Rdelim  = \right ] ,        outer-Rdelim   = \bigr ),
     sub-nudge     = 0 mu     ,        sub-nudge      = -2   mu,
     *inner-Ldelim = \mleft ( ,        *inner-Ldelim  = \bigl (,
     *inner-Rdelim = \mright ),        *inner-Rdelim  = \bigr ),
     *outer-Ldelim = \left [  ,        *outer-Ldelim  = \bigl [,
     *outer-Rdelim = \right ]          *outer-Rdelim = \right ]
   }                                 }
\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 \verb`auto` (which is
built around \verb`\left.`, \verb`\middle/`, \verb`\right.`). \texttt{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{example}
\verb`\[ \difsp.0.{\frac1Y}{\frac1X} \]` $\Longrightarrow$ \[ \difsp.0.{\frac1Y}{\frac1X} \]
\end{example}

But for small size increases, the results can be pleasing. To the
author's eye, both \verb`0` and \verb`1` variants (the first two
of the following) give better results than the default (the last):
\begin{example}
\verb`$ \difsp.1.{F(x,y)}{\tfrac1x}[x=0] $` $\Longrightarrow$ $ \difsp.1.{F(x,y)}{\tfrac1x}[x=0] $

\verb`$ \difsp.0.{F(x,y)}{\tfrac1x}[x=0] $` $\Longrightarrow$ $\difsp.0.{F(x,y)}{\tfrac1x}[x=0]\vphantom{\bigg|} $

\verb`$ \difsp{F(x,y)}{\tfrac1x}[x=0] $` $\Longrightarrow$ $ \difsp{F(x,y)}{\tfrac1x}[x=0] $
\end{example}

\noindent Subscripted \emph{square} brackets are chosen for the scaling
variant so that the setting \verb`sub-nudge=0 mu` is appropriate
at all scales. They provide good visual contrast with the parentheses
of $F(x,y)$.

\subsubsection{Compact--form derivatives}

\label{subsec:variantCompact=002013forms}Three styles are available
for compact-form derivatives, \verb`style=_`, the default as displayed
in $\difc yx$; \verb`style=dl`, a `differential style' as displayed
in $\difc.dl.{}{x:2}$ (with no differentiand), and from version 5.5
of \texttt{diffcoeff}, a `doubly compact' style, \verb`style=cc`
as displayed in $\difcp.cc.<1>f{x:2,y,z:3}$. (Nominally there is
a fourth style, \verb`style=d^`, but that is equivalent to \verb`style=_`.)

In the default style (for a partial derivative) the orders of differentiation
are applied to the operator symbol: 
\begin{example}
\verb`$ \difcp[3,1,2]f{x,y,z} $` $\Longrightarrow$ $ \difcp[3,1,2]{f}{x,y,z} $.
\end{example}

\noindent If no differentiation variable is specified, only an empty
brace pair,\footnote{This is the behaviour from version 5.2 of \texttt{diffcoeff}; in version
5.1, a nested\emph{ }pair of empty braces, \{\{\}\}, was required.} 
\begin{example}
\verb`$ \difc[2]f{} $` $\Longrightarrow$ $ \difc[2]f{} $.
\end{example}

\noindent (One could also write \verb`$ \difc f{:2} $` to get this
result.) If you want to write `differentials of differentials',
second order differentials, then this is a possible way of doing so
-- but \texttt{diffcoeff} has a dedicated differential command, \verb`\dl`,
see §\ref{sec:Differentials}, and in relation to the example, see
§\ref{subsec:Variant-differentials}.

Suppose now we define a variant form (as is done in  \texttt{diffcoeff5.def}),
\begin{verbatim}
    \difdef { cp } { dl } 
      { 
        style           = dl   ,
        multi-term-sep  =  1 mu,
        term-sep-adjust = -1 mu 
      }
\end{verbatim}
and use it to form a similar expression but without the differentiand
this time, an empty argument in \emph{its} place:
\begin{example}
\verb`$ \difcp.dl.[3,2]{}{x,y,z} $` $\Longrightarrow$ $ \difcp.dl.[3,2]{}{x,y,z}$
\end{example}

\noindent In this \verb`dl` (or \emph{differential}) style, the orders
of differentiation in the displayed output  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.
(But see §\ref{sec:Differentials}, on differentials, which more conveniently
allows  the writing of, for example, $\!\dl[3]x$.)

\paragraph{Doubly compact forms}

\label{par:Doubly-compact-forms}In the search for ever more concision,
one might wonder if a form like $ \difcp[3,1,2]{f}{x,y,z} $ can be
compressed further to use only one operator symbol. This is the purpose
of \verb`style=cc`. The file \texttt{diffcoeff5.def} contains the
definition
\begin{verbatim}
    \difdef { cp } { cc } 
      {
        style           =  cc  ,
        multi-term-sep  =  0 mu,
        term-sep-adjust = -1 mu,
        var-sup-nudge   =  0 mu
      }
\end{verbatim}
Now one can write \verb`$\difcp.cc.f{x:3,y,z:2}$` $\Longrightarrow$
$\difcp.cc.f{x:3,y,z:2} $. Is the total order -- the $6$ -- really
necessary? We can use the order-override option to suppress it: \verb`$\difcp.cc.<1>f{x:3,y,z:2}$`
$\Longrightarrow$ $\difcp.cc.<1>f{x:3,y,z:2}$, which to my eye is
cleaner. You can make this your \emph{default} compact derivative
by omitting the \verb`cc` from the second argument of \verb`\difdef`,
leaving it empty; then it would suffice to write \verb`$\difcp<1>f{x:3,y,z:2}$`
to obtain the last result. 

But do you want always to be writing \verb`<1>` to suppress the superfluous
total order of differentiation? Obviously not. For that reason, \texttt{diffcoeff5.def}
contains the lines
\begin{verbatim}
    \NewDocumentCommand \difccp { s s O{1} } 
      {
        \IfBooleanTF #1 
          { \difcp.cc.**[#3]<1> } { \difcp.cc.[#3]<1> } 
      }
\end{verbatim}
which now means you can write \verb`$\difccp f{x:3,y,z:2}$` $\Longrightarrow$
$\difccp f{x:3,y,z:2}$ or \verb`$\difccp[3,1,2]f{x,y,z}[(x,y,z)=\mathbf0]$`
$\Longrightarrow$ $\difccp[3,1,2]f{x,y,z}[(x,y,z)=\mathbf0]$.

\verb`\difccp` can be double starred to reverse the order of its
arguments, variables of differentiation before differentiand. (In
fact a single star has the same effect here: present the arguments
to \verb`\difccp` in reverse order.) Thus, doubly starred, \verb`$\difccp**{x,y}f[y=1]$`
$\Longrightarrow$ $\difccp**{x,y}f[y=1]$ (although a single star
would have sufficed). However, \verb`\difccp` does not accept a dot
delimited first argument with which to define a variant. 

There is one key in template \verb`DIF` solely relevant to doubly
compact derivatives: \verb`difcc-var-ord` specifies how the orders
of differentiation are displayed between the variables of differentiation.
It's default value is \verb`^{#1}` meaning that the orders are presented
as superscripts -- as shown in the examples. If you do not want superscripting
but, say, only the order then edit the above variant in this way:
either add the line \verb`difcc-var-ord = ##1` (a double \verb`#`
must be used within the \verb`\difdef` command) to the \emph{key-value}
list defining the \verb`\difcp.cc.` variant above (ensuring all lines
except possibly the last end in commas), or \emph{after} the definition
above add a definition to your \verb`.def` file that edits it:
\begin{verbatim}
    \difdef { cp } { cc } { difcc-var-ord = ##1 }
\end{verbatim}
If you prefer the form $\partial_{x:3yz:2}$ replace \verb`##1` here
with \verb`:##1`; if you prefer $\partial_{x\boldsymbol{3}yz\boldsymbol{2}}$
replace \verb`##1` with \verb`\mathbf{##1}`. 

\emph{Subscripts} (actually sub-subscripts) to my eye give a poor
result: $\partial_{x_{3}yz_{2}}$, but if this is what you want, then
a complication emerges. Placed in the \emph{preamble} of your document,
\begin{verbatim}
  \difdef { cp } { cc } { difcc-var-ord = _{##1} }
\end{verbatim}
will achieve the desired effect; placed in your \verb`.def` file,
it will not. There you will need to write
\begin{verbatim}
  \difdef { cp } { cc } 
      { difcc-var-ord = \c_math_subscript_token {##1} }
\end{verbatim}

\subsubsection{D, \textbackslash delta, \textbackslash Delta derivatives}

\label{subsec:variantD-delta-Delta}In introductory calculus texts
a derivative-like symbol is created with the lowercase Greek delta,
$\delta$ . An uppercase Greek delta, $\Delta$, is often used in
a derivative-like 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 \texttt{diffcoeff5.def}
contains the definitions
\begin{verbatim}
    \difdef { f, s } { gd }
      { op-symbol = \delta }
    \difdef { f, s } { gD }
      { op-symbol = \Delta }
    \difdef { f, s } { D }
      { op-symbol = \mathrm{D} }
    \difdef { c } { bD } 
      { 
        op-symbol    = \mathbf{D}, 
        op-sub-nudge = -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{example}
\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{example}

\noindent for the total derivative of $\rho$ (perhaps in fluid dynamics),
or, in a course on solving differential equations,
\begin{example}
\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{example}


\subsection{Changing defaults in \texttt{DIF}}

\label{subsec:Changing-DIF-defaults}Leaving the second argument of
the \verb`\difdef` command empty changes default values in the templates
specified in the first argument. But the grandparent template \verb`DIF`
is unaffected. Intuitively, one might expect that leaving the first
argument of the \verb`\difdef` command empty would change a \verb`DIF`
default, but that is not the case. To change a default in \verb`DIF`
so that it `infects' -- is inherited by -- all other templates
can be done  only at load time. 

There are two ways of doing this. The first is to create a text file
with the specific name \texttt{diffcoeff.DIF} with the desired settings.
For example, if we want math-italic `d's and a subscripted vertical
rule for points of evaluation, then the file might look like
\begin{verbatim}
    op-symbol      = d,
    op-order-nudge = 1 mu,
    outer-Ldelim   = \left . ,
    outer-Rdelim   = \right |,
    sub-nudge      = 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 §\ref{subsec:The-def-file},
and in particular the need to alert your \TeX{} distro to the presence
of the file) -- \texttt{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`op-symbol = \partial` and similar
statements in the definitions of those templates).

Note that placing \texttt{diffcoeff.DIF} in your current document
directory means that only for documents sharing that directory will
it be found. If you want \texttt{diffcoeff.DIF} to be found whatever
the location of the document you are working on, then place \texttt{diffcoeff.DIF}
in your personal \verb`texmf` tree and alert your \TeX{} distro to
its presence (`refresh the filename database').

The second method of changing defaults in the grandparent template
\verb`DIF` is to use the \emph{package option} \verb`DIF`. For instance
loading \texttt{diffcoeff} with the call
\begin{verbatim}
    \usepackage
      [ DIF = 
          {
            op-symbol = d,
            op-order-nudge  = 1 mu,
            outer-Ldelim    = \left . ,
            outer-Rdelim    = \right |,
            sub-nudge       = 0 mu 
          }
      ]{diffcoeff}
\end{verbatim}
will overwrite the built-in 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{.} If using
the package option \verb`DIF` and employing commands within the \emph{key=value}
list from the \texttt{mleftright} package, you will need to explicitly
load that package before the call to \texttt{diffcoeff}. (This issue
does not affect use of the file \texttt{diffcoeff.DIF}.)

If both methods of changing the template \verb`DIF` are employed,
the order of use is, first, read and act on the file \texttt{diffcoeff.DIF},
then read and act on the package option \verb`DIF`. (In other words,
to avoid complicating the preamble, preferably use the file \texttt{diffcoeff.DIF};
use the package option \verb`DIF` only for fine-tuning -- perhaps
a setting specific to that particular document.)

\subsection{Other notations}

\label{subsec:Other-notations}The \texttt{diffcoeff} package is about
defining \emph{derivatives} but it is worth observing that other notations
can be built from the \texttt{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\cdots\otimes`
displaying as $\otimes\cdots\otimes$. The critical key is \verb`slash-tok`,
with possible extra spacing on either side through the key \verb`slash-sep`.
Or, one may want to void the \verb`op-symbol` key by giving it an
empty value or do something like \verb`op-symbol=\mathbf`, or give
\verb`outer-Ldelim`, \verb`outer-Rdelim` special values, e.g.,\verb`\langle`,
\verb`\rvert`.

In the file \texttt{diffcoeff5.def} I have included the following
definition, in order to mimic the \verb`\Braket` command of the \verb`braket`
package,
\begin{verbatim}
    \difdef{ s }{ bk }
      {
        slash-tok = ,
        op-symbol = ,
        multi-term-sep = 3mu\middle|\mskip3mu ,
        outer-Ldelim = \left\langle ,
        outer-Rdelim = \right\rangle
      }
\end{verbatim}
and supplemented it with the definition:
\begin{verbatim}
    \NewDocumentCommand \Braket { m }
      { \difs.bk.<\negmu>{}{#1}[] }
\end{verbatim}
Testing the new command, \verb`\Braket`, gives this display:
\begin{example}
\verb`\[ \Braket{\phi,\diffp[2]{}t,\psi} \]` $\Longrightarrow$ \[\Braket{\phi,\diffp[2]{}t,\psi} \]
\end{example}

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).

\chapter{Differentials and jacobians}

\label{chap:Differentials-and-jacobians}In addition to the six derivative
commands, \verb`\difx` and \verb`\difxp`,  the \texttt{diffcoeff}
package has two further commands, \verb`\dl` (also \verb`\difl`)
and \verb`\jacob` (also \verb`\difj`), 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.

\section{Differentials}

\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 in integrals, like $\int\sin x\dl x$, or multi-variable integrals
like 
\[
\iiintop^{\infty}_{-\infty}V(x,y,z)\dl{x,y,z},
\]
or, with subscripted variables, rendered more cryptically as
\[
\iiintop^{\infty}_{-\infty}V(x_{1},x_{2},x_{3})\dl[3]x,\text{ or }\iiintop^{\infty}_{-\infty}V(x_{1},x_{2},x_{3})\dl.dn.[3]x.
\]
They also occur in differential geometry and elsewhere in the form
of line elements like 
\begin{example}
$\dl.+.{x,y,z}^2$ \quad{}and\quad{} $c^2\dl.-.{t,x,y,z}^2$.
\end{example}

Surely we want the `d's in these expressions to correspond to their
form (upright or math italic) in derivatives? 

To this end, \texttt{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{example}
\verb`$ \dl x $` $\Longrightarrow$ $ \dl x. $
\end{example}

\noindent (From version 5.4 of \texttt{diffcoeff}, following the pattern
of \verb`\diff`, \verb`\difs` and \verb`\difc`, the command \verb`\difl`
is also available: \verb`$ \difl x $` $\Longrightarrow$ $ \difl x $.)
To use the command before a multi-token variable of differentiation,
put the variable in braces:
\begin{example}
\verb`$ \dl{\vec{x}},\quad \dl{\mathbf{x}} $` $\Longrightarrow$
$ \dl{\vec{x}},\quad \dl{\mathbf{x}} $.
\end{example}

For the first triple integral above, writing the differentials required
not three but just the \emph{one} command:
\begin{example}
\verb`$ \dl{x,y,z} $` $\Longrightarrow$ $ \dl{x,y,z} $.
\end{example}

For the second triple integral, $\dl[3]x$ was just \verb`\dl[3]x`,
and for the third I used a dot-delimited argument producing a variant
form of the differential \verb`\dl.dn.[3]x` (which could be compacted
further into a macro if it were to be used often; see §\ref{subsec:Variant-differentials}
below).

To write the line elements I again made use of a variant form of the
differential (again see §\ref{subsec:Line-elements}):
\begin{example}
\verb`$ \dl.+.{x,y,z}^2 $` $\Longrightarrow$ $ \dl.+.{x,y,z}^2 $,

\verb`$ c^2\dl.-.{t,x,y,z}^2 $` $\Longrightarrow$ $ c^2\dl.-.{t,x,y,z}^2 $.
\end{example}


\subsection{Template \texttt{DIFL}}

\begin{wraptable}{o}{0.5\columnwidth}%

\centering{}\caption{\texttt{DIFL} defaults\label{tab:DIFL-defaults}}
\begin{center}
\begin{tabular}{lr}
\toprule 
{\small key} & {\small default}\tabularnewline
\midrule
{\small style} & {\small\texttt{dl}}\tabularnewline
{\small outer-Ldelim} & {\small\texttt{\textbackslash ,}}\tabularnewline
{\small outer-Rdelim} & \tabularnewline
\bottomrule
\end{tabular}
\par\end{center}\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:DIFL-defaults}. In
prior versions of \texttt{diffcoeff} the \verb`style` key was fixed
at the value \verb`dl`; from version 5.4 it can also take the value
\verb`d^`. With the default style \verb`dl`, \verb`$\dl[2]x$` $\Longrightarrow$
$\dl[2]x$; with style \verb`d^` the superscript attaches to the
`d', $\dl.dn.[3]x$. This form is sometimes used when abbreviating
the product of differentials in a multiple integral. The \verb`outer-Ldelim`
key inserts a thin space before the differential; the \verb`outer-Rdelim`
key does nothing. For the differential, both \verb`outer-Ldelim`
and \verb`outer-Rdelim` are \emph{always inserted}. This differs
from the derivative for which \verb`outer-Ldelim` and \verb`outer-Rdelim`
are inserted only if there is a trailing optional argument. It is
as if the differential command \verb`\dl` had a built-in empty trailing
optional argument.

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 §\ref{subsec:DIFL-(differential)}.

\subsection{Syntax and options}

\label{subsec:DifferentialsSyntaxOptions}If all arguments are present
the differential command has the syntax
\begin{verbatim}
    \dl.name.[order-spec]{variable(s)}^{exponent}
\end{verbatim}
where the arguments have the following significance:
\begin{enumerate}
\item \verb`name` (optional) A dot-delimited name to distinguish a variant
form (non-default form) of differential; see §\ref{subsec:Variant-differentials}
below.
\item \verb`order-spec` (optional) The power or comma-list 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,
§\ref{subsec:Mixed-partial-derivatives}. 
\item \verb`variable(s)` (mandatory) The variable or comma-list 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`order-spec`; see §\ref{subsec:Line-elements}
for examples of use.
\end{enumerate}
Only the third argument is mandatory, although it may be empty. As
with derivatives, the square-bracket delimited order spec. can be
replaced by colon-modified arguments in the variable specification:
\begin{example}
\verb`$ \dl[3]x,\quad \dl{x:3} $` $\Longrightarrow$ $ \dl[3]x,\quad \dl{x:3} $.
\end{example}


\subsection{Variant forms of differential}

\label{subsec:Variant-differentials}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 }
      { op-symbol = \partial }
\end{verbatim}
In fact just this definition can be found in the file \texttt{diffcoeff5.def},
so that
\begin{example}
\verb`$ \dl.p.x $` $\Longrightarrow$ $\dl.p.x$
\end{example}

\noindent which is seven keystrokes in all versus ten (space included)
for \verb`\partial x`. Defining \verb`\dlp` by writing
\begin{example}
\verb`\NewDocumentCommand \dlp {} { \dl.p. }`.
\end{example}

\noindent saves another keystroke. This command can be found in the
file \texttt{diffcoeff5.def}. The command eases the writing of expressions
like $\!\dlp{x:3,y:2,z}$ -- perhaps in a document like the present
one to discuss the minutiae of spacing in the denominators of mixed
partial derivatives. 
\begin{example}
\verb`$\dlp[3,2]{x,y,z},\quad \dlp{x:3,y:2,z}$` $\Longrightarrow$
$\dlp[3,2]{x,y,z},\quad \dlp{x:3,y:2,z}$
\end{example}

\noindent As you can see from the example, just as for mixed partial
derivatives, if more than one variable is specified but the \verb`order-spec`
contains fewer than that number of entries, \texttt{diffcoeff} assumes
the missing entries on the right of the \verb`order-spec` are \verb`1`. 

A second example of a variant form of differential is provided by
the definition
\begin{verbatim}
   \difdef { l } { b }
      { op-symbol = \mathrm{d}\mathbf }
\end{verbatim}
which can be found in the file \texttt{diffcoeff5.def}. If you distinguish
vectors by boldface type then you can avoid the repetitive writing
of \verb`\mathbf` for differentials of vectors by using the variant
form \verb`\dl.b.`:
\begin{example}
\verb`$ \dl.b.x,\quad \dl.b.{x,y,z} $` $\Longrightarrow$ $ \dl.b.x ,\quad \dl.b.{x,y,z} $.
\end{example}

A third example is of a differential raised to a power in which the
superscript is attached to the \verb`d`, as provided by the definition
\begin{verbatim}
    \difdef { l } { dn } { style = d^ }
\end{verbatim}
I have added this definition to the file \texttt{diffcoeff5.def}.
With this definition
\begin{verbatim}
   \[ \iiintop_{-\infty}^{\infty}
        V(x_{1},x_{2},x_{3})\dl.dn.[3]x. \]
\end{verbatim}
$\Longrightarrow$ \[ \iiintop_{-\infty}^{\infty}
   V(x_{1},x_{2},x_{3})\dl.dn.[3]x. \]If you are going to need this form of differential often, you could
save some keystrokes with a macro definition like
\begin{example}
\verb`\NewDocumentCommand \dn { m m } { \dl.dn.[#1] #2 }`
\end{example}

\noindent which I have added to the preamble of the current document.
Then to obtain $\dn2x$ one writes \verb`\dn2x`. (But note that to
obtain $\!\dn1x$ with no superscript means reverting to \verb`\dl x`
or remembering the \verb`1` when writing \verb`\dn1x`.) 

\subsubsection{Line elements}

\label{subsec:Line-elements}Variant forms can be used to write line
elements of Pythagorean or Minkowskian form. The definition
\begin{verbatim}
    \difdef { l } { + }
      {
        multi-term-sep  = 0 mu +,
        term-sep-adjust = 0 mu  ,
        outer-Ldelim      =
      }
\end{verbatim}
which can be found in the file \texttt{diffcoeff5.def}, inserts a
\verb`+` sign between terms in the variable specification. Note that
the value of the \verb`multi-term-sep` key begins with \verb`0 mu`.
A dimension here \emph{initially} is essential. The intriguing feature
of the definition is what follows the \verb`0 mu`: a \verb`+` sign.
Also note that the thin space inserted by default before a differential
by means of the \verb`outer-Ldelim` setting is now removed. 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{example}
\verb`$ \dl.+.{x,y,z}^2 $` $\Longrightarrow$ $ \dl.+.{x,y,z}^2 $.
\end{example}

\noindent 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.

Similarly, the file \texttt{diffcoeff5.def} contains a definition
where the plus sign is replaced by a minus. This enables the writing
of a Minkowski metric:
\begin{example}
\verb`$ c^2\dl.-.{t,x,y,z}^2 $` $\Longrightarrow$ $ c^2\dl.-.{t,x,y,z}^2 $.
\end{example}


\subsection{Changing defaults}

To change the \emph{default} values of the \verb`DIFL` template use
the \verb`\difdef` command but, as with derivatives, leave its second
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 } {} { outer-Ldelim = \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 } {} 
      { outer-Ldelim = \mskip 3muplus1muminus2mu }
\end{verbatim}
The crucial point is to leave the second argument of \verb`\difdef`,
the variant \verb`name`, empty. That changes the \emph{default} values
in \verb`DIFL` of the keys listed in the third argument of \verb`\difdef`.

\subsection{Rationale}

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}

\section{Jacobians}

\label{subsec:Jacobians}\texttt{diffcoeff} provides a command {\ttfamily\verb`\jacob`}
for writing jacobians -- not the determinant as such but the symbol
conventionally used to denote the determinant. (From version 5.4 of
\texttt{diffcoeff}, the equivalent command \verb`\difj` is also available
for this purpose.) For example
\begin{example}
\verb`\[ \jacob{u,v}{x,y},\quad \jacob{u,v,w}{x,y,z}. \]` $\Longrightarrow$
\[ \jacob{u,v}{x,y},\quad \jacob{u,v,w}{x,y,z}. \]
\end{example}

\begin{wraptable}{o}{0.4\columnwidth}%
\centering{}\caption{\texttt{DIFJ} defaults\label{tab:DIFJ-defaults}}
\begin{center}
\begin{tabular}{lr}
\toprule 
{\small key} & {\small default}\tabularnewline
\midrule
{\small op-symbol} & {\small\texttt{\textbackslash partial}}\tabularnewline
{\small outer-Ldelim} & \tabularnewline
{\small outer-Rdelim} & \tabularnewline
\bottomrule
\end{tabular}
\par\end{center}\end{wraptable}%
The comma lists can contain any number of variables, even one or none,
nor need the number of variables in numerator and denominator be equal.
\verb`\jacob` does \emph{not} check such things. (It may be possible
to exploit this fact when defining variant forms of jacobian.) The
content of the variable lists in both numerator and denominator of
a jacobian are used exactly as entered by you. That means that if
you wish to include dots in the variable lists then you need to include
(e.g.) \verb`\ldots` explicitly yourself -- entering three dots
as in other \texttt{diffcoeff} commands will simply give you three
dots in the output. It is fair to say that -- as of version 5.6 --
the jacobian is not \emph{fully} integrated into the \texttt{diffcoeff}
scheme, although it is still (partly) configurable.

\subsection{Template \texttt{DIFJ}}

The command \verb`\jacob` (also \verb`\difj`) 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:DIFJ-defaults}. Note
that the keys \verb`outer-Ldelim` and \verb`outer-Rdelim` 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:DIFJ-defaults} is because
many keys are irrelevant for forming jacobians -- it doesn't matter
what their  values are. For a list of \emph{relevant} keys -- ones
that have some effect on the appearance of a jacobian -- see §\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 dot-delimited 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, slash-fraction form then once again
the \verb`\difdef` command is used. The file \texttt{diffcoeff5.def}
contains the definition
\begin{verbatim}
    \difdef { j } { / } { style = / }
\end{verbatim}
To access this style, use the name -- which is at your discretion
but here I have chosen \verb`/` -- between dots after the \verb`\jacob`
command:
\begin{example}
\verb`$ \jacob./.{u,v,w}{x,y,z} $` $\Longrightarrow$ $ \jacob./.{u,v,w}{x,y,z}. $
\end{example}

\noindent Or you might want an inline split-level jacobian, available
from version 5.5 of \texttt{diffcoeff}, with the definition
\begin{verbatim}
    \difdef { j } { s } { style = sfrac }
\end{verbatim}
(to be found in \texttt{diffcoeff5.def}). With this definition 
\begin{example}
\verb`$ \jacob.s.{u,v,w}{x,y,z} $` $\Longrightarrow$ $ \jacob.s.{u,v,w}{x,y,z} $.
\end{example}

If you want to change the operator symbol from \verb`\partial` to
math-italic \verb`D`, as I have seen used, then the definition is:
\begin{verbatim}
    \difdef { j } { D } { op-symbol = 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{example}
\verb`\[ \jacob.D.{u,v,w}{x,y,z} \]` $\Longrightarrow$ \[ \jacob.D.{u,v,w}{x,y,z}.\]
\end{example}

If you want square brackets rather than parentheses around the variable
lists, then \verb`lvwrap-Ldelim` and \verb`lvwrap-Rdelim` (perhaps
not intuitively) are the keys to change: 
\begin{verbatim}
    \difdef { j } { [ } 
      { 
        lvwrap-Ldelim = \onemu\mleft [,
        lvwrap-Rdelim = \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{example}
\verb`\[ \jacob.[.{u,v,w}{x,y,z} \]` $\Longrightarrow$ \[ \jacob.[.{u,v,w}{x,y,z}. \]
\end{example}


\subsection{Changing defaults}

To change \emph{default} values of the \verb`DIFJ` template leave
the second argument of the \verb`\difdef` command -- the variant
\verb`name` -- empty. For instance, if you want split-level to be
your default setting, the \verb`\difdef` command would be 
\begin{verbatim}
    \difdef { j } {} { style = sfrac }
\end{verbatim}
The only difference from the definition shown earlier is the absence
of the name from the now empty second argument. 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.s.{u,v,w}{x,y,z}`.

\chapter{Reference}

\label{chap:Reference}For convenience I list here the commands of
\texttt{diffcoeff}, the template defaults, and the files and preamble
definitions associated with this document.

\section{Commands}

\subsection{Derivatives}

\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 upright-fraction, slash-fraction
and compact forms respectively. With all arguments present the syntax
is
\begin{verbatim}
    \difx.name.**[order-spec]<override>{variable(s)}
        {differentiand}[pt of eval]
\end{verbatim}
The syntax is identical for \verb`\difxp`. The eight arguments have
the following meanings:
\begin{enumerate}
\item \verb`name` (optional) A dot-delimited name to distinguish a variant
form (non-default form) of derivative; see §\ref{chap:Templates-defaults-variants}
and specifically §\ref{sec:Variant-forms}.
\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 slash-fraction form derivative; no
effect for compact-form derivatives unless (see next) a second \verb`*`
is present; see §\ref{subsec:Appending-the-differentiand}.
\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 §\ref{subsec:Transposing-the-argument}.
\item \verb`order-spec` (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 §\ref{subsec:Higher-order-derivatives}
and §\ref{subsec:Mixed-partial-derivatives}. Not necessary if orders
are specified with the colon notation in the variable list, §§\ref{subsec:Colon-notation} and \ref{subsec:AlgebraicOrders-ColonNotation}.
\item \verb`override` (optional) Specifies the total order of differentiation
when it cannot be calculated by \texttt{diffcoeff}, or is wanted in
a different form from the calculated value; see §\ref{subsec:Order-override-command}.
\item \verb`differentiand/derivand` (mandatory) The function or expression
being differentiated.
\item \verb`variable(s)` (mandatory) The variable of differentiation or
a comma list of variables of differentiation (for a mixed partial
derivative); also, with the colon notation (see §§\ref{subsec:Colon-notation},
\ref{subsec:AlgebraicOrders-ColonNotation}), provides an alternative
method of specifying orders of differentiation.
\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 §\ref{subsec:Point-of-evaluation}.
\end{enumerate}
Both mandatory arguments may be empty, but require empty brace pairs
to indicate as much. (Omitting the differentiand makes sense for all
forms of derivative, \verb`\difx`, \verb`\difxp`, but omitting the
variable or variables of differentiation is sensible only for the
compact forms, \verb`\difc`, \verb`\difcp` -- see §\ref{subsec:variantCompact=002013forms}.)

\subsection{Differential}
\begin{description}
\item [{\texttt{\textbackslash dl}}] (also \verb`\difl`) differential.
If all arguments are present the differential command has the syntax
\end{description}
\begin{verbatim}
    \dl.name.[order-spec]{variable(s)}^{exponent}
\end{verbatim}
where the arguments have the following significance:
\begin{enumerate}
\item \verb`name` (optional) A dot-delimited name to distinguish a variant
form of differential; see §\ref{subsec:Variant-differentials}.
\item \verb`order-spec` (optional) The power or comma-list 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,
§\ref{subsec:Mixed-partial-derivatives}. Or, the alternative colon
notation can be used instead. 
\item \verb`variable(s)` (mandatory) The variable or comma-list 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`order-spec`; see §\ref{subsec:Line-elements}
for examples of use.
\end{enumerate}

\subsection{Jacobian}
\begin{description}
\item [{\texttt{\textbackslash jacob}}] (also \verb`\difj`) jacobian
with syntax
\end{description}
\begin{verbatim}
    \jacob.name. {numer} {denom}
\end{verbatim}
where the arguments have the following significance:
\begin{enumerate}
\item \verb`name` (optional) The dot-delimited 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}

\subsection{Supporting commands}
\begin{description}
\item [{\texttt{\textbackslash difdef}}] Means of defining variant forms
of derivatives, differentials and jacobians, with syntax 
\end{description}
\begin{verbatim}
    \difdef { id(s) } { name } { settings }
\end{verbatim}
The arguments are all mandatory and have the following significance
\begin{enumerate}
\item \verb`id(s)` Non-empty 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`#`; may be empty, in which case the \verb`{settings}`
determine (new) default values for the template(s) identified in \verb`{id(s)}`.
\item \verb`settings` Comma list of changed \emph{key=value} settings.
\end{enumerate}
\begin{description}
\item [{\texttt{\textbackslash difoverride}}] (see §\ref{subsec:Order-override-command})
order-override command (now deprecated in favour of the order-override
option) with syntax
\end{description}
\begin{verbatim}
    \difoverride { total order }
\end{verbatim}
where the one mandatory argument has the significance
\begin{enumerate}
\item \verb`total order` desired value of total order of differentiation;
may be (and generally is) empty.
\end{enumerate}

\subsubsection{Spacing commands}
\begin{description}
\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}
From version 5.5 of \texttt{diffcoeff}, each of these commands can
be starred to produce a space of opposite sign but the same magnitude,
e.g. \verb`\twomu*` gives a space of \verb`-2 mu`.

From version 5.5, \texttt{diffcoeff} also supports three commands
which switch on one of the \verb`spaced` package option values \emph{within
the current group}.
\begin{description}
\item [{\textbackslash\texttt{spacedone}}] is equivalent to \verb`spaced=1`
within the current group;
\item [{\texttt{\textbackslash spacednil}}] is equivalent to \verb`spaced=0`
within the current group;
\item [{\texttt{\textbackslash spacedneg}}] is equivalent to \verb`spaced=-1`
within the current group.
\end{description}

\subsection{Variant-form-derived commands}

Definitions in terms of variant forms of derivative:
\begin{description}
\item [{\texttt{\textbackslash difsfrac}}] split-level inline fraction,
§\ref{par:variant-sfrac-analogue},
\item [{\texttt{\textbackslash difccp}}] doubly compact derivative, §\ref{par:Doubly-compact-forms},
\item [{\texttt{\textbackslash Braket}}] bra-ket command (as used in quantum
mechanics), §\ref{subsec:Other-notations},
\item [{\texttt{\textbackslash dlp}}] partial derivative differential,
§\ref{subsec:Variant-differentials},
\item [{\texttt{\textbackslash dn}}] superscripted-`d' differential,
§\ref{subsec:Variant-differentials}.
\end{description}
All save the last can be found in the file \texttt{diffcoeff5.def},
§\ref{sec:The-file-diffcoeff5.def}.

\section{Templates}

The following lists record the default values of the templates used
by \texttt{diffcoeff}. For templates other than \verb`DIF`, 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,
    slash-tok        = /,
    slash-sep        = 0 mu,
    sfrac-scaling    = 0.7,
    derivand-sep     = 3 mu plus 1 mu minus 2 mu,
    op-symbol        = \mathrm{d},
    op-symbol-alt    = \KeyValue{ op-symbol },
    op-order-nudge   = 0 mu,
    op-sub-nudge     = 0 mu,
    var-sup-nudge    = 1 mu,
    multi-term-sep   = 2 mu plus 1 mu minus 1 mu,
    term-sep-adjust  = -1 mu,
    dots             = \cdots,
    long-var-wrap    = d(v),
    lvwrap-Ldelim    = \mleft (,
    lvwrap-Rdelim    = \mright ),
    lvwrap-sup-nudge = -2 mu,
    outer-Ldelim     = \left (,
    outer-Rdelim     = \right ),
    elbowroom        = 0 mu,
    sub-nudge        = -5 mu,
    difcc-var-ord    = ^{#1},
    *derivand-sep    = \KeyValue{ derivand-sep },
    *op-set-left     = false,
    *italic-nudge    = 0 mu,
    *inner-wrap      = false,
    *inner-Ldelim    = (,
    *inner-Rdelim    = ),
    *outer-Ldelim    = \big [,
    *outer-Rdelim    = \big ],
    *sub-nudge       = 0 mu
\end{verbatim}

\subsection{\texttt{DIFF} (upright-fraction derivative)}

\label{subsec:DIFF-(upright-fraction-derivative)}Relevant keys and
default values for template \verb`DIFF` (all values correspond to
the defaults in \verb`DIF`): 
\begin{verbatim}
    style            = frac,
    derivand-sep     = 3 mu plus 1 mu minus 2 mu,
    op-symbol        = \mathrm{d},
    op-symbol-alt    = \KeyValue { op-symbol },
    op-order-nudge   = 0 mu,
    var-sup-nudge    = 1 mu,
    multi-term-sep   = 2 mu plus 1 mu minus 1 mu,
    term-sep-adjust  = -1 mu,
    dots             = \cdots,
    long-var-wrap    = d(v),
    lvwrap-Ldelim    = \mleft (,
    lvwrap-Rdelim    = \mright ),
    lvwrap-sup-nudge = -2 mu,
    outer-Ldelim     = \left (,
    outer-Rdelim     = \right ),
    elbowroom        = 0 mu,
    sub-nudge        = -5 mu,
    *derivand-sep    = \KeyValue { derivand-sep },
    *op-set-left     = false,
    *italic-nudge    = 0 mu 
\end{verbatim}

\subsubsection{\texttt{DIFFP}}

\verb`DIFF` defaults as above with the following changes (a marginal
\verb`>>` indicates where a setting differs from that in \verb`DIFF`): 
\begin{verbatim}
>>  op-symbol        = \partial,
>>  op-order-nudge   = 1 mu,
>>  *italic-nudge    = 3 mu
\end{verbatim}

\subsection{\texttt{DIFS} (slash-fraction derivative)}

\label{subsec:DIFS-(slash-fraction-derivative)}Relevant keys and
default values for template \verb`DIFS` (a marginal \verb`>` indicates
where a setting differs from that in \verb`DIF`): 
\begin{verbatim}
>   style            = /,
    slash-tok        = /,
    slash-sep        = 0 mu,
    sfrac-scaling    = 0.7,
>   derivand-sep     = 2 mu plus 1 mu minus 1 mu,
    op-symbol        = \mathrm{d},
    op-symbol-alt    = \KeyValue { op-symbol },
    op-order-nudge   = 0 mu,
    var-sup-nudge    = 1 mu,
    multi-term-sep   = 2 mu plus 1 mu minus 1 mu,
    term-sep-adjust  = -1 mu,
>   dots             = \ldots,
    long-var-wrap    = d(v),
    lvwrap-Ldelim    = \mleft (,
    lvwrap-Rdelim    = \mright ),
    lvwrap-sup-nudge = -2 mu,
>   outer-Ldelim     = (,
>   outer-Rdelim     = ),
    elbowroom        = 0 mu,
>   sub-nudge        = 0 mu,
    *derivand-sep    = \KeyValue { derivand-sep },
>   *inner-wrap      = true, 
    *inner-Ldelim    = (,
    *inner-Rdelim    = ),
    *outer-Ldelim    = \big [,
    *outer-Rdelim    = \big ],
    *sub-nudge       = 0 mu
\end{verbatim}

\subsubsection{\texttt{DIFSP}}

\verb`DIFS` defaults as above with the following changes (a marginal
\verb`>>` indicates where a setting differs from that in \verb`DIFS`):
\begin{verbatim}
>>  op-symbol        = \partial,
>>  op-order-nudge   = 1 mu 
\end{verbatim}

\subsection{\texttt{DIFC} (compact derivative)}

\label{subsec:DIFC-(compact-derivative)}Relevant keys and default
values for template \verb`DIFC` (a marginal \verb`>` indicates where
a setting differs from that in \verb`DIF`): 
\begin{verbatim}
>   style            = _ ,
>   derivand-sep     = 1 mu plus 1 mu minus 1 mu,
    op-symbol        = \mathrm{d},
    op-order-nudge   = 0 mu,
    op-sub-nudge     = 0 mu,
>   multi-term-sep   = 1 mu,
>   term-sep-adjust  = 0 mu,
>   dots             = \ldots,
>   outer-Ldelim     = \bigl (,
>   outer-Rdelim     = \bigr ),
    elbowroom        = 0 mu,
>   sub-nudge        = -2 mu,
    *derivand-sep    = \KeyValue { derivand-sep }
\end{verbatim}

\subsubsection{\texttt{DIFCP}}

\verb`DIFC` defaults as above with these changes (a marginal \verb`>>`
indicates where a setting differs from that in \verb`DIFC`):
\begin{verbatim}
>>  op-symbol        = \partial,
>>  op-order-nudge   = 1 mu 
\end{verbatim}

\subsection{\texttt{DIFL} (differential)}

\label{subsec:DIFL-(differential)}Relevant keys and default values
for template \verb`DIFL` (a marginal \verb`>` indicates where a
setting differs from that in \verb`DIF`): 
\begin{verbatim}
    op-symbol        = \mathrm{d},
    op-order-nudge   = 0 mu,
    var-sup-nudge    = 1 mu,
    multi-term-sep   = 2 mu plus 1 mu minus 1 mu,
    term-sep-adjust  = -1 mu,
>   long-var-wrap    = dv,
    lvwrap-Ldelim    = \mleft (,
    lvwrap-Rdelim    = \mright ),
    lvwrap-sup-nudge = -2 mu,
>   outer-Ldelim     = \, ,
>   outer-Rdelim     = ,
    elbowroom        = 0 mu
\end{verbatim}

\subsection{\texttt{DIFJ} (jacobian)}

\label{subsec:DIFJ-(jacobian)}Relevant keys and default values for
template \verb`DIFJ` (a marginal \verb`>` indicates where a setting
differs from that in \verb`DIF`): 
\begin{verbatim}
    style            = frac,
    slash-tok        = /,
    slash-sep        = 0 mu,
    sfrac-scaling    = 0.7,
>   op-symbol        = \partial,
    op-symbol-alt    = \KeyValue{ op-symbol },
    lvwrap-Ldelim    = \mleft (,
    lvwrap-Rdelim    = \mright ),
>   outer-Ldelim     = ,
>   outer-Rdelim     = ,
    elbowroom        = 0 mu ,
    *op-set-left     = false,
    *italic-nudge    = 0 mu 
\end{verbatim}

\section{The file \texttt{diffcoeff5.def}}

\label{sec:The-file-diffcoeff5.def}
\begin{verbatim}
% file `diffcoeff5.def'
% definitions for variant forms
% 2025/10/01
% Andrew Parsloe ajparsloe@gmail.com
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% material derivative
\difdef { f, s } { D }
  { op-symbol = \mathrm{D} }
% math italic
\difdef { f, s, c } { d' } 
  {
    op-symbol      = d,
    op-order-nudge = 1 mu,
    *slash-sep    = { 0 mu, -1 mu }
  }
\difdef { f, s, c } { D' } 
  {
    op-symbol  = D,
    op-order-nudge = 1 mu,
    *slash-sep    = -1 mu
  }
% Greek 
\difdef { f, s } { gd }
  { op-symbol = \delta }
\difdef { f, s } { gD }
  { op-symbol = \Delta }
% nabla, tensor calc. acceleration
\difdef { f, s } { n } 
  {
    op-symbol     = \nabla,
    op-symbol-alt = \mathrm{d},
    *slash-sep    = { -2mu, 0mu }
  }
% tfrac, nonscalable
\difdef { f, fp } { t }
  {
    style             = tfrac  ,
    derivand-sep      = 1 mu plus 1 mu minus 1 mu,
    multi-term-sep    = 0 mu   ,
    term-sep-adjust   = 0 mu   ,
    lvwrap-sup-nudge  = 0 mu   ,
    outer-Ldelim      = \bigl (,
    outer-Rdelim      = \bigr ),
    elbowroom         = -2 mu  ,
    sub-nudge         = -3 mu
  }
% pt of eval., sq. bracket
\difdef { f, fp, s, sp } { ] } 
  {
    outer-Ldelim = \left [ ,
    outer-Rdelim = \right ],
    elbowroom    = 1 mu,
    sub-nudge    = 0 mu
  }
% long var wrap
\difdef { f, fp } { (dv) } 
  { long-var-wrap = (dv) }
\difdef { f, fp } { dv } 
  { long-var-wrap = dv }
\difdef { f, fp } { dv_ } 
  { 
    long-var-wrap = dv,
    var-sup-nudge = -2 mu
  }
%%%%%%%%%% slash fraction %%%%%%%%%%
% sfrac split-level
\difdef { s, sp } { s }
  {
    style             = sfrac,
    slash-sep         = { -2 mu, -1 mu },
    derivand-sep      = 0 mu ,
    multi-term-sep    = 0 mu ,
    term-sep-adjust   = 0 mu ,
    var-sup-nudge     = 0 mu ,
    lvwrap-sup-nudge  = 0 mu
  }
\difdef { s } { s } { *slash-sep = { -1 mu, -1 mu } }
% sfrac, no op symbols
\NewDocumentCommand \difsfrac { O{-2mu,-1mu} m m } 
  {{ 
    \difdef { s } { s } { op-symbol=, slash-sep={#1} }
    \difs.s.{#2}{#3}
  }}
% \NewDocumentCommand \difsfrac { D[,{-2} D-]{1} m m } 
  % {{ 
    % \difdef{s}{s}{op-symbol=,slash-sep={#1mu,-#2mu} }
    % \difs.s.{#3}{#4}
  % }}
% slash frac: 0=scalable, 1=big, 
% % 2=Big, 3=bigg, 4=Bigg but > 1
% generally gives eyesores
\difdef { s, sp } { 0 }
  {
    style         = auto     ,
    outer-Ldelim  = \left [  ,
    outer-Rdelim  = \right ] ,
    sub-nudge     = 0 mu     ,
    *inner-Ldelim = \mleft ( ,
    *inner-Rdelim = \mright ),
    *outer-Ldelim = \left [  ,
    *outer-Rdelim = \right ]
  }
\difdef { s, sp } { 1 }
  {
    style          =  big   ,
    outer-Ldelim   = \bigl (,
    outer-Rdelim   = \bigr ),
    sub-nudge      = -2 mu  ,
    *inner-wrap    = true   ,
    *inner-Ldelim  = \bigl (,
    *inner-Rdelim  = \bigr ),
    *outer-Ldelim  = \bigl [,
    *outer-Rdelim  = \bigr ]
  }
% \cdots generic slash fraction
\difdef { s, sp } { cd } { dots = \cdots }
% pt of eval -- pipe
\difdef { f, fp, s, sp } { | } 
  {
    outer-Ldelim = \left . ,
    outer-Rdelim = \right |,
    sub-nudge    = 0 mu
  }
%%%%%%%%%% compact %%%%%%%%%%
% D operator
\difdef { c } { D }
  { 
    op-symbol    = \mathrm{D}, 
    op-sub-nudge = -2 mu
  }
\difdef { c } { D' }
  { 
    op-symbol    = D, 
    op-sub-nudge = -2 mu
  }
% bold
\difdef { c } { bD } 
  { 
    op-symbol    = \mathbf{D}, 
    op-sub-nudge = -2 mu
  }
% differential style
\difdef { c, cp } { dl } 
  { 
    style           = dl,
    multi-term-sep  = 1 mu,
    term-sep-adjust = -1 mu
  }
% attach superscript to the d
\difdef { c, cp } { d^ } 
  { 
    style           = d^,
    multi-term-sep  = 1 mu,
    term-sep-adjust = -1 mu
  }
% doubly compact
\difdef { cp } { cc } 
  {
    style           =  cc  ,
    op-order-nudge  =  1 mu,
    multi-term-sep  =  0 mu,
    term-sep-adjust = -1 mu,
    var-sup-nudge   =  0 mu
  }
% \difdef { cp } { cc } { difcc-var-ord = ##1 }
% \difdef { cp } { cc } { difcc-var-ord = :##1 }
% \difdef { cp } { cc } { difcc-var-ord = \mathbf{##1} }
\NewDocumentCommand \difccp { s s O{1}} 
  { 
    \IfBooleanTF #1 
      { \difcp.cc.**[#3]<1> } 
      { \difcp.cc.[#3]<1> } 
  }
%%%%%%%%%% differentials %%%%%%%%%%
% partial
\difdef { l } { p } { op-symbol = \partial }
\NewDocumentCommand \dlp {} { \dl.p. }
% bold variable
\difdef { l } { b }
  { op-symbol = \mathrm{d}\mathbf }
% d^n x
\difdef { l } { dn }{ style = d^ }
% line element: Pythagoras
\difdef { l } { + }
  {
    multi-term-sep  = 0 mu +,
    term-sep-adjust = 0 mu  ,
    outer-Ldelim    =
  }
% line element: Minkowski
\difdef { l } { - }
  {
    multi-term-sep  = 0 mu -,
    term-sep-adjust = 0 mu  ,
    outer-Ldelim    =
  }
%%%%%%%%%% jacobian %%%%%%%%%%
% slash fraction
\difdef { j } { / } { style = / }
% split level
\difdef { j } { s } { style = sfrac }
%%%%%%%%%% \Braket %%%%%%%%%%
\difdef{ s }{ bk }
  {
      slash-tok = ,
      op-symbol =  ,
      multi-term-sep = 3mu\middle|\mskip3mu ,
      outer-Ldelim=\left\langle ,
      outer-Rdelim=\right\rangle
  }
\NewDocumentCommand \Braket { m }
  {	\difs.bk.<\negmu>{}{#1}[] }
\end{verbatim}

\section{Preamble definitions}

\label{sec:Preamble-definitions}The preamble to the present document
contains the command
\begin{verbatim}
\usepackage[def-file=<path to>/diffcoeff5,%
            spaced=-1]{diffcoeff}
\end{verbatim}
where \verb`<path to>` is the path on my computer (beginning \verb`E:/`),
and definitions:
\begin{verbatim}
% no sub nudge (a sea of white space)
\difdef { f, fp } { wsp }
  { sub-nudge = 0 mu }
% align op left; no italic nudge
\difdef { f,fp } { left0 }
  {
    *op-set-left  = true,
    *italic-nudge = 0 mu
  }
% align op left; italic nudge
\difdef { f,fp } { left }
  { *op-set-left  = true }
% partial variant of \diff
\difdef { f } { p }
  {
    op-symbol      = \partial,
    op-order-nudge = 1 mu
  }
% partial, 3mu sep of terms
\difdef { fp, sp } { 3mu }
  {  multi-term-sep  = 3 mu }
% partial, compact, -2 mu subscr. var. adjustment
\difdef { cp } { 2 } { term-sep-adjust = -2 mu }
% partial, use \ldots
\difdef { fp } { ld } { dots = \!\ldots }
% differential d^n x
\NewDocumentCommand \dn { m m } { \dl.dn.[#1] #2 }
% D jacobian
\difdef { j } { D }
  { op-symbol = D }
% square bracket jabobian
\difdef { j } { [ }
  {
    lvwrap-Ldelim = \onemu\mleft [,
    lvwrap-Rdelim = \mright ]
  }
\end{verbatim}

\section{Version history}

Version 5 was conceived as a new package (under the name \verb`diffcoefx`)
and only at the end, after discussion with CTAN maintainers, changed
to version 5.0 of \texttt{diffcoeff}. 
\begin{enumerate}
\item Version 5.0 (2023-01-02) of \texttt{diffcoeff}
\begin{enumerate}
\item splits the \verb`\diff` command of version 4 into three pairs of
commands: \verb`\diff` and \verb`\diffp` for upright-fraction derivatives;
\verb`\difs` and \verb`difsp` for slash-fraction derivatives, and
\verb`\difc` and \verb`\difcp` for `compact form' derivatives;
\item replaces the order-override option by a new command \verb`\difoverride`
(to avoid cluttering formulas with a second square-bracket delimited
optional argument before the differentiand);
\item adds a second star option to reverse the order of differentiand and
variable(s) of differentiation when the differentiand is appended;
\item replaces the two-argument \verb`\diffdef` command of earlier versions
with the three-argument command \verb`\difdef` command, 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;
\item rewrites the differential command \verb`\dl` which is now template-configurable
(e.g. allowing easy writing of line elements like $\dl.+.{x,y,z}^{2}$);
\item rewrites the jacobian command \verb`\jacob` which is now template-configurable;
\item uses ISO defaults;
\item includes version conflict messages.
\end{enumerate}
\item Version 5.1 (2023-01-16)
\begin{enumerate}
\item adds a now-redundant \verb`ISO` package option and related version
conflict message;
\item makes some corresponding tweaks to documentation (including this version
5 history).
\end{enumerate}
\item Version 5.2 (2023-01-24)
\begin{enumerate}
\item Simplifies the treatment of the empty argument of an absent differentiation
variable;
\item initializes (clears) two sequence variables that otherwise caused
error when \verb`scrbook` class was used;
\item amends documentation.
\end{enumerate}
\item Version 5.3 (2023-04-10)
\begin{enumerate}
\item Fixes a bug when \verb`\dl` was used in a particular way in \texttt{beamer}
(e.g. \verb`\[\alert{\dl x}\]`). 
\item Provides an alternative method of specifying orders of differentiation
by means of colon separators in the variable argument.
\item Reinstates (from v.4) the order-override option as an alternative
to \verb`\difoverride` but now angle-bracket delimited.
\end{enumerate}
\item Version 5.4 (2023-11-08)
\begin{enumerate}
\item Adjusts both code and documentation about the differential to enable
forms like $\!\dn3x$ (sometimes used in multiple integrals).
\end{enumerate}
\item Version 5.5 (2025-10-01)
\begin{enumerate}
\item Adds the ability to write a generic mixed partial derivative (e.g.
$\difsp<n>y{x_{1},...,x_{n}}$) in $n$ variables in a natural way
by entering 3 dots between commas in the variable list; adds an associated
key \verb`dots`.
\item Adds the option of a split-level slash-fraction form derivative (like
\verb`\sfrac` of the \verb`xfrac` package), an associated key \verb`sfrac-scaling`,
and an adjustment to the key \verb`slash-sep`.
\item Adds the option of a `doubly compact' form of compact derivative
and an associated key \verb`difcc-var-ord`.
\item Adds the key \verb`op-sub-nudge` to adjust the position of the subscript
in a compact form derivative (e.g. for an operator like \verb`\nabla`).
\item Adds a package option \verb`dif**` making permanent the double star
option (reversing the order of the derivand and differentiation variable(s)
arguments) for specified derivatives (like \verb`\difc`, \verb`\difcp`).
\item Fixes a bug when using colon notation to indicate an order of differentiation
when either the variable or the order is multi-character.
\item Adds to the documentation and corrects a few typos.
\end{enumerate}
\item Version 5.6 (2025-12-10)
\begin{enumerate}
\item Resolves an error arising if version 5.5 is used at the same time
as a package still using \texttt{xtemplate}.
\end{enumerate}
\end{enumerate}

\end{document}
