% \iffalse meta-comment
% File: thermodynamics.dtx Copyright (C) 2022-2024 Karl D. Hammond
%
% Karl D. Hammond
% Chemical Engineering Program
% University of Missouri
% Contact: hammondkd@missouri.edu
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is K. D. Hammond.
%
% This work consists of the files thermodynamics.dtx and thermodynamics.ins
% and the derived files thermodynamics.sty, thermodynamics.pdf,
% thermodynamics-examples.tex, and thermodynamics-examples.pdf.
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{thermodynamics.dtx}
%</driver>
%
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\RequirePackage{expl3}
%<package>\ProvidesPackage{thermodynamics}
%<*package>
    [2024/06/14 v2.02 thermodynamics notation]
%</package>
%<*driver>
\documentclass[11pt,letterpaper]{ltxdoc}
%^^X\bool_set_false:N \l__codedoc_allow_indexing_bool
\usepackage[margin=0.80in,left=2.05in]{geometry}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{pxfonts}
\usepackage{array}
\usepackage{booktabs}
\usepackage{footmisc}
\usepackage{pdflscape}
\usepackage{supertabular}
\usepackage{graphicx} %^^A for \reflectbox
\usepackage{xcolor}
\usepackage[labelfont=bf,labelsep=period,font=small]{caption}
\usepackage{emf}
\GetFileInfo{thermodynamics.dtx}
\usepackage{thermodynamics}[\filedate\space\fileversion]
\DeclareMathAlphabet{\mathdutchcal}{U}{dutchcal}{m}{n}
\DisableCrossrefs
\CodelineIndex
\PageIndex
\CodelineNumbered
\RecordChanges
%^^X\OnlyDescription
%^^X Preparing to use l3doc.cls, but it's not quite mature yet....
%^^A\DisableDocumentation
%^^A\DisableImplementation
%^^X\ExplSyntaxOff
\let\tn\cs
\let\env\texttt
\let\pkg\textsf
\IndexPrologue{\section*{Index}%
                 \markboth{Index}{Index}%
                 Numbers written in italics refer to the page
                 where the corresponding entry is described;
                 numbers underlined refer to the
                 %^^A\ifcodeline@index
                   code line of the
                 %^^A\fi
                 definition.%^^A; numbers in Roman refer to the
                 %^^A\ifcodeline@index
                 %^^A  code lines
                 %^^A\else
                 %^^A  pages
                 %^^A\fi
                 %^^Awhere the entry is used.
                 }
\makeatother
\begin{document}
  \DocInput{thermodynamics.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{3537}
%
% \CharacterTable
% {Upper-case   \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%  Lower-case   \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%  Digits       \0\1\2\3\4\5\6\7\8\9
%  Exclamation     \!      Double quote    \"      Hash (number)   \#
%  Dollar          \$      Percent         \%      Ampersand       \&
%  Acute accent    \'      Left paren      \(      Right paren     \)
%  Asterisk        \*      Plus            \+      Comma           \,
%  Minus           \-      Point           \.      Solidus         \/
%  Colon           \:      Semicolon       \;      Less than       \<
%  Equals          \=      Greater than    \>      Question mark   \?
%  Commercial at   \@      Left bracket    \[      Backslash       \\
%  Right bracket   \]      Circumflex      \^      Underscore      \_
%  Grave accent    \`      Left brace      \{      Vertical bar    \|
%  Right brace     \}      Tilde           \~}
%
% \changes{v1.00}{2022/04/29}{Initial public release}
% \changes{v2.00}{2023/11/16}{Revision to use \LaTeX3
%       (\pkg{expl3}/\pkg{xparse}) syntax layer.}
%
% \newcommand*{\setmarginparsize}[1]
% {\bgroup
% \RenewExpandableDocumentCommand{\MacroFont}{}{\fontencoding\encodingdefault
%    \fontfamily\ttdefault
%    \fontseries\mddefault
%    \fontshape\shapedefault
%    #1}
% }
% \newcommand*{\restoremarginparsize}{\egroup}
%
% \GetFileInfo{thermodynamics.dtx}
%^^X \title{The \textsf{thermodynamics} package\thanks{This document
%^^X   corresponds to \textsf{thermodynamics}~\ExplFileVersion,
%^^X   dated \ExplFileDate.}}
% \title{The \textsf{thermodynamics} package\thanks{This document
%   corresponds to \textsf{thermodynamics}~\fileversion,
%   dated \filedate.}}
% \author{Karl D. Hammond \\ \texttt{hammondkd@missouri.edu}}
%^^X \date{\ExplFileDate}
% \date{\filedate}
% \maketitle
%
% \begin{abstract}
% A package, \textsf{thermodynamics}, is defined that makes typesetting
% quantities found in thermodynamics texts relatively simple. The commands are
% flexible and intended to be relatively intuitive. It handles several sets
% of notation for total, specific, and molar quantities; allows changes between
% symbols (e.g., $A$ vs.\ $F$ for Helmholtz free energy); and greatly
% simplifies the typesetting of symbols and partial derivatives commonly
% encountered in mixture thermodynamics. Changes of one's notes from one
% textbook to another can be achieved relatively easily by changing package
% options.
% \end{abstract}
%
%^^X \begin{documentation}
% \section{Introduction}
% The purpose of this package is to simplify the typesetting of equations in
% thermodynamics, particularly chemical engineering thermodynamics, which are
% often cumbersome to enter. For example, consider the following equation:
% \begin{equation}
%   d\Ut = \Partial*{\Ut}{\St}{\Vt,\allNs} \,d\St
%         + \Partial*{\Ut}{\Vt}{\St,\allNs} \,d\Vt
%         + \sumall_i \Partial*{\Ut}{\Nt_i}{\St,\Vt,\allNsbut{i}} d\Nt_i.
%   \label{eq:chain-rule-U}
% \end{equation}
% This equation is pretty basic, and equations like it occur all the time in
% thermodynamics. Without this package, you might typeset it like this:
% \begin{verbatim}
% \[ d\underline{U} =
%    \left(\frac{\partial\underline{U}}
%               {\partial\underline{S}}\right)_{\underline{V},\vec{n}}
%    d\underline{S}
%  + \left(\frac{\partial\underline{U}}
%               {\partial\underline{V}}\right)_{\underline{S},\vec{n}}
%    d\underline{V}
%  + \sum_{i=1}^C \left(\frac{\partial\underline{U}}
%       {\partial n_i}\right)_{\underline{S},\underline{V},n_{j\neq i}}
%    dn_i. \]
%\end{verbatim}
% This is a lot of code, and even then the output is slightly clunky:
% \[ d\underline{U} =
%     \left(\frac{\partial\underline{U}}
%                {\partial\underline{S}}\right)_{\underline{V},\vec{n}}
%     d\underline{S}
%   + \left(\frac{\partial\underline{U}}
%                {\partial\underline{V}}\right)_{\underline{S},\vec{n}}
%     d\underline{V}
%   + \sum_{i=1}^C \left(\frac{\partial\underline{U}}
%                {\partial n_i}\right)_{\underline{S},\underline{V},n_{j\neq i}}
%     dn_i.
% \]
% It is also frustratingly difficult to change one's notes or handouts from one
% textbook that uses, say, $n_1$ to denote moles of component 1 to another
% textbook that uses $N_1$ for the same quantity, or perhaps denotes the
% total internal energy as $U$ or $U^t$ rather than $\Ut$.
% For example, if you wanted it to be
% \[\begin{thermomolesrange}
%   \begin{thermoextensiveplain}
%   \RenewExpandableDocumentCommand{\Nt}{}{N}
%   \RenewExpandableDocumentCommand{\ncomponents}{}{\mathcal{C}}
%   d\Ut = \Partial*{\Ut}{\St}{\Vt,\allNs} \,d\St
%         + \Partial*{\Ut}{\Vt}{\St,\allNs} \,d\Vt
%         + \sumall_i \Partial*{\Ut}{\Nt_i}{\St,\Vt,\allNsbut{i}} d\Nt_i.
%   \end{thermoextensiveplain}
%   \end{thermomolesrange}
% \]
% without changing any of your code---to update it across all handouts, exams,
% and homework sets after changing textbooks, say---you would be out of luck
% (or in for a lot of work).
%
% With this package, you could reduce the code to typeset this equation to
% \begin{verbatim}
%  \begin{equation}
%     d\Ut = \Partial*{\Ut}{\St}{\Vt,\allNs} d\St
%       + \Partial*{\Ut}{\Vt}{\St,\allNs} d\Vt
%       + \sumall_i \Partial*{\Ut}{\Nt_i}{\St,\Vt,\allNsbut{i}} d\Nt_i
%  \end{equation}
%\end{verbatim}
% and it will render similarly to Equation~\eqref{eq:chain-rule-U}, including
% the shortened underscores and negative kerning.
% If you later decide to change the notation such that extensive properties are
% not underlined, you can do that without changing any of your code (just
% change a package option). Similarly, if you want $\vec{n}$ replaced by
% $n_1,\dots,n_C$, you can do that with a package option, too.
%
% The package handles second derivatives, too. For example,
% \begin{verbatim}
%  \[ \Partial*{\Hm}{T}{P} = T\Partial*{\Sm}{T}{P}
%                          = -T\PartialSecond*{\Gm}{T}{P} = \cP \]
%\end{verbatim}
% renders (using the default options)
%  \[ \Partial*{\Hm}{T}{P} = T\Partial*{\Sm}{T}{P}
%                          = -T\PartialSecond*{\Gm}{T}{P} = \cP. \]
% Similarly, macros are defined for mixed second partial derivatives that allow
% things like
% \begin{verbatim}
%  \[ \Partial*{\Gpm_i}{P}{T,\allNs}
%    = \PartialMixSecond*{\Gt}{P}{\Nt_i}{T,\allNsbut{i}}
%    = \PartialMixSecond*{\Gt}{\Nt_i}{P}{T,\allNsbut{i}}
%    = \Partial*{\Vt}{\Nt_i}{T,P,\allNsbut{i}} = \Vpm_i \],
%\end{verbatim}
% which renders
% \[ \Partial*{\Gpm_i}{P}{T,\allNs}
%   = \PartialMixSecond*{\Gt}{P}{\Nt_i}{T,\allNsbut{i}}
%   = \PartialMixSecond*{\Gt}{\Nt_i}{P}{T,\allNsbut{i}}
%   = \Partial*{\Vt}{\Nt_i}{T,P,\allNsbut{i}} = \Vpm_i
% \]
% using the defaults.
%
%^^A-------------------------------------------------------------------------
%
% \section{Using the Package} \label{sec:using}
% There are three categories of macros defined in this package: macros
% that produce symbols (or groups of them), macros that typeset derivatives,
% and macros that are used internally that the user need not know about.
% There are also several environments that allow the user to change notation
% temporarily.
%
% \subsection{Predefined Symbols}
% The macros used to produce symbols fall into five categories: extensive
% properties, molar properties, specific properties (i.e., per unit mass),
% partial molar properties, and shortcut macros (e.g., macros for the heat
% capacities, saturation pressure, and so forth). The macros corresponding to
% extensive, molar, and specific properties are shown in
% Table~\ref{table:symbols}. Examples using the enthalpy are
% \DescribeMacro{\Ht}
% \DescribeMacro{\Hm}
% \DescribeMacro{\Hs}
% \DescribeMacro{\Hpm}
% \begin{verbatim}
%   \[ \Ht \quad \Hm \quad \Hs \quad \Hpm_i. \]
%\end{verbatim}
% Using the default package options, the above renders as
%   \[ \Ht \quad \Hm \quad \hat H \quad \Hpm{i}. \]
% In addition, the properties in
% Table~\ref{table:conveniences} are defined for convenience. A more
% comprehensive list, including how those properties are represented in the
% various textbook-related options supported by this package, are shown in
% Appendix~\ref{sec:symbols}.
%
% \DescribeMacro{\Ut}
% \DescribeMacro{\Um}
% How these symbols are rendered can be customized by package options. As long
% as the user consistently uses \cs{Ut} to render the total internal energy,
% \cs{Um} to render the molar internal energy, and so forth, switching notation
% from, say, $\Ut$ to $U^t$ for extensive properties is trivial.
%
% \DescribeMacro{\cP}
% \DescribeMacro{\cV}
% \DescribeMacro{\cPt}
% \DescribeMacro{\cVt}
% \DescribeMacro{\cPs}
% \DescribeMacro{\cVs}
% \DescribeMacro{\cPpm}
% \DescribeMacro{\cVpm}
% The heat capacities (see Table~\ref{table:conveniences}) are generally
% assumed to be molar (e.g., \cs{cP} is interpreted to be the molar heat
% capacity). To get the specific heat capacities, the macros \cs{cPs} and
% \cs{cVs} are provided, which by default render as $\cPs$ and $\cVs$,
% respectively. There are also extensive versions, so \cs{cPt} and \cs{cVt}
% will render as $\cPt$ and $\cVt,$
% respectively.  Note that \cs{cP} and friends require you to surround
% \cs{text} with brackets.  For example, \verb"\cP_i^\text{A}" will not work,
% nor will \verb"\cP^\text{A}_i"; you need to use \verb"\cP_i^{\text{A}}" and
% \verb"\cP^{\text{A}}_i". Using \verb"\cP^\IG_i" will work as expected.
%
% You can also get partial molar heat capacities via \cs{cPpm} and \cs{cVpm},
% though the latter's mathematical definition is a bit hard to wrap one's head
% around:
% \begin{verbatim}
%   \[ \cVpm_i = \Partial*{\cVt}{\Nt_i}{T,P,\allNsbut{i}}
%              = \frac{\partial}{\partial\Nt_i}
%                \left[ -T\PartialSecond{\Ft}{T}{\Vt,\allNs}
%                \right]_{T,P,\allNsbut{i}} \]
%\end{verbatim}
% yields
%   \[ \cVpm{i} = \Partial*{\cVt}{\Nt_i}{T,P,\allNsbut{i}}
%               = \frac{\partial}{\partial\Nt_i}
%                 \left[ -T\PartialSecond{\Ft}{T}{\Vt,\allNs}
%                 \right]_{T,P,\allNsbut{i}}. \]
%
% \begin{table}
%   \caption{Commands defined in this package to represent extensive
%       thermodynamic quantities and their molar and specific analogs.
%       These macros should be used even if the symbol the user
%       wishes to use does not match the command used (e.g., \cs{Ft}
%       for total Helmholtz free energy even if it ends up being set as
%       $\Ft$)\@.
%   }
%   \label{table:symbols}
%^^A TODO The \leavevmode macro here is to prevent whitespace from building
%^^A      up due to a bug in old versions of hypdoc. It should be harmless to
%^^A      leave it in there, but consider removing it at some point.
%   \leavevmode
%   \SpecialMacroIndex{\Qt}\relax
%   \SpecialMacroIndex{\Qm}\relax
%   \SpecialMacroIndex{\Qs}\relax
%   \SpecialMacroIndex{\Wt}\relax
%   \SpecialMacroIndex{\Wm}\relax
%   \SpecialMacroIndex{\Ws}\relax
%   \SpecialMacroIndex{\Et}\relax
%   \SpecialMacroIndex{\Em}\relax
%   \SpecialMacroIndex{\Es}\relax
%   \SpecialMacroIndex{\Epm}\relax
%   \SpecialMacroIndex{\EEt}\relax
%   \SpecialMacroIndex{\EE}\relax
%   \SpecialMacroIndex{\EEs}\relax
%   \SpecialMacroIndex{\EEpm}\relax
%   \SpecialMacroIndex{\ERt}\relax
%   \SpecialMacroIndex{\ER}\relax
%   \SpecialMacroIndex{\ERs}\relax
%   \SpecialMacroIndex{\ERpm}\relax
%   \SpecialMacroIndex{\Ut}\relax
%   \SpecialMacroIndex{\Um}\relax
%   \SpecialMacroIndex{\Us}\relax
%   \SpecialMacroIndex{\Upm}\relax
%   \SpecialMacroIndex{\UEt}\relax
%   \SpecialMacroIndex{\UE}\relax
%   \SpecialMacroIndex{\UEs}\relax
%   \SpecialMacroIndex{\UEpm}\relax
%   \SpecialMacroIndex{\URt}\relax
%   \SpecialMacroIndex{\UR}\relax
%   \SpecialMacroIndex{\URs}\relax
%   \SpecialMacroIndex{\URpm}\relax
%   \SpecialMacroIndex{\Ht}\relax
%   \SpecialMacroIndex{\Hm}\relax
%   \SpecialMacroIndex{\Hs}\relax
%   \SpecialMacroIndex{\Hpm}\relax
%   \SpecialMacroIndex{\HEt}\relax
%   \SpecialMacroIndex{\HE}\relax
%   \SpecialMacroIndex{\HEs}\relax
%   \SpecialMacroIndex{\HEpm}\relax
%   \SpecialMacroIndex{\HRt}\relax
%   \SpecialMacroIndex{\HR}\relax
%   \SpecialMacroIndex{\HRs}\relax
%   \SpecialMacroIndex{\HRpm}\relax
%   \SpecialMacroIndex{\St}\relax
%   \SpecialMacroIndex{\Sm}\relax
%   \SpecialMacroIndex{\Ss}\relax
%   \SpecialMacroIndex{\Spm}\relax
%   \SpecialMacroIndex{\SEt}\relax
%   \SpecialMacroIndex{\SE}\relax
%   \SpecialMacroIndex{\SEs}\relax
%   \SpecialMacroIndex{\SEpm}\relax
%   \SpecialMacroIndex{\SRt}\relax
%   \SpecialMacroIndex{\SR}\relax
%   \SpecialMacroIndex{\SRs}\relax
%   \SpecialMacroIndex{\SRpm}\relax
%   \SpecialMacroIndex{\Ft}\relax
%   \SpecialMacroIndex{\Fm}\relax
%   \SpecialMacroIndex{\Fs}\relax
%   \SpecialMacroIndex{\Fpm}\relax
%   \SpecialMacroIndex{\FEt}\relax
%   \SpecialMacroIndex{\FE}\relax
%   \SpecialMacroIndex{\FEs}\relax
%   \SpecialMacroIndex{\FEpm}\relax
%   \SpecialMacroIndex{\FRt}\relax
%   \SpecialMacroIndex{\FR}\relax
%   \SpecialMacroIndex{\FRs}\relax
%   \SpecialMacroIndex{\FRpm}\relax
%   \SpecialMacroIndex{\Gt}\relax
%   \SpecialMacroIndex{\Gm}\relax
%   \SpecialMacroIndex{\Gs}\relax
%   \SpecialMacroIndex{\Gpm}\relax
%   \SpecialMacroIndex{\GEt}\relax
%   \SpecialMacroIndex{\GE}\relax
%   \SpecialMacroIndex{\GEs}\relax
%   \SpecialMacroIndex{\GEpm}\relax
%   \SpecialMacroIndex{\GRt}\relax
%   \SpecialMacroIndex{\GR}\relax
%   \SpecialMacroIndex{\GRs}\relax
%   \SpecialMacroIndex{\GRpm}\relax
%   \SpecialMacroIndex{\At}\relax
%   \SpecialMacroIndex{\Am}\relax
%   \SpecialMacroIndex{\As}\relax
%   \SpecialMacroIndex{\Apm}\relax
%   \SpecialMacroIndex{\Nt}\relax
%   \SpecialMacroIndex{\Lt}\relax
%   \SpecialMacroIndex{\Lm}\relax
%   \SpecialMacroIndex{\Ls}\relax
%   \SpecialMacroIndex{\Lpm}\relax
%   \SpecialMacroIndex{\LEt}\relax
%   \SpecialMacroIndex{\LE}\relax
%   \SpecialMacroIndex{\LEs}\relax
%   \SpecialMacroIndex{\LEpm}\relax
%   \SpecialMacroIndex{\LRt}\relax
%   \SpecialMacroIndex{\LR}\relax
%   \SpecialMacroIndex{\LRs}\relax
%   \SpecialMacroIndex{\LRpm}\relax
%   \centering
%   \begin{minipage}{\linewidth}\renewcommand*{\footnoterule}{\vskip-1.75ex}%
%   \centering\scriptsize\setlength{\tabcolsep}{0.05in}
%   \begin{tabular}{l l l l l l l l l l l l l}
%   \toprule
%     & & & & & \multicolumn{4}{c}{Excess}
%       & \multicolumn{4}{c}{Residual (Departure)} \\
%   \cmidrule(r{0.5ex}){6-9}
%   \cmidrule(l{0.5ex}){10-13}
%     Property & Total & Molar & Specific & \parbox[b]{0.45in}{Partial Molar}
%     & T & M & S & PM & T & M & S & PM \\
%   \midrule
%     Heat            & \cs{Qt}  & \cs{Qm} & \cs{Qs}  & \\
%     Work            & \cs{Wt}  & \cs{Wm} & \cs{Ws}  & \\
%     Total energy    & \cs{Et}  & \cs{Em} & \cs{Es}  & \cs{Epm}
%                     & \cs{EEt} & \cs{EE} & \cs{EEs} & \cs{EEpm}
%                     & \cs{ERt} & \cs{ER} & \cs{ERs} & \cs{ERpm} \\
%     Internal energy & \cs{Ut} & \cs{Um} & \cs{Us} & \cs{Upm}
%                     & \cs{UEt} & \cs{UE} & \cs{UEs} & \cs{UEpm}
%                     & \cs{URt} & \cs{UR} & \cs{URs} & \cs{URpm} \\
%     Enthalpy        & \cs{Ht} & \cs{Hm} & \cs{Hs} & \cs{Hpm}
%                     & \cs{HEt} & \cs{HE} & \cs{HEs} & \cs{HEpm}
%                     & \cs{HRt} & \cs{HR} & \cs{HRs} & \cs{HRpm} \\
%     Entropy         & \cs{St} & \cs{Sm} & \cs{Ss} & \cs{Spm}
%                     & \cs{SEt} & \cs{SE} & \cs{SEs} & \cs{SEpm} 
%                     & \cs{SRt} & \cs{SR} & \cs{SRs} & \cs{SRpm} \\
%     Volume          & \cs{Vt} & \cs{Vm} & \cs{Vs} & \cs{Vpm}
%                     & \cs{VEt} & \cs{VE} & \cs{VEs} & \cs{VEpm}
%                     & \cs{VRt} & \cs{VR} & \cs{VRs} & \cs{VRpm} \\
%     Helmholtz free energy & \cs{Ft} & \cs{Fm} & \cs{Fs} & \cs{Fpm}
%                     & \cs{FEt} & \cs{FE} & \cs{FEs} & \cs{FEpm}
%                     & \cs{FRt} & \cs{FR} & \cs{FRs} & \cs{FRpm} \\
%     Gibbs free energy & \cs{Gt} & \cs{Gm} & \cs{Gs} & \cs{Gpm}
%                     & \cs{GEt} & \cs{GE} & \cs{GEs} & \cs{GEpm}
%                     & \cs{GRt} & \cs{GR} & \cs{GRs} & \cs{GRpm} \\
%     Surface area    & \cs{At} & \cs{Am} & \cs{As} & \cs{Apm} \\
%     Grand potential\footnote{The grand potential,
%       $\begin{thermomolesrange}\Lt(T,\Vt,\allmus)\end{thermomolesrange}
%           = \Ut - T\St - \sumall_i \mu_i \Nt_i,$
%       is also called the Landau free energy by some authors.}
%                     & \cs{Lt} & \cs{Lm} & \cs{Ls} & \cs{Lpm}
%                     & \cs{LEt} & \cs{LE} & \cs{LEs} & \cs{LEpm}
%                     & \cs{LRt} & \cs{LR} & \cs{LRs} & \cs{LRpm} \\
%     Moles           & \cs{Nt} & \\
%   \bottomrule
%   \end{tabular}
%   \end{minipage}
% \end{table}
%
% \begin{table}
%   \caption{Convenience macros and their default symbols.
%       These are generally ``smart'': for example,
%       \texttt{\textbackslash cP\_i} renders as $C_{P,i}$, as expected, and
%       \texttt{\textbackslash cP\_i\^{}\textbackslash std} renders as
%       $C_{P,i}^\circ$, also as expected. You can also reverse it:
%       \texttt{\textbackslash cP\^{}\textbackslash std\_i} becomes
%       $C^\circ_{P,i}$.}\relax
%   \label{table:conveniences}\relax
%^^A TODO The \leavevmode macro here is to prevent whitespace from building
%^^A      up due to a bug in old versions of hypdoc. It should be harmless to
%^^A      leave it in there, but consider removing it at some point.
%   \leavevmode
%   \SpecialMacroIndex{\cP}\relax
%   \SpecialMacroIndex{\cV}\relax
%   \SpecialMacroIndex{\kappaT}\relax
%   \SpecialMacroIndex{\kappaS}\relax
%   \SpecialMacroIndex{\alphaP}\relax
%   \SpecialMacroIndex{\alphaS}\relax
%   \SpecialMacroIndex{\muJT}\relax
%   \SpecialMacroIndex{\heatcapacitysymbol}\relax
%   \SpecialMacroIndex{\compressibilitysymbol}\relax
%   \SpecialMacroIndex{\expansivitysymbol}\relax
%   \SpecialMacroIndex{\fpure}\relax
%   \SpecialMacroIndex{\fmix}\relax
%   \SpecialMacroIndex{\fsat}\relax
%   \SpecialMacroIndex{\phipure}\relax
%   \SpecialMacroIndex{\phimix}\relax
%   \SpecialMacroIndex{\phisat}\relax
%   \SpecialMacroIndex{\actrel}\relax
%   \SpecialMacroIndex{\Psat}\relax
%   \SpecialMacroIndex{\Pvap}\relax
%   \SpecialMacroIndex{\sat}\relax
%   \SpecialMacroIndex{\std}\relax
%   \SpecialMacroIndex{\Pstd}\relax
%   \SpecialMacroIndex{\Cstd}\relax
%   \SpecialMacroIndex{\fstd}\relax
%   \SpecialMacroIndex{\mustd}\relax
%   \SpecialMacroIndex{\Henryrat}\relax
%   \SpecialMacroIndex{\Henrymol}\relax
%   \SpecialMacroIndex{\gammarat}\relax
%   \SpecialMacroIndex{\gammamol}\relax
%   \SpecialMacroIndex{\Deltamix}\relax
%   \SpecialMacroIndex{\Deltarxn}\relax
%   \SpecialMacroIndex{\Deltavap}\relax
%   \SpecialMacroIndex{\Deltasub}\relax
%   \SpecialMacroIndex{\Deltafus}\relax
%   \SpecialMacroIndex{\mixing}\relax
%   \SpecialMacroIndex{\reaction}\relax
%   \SpecialMacroIndex{\fusion}\relax
%   \SpecialMacroIndex{\vaporization}\relax
%   \SpecialMacroIndex{\sublimation}\relax
%   \SpecialMacroIndex{\Epot}\relax
%   \SpecialMacroIndex{\xrxn}\relax
%   \begin{minipage}{\linewidth}\relax
%   \footnotesize
%   \addtolength{\tabcolsep}{-2.75pt}\relax
%   \addtolength{\extrarowheight}{0.50ex}\relax
%   \renewcommand*{\footnoterule}{\vskip-1.5ex}\relax
%   \begin{tabular}{l l l l l}
%   \toprule
%   \\[-1.5\normalbaselineskip]
%     Name & Macro & Sym. & Definition & Base Symbol Macro \\
%   \midrule
%     Isobaric heat capacity & \cmd\cP\footnote{\relax
%         Extensive and specific (per-unit-mass) versions are available
%         as \cs{cPt} and \cmd\cPs, respectively, with similar macros for the
%         isochoric heat capacity.\label{fn:cP}}
%     & \(\cP\) & \(\displaystyle T\Partial{\Sm}{T}{P}\)
%     & \cmd\heatcapacitysymbol \\[1.75ex]
%     Isochoric heat capacity & \verb"\cV"\footref{fn:cP} & \(\cV\)
%     & \(\displaystyle T\Partial{\Sm}{T}{\Vm}\)
%     & \cmd\heatcapacitysymbol \\[1.75ex]
%     Isothermal compressibility & \cmd\kappaT & $\kappaT$
%       & \(\displaystyle -\frac{1}{\Vm} \Partial{\Vm}{P}{T} \)
%       & {\footnotesize\cmd\compressibilitysymbol} \\[1.75ex]
%     Isentropic compressibility & \cmd\kappaS & $\kappaS$
%       & \(\displaystyle -\frac{1}{\Vm} \Partial{\Vm}{P}{\Sm}\)
%       & {\footnotesize\cmd\compressibilitysymbol} \\[1.75ex]
%     Isobaric expansivity & \cmd\alphaP & $\alphaP$
%       & \(\displaystyle \frac{1}{\Vm} \Partial{\Vm}{T}{P}\)
%       & \cmd\expansivitysymbol \\[1.75ex]
%     Isentropic expansivity & \cmd\alphaS & $\alphaS$
%       & \(\displaystyle \frac{1}{\Vm} \Partial{\Vm}{T}{\Sm}\)
%       & \cmd\expansivitysymbol \\[1.75ex]
%     Joule--Thomson coeff. & \cmd\muJT & $\muJT$
%       & \(\displaystyle \Partial{T}{P}{\Hm}\) & \cmd\JTsymbol \\
%     Pure fugacity & \cmd\fpure & $f$ & $\phi P$ \\
%     Saturation fugacity & \cmd\fsat & $\fsat$
%       & $\phisat \Psat$ & \cmd\sat \\
%     Mixture fugacity & \cmd\fmix & $\fmix$
%       & $\fmix_i = x_i\phimix_i P$ \\
%     Pure fugacity coefficient & \cmd\phipure & $\phipure$ &
%       \multicolumn{2}{l}{\( \phipure_i
%         = \exp\left(\frac{1}{RT}\int_0^P \Vm_i(T,p)
%               - \frac{RT}{p}\,dp\right) \)} \\
%     Saturation fugacity coeff.\ & \cmd\phisat & $\phisat$
%       & $\phipure(T,\Psat)$ & \cmd\sat \\
%     Mixture fugacity coeff.\ & \cmd\phimix & $\phimix$
%       & \multicolumn{2}{l}{\( \phimix_i
%          = \exp\left(\frac{1}{RT}\int_0^P \Vpm{i}(T,p,\allXs)
%                - \frac{RT}{p}\,dp\right) \)} \\[1.25ex]
%     Absolute activity & \cmd\actabs & $\actabs$
%       & \multicolumn{2}{l}{\(\actabs_i = \exp(\mu_i/{RT})\)} \\
%     Relative activity & \cmd\actrel & $\actrel$
%       & \multicolumn{2}{l}{\(\actrel_i = \exp\left(\frac{\mu_i - \mu_i^\std}{RT}\right) = \frac{\fmix_i(T,P,\allXs)}{\fstd_i(T)}\)} \\
%     Henry's constant (rational) & \cmd\Henryrat & $\Henryrat$
%       & $\gamma_i^\infty f_i$ \\
%     Henry's constant (molal) & \cmd\Henrymol & $\Henrymol$
%       & $M_s \gamma_i^\infty f_i$ \\
%     Rational activity coeff.\ & \cmd\gammarat & $\gammarat$
%       & $\gamma/\gamma^\infty$ \\
%     Molal activity coeff.\ & \cmd\gammamol & $\gammamol$
%       & $x_s \gamma/\gamma^\infty$ \\
%     Saturation pressure & \cmd\Psat\footnote{\cs{Pvap} is a synonym for
%         \cs{Psat}; if you want it to produce $P^\text{vap}$, you should
%         redefine the \cs{sat} macro} & $\Psat$ && \cmd\sat \\
%     Standard state & \cmd\std\footnote{Typical usage would be
%       \texttt{\$\cs{mu}\_i = \cs{mu}\textasciicircum\cs{std}\_i
%         + RT \cs{log} a\_i\$},
%       yielding $\mu_i = \mu_i^\std + RT \log a_i$.} & $\std$ \\
%     Standard pressure & \cmd\Pstd & $\Pstd$ & & \cs{std} \\
%     Standard molality & \cmd\Cstd & $\Cstd$ & & \cs{std} \\
%     Standard fugacity & \cmd\fstd & $\fstd$
%           & $\fstd_i = \fpure_i(T,\Pstd,x^\std)$ & \cs{std} \\
%     Standard chemical potential & \cmd\mustd & $\mustd$
%           & $\mustd_i = \mu(T,\Pstd,x^\std)$ & \cs{std} \\
%     Change on mixing & \cmd\Deltamix\footnote{The usual usage would be
%         something like
%         \texttt{\$\cs{Deltamix}\cs{Vm}\textasciicircum\cs{IGM} = 0\$}.\relax
%       \label{fn:Deltausage}}
%       & $\Delta M$\textsubscript{mix}
%       & $M - \sumall_i x_i M_i$ & \cmd\mixing \\
%     Change on reaction & \cmd\Deltarxn\footref{fn:Deltausage}
%       & $\Deltarxn M$
%       & $\sumall_i \nu_i M_i$ & \cmd\reaction \\
%     Change on melting & \cmd\Deltafus\footref{fn:Deltausage}
%       & $\Deltafus M$ & $M^L - M^S$ & \cmd\fusion \\
%     Change on boiling & \cmd\Deltavap\footref{fn:Deltausage}
%       & $\Deltavap M$ & $M^V - M^L$ & \cmd\vaporization \\
%     Change on subliming & \cmd\Deltasub\footref{fn:Deltausage}
%       & $\Deltasub M$ & $M^V - M^S$ & \cmd\sublimation \\
%     Electric potential & \cmd\Epot & $\Epot$
%       & $-n_e\mathscr{F}\Deltarxn\Gm$ \\
%     Extent of reaction & \cmd\xrxn & $\xrxn$ & & \\
%   \bottomrule
%   \end{tabular}
%   \end{minipage}
% \end{table}
%
% \subsection{Partial Molar Properties}
% \DescribeMacro{\Upm}
% \DescribeMacro{\Vpm}
% Partial molar quantities are defined with the suffix \verb"pm".
% For example, \cs{Upm} refers to the partial molar internal energy. There
% are two options for how to enter partial molar quantities: as commands or
% as super/subscripts. For example,
% \begin{verbatim}
%  \[ \Upm{i} \quad \Upm[\IG]{i} \quad \Vpm_i \quad \Vpm^\IG_i \]
%\end{verbatim}
% will typeset as
% \[ \Upm{i} \quad \Upm[\text{IG}]{i} \quad \Vpm{i} \quad \Vpm^{\text{IG}}_i.\]
% There are also partial molar heat capacities available via the macros
%  \cs{cPpm} and \cs{cVpm}.
% \textbf{Important}: The \tn{text} command defined by the \pkg{amstext}
% package is usually robust enough that something like \verb"\Um^\text{L}" will
% work as expected, without additional braces. This does \emph{not} work for
% partial molar properties; for example, \verb"\Hpm^\text{L}_i" will produce an
% error, as will \verb"\Hpm_i^\text{L}". The expression
% \verb"\Hpm_i^{\text{L}}" will work as expected.
%
% \DescribeMacro{\partialmolar}
% New partial molar properties can be defined for any ``simple'' symbol using
% the \cs{partialmolar} macro. ``Simple'' means it has no subscripts or
% superscripts. For example, the macro for the partial molar Gibbs free energy
% is effectively defined via the macro
% \DescribeMacro{\Gpm}
% \begin{verbatim}
%   \NewDocumentCommand{\Gpm}{}{\partialmolar{G}}.
%\end{verbatim}
% A list of pre-defined macros for total, molar, specific, and partial molar
% quantities commonly used in thermodynamics is included in
% Table~\ref{table:symbols}.
%
% \subsection{Defining New Properties}
% \DescribeMacro{\NewExtensiveProperty}
% Users can create new properties using a family of commands. Typically, a
% user would want to define at least the total, molar, and specific properties,
% which can be accomplished by the \cs{NewExtensiveProperty} command.
% For example,
% \begin{verbatim}
%  \NewExtensiveProperty{J}{K}
%\end{verbatim}
% \NewExtensiveProperty{J}{K}\relax
% would define the commands \cs{Jt}, \cs{Jm}, and \cs{Js}, which would produce
% (using the default package options) the symbols $\Jt$, $K$, and $\hat{K}$,
% respectively.
%
% \DescribeMacro{\NewPartialMolarProperty}%
% Partial molar properties can be created either with the \cs{partialmolar}
% macro directly as described above or with \cs{NewPartialMolarProperty}, which
% has the same argument style as \cs{NewExtensiveProperty}.
%
% \DescribeMacro{\NewExcessProperty}%
% \DescribeMacro{\NewResidualProperty}%
% Similarly, one can define commands for the total, molar, and specific excess
% properties using \cs{NewExcessProperty} in a similar manner, and similar
% commands for the residual properties with \cs{NewResidualProperty}.
%
% \setmarginparsize{\footnotesize}
% \DescribeMacro{\NewThermodynamicProperty}\relax
% \restoremarginparsize
% \NewThermodynamicProperty{B}{B}\relax
% \NewExtensiveProperty{M}{M}\relax
% It is common that a user wants the total, molar, specific, and partial molar
% commands for a new symbol, as well as excess and residual (departure)
% properties for each case.  Users can define such properties---common examples
% are $\Bt$ and $\Mt$ to represent uncommon or arbitrary properties---by using
% \cs{NewThermodynamicProperty}, which calls all four of the aforementioned
% declarations on the same command/\allowbreak{}symbol combinations. For
% example,
% \begin{verbatim}
%  \NewThermodynamicProperty{B}{B}
%\end{verbatim}
% defines the commands \cs{Bt}, \cs{Bm}, \cs{Bs}, and \cs{Bpm}, which define
% the total, molar, specific, and partial molar properties, respectively.
% It also defines \cs{BEt}, \cs{BE}, \cs{BEs}, and \cs{BEpm} for the
% corresponding excess properties, and \cs{BRt}, \cs{BR}, \cs{BRs}, and
% \cs{BRpm} for residual (departure) properties. These produce, respectively,
% $\Bt, \Bm, \Bs, \Bpm{i}, \BEt, \BE, \BEs, \BEpm{i}, \BRt, \BR, \BRs,$ and
% $\BRpm{i}$ using the defaults.
%
% \subsection{Other Predefined Symbols and Modifiers}
% There are a number of predefined symbols and modifiers.
% While these symbols could be defined or used without these macros, such use
% is not recommended: changing package options will result in inconsistencies
% if these macros are not used.
%
% \subsubsection{Heat Capacities, Compressibilities, and Expansivities}
% \DescribeMacro{\cP}
% \DescribeMacro{\cV}
% \DescribeMacro{\kappaS}
% \DescribeMacro{\kappaT}
% \DescribeMacro{\alphaP}
% \DescribeMacro{\alphaS}
% The isobaric and isochoric heat capacities are produced with \cs{cP} and
% \cs{cV}, respectively. Four other measurable quantities are defined: the
% isothermal and isentropic compressibilities, \cs{kappaT} and \cs{kappaS},
% respectively; and the isobaric and isentropic volume expansivities,
% \cs{alphaP} and \cs{alphaS}, respectively. Some textbooks use $\beta$ instead
% of $\alpha$ for the volume expansivity to differentiate it from the
% \emph{linear} expansivity; this can be changed by redefining
% \cs{expansivitysymbol}, which is done automatically by some of the
% package options that create notation specific to a particular textbook.
%
% \subsubsection{Joule--Thomson Coefficient}
% \changes{v2.00}{2023/11/16}{Added \cs{muJT} to represent Joule--Thomson
%   coefficients (which have different notation across textbooks).}
% \DescribeMacro{\muJT}
% The Joule--Thomson coefficient is produced with \cs{muJT}, which by default
% is rendered $\muJT$. Some books call this coefficient $\alpha_H$; this is
% handled automatically for books of which the package author is aware.
%
% \subsubsection{Chemical Potentials}
% \DescribeMacro{\mu}
% \DescribeMacro{\muit}
% The chemical potential is always produced by the macro \cs{mu}. Some
% textbook-related options use \(\muup\) instead of \(\mu\) for chemical
% potential; if so, the macro \cs{muit} will always produce \(\muit\).
%
% \subsubsection{Fugacities and Fugacity Coefficients}
% \DescribeMacro{\fpure}
% \DescribeMacro{\fmix}
% \DescribeMacro{\phipure}
% \DescribeMacro{\phimix}
% Different textbooks use different variations on the symbol $f$ for
% fugacity, so it is recommended to use the macro \cs{fpure} to denote the
% pure-component fugacity and \cs{fmix} to denote the mixture fugacity.
% Similarly, the pure-component fugacity coefficient should be generated with
% \cs{phipure}, and that in a mixture should be \cs{phimix}.
%
% For example, the following markup is an example of a common equation in
% mixture thermodynamics:
% \begin{verbatim}
%   \[ \fmix_j = x_j \phimix_j P = x_j \gamma_j \fpure_j
%              = x_j \gamma_j \phipure_j P. \]
%\end{verbatim}
% With the default package options, this produces
%   \[ \fmix_j = x_j \phimix_j P = x_j \gamma_j \fpure_j
%       = x_j \gamma_j \phipure_j P. \]
% With the |Thompson| package option, however, the same markup produces
%   \[ \hat f_j = x_j \hat\phi_j P = x_j \gamma_j f^\bullet_j
%       = x_j \gamma_j \phi^\bullet_j P. \]
% Similarly, the |Prausnitz| package option causes it to generate
%   \[ f_j = x_j \phi_j P = x_j \gamma_j f_{\text{pure},j}
%          = x_j \gamma_j \phi_{\text{pure},j} P, \]
% and the |Sandler| option causes it to generate
%   \[ \bar f_j = x_j \bar \phi_j P = x_j \gamma_j f_j
%          = x_j \gamma_j \phi_j  P. \]
%
% \subsubsection{Activity Coefficients and Henry's Constants}
% \DescribeMacro{\gamma}
% \DescribeMacro{\gammait}
% \DescribeMacro{\gammarat}
% \DescribeMacro{\gammamol}
% \DescribeMacro{\Henryrat}
% \DescribeMacro{\Henrymol}
% The activity coefficient based on the Lewis--Randall rule can be generated
% with \cs{gamma}, as usual. The symbol \cs{gammait} is provided just in case
% \cs{gamma} has been redefined by a package option and you want to use the
% original symbol for some reason. The Henry's Law activity coefficients should
% be produced with \cs{gammarat} (rational basis) and \cs{gammamol} (molal
% basis).  There are also macros to generate the Henry's law constants for both
% the rational basis (\cs{Henryrat}) and the molal basis (\cs{Henrymol}).
% These are interrelated:
% \begin{verbatim}
% \[ \fmix_i = x_i \gamma_i \fpure_i = x_i \gammarat_i \Henryrat_i
%            = C_i \gammamol_i \Henrymol_i \]
%\end{verbatim}
% produces
% \[ \fmix_i = x_i \gamma_i \fpure_i = x_i \gammarat_i \Henryrat_i
%            = C_i \gammamol_i \Henrymol_i \]
% using the default options.
% These symbols can be customized either directly or by using package options.
% For example, the |TesterModell| package option changes the equation
% above to
% \[ \hat f_i = x_i \gamma_i f_i = x_i \gamma_i^{**} f_i^{**}
%   = C_i \gamma_i^* f_i^* \]
% without any changes in markup.
%
% Note that some books (e.g., |ElliottLira|) prefer the atmospheric chemistry
% convention for the molal basis, namely
% \[ \fmix_i = x_i \gamma_i \fpure_i = x_i \gammarat_i \Henryrat_i
%            = C_i \gammamol_i / K_{H,i} \]
% (that is, using $1/K_{H,i}$ in place of $\Henrymol_i$).
% Unfortunately, this makes it impossible to change symbols without any edits
% to markup, so this convention is \emph{not} supported by this package.
%
% \subsubsection{Saturation Properties}
% \DescribeMacro{\Psat}
% \DescribeMacro{\Pvap}
% \DescribeMacro{\fsat}
% \DescribeMacro{\phisat}
% The saturation pressure is generated with \cs{Psat}. The macro \cs{Pvap} is
% an alias for \cs{Psat}. The fugacity and fugacity coefficient at saturation
% are accessed via \cs{fsat} and \cs{phisat}, respectively. Package options
% can be used to change some of these to match the notation of specific
% textbooks.
%
% \DescribeMacro{\sat}
% The \cs{sat} macro is used ``behind the scenes'' as part of
% \cs{Psat}, \cs{fsat}, and \cs{phisat}, which produce $\Psat$,
% $\fsat$, and $\phisat$, respectively (using the defaults). If you wanted to
% redefine them to be $P^\text{vap}$, $f^\text{vap}$, and $\phi^\text{vap}$,
% you could simply redefine \cs{sat} with
% \verb"\RenewDocumentCommand{\sat}{}{{\text{vap}}}".
% This is done automatically using package option |Sandler|.
%
% \subsubsection{Standard States and Chemical Reactions}
% \DescribeMacro{\std}
% \DescribeMacro{\Pstd}
% \DescribeMacro{\Cstd}
% \DescribeMacro{\fstd}
% \DescribeMacro{\mustd}
% The symbol $\circ$ (\cs{circ}) is used by default for standard states.
% This is intended to be easy to change should the user want to replace
% $P^\circ$ with $P^\ominus$, say. This is accessed via the \cs{std} macro.
% The macro \cs{Pstd} is defined as |P^\std| for convenience to denote
% standard pressure, \cs{Cstd} is defined as |C^\std| to denote standard
% molality, \cs{fstd} is defined for standard fugacities, and \cs{mustd} is
% defined for standard chemical potentials so as to ease implementation across
% textbooks.
%
% The usual usage would be something like this:
% \begin{verbatim}
% \[ \Deltarxn\Gm = \sumall_i \nu_i \mu_i = \sumall_i \left[ \nu_i \mustd_i
%    + \nu_i RT \log\left(\frac{\fmix_i}{\fstd_i}\right) \right]
%    = \Deltarxn\Gm^\std + RT \log\left[\prodall_i a_i^{\nu_i} \right] \],
%\end{verbatim}
% which produces
% \[ \Deltarxn\Gm = \sumall_i \nu_i \mu_i = \sumall_i \left[ \nu_i \mustd_i
%    + \nu_i RT \log\left(\frac{\fmix_i}{\fstd_i}\right) \right]
%    = \Deltarxn\Gm^\std + RT \log\left[\prodall_i a_i^{\nu_i} \right] \]
% with the default settings.
%
% The extent of reaction is generated by the macro \cs{xrxn}, which by default
% is printed as \(\xrxn\).
%
% \subsubsection{Changes on Mixing, Reaction, Fusion, Vaporization, and
%   Sublimation}
% \DescribeMacro{\Deltamix}
% Mixing properties are handled via the \cs{Deltamix} macro, and are used as in
% the following example:
% \begin{verbatim}
% \[ \Deltamix\Gm = \Gm - \sumall_i x_i \Gm_i
%                 = \Deltamix\Hm - T\Deltamix\Sm \],
%\end{verbatim}
% which yields, using the default options,
% \[ \Deltamix\Gm = \Gm - \sumall_i x_i \Gm_i = \Deltamix\Hm - T\Deltamix\Sm \]
% Some textbooks (|Sandler|, |Thompson|) choose to typeset these with the word
% ``mix'' \emph{before} the symbol, which is handled automatically by this
% package.
% \DescribeMacro{\mixing}
% The macro \cs{mixing} determines how the change in mixing label is rendered;
% the default is \verb"{\text{mix}}".
%
% \DescribeMacro{\Deltafus}
% \DescribeMacro{\Deltasub}
% \DescribeMacro{\Deltavap}
% The commands \cs{Deltafus}, \cs{Deltasub}, and \cs{Deltavap}
% typeset changes due to fusion (melting), sublimation (subliming), and
% vaporization (boiling), respectively. Their use is straightforward, viz.,
% \begin{verbatim}
%  \[ \Deltasub\Hm = \Hm^V - \Hm^S = \Hm^V - \Hm^L + (\Hm^L - \Hm^S)
%                  = \Deltafus\Hm + \Deltavap\Hm \],
%\end{verbatim}
% yielding
%  \[ \Deltasub\Hm = \Hm^V - \Hm^S = \Hm^V - \Hm^L + (\Hm^L - \Hm^S)
%                  = \Deltafus\Hm + \Deltavap\Hm \]
% with the default options. Note that some textbooks (e.g., |Sandler|) typeset
% these quantities quite differently; this is handled automatically. Other
% textbooks (e.g., |Koretsky|) typeset them as subscripts; this is also
% handled automatically.
%
% \DescribeMacro{\Deltaf}
% \DescribeMacro{\Deltarxn}
% The macros \cs{Deltaf} and \cs{Deltarxn} are intended to typeset the enthalpy
% or free energy of formation and reaction, respectively. For example,
% \begin{verbatim}
%  \[ \Deltarxn\Hm^\std = \sumall_i \nu_i \Deltaf\Hm_i^\std \]
%\end{verbatim}
% results in
% \[ \Deltarxn\Hm^\std = \sumall_i \nu_i \Deltaf\Hm_i^\std. \]
% It is not anticipated that this command will be combined with something like
% a heat capacity, which already has a (potentially double) subscript, but as
% there is no ``formation'' heat capacity, that should not present a problem.
%
% \subsection{Residual and Excess Properties}
% \DescribeMacro{\UR}
% \DescribeMacro{\URt}
% \DescribeMacro{\URs}
% \DescribeMacro{\URpm}
% \DescribeMacro{\UE}
% \DescribeMacro{\UEt}
% \DescribeMacro{\UEs}
% \DescribeMacro{\UEpm}
% Additional macros are defined that make it easy to typeset the residual
% (also called ``departure'') and excess total, molar, specific, and partial
% molar properties. These macros follow the same pattern: \cs{UR}, \cs{URt},
% \cs{URs}, and \cs{URpm} typeset the molar, total, specific, and partial molar
% residual internal energies, respectively, and by default expand to $U^R,$
% $\URt,$ $\URs, $ and $\smash[t]{\URpm{i}}$ (the last
% is called as \verb"\URpm{i}" or \verb"\URpm_i"). Similarly, \cs{UE},
% \cs{UEt}, \cs{UEs}, and \cs{UEpm} typeset the corresponding excess
% properties. The first character of the macros for other properties follow the
% same pattern as in Table~\ref{table:symbols}.
%
% The $R$ and $E$ characters are generated by the macros \cs{residual} and
% \cs{excess}, respectively. These macros can be redefined; for example, if you
% \DescribeMacro{\excess}
% \DescribeMacro{\residual}
% want \cs{SE}, which normally produces $\SE$, to give you $S^{EX}$---and let's
% be honest, who doesn't want that?\footnote{You knew that joke was
% coming.}---then you can redefine it with
% \begin{verbatim}
%   \RenewDocumentCommand{\excess}{}{{EX}},
%\end{verbatim}
% or possibly
% \begin{verbatim}
%   \RenewDocumentCommand{\excess}{}{{\mathrm{EX}}}
%\end{verbatim}
% or even
% \begin{verbatim}
%   \RenewDocumentCommand{\excess}{}{\text{EX}},
%\end{verbatim}
% which cause \cs{SE} to expand to $S^{EX},$ $S^\mathrm{EX},$ and
% $S^\text{EX},$ respectively.
%
% It is generally possible to use superscripts with the excess or residual
% properties; in the event this fails, the \cs{excess} and \cs{residual} macros
% can be used directly, viz.,
% \begin{verbatim}
%   \begin{gather*}
%     \HE^\std = \Hm^{\excess,\std} = \HE(T,\Pstd)
%       = \HR(T,\Pstd) - \HR^\IS(T,\Pstd) = \HR^\std - \HR^{\IS,\std} \\
%   \RenewDocumentCommand{\excess}{{EX}}
%     \HE^\std = \Hm^{\excess,\std} = \HE(T,\Pstd)
%       = \HR(T,\Pstd) - \HR^\IS(T,\Pstd)
%   \end{gather*},
%\end{verbatim}
% which yields
% \begin{gather*}
%     \HE^\std = \Hm^{\excess,\std} = \HE(T,\Pstd)
%       = \HR(T,\Pstd) - \HR^\IS(T,\Pstd) = \HR^\std - \HR^{\IS,\std} \\
%   \RenewDocumentCommand{\excess}{}{{EX}}
%     \HE^\std = \Hm^{\excess,\std} = \HE(T,\Pstd)
%       = \HR(T,\Pstd) - \HR^\IS(T,\Pstd)
% \end{gather*}
% using the default options.
%
% \subsection{Partial Derivatives}
% \DescribeMacro{\Partial}%
% \DescribeMacro{\Partial*}%
% Partial derivatives are easily rendered using the \cs{Partial} command.
% There is a starred form (\cs{Partial*}) that additionally adjusts the
% spacing after the closing symbol to remove some of the space, anticipating
% that the following binary operator will overhang the subscripts.
% Compare the following:
% \begin{verbatim}
%  \[ \Partial{\Hm}{T}{P} = \cP \qquad \Partial*{\Hm}{T}{P} = \cP \],
%\end{verbatim}
% which yields
%  \[ \Partial{\Hm}{T}{P} = \cP \qquad \Partial*{\Hm}{T}{P} = \cP. \]
%
% \DescribeMacro{\Partialinline}%
% Inline first derivatives\footnote{The ``inline'' versions of
%   partial derivatives are ``sticky'': if you issue \cs{Partialinline} or
%   its second-order equivalents anywhere in a line, all subsequent
%   \cs{Partial} and \cs{Partial[Mix]Second} macros on the same line
%    (technically, anywhere in the same \TeX\ ``group'') will
%   expand inline as well. To prevent this, enclose your \cs{Partialinline} and
%   associated arguments in its own group (i.e.,
%   \texttt{\{\cs{Partialinline}\dots\}}).%
%   \label{fn:inline}}
% can be entered the same way; compare:
% \begin{verbatim}
%  \[ \Partial*{\Hm}{T}{P} = \Partialinline{\Hm}{T}{P}
%       = T\Partial{\Sm}{T}{P} \],
%\end{verbatim}
% which results in
%   \[ \Partial*{\Hm}{T}{P} = \Partialinline{\Hm}{T}{P}
%       = T\Partial{\Sm}{T}{P}. \]
% There is no need for an inline starred form, as the subscripts do not
% extend far enough below the baseline.
%
% \subsubsection{Second-Order Partial Derivatives}
% \DescribeMacro{\PartialSecond}%
% \DescribeMacro{\PartialSecond*}%
% \DescribeMacro{\PartialMixSecond}%
% \DescribeMacro{\PartialMixSecond*}%
% Second partial derivatives and mixed-second partial derivatives are typeset
% with the commands \cs{PartialSecond} and \cs{PartialMixSecond}, respectively.
% Like the first-order variety, these also have starred versions that remove
% the space immediately following the closing symbols, anticipating that the
% equals sign or other binary operator following the derivative will overhang
% the elements held constant. For example,
% \begin{verbatim}
%   \[ \Vpm_i = \Partial*{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
%             = \PartialMixSecond*{\Gt}{\Nt_i}{P}{T,\allNsbut{i}}
%             = \PartialMixSecond*{\Gt}{P}{\Nt_i}{T,\allNsbut{i}}
%             = \Partial{\Gpm_i}{P}{T,\allNs} \]
%\end{verbatim}
% looks like
%   \[ \Vpm_i = \Partial*{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
%             = \PartialMixSecond*{\Gt}{\Nt_i}{P}{T,\allNsbut{i}}
%             = \PartialMixSecond*{\Gt}{P}{\Nt_i}{T,\allNsbut{i}}
%             = \Partial{\Gpm_i}{P}{T,\allNs}. \]
% \DescribeMacro{\PartialSecondinline}%
% \DescribeMacro{\PartialMixSecondinline}%
% Inline versions\footref{fn:inline} of second-order derivatives are handled
% with \cs{PartialSecondinline} and \cs{PartialMixSecondinline}, viz.,
% \begin{verbatim}
% \begin{equation}
%   \Vpm_i = \Partialinline{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
%          = \PartialMixSecondinline{\Gt}{\Nt_i}{P}{T,\allNsbut{i}}
%          = \PartialMixSecondinline{\Gt}{P}{\Nt_i}{T,\allNsbut{i}}
%          = \Partialinline{\Gpm_i}{P}{T,\allNs} \]
% \end{equation}
%\end{verbatim}
% looks like
% \begin{equation}
%     \Vpm_i = \Partialinline{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
%            = \PartialMixSecondinline{\Gt}{\Nt_i}{P}{T,\allNsbut{i}}
%            = \PartialMixSecondinline{\Gt}{P}{\Nt_i}{T,\allNsbut{i}}
%            = \Partialinline{\Gpm_i}{P}{T,\allNs}
%   \label{eq:Vpm-inline}
% \end{equation}
% with the default options.
% \pagebreak[0]%
%
% \subsubsection{Delimiter Sizing}
% \DescribeMacro{\PartialBigg}%
% \DescribeMacro{\PartialSecondBigg}%
% \DescribeMacro{\PartialMixSecondBigg}%
% \DescribeMacro{\Partialbigg}%
% \DescribeMacro{\PartialSecondbigg}%
% \DescribeMacro{\PartialMixSecondbigg}%
% There are instances (such as the line above) when \cs{Partial} causes
% parentheses that are slightly
% too tall but do not need to be---particularly when partial molar properties,
% specific quantities, or fugacities are involved. The macro \cs{PartialBigg}
% uses \pkg{amsmath}'s \tn{Biggl} and \tn{Biggr} macros in place of \tn{left}
% and \tn{right} to size the delimiters accordingly; \cs{Partialbigg} uses
% \tn{biggl} and \tn{biggr} in a similar fashion. For example, compare the
% following:
% \begin{verbatim}
%  \[ \Vpm_i = \Partial*{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
%            = \Partial*{\Gpm_i}{P}{T,\allNs}
%            = \PartialBigg*{\Gpm_i}{P}{T,\allNs}
%            = RT\Partial*{\log\fmix_i}{P}{T,\allNs}
%            = RT\PartialBigg*{\log\fmix_i}{P}{T,\allNs}
%            = RT\Partialbigg{\log\fmix_i}{P}{T,\allNs} \],
%\end{verbatim}
% which typesets as
%  \[ \Vpm{i} = \Partial*{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
%            = \Partial*{\Gpm{i}}{P}{T,\allNs}
%            = \PartialBigg*{\Gpm{i}}{P}{T,\allNs}
%            = RT\Partial*{\log\fmix_i}{P}{T,\allNs}
%            = RT\PartialBigg*{\log\fmix_i}{P}{T,\allNs}
%            = RT\Partialbigg{\log\fmix_i}{P}{T,\allNs}. \]
% Note that a similar effect---possibly with other side effects---can be
% achieved with \pkg{amsmath}'s \tn{smash} command, which has the effect of
% removing all vertical space associated with a particular character.
% Observe:
% \begin{verbatim}
%  \[ \Vpm_i = \Partial*{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
%            = \Partial{\smash{\Gpm_i}}{P}{T,\allNs} \]
%\end{verbatim}
% produces
%  \[ \Vpm_i = \Partial*{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
%            = \Partial{\smash{\Gpm_i}}{P}{T,\allNs}. \]
%
% \setmarginparsize{\footnotesize}%
% \DescribeMacro{\Partialinlinetext}%
% \DescribeMacro{\PartialSecondinlinetext}%
% \restoremarginparsize
% \setmarginparsize{\scriptsize}
% \DescribeMacro{\PartialMixSecondinlinetext}%
% \restoremarginparsize
% Similarly, there are times when \cs{Partialinline} causes parentheses that
% are too big for inline text, and they do not need to be---particularly for
% symbols with overlines, underlines, or other decorations. In this case, the
% macros \cs{Partialinlinetext}, \cs{PartialSecondinlinetext}, and
% \cs{PartialMixSecondinlinetext} come in handy; using these macros like so,
% \begin{verbatim}
% \[ \Vpm_i = \Partialinlinetext{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
%           = \PartialMixSecondinlinetext{\Gt}{\Nt_i}{P}{T,\allNsbut{i}}
%           = \PartialMixSecondinlinetext{\Gt}{P}{\Nt_i}{T,\allNsbut{i}}
%           = \Partialinlinetext{\Gpm_i}{P}{T,\allNs} \],
%\end{verbatim}
% Equation~\eqref{eq:Vpm-inline} looks like
% \[ \Vpm{i} = \Partialinlinetext{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
%           = \PartialMixSecondinlinetext{\Gt}{\Nt_i}{P}{T,\allNsbut{i}}
%           = \PartialMixSecondinlinetext{\Gt}{P}{\Nt_i}{T,\allNsbut{i}}
%           = \Partialinlinetext{\Gpm{i}}{P}{T,\allNs}. \]
%
% \subsubsection{Higher-Order Derivatives}
% It is possible to ``fake'' higher-order derivatives via some trickery.
% For example,
% \begin{verbatim}
% \[ \cPpm_i = T\Partial*{\Spm_i}{T}{P,\allXs}
%            = T\PartialMixSecond*{\St}{T}{\Nt_i}{P,\allNsbut{i}}
%            = -T\Partial{^3\Gt}{T^2\partial\Nt_i}{P,\allNsbut{i}} \]
%\end{verbatim}
% gives
% \[ \cPpm{i} = T\Partial*{\Spm{i}}{T}{P,\allXs}
%             = T\PartialMixSecond*{\St}{T}{\Nt_i}{P,\allNsbut{i}}
%             = -T\Partial{^3\Gt}{T^2\partial\Nt_i}{P,\allNsbut{i}}, \]
% which is probably pretty close to what you wanted. Using this trickery with
% the package option \verb"nosubscripts" will not work, and the use of
% third- and higher-order derivatives with this package should generally be
% considered unsupported.
%
% \subsection{Holding Constant the Number of Moles of Several Species}
% \DescribeMacro{\allNs}%
% \DescribeMacro{\allNsbut}%
% \DescribeMacro{\allmus}%
% \DescribeMacro{\allmusbut}%
% \DescribeMacro{\allXs}%
% \DescribeMacro{\allXsbut}%
% \DescribeMacro{\allYs}%
% \DescribeMacro{\allYsbut}%
% \DescribeMacro{\allMs}%
% \DescribeMacro{\allMsbut}%
% \DescribeMacro{\allWs}%
% \DescribeMacro{\allWsbut}%
% It is common in thermodynamics to use notation such as
% \[ \Vpm_k = \Partial{\Vt}{\Nt_k}{T,P,\allNsbut{k}}, \]
% or perhaps
% \begin{thermomolesrange}
% \[ \Vpm{k} = \Partial{\Vt}{\Nt_k}{T,P,\allNsbut{k}} \]
% \end{thermomolesrange}
% or
% \[ \Vpm{k} = \left(\frac{\partial\Vt}{\partial\Nt_k}\right)_{T,P,\Nt_j[k]}, \]
% to mean partial derivatives that hold the number of moles of each species
% constant \emph{except} the one being changed.
% Similarly, a property determined with all mole fractions held
% constant might be written
% \[ \cP = \Partial{\Hm}{T}{P,\allXs}, \]
% or perhaps
% \begin{thermomolesrange}\relax
% \[ \cP = \Partial{\Hm}{T}{P,\allXs}. \]
% \end{thermomolesrange}\relax
% There are several macros that standardize such constructs.
% The \cs{allNs} macro expands to something meaning the number of moles of all
% species; by default, this is $\vec{n}$ (package option
% \verb"moles-index"), but can be changed to $n_1,\dotsc,n_C$ using the package
% option \verb"moles-range". Similarly, the macros \cs{allmus} and
% \cs{allmusbut} do the same but with $n$ replaced by $\mu$, and \cs{allMsbut}
% is the same with $m$ instead of $n$. There are analogous macros for mole
% fractions, namely \cs{allXs} and \cs{allXsbut} for $x$ and \cs{allYs} and
% \cs{allYsbut} for $y$, as well as \cs{allWs} and \cs{allWsbut} for mass
% fractions---these implicitly assume that all mole or mass fractions
% \emph{except} the last are used as variables.
% These macros all take an optional argument; for example,
% \begin{verbatim}
% \[ \Partial{\Ht}{\Nt_1}{T,P,\allNsbut{1}} =
%    \Partial{\Ht}{\Nt_1}{T,P,\allNsbut[m]{1}} = \Hpm_1 \]
%\end{verbatim}
% typesets as
% \[ \Partial{\Ht}{\Nt_1}{T,P,\allNsbut{1}} =
%    \Partial{\Ht}{\Nt_1}{T,P,\allNsbut[m]{1}} = \Hpm{1}. \]
% Similarly,
% \begin{verbatim}
% \[ \Partial{\Hm}{x_i}{T,P,\allXsbut{i}}
%   = \Partial{\Hm}{x_i}{T,P,\allXsbut[m]{i}}
%   = \Hpm_i - \Hpm_\ncomponents \]
%\end{verbatim}
% becomes
% \[ \Partial{\Hm}{x_i}{T,P,\allXsbut{i}}
%  = \Partial{\Hm}{x_i}{T,P,\allXsbut[m]{i}}
%  = \Hpm{i} - \Hpm{\ncomponents}. \]
% Users must supply their own redefinitions if they wish to hold something
% other than \cs{ncomponents} constant in addition to the argument for mole
% and mass fractions.
% Using the \verb"moles-range" package option, for which \verb"\allXsbut{k}"
% expands to
% \( \begin{thermomolesrange}\allXsbut{k}\end{thermomolesrange} \)
% rather than \( \allXsbut{k} \), the optional argument is ignored.
%
% The optional argument to \cs{allNs} and similar commands is ignored when
% using the default options; it is relevant for package options that redefine
% \cs{allNs} to make $N_i$, for example; in this case, one can enter
% \cs{allNs[j]} to make \TeX\ render $N_j$ instead of $N_i$. This is useful
% if you are using $i$ somewhere else in the equation.
%
% \DescribeMacro{\allbut}
% \DescribeMacro{\allbutlastand}
% Users can define new ``all but'' macros using the \cs{allbut} and
% \cs{allbutlastand} commands. For example,
% \begin{verbatim}
%   \NewDocumentCommand{\allNsbut}{O{j} m}{\allbut[#1]{#2}{\Nt}}
%   \NewDocumentCommand{\allXsbut}{O{j} m}{\allbutlastand[#1]{#2}{x}}
%\end{verbatim}
% are the definitions of \cs{allNsbut} and \cs{allXsbut}, respectively.
%
% \subsection{Jacobians}
% \DescribeMacro{\Jacobian}%
% \DescribeMacro{\Jacobiandet}%
% The Jacobian determinant is often denoted with Leibnitz-like notation, viz.,
% \begin{verbatim}
% \[ \Jacobian{K,L}{X,Y} = \Jacobiandet{K,L}{X,Y} \],
%\end{verbatim}
% which produces (assuming the \pkg{amsmath} package has been loaded)
% \[ \Jacobian{K,L}{X,Y} = \Jacobiandet{K,L}{X,Y}. \]
% There are two optional arguments to \cs{Jacobiandet}. The first will be
% pre-pended before every element of the matrix (typically \cs{textstyle} or
% \cs{displaystyle}); the second is the extra spacing added between rows
% (default is 1.25~ex for text-style fractions and 2.75~ex for display-style
% fractions).  More than two variables can be specified, viz.,
% \begin{verbatim}
% \[ \Jacobian{K,L,M}{X,Y,Z}
%   = \Jacobiandet[\displaystyle][3ex]{K,L,M}{X,Y,Z} \]
%\end{verbatim}
% will produce
% \[ \Jacobian{K,L,M}{X,Y,Z} = \Jacobiandet[\displaystyle][3ex]{K,L,M}{X,Y,Z}.
% \]
% The \cs{Jacobiandet} macro will understand implied multicomponent Jacobians,
% too, namely,
% \begin{verbatim}
% \[ \Jacobian{f_1,\dots,f_m}{x_1,\dots,x_m} =
%    \Jacobiandet{f_1,\dots,f_m}{x_1,\dots,x_m} \]
%\end{verbatim}
% typesets as
% \[ \Jacobian{f_1,\dots,f_m}{x_1,\dots,x_m} =
%    \Jacobiandet{f_1,\dots,f_m}{x_1,\dots,x_m}. \]
% If the option |moles-range| or the \env{thermomolesrange} environment is
% used, the same code produces
% \begin{thermomolesrange}
% \[ \Jacobian{f_1,\dots,f_m}{x_1,\dots,x_m} =
%    \Jacobiandet{f_1,\dots,f_m}{x_1,\dots,x_m}. \]
% \end{thermomolesrange}
%
% \subsection{Sums and Products}
% \DescribeMacro{\sumall}
% \DescribeMacro{\sumallbutlast}
% \DescribeMacro{\prodall}
% It is common to require sums and products such as
% \[ \sumall_i x_i = 1 \quad \text{or} \quad
%    x_\ncomponents = 1 - \sumallbutlast_i x_i \quad \text{or} \quad
%    \Gt = \sumall_j \mu_j\Nt_j \quad \text{and} \quad
%    K = \prodall_k a_k^{\nu_k}. \]
% This package defines shortcuts to typeset such terms thus:
% \begin{verbatim}
% \[ \sumall_i x_i = 1 \quad \text{or} \quad
%    x_\ncomponents = 1 - \sumallbutlast_i x_i \quad \text{or} \quad
%    \Gt = \sumall_j \mu_j\Nt_j \quad \text{and} \quad
%    K = \prodall_k a_k^{\nu_k} \].
%\end{verbatim}
% The symbol $C$ can be changed by redefining the expandable macro
% \cs{ncomponents}. This is done automatically by some package options (e.g.,
% |TesterModell| changes it to $n$; |Sandler| changes it to $\mathcal{C}$;
% |Thompson| changes it to $c$).
%
% \section{Loading the Package} \label{sec:loading}
% To load the package with the defaults enabled, load it the usual way:
% \begin{verbatim}
%   \usepackage{thermodynamics}
%\end{verbatim}
% The package options loaded by default are \verb"EUAGHan", \verb"subscripts",
% \verb"parentheses", \verb"intensive-plain", and \verb"moles-index".
% These define, respectively, the default symbols to use for total energy,
% internal energy, Helmholtz free energy, and so forth; the manner of writing
% partial derivatives; the delimiters around partial derivatives; the
% manner of denoting extensive, molar, and specific properties; and the
% manner of writing the number of moles of all or most species in partial
% derivatives. The default behavior can be altered by options in the following
% section.
%
% \subsection{Package Options}
% There are three categories of options: options that affect which symbols are
% used, options that affect how symbols are decorated, and options that affect
% how partial derivatives are displayed. These are presented in turn.
%
% \subsubsection{Options that Change Symbol Sets}
% There are several options that choose the set of symbols to use for total
% energy, internal energy, Helmholtz free energy, and so forth. These are
% summarized in Table~\ref{table:symbol-sets}. The default is \verb"EUAGHan".
%
% \NewExtensiveProperty{f}{F}
% \NewExtensiveProperty{a}{A}
% \NewExtensiveProperty{ee}{\mathcal{E}}
% \NewExtensiveProperty{aa}{\mathcal{A}}
% \begin{table}
%   \caption{Options controlling which symbols to use by default. The
%       macros \cs{Et}, \cs{Ut}, \cs{Ft}, \cs{Gt}, \cs{Ht}, \cs{At}, and
%       \cs{Nt} represent the total energy, internal energy,
%       Helmholtz free energy, Gibbs free energy, enthalpy, surface area,
%       and number of moles, respectively. Symbols are shown as they would
%       appear with the (default) option \texttt{intensive-plain}.
%   }
%   \label{table:symbol-sets}
%   \centering\small
%   \begin{tabular}{l l l l l l l l l}
%   \toprule
%   Option & \verb"\Et" & \verb"\Ut" & \verb"\Ft" & \verb"\Gt" & \verb"\Ht"
%          & \verb"\At" & \verb"\Nt" \\
%   \midrule
%     |EUAGHan| & $\Et$ & $\Ut$ & $\Ft$ & $\Gt$ & $\Ht$ & $\At$ & $n$ \\
%     |EUAGHaN| & $\Et$ & $\Ut$ & $\Ft$ & $\Gt$ & $\Ht$ & $\At$ & $N$ \\
%     |EUHAGan| & \multicolumn{7}{l}{(synonym for \texttt{EUAGHan})} \\
%     |EUHAGaN| & \multicolumn{7}{l}{(synonym for \texttt{EUAGHaN})} \\
%     |EUFGHAn| & $\Et$ & $\Ut$ & $\ft$ & $\Gt$ & $\Ht$ & $\at$ & $n$ \\
%     |EUFGHAN| & $\Et$ & $\Ut$ & $\ft$ & $\Gt$ & $\Ht$ & $\at$ & $N$ \\
%     |EEFGHAn| & $\eet$ & $\Et$ & $\ft$ & $\Gt$ & $\Ht$ & $\at$ & $n$ \\
%     |EEFGHAN| & $\eet$ & $\Et$ & $\ft$ & $\Gt$ & $\Ht$ & $\at$ & $N$ \\
%     |EEFGHan| & $\eet$ & $\Et$ & $\ft$ & $\Gt$ & $\Ht$ & $\At$ & $n$ \\
%     |EEFGHaN| & $\eet$ & $\Et$ & $\ft$ & $\Gt$ & $\Ht$ & $\At$ & $N$ \\
%     |EEAGHaN| & $\eet$ & $\Et$ & $\Ft$ & $\Gt$ & $\Ht$ & $\At$ & $N$ \\
%     |EEAGHAN| & $\eet$ & $\Et$ & $\Ft$ & $\Gt$ & $\Ht$ & $\aat$ & $n$ \\
%     |EUAGHAN| & $\Et$ & $\Ut$ & $\Ft$ & $\Gt$ & $\Ht$ & $\aat$ & $N$ \\
%     |EUFGHan| & $\Et$ & $\Ut$ & $\ft$ & $\Gt$ & $\Ht$ & $\At$ & $n$ \\
%     |EUFGHaN| & $\Et$ & $\Ut$ & $\ft$ & $\Gt$ & $\Ht$ & $\At$ & $N$ \\
%   \bottomrule
%   \end{tabular}
% \end{table}
%
% Using \verb"EUAGHan" (the default), we might use the following markup:
% \begin{verbatim}
%   \[ \Ft = \Ut - T\St = -P\Vt + \sumall_i \mu_i \Nt_i + \sigma \At
%      \qquad \Hm = \Um + P\Vm \qquad \Et = \Ut + \frac12 mv^2 \],
%\end{verbatim}
% which would look like
%   \[ \Ft = \Ut - T\St = -P\Vt + \sumall_i \mu_i \Nt_i + \sigma \At
%      \qquad \Hm = \Um + P\Vm \qquad \Et = \Ut + \frac12 mv^2 \]
% Using the \verb"EEFGHAN" option, the same markup would yield
% \[ \ft
%    = \Et - T\St
%    = -P\Vt + \sumall_i \mu_i N_i + \sigma \at
%    \qquad H = U + PV
%    \qquad \eet = \Et + \frac12 mv^2. \]
%
% \subsubsection{Options for Extensive vs.\ Molar Properties}
% There are four sets of notation that define how extensive properties are
% represented, as shown in Table~\ref{table:extensive}.
% The default is \verb"intensive-plain", which (using the volume as an
% example) represents the total, molar, specific, and partial molar volumes,
% respectively, as $\Vt,$ $\Vm,$ $\Vs,$ and $\Vpm{j}$.
%
% For example, the definition of the partial molar enthalpy would be different
% depending on which set of notation is used. The markup
% \begin{verbatim}
% \[ \Hpm_i = \Partial*{\Ht}{\Nt_i}{T,P,\allNsbut{i}}
%           = \Partial{\Nt\Hm}{\Nt_i}{T,P,\allNsbut{i}} \]
%\end{verbatim}
% yields the following, depending on the package option loaded:
% \begin{align*}
%   \Hpm_i &= \Partial*{\Ht}{\Nt_i}{T,P,\allNsbut{i}}
%           = \Partial{\Nt\Hm}{\Nt_i}{T,P,\allNsbut{i}}
%       && \text{\texttt{intensive-plain}} \\
%   \Hpm_i &=
% \begin{thermoextensiveplain}
%             \Partial*{\Ht}{\Nt_i}{T,P,\allNsbut{i}}
%           = \Partial{\Nt\Hm}{\Nt_i}{T,P,\allNsbut{i}}
% \end{thermoextensiveplain}
%       && \text{\texttt{extensive-plain}} \\
%   \Hpm_i &=
% \begin{thermoextensivesuperscript}
%             \Partial*{\Ht}{\Nt_i}{T,P,\allNsbut{i}}
%           = \Partial{\Nt\Hm}{\Nt_i}{T,P,\allNsbut{i}}
% \end{thermoextensivesuperscript}
%       && \text{\texttt{extensive-superscript}} \\
% \begin{thermointensivelowercase}
%   \Hpm_i
% \end{thermointensivelowercase}
%          &=
% \begin{thermointensivelowercase}
%             \Partial*{\Ht}{\Nt_i}{T,P,\allNsbut{i}}
%           = \Partial{\Nt\Hm}{\Nt_i}{T,P,\allNsbut{i}}
% \end{thermointensivelowercase}
%       && \text{\texttt{intensive-lowercase}}
% \end{align*}
% The use of \verb"intensive-lowercase" is strongly discouraged.
%
% Note that the number of moles can be changed from $n$ to $N$ via the
% options in the previous section.
%
% \begin{table}
%   \caption{Notation sets that can be set using the options
%       \texttt{intensive-plain} (the default), \texttt{extensive-plain},
%       \texttt{extensive-superscript}, and \texttt{intensive-lowercase}.}
%   \label{table:extensive}
%   \centering\small
%   \begin{tabular}{l l l l l l}
%   \toprule
%     Option & \verb"\Vt" & \verb"\Vm" & \verb"\Vs" & \verb"\Vpm_i" \\
%   \midrule
%     \verb"intensive-plain" & $\Vt$ & $\Vm$ & $\Vs$ & $\Vpm{i}$ \\[2ex]
%     \verb"extensive-plain" &
%       \begin{thermoextensiveplain}$\Vt$\end{thermoextensiveplain} &
%       \begin{thermoextensiveplain}$\Vm$\end{thermoextensiveplain} &
%       \begin{thermoextensiveplain}$\Vs$\end{thermoextensiveplain} &
%       \begin{thermoextensiveplain}$\Vpm{i}$\end{thermoextensiveplain}
%     \\[2ex]
%     \verb"extensive-superscript" &
%       \begin{thermoextensivesuperscript}$\Vt$\end{thermoextensivesuperscript} &
%       \begin{thermoextensivesuperscript}$\Vm$\end{thermoextensivesuperscript} &
%       \begin{thermoextensivesuperscript}$\Vs$\end{thermoextensivesuperscript} &
%       \begin{thermoextensivesuperscript}$\Vpm{i}$\end{thermoextensivesuperscript} \\[2ex]
%     \verb"intensive-lowercase" &
%       \begin{thermointensivelowercase}$\Vt$\end{thermointensivelowercase} &
%       \begin{thermointensivelowercase}$\Vm$\end{thermointensivelowercase} &
%       \begin{thermointensivelowercase}$\Vs$\end{thermointensivelowercase} &
%       \begin{thermointensivelowercase}$\Vpm{i}$\end{thermointensivelowercase} 
%     \\
%   \bottomrule
%   \end{tabular}
% \end{table}
%
% \pagebreak[1]\relax
% \setmarginparsize{\footnotesize}
% \DescribeEnv{thermointensiveplain}
% \DescribeEnv{thermoextensiveplain}
% \DescribeEnv{thermoextensivesuperscript}
% \DescribeEnv{thermointensivelowercase}
% \restoremarginparsize
% It is possible to change notation locally, though there are very, very few
% good reasons why you would want to do this in a regular document---normally,
% one would use the corresponding package options. The environment
% \env{thermointensiveplain} means \cs{St} will become $\St$ and \cs{Sm} will
% become $\Sm$ in the text. Similarly, inside \env{thermoextensiveplain},
% \cs{St} will become $S$ and \cs{Sm} will become $\St$.
% Inside \env{thermoextensivesuperscript}, \cs{St} will become $S^t$ and
% \cs{Sm} will be $S$; and inside \env{thermointensivesubscript},
% \cs{St} will be $S$ and \cs{Sm} will be $s$.
%
% \subsubsection{Options Affecting Partial Molar Properties}
% There are two options that change how partial molar properties are typeset.
% For option |longpm| (the default), the subscript and superscript are
% considered part of the symbol, producing something like $\HEpm_i$.
% The option |shortpm| makes it display as
% \begin{thermoshortpm}
%   $\HEpm_i$.
% \end{thermoshortpm}
% The |shortpm| option is the default for several textbook-related options.
%
% \DescribeEnv{thermolongpm}
% \DescribeEnv{thermoshortpm}
% It is possible to change partial molar notation locally---this could be
% useful if you have a very, very long superscript or subscript and the
% default option looks silly, say. The environment \env{thermolongpm} sets
% the style equivalent to the |longpm| option, while the \env{thermoshortpm}
% environment sets the local style equivalent to the |shortpm| option.
% For example,
% \begin{verbatim}
% \[ \Spm_i = \Spm_i^\IGM + \SRpm_i
%     \begin{thermoshortpm}
%       = \Spm_i^\IGM + \SRpm_i
%     \end{thermoshortpm} \]
%\end{verbatim}
% produces
% \[ \Spm_i = \Spm_i^\IGM + \SRpm_i
%     \begin{thermoshortpm}
%       = \Spm_i^\IGM + \SRpm_i,
%     \end{thermoshortpm} \]
% assuming the default options are loaded.
%
% \subsubsection{Options Affecting Partial Derivatives}
% There are several options that change how partial derivatives are rendered.
% First are the options that affect the delimiters. We will use the following
% code as an example:
% \begin{verbatim}
%   \[ \Partial*{\Vm}{T}{P} = \PartialMixSecond{\Gm}{T}{P}{}
%                           = \PartialMixSecond{\Gm}{P}{T}{}
%                           = -\Partial{\Sm}{P}{T}. \]
%\end{verbatim}
% Using the |parentheses| option (the default), this gives
%   \[ \Partial*{\Vm}{T}{P} = \PartialMixSecond{\Gm}{T}{P}{}
%                           = \PartialMixSecond{\Gm}{P}{T}{}
%                           = -\Partial{\Sm}{P}{T}. \]
% The option |brackets| changes the output to
% \begin{thermobrackets}
%   \[ \Partial*{\Vm}{T}{P} = \PartialMixSecond{\Gm}{T}{P}{}
%                           = \PartialMixSecond{\Gm}{P}{T}{}
%                           = -\Partial{\Sm}{P}{T}. \]
% \end{thermobrackets}\relax
% The option \verb"bar" changes the output to
% \begin{thermobar}
%   \[ \Partial*{\Vm}{T}{P} = \PartialMixSecond{\Gm}{T}{P}{}
%                           = \PartialMixSecond{\Gm}{P}{T}{}
%                           = -\Partial{\Sm}{P}{T}. \]
% \end{thermobar}\relax
% The option \verb"plain-derivatives" eliminates all delimiters; this forces
% the \verb"nosubscripts" option. The output in this case is
% \begin{thermoplain}%
%   \[ \Partial*{\Vm}{T}{P} = \PartialMixSecond{\Gm}{T}{P}{}
%                           = \PartialMixSecond{\Gm}{P}{T}{}
%                           = -\Partial{\Sm}{P}{T}. \]
% \end{thermoplain}\relax
% Accompanying the \verb"plain-derivatives" option is the \verb"nosubscripts"
% option, which overrides the default option \verb"subscripts". This option
% makes partial derivatives such as
% \[ \begin{thermosubscripts}
%      \Partial{\Vm}{P}{T} \qquad \text{(\texttt{subscripts} option)},
%     \end{thermosubscripts}\relax \]
% and instead renders them
% \[ \begin{thermoNOsubscripts}
%       \Partial{\Vm}{P}{T} \qquad \text{(\texttt{nosubscripts} option)}.
%    \end{thermoNOsubscripts} \]
% Combined with \verb"plain-derivatives", this would give
% \[ \begin{thermoplain}
%      \Partial{\Vm}{P}{T} \qquad \text{(\texttt{nosubscripts} and
%                                        \texttt{plain-derivatives} options)}.
%    \end{thermoplain} \]
% The variables are sorted into an order defined by an internal constant,
% meaning $T$ will always be listed before $P$. The order by default is in
% the order that terms appear in the fundamental equations, that is,
% \begin{gather*}
%   d\Ut = T \,d\St - P \,d\Vt + \mu \,d\Nt \\
%   d\Ht = T \,d\St + \Vt \,dP + \mu \,d\Nt \\
%   d\Ft = -\St\,dT - P \,d\Vt + \mu \,d\Nt \\
%   \vdots \\
%   d\Lt = -\St\,dT - P \,d\Vt - \Nt\,d\mu,
% \end{gather*}
% with the exception that subscripted variables are (currently) not sortable.
% If \verb"\Nt_i" or some similar construct appears as a variable and
% \verb"\allNsbut{i}" appears in the held-constant list, the package will
% assume that the argument list \emph{should} contain all of the mole numbers.
% Symbols without subscripts that are not in the fundamental equation or one of
% its variants are sorted in alphabetical order.
%
% \DescribeEnv{thermoparentheses}
% \DescribeEnv{thermobrackets}
% \DescribeEnv{thermobraces}
% \DescribeEnv{thermobar}
% \DescribeEnv{thermoplain}
% If you want to use parentheses \emph{locally}, even though your overall
% document uses another delimiter, the \env{thermoparentheses} environment will
% do that. Similarly, \env{thermobrackets} will temporarily switch to brackets,
% \env{thermobar} will temporarily switch to a tailing vertical bar, and
% \env{thermoplain} will remove delimiters altogether.
%
% \DescribeEnv{thermosubscripts}
% \DescribeEnv{thermoNOsubscripts}
% The environments \env{thermosubscripts} and \env{thermoNOsubscripts}
% force the use or disuse of subscripts, respectively.
%
% \subsubsection{Options Regarding the Number of Moles}
% \DescribeMacro{\allNs}%
% \DescribeMacro{\allNsbut}%
% The default option \verb"moles-index" defines the macro \cs{allNs} to expand
% to $\allNs$ and the macro \verb"\allNsbut{i}" to expand to $\allNsbut{i}$.
% You can change the dummy index: \verb"\allNsbut[k]{i}" expands to
% $\allNsbut[k]{i}$ by default. This is typically not necessary, however: if
% you type \verb"\allNsbut{j}", the package will figure out that you want
% $\allNsbut{j}$ rather than $\Nt_{j\neq j}$. The time to use the optional
% argument is in situations such as
% \[ \Partial{\mu_j}{\Nt_k}{\allNsbut[i]{k}}, \]
% which is incorrect if the dummy index $j$ is used in place of the $i$.
%
% You can change these to expand to ranges using the \verb"moles-range"
% option, which renders \cs{allNs} as
% $\begin{thermomolesrange}\allNs\end{thermomolesrange}$ and
% \verb"\allNsbut{i}" as
% $\begin{thermomolesrange}\allNsbut{i}\end{thermomolesrange}.$
% The optional argument is ignored in this set of notation. Examples of these
% options are shown in Table~\ref{table:allNs}.
%
% \DescribeEnv{thermomolesrange}
% The environment \env{thermomolesrange} temporarily redefines \cs{allNs} and
% other range-oriented macros as though the |moles-range| package option had
% been invoked.
%
% \DescribeMacro{\ncomponents}%
% You can change the symbol for the number of components (default: $C$) by
% redefining the macro \cs{ncomponents}. This is done for you by some package
% options that define notation for particular textbooks.
%
% \begin{table}
%   \caption{Illustration of the \texttt{moles-index} and \texttt{moles-range}
%       options and their effects on \cs{allNs} and \cs{allNsbut}.}
%   \label{table:allNs}
%^^A TODO The \leavevmode macro here is to prevent whitespace from building
%^^A      up due to a bug in old versions of hypdoc. It should be harmless to
%^^A      leave it in there, but consider removing it at some point.
%   \leavevmode
%   \SpecialMacroIndex{\allNs}\relax
%   \SpecialMacroIndex{\allNsbut}\relax
%   \SpecialMacroIndex{\allXs}\relax
%   \SpecialMacroIndex{\allXsbut}\relax
%   \centering
%   \begin{minipage}{4.49in}\renewcommand*{\footnoterule}{\vskip-1.5ex}%
%   \small
%     \begin{tabular}{l l l}
%     \toprule
%       Macro\footnote{You may use $C$ directly instead of \cs{ncomponents}
%         here, but then it will not change to another symbol if you want to
%         switch to an option that redefines \cs{ncomponents} later.}
%       & \verb"moles-index" & \verb"moles-range" \\
%     \midrule
%       \verb"\allNs" & $\allNs$
%           & $\begin{thermomolesrange}\allNs\end{thermomolesrange}$ \\
%       \verb"\allNsbut{1}" & $\allNsbut{1}$
%           & $\begin{thermomolesrange}\allNsbut{1}\end{thermomolesrange}$ \\
%       \verb"\allNsbut{i}" & $\allNsbut{i}$
%           & $\begin{thermomolesrange}\allNsbut{i}\end{thermomolesrange}$ \\
%       \verb"\allNsbut{j}" & $\allNsbut{j}$
%           & $\begin{thermomolesrange}\allNsbut{j}\end{thermomolesrange}$ \\
%       \verb"\allNsbut{\ncomponents}" & $\allNsbut{\ncomponents}$
%  & $\begin{thermomolesrange}\allNsbut{\ncomponents}\end{thermomolesrange}$\\
%       \verb"\allNsbut[k]{i}" & $\allNsbut[k]{i}$
%           & $\begin{thermomolesrange}\allNsbut[k]{i}\end{thermomolesrange}$\\
%       \verb"\allXs" & $\allXs$
%           & $\begin{thermomolesrange}\allXs\end{thermomolesrange}$ \\
%       \verb"\allXsbut{1}" & $\allXsbut{1}$
%           & $\begin{thermomolesrange}\allXsbut{1}\end{thermomolesrange}$ \\
%       \verb"\allXsbut{i}" & $\allXsbut{i}$
%           & $\begin{thermomolesrange}\allXsbut{i}\end{thermomolesrange}$ \\
%       \verb"\allXsbut{j}" & $\allXsbut{j}$
%           & $\begin{thermomolesrange}\allXsbut{j}\end{thermomolesrange}$ \\
%       \verb"\allXsbut{\ncomponents-1}" & $\allXsbut{\ncomponents-1}$
%           & $\begin{thermomolesrange}\allXsbut{\ncomponents-1}
%               \end{thermomolesrange}$ \\
%       \verb"\allXsbut[k]{\ncomponents-1}" & $\allXsbut[k]{\ncomponents-1}$
%           & $\begin{thermomolesrange}\allXsbut[k]{\ncomponents-1}
%               \end{thermomolesrange}$ \\
%       \verb"\allXsbut{\ncomponents}"\footnote{This would typically be used
%           to denote something like
%           \( \begin{thermomolesrange}
%                \Gt(T,P,\Nt,\allXsbut{\ncomponents})
%               \end{thermomolesrange}
%           \) rather than in a subscript, but it looks silly if we do not
%           handle this case this way.}
%           & $\allXsbut{\ncomponents}$
%           & $\begin{thermomolesrange}\allXsbut{\ncomponents}
%              \end{thermomolesrange}$ \\
%     \bottomrule
%     \end{tabular}
%   \end{minipage}
% \end{table}
%
% \subsubsection{Other Options}
% \DescribeMacro{\dbar}%
% The default for path-dependent one-forms (often called ``inexact
% differentials'') is \cs{dbar}, which looks like $\dbar$. This can be changed,
% if desired, to a delta ($\delta$) with the \verb"delta" option to the
% package.
%
% It should be noted that the \cs{dbar} macro is context-dependent: changing
% the typeface to something not supported will probably ruin it, as the kerning
% is very font-specific. This package currently supports Computer Modern,
% Times, Palatino, Bitstream Charter, Garamond, and Utopia, but other typefaces
% may require a manual redefinition.
%
% \subsubsection{Options for Particular Textbooks} \label{sec:textbooks}
% There are several options that load package options and/or redefine
% particular commands to match the notation in a particular textbook.
% A table showing how various properties are typeset using each of these
% packages is included in Appendix~\ref{sec:symbols}.
% So far, the following textbooks are supported:
% \begin{description}
%   \item[Bejan] Notation used by Bejan, \emph{Advanced Engineering
%     Thermodynamics}, Third Edition. Wiley: Hoboken, 2006.
%   \item[CBK] Notation used by \c Cengel, Boles, and Kano\u glu,
%     \emph{Thermodynamics: An Engineering Approach}, Ninth Edition.
%     McGraw Hill: Singapore, 2020.  Their symbols for specific and
%     total volume, which appear to be from the font ITC Benguiat Gothic (and
%     reasonably approximated by Krub Italic), are not directly
%     supported.\footnote{%
%       \providecommand*{\XeTeX}{X\kern-0.125em \lower 0.5ex
%           \hbox{\reflectbox{\hbox{E}}}\kern-0.125em \TeX}
%       If you have ITC Benguiat Gothic installed and want to use it for the
%       volume symbol, you can use it through \XeTeX; try this:\\
%       \texttt{\textbackslash usepackage\{fontspec\}} \\
%       \texttt{\textbackslash setsansfont\{ITC Benguiat Gothic\}} \\
%       \texttt{\textbackslash ExplSyntaxOn} \\
%       \texttt{\mbox{}~~\textbackslash tl\_gset:Nn
%               \textbackslash g\_\_thermodynamics\_volume\_symbol
%            \{\{\textbackslash text\{\textbackslash
%                sffamily V\}\}\}} \\
%       \texttt{\textbackslash ExplSyntaxOff}
%       \label{fn:XeTeX}}
%   \item[ElliottLira] Notation used by Elliott and Lira, \emph{Introductory
%     Chemical Engineering Thermodynamics}, Second Edition. Prentice Hall:
%     Upper Saddle River, 2012. \emph{Note: these authors use
%     Henry's Law (molal basis) in the form \(y_i P = m_i/K_{H,i}\), which is
%     inconsistent with their notation for the rational basis, so that macro
%     is left set to its default.}
%   \item[KlotzRosenberg] Notation used by Klotz and Rosenberg, \emph{Chemical
%     Thermodynamics: Basic Concepts and Methods}, Seventh Edition.
%     Wiley: Hoboken, 2008.
%   \item[Koretsky] Notation used by Koretsky, \emph{Engineering and Chemical
%     Thermodynamics}, Second Edition. Wiley: New Caledonia, 2013.
%   \item[ModellReid] Alias for \verb"TesterModell" (the first and second
%     editions were by Modell and Reid; Reid died prior to the third edition).
%   \item[MSBB] Notation used by Moran, Shapiro, Boettner, and Bailey,
%     \emph{Fundamentals of Engineering Thermodynamics}, Eighth Edition.
%     Wiley: Kendallville, 2014.
%   \item[Prausnitz] Notation used by Prausnitz, Lichtenthaler, and de Azevedo,
%     \emph{Molecular Thermodynamics of Fluid-Phase Equilibria}, Third Edition,
%     Pearson, 1998.
%   \item[Sandler] Notation used by Sandler, \emph{Chemical, Biochemical, and
%     Engineering Thermodynamics}, Fifth Edition. Wiley: Hoboken, 2017.
%   \item[SVNAS] Notation used by Smith, Van Ness, Abbott, and Swihart,
%     \emph{Introduction to Chemical Engineering Thermodynamics}, Ninth
%     Edition. McGraw-Hill: Boston, 2021.
%   \item[TesterModell] Notation used by Tester and Modell,
%     \emph{Thermodynamics and Its Applications}, Third Edition, Prentice Hall:
%     Upper Saddle River, 1997.
%   \item[Thompson] Notation used by Thompson, \emph{A Unified Introduction to
%     Chemical Engineering Thermodynamics}, Stillwater Press: Orono, 2000.
%     Note that he uses $c$, $\mathrm{c}$, $n_C$, and $\mathrm{n}$ for the
%     number of components in various places in the book; I chose $c$ for the
%     definition of \cs{ncomponents}, but it is impossible to be completely
%     consistent with his notation.
% \end{description}
% There may well be some inconsistencies between the notation in these books
% and the symbols used here. I will fix such inconsistencies as I become aware
% of them.
%
% \textbf{Important}: Some textbooks use symbols other than \(\mu\) for
% chemical potential and \(\gamma\) for activity coefficients. For example,
% |KlotzRosenberg| uses $\muup$ for the chemical potential and $\gammaup$
% for the activity coefficient. In such cases,
% the macro \verb"\mu" will produce whatever symbol \emph{is} used for the
% chemical potential, and \verb"\gamma" will produce the activity coefficient.
% The original symbols will still be available as \cs{gammait} and \cs{muit},
% respectively.
%
% \appendix
% \section{Notation Across Textbooks} \label{sec:symbols}
% \changes{v2.02}{2024/06/14}{Improved consistency of package options for
%       textbooks and added a table of symbols organized by textbook option.}
% Some of the textbooks supported by this package use multiple symbols for the
% same quantity---for example, Sandler's textbook uses both \(P^\text{sat}\)
% and \(P^\text{vap}\) for vapor (saturation) pressure, and Elliott and Lira
% use both \(\Delta H^\circ\) and \(\Delta H_R^o\) for the standard enthalpy
% of reaction. This package may only support one of the two in such cases.
%
% Table~\ref{table:textbooks} gives a description of each symbol supported
% by the package, the corresponding command, and the way that command is
% rendered using each of the textbook-related options in
% Section~\ref{sec:textbooks}. Packages consisting of two names are shortened
% to one name in the headers for space considerations.
%
% \NewDocumentCommand{\inherit}{m}{\textcolor{gray}{#1}}
% \begin{landscape}\scriptsize
% \tablehead{%
%   \toprule
%   Quantity & Macro & Default & Bejan & CBK & Elliott & Klotz
%       & Koretsky & MSBB & Prausnitz & Sandler & SVNAS & Modell & Thompson \\
%   \midrule
% }
% \tabletail{%
%   \midrule\multicolumn{13}{l}{\emph{continued on next page\dots}} \\
% }
% \tablelasttail{\bottomrule}
% \tablecaption{How symbols are typeset for various textbooks.
%   Entries in \inherit{gray} indicate quantities that are not directly or
%   indirectly defined in a particular textbook and are therefore inherited
%   fromthe defaults.
%   \emph{Note: Options with two authors, such as \texttt{ElliottLira},
%   only include one name so as to fit on one page.}
%   \label{table:textbooks}}
% \setlength{\extrarowheight}{3.5pt}%
% \begin{mpsupertabular}{l l l l l l l l l l l l l l}
%   \# components & \verb"\ncomponents" & $\ncomponents$ & $n$ & $\inherit{\ncomponents}$ & $\inherit{\ncomponents}$ & $\inherit{\ncomponents}$ & $m$ & $\inherit{\ncomponents}$ & $m$ & $\mathcal{C}$ & $\inherit{\ncomponents}$ & $n$ & $c$ \\
%   activity (absolute) & \verb"\actabs_i" & $\actabs_i$ & $\inherit{\lambda_i}$ & $\inherit{\actabs_i}$ & $\inherit{\actabs_i}$ & $\inherit{\lambda_i}$ & $\inherit{\lambda_i}$ & $\inherit{\actabs_i}$ & $\inherit{\actabs_i}$ & $\inherit{\actabs_i}$ & $\inherit{\actabs_i}$ & $\inherit{\actabs_i}$ & $\inherit{\actabs_i}$ \\
%   activity (relative) & \verb"\actrel_i" & $\actrel_i$ & $\inherit{\actrel_i}$ & $\inherit{\actrel_i}$ & $a_i$ & $a_i$ & $\inherit{a_i}$ & $\inherit{\actrel_i}$ & $\mathdutchcal{a}_i$\relax
%    \footnote{The symbol $\mathdutchcal{a}$ requires the |dutchcal| fonts to be installed,
%      though the package itself is not loaded. This symbol is an approximation to the one
%      the book actually uses.} & $a_i$ & $a_i$ & $a_i$ & $\widehat a_i$ \\
%   activity coefficient (ordinary) & \verb"\gamma_i" & $\gamma_i$ & $\inherit{\gamma_i}$ & $\inherit{\gamma_i}$ & $\gamma_i$ & $\gammaup_i$ & $\gamma_i$ & $\inherit{\gamma_i}$ & $\gamma_i$ & $\gamma_i$ & $\gamma_i$ & $\gammaup_i$ & $\gamma_i$ \\
%   activity coefficient (Henry, rational) & \verb"\gammarat_i" & $\gammarat_i$ & $\inherit{\gammarat_i}$ & $\inherit{\gammarat_i}$ & $\gamma_i^\ast$ & $\gammaup_i$ & $\gamma_i^\text{Henry's}$ & $\inherit{\gammarat_i}$ & $\inherit{\gammarat_i}$ & $\gamma_i^\ast$ & $\inherit{\gammarat_i}$ & $\gammaup_i^{\ast\ast}$ & $\inherit{\gammarat_i}$ \\
%   activity coefficient (Henry, molal) & \verb"\gammamol_i" & $\gammamol_i$ & $\inherit{\gammamol_i}$ & $\inherit{\gammamol_i}$ & $\gamma_i^\square$ & $\gammaup_i$ & $\gamma_i^m$ & $\inherit{\gammamol_i}$ & $\inherit{\gammamol_i}$ & $\gamma_i^\square$ & $\gammarat_i$ & $\gammaup_i^\ast$ & $\inherit{\gammamol_i}$ \\
%   adiabatic compressibility & \multicolumn{13}{l}{\emph{See} isentropic compressibility} \\
%   adiabatic expansivity & \multicolumn{13}{l}{\emph{See} isentropic expansivity} \\
%   area (total) & \verb"\At" & $\At$ & $A$ & $A$ & $\inherit{\At}$ & $\inherit{a}$ & $A$ & $A$ & $\inherit{A}$ & $\inherit{a}$ & $\inherit{a^t}$ & {\large$\underline{a}$} & $\inherit{\mkern2mu\underline{\mkern-2mu\mathcal{A}\mkern-2mu}\mkern2mu}$  \\
%   chemical potential & \verb"\mu" & $\mu$ & $\mu$ & $\mu$ & $\mu$ & $\muup$ & $\mu$ & $\mu$ & $\mu$ & $\mu$ & $\mu$ & $\muup$ & $\mu$ \\
%   electric potential & \verb"\Epot" & $\Epot$ & $\inherit{\Epot}$ & $\inherit{\Epot}$ & $E$ & $\emf$\footnote{The
%       symbol $\emf$ requires the \pkg{emf} package. If that package is not
%       loaded, $\mathcal{E}$ is used instead.\label{fn:emf}}
%     & $E$ & $\inherit{\Epot}$ & $\emf$\footref{fn:emf} & $E$ & $E$ & $\exists$ & $E$ \\
%   electric potential (standard) & \verb"\Epot^\std" & $\Epot^\std$ & $\inherit{\Epot^\std}$ & $\inherit{\Epot^\std}$ & $E^\circ$ & $\emf^\circ$ & $E^o$ & $\inherit{\Epot^\std}$ & $\emf^0$ & $\inherit{E^\circ}$ & $E^\circ$ & $\exists^o$ & $E^\circ$ \\
%   energy (total) & \verb"\Et" & $\Et$ & $E$ & $E$ & $\inherit{\Et}$ & $\inherit{E}$ & $E$ & $E$ & $E$ & $\inherit{E}$ & $\inherit{E^t}$ & $\Et$ & $\inherit{\Et}$ \\
%   energy (molar) & \verb"\Em" & $\Em$ & $\overline{e}$ & $\overline{e}$ & $\inherit{\Em}$ & $\inherit{E_{\textrm{m}}}$ & $e$ & $\overline{e}$ & $\inherit{e}$ & \begin{thermoextensiveplain}$\inherit{\Em}$\end{thermoextensiveplain} & $\inherit{E}$ & $\Em$ & $\inherit{\Em}$ \\
%   energy (specific) & \verb"\Es" & $\Es$ & $e$ & $e$ & $\inherit{E}$ & $\inherit{\hat E}$ & $\hat e$ & $e$ & $\inherit{\hat e}$ & $\hat E$ & $\inherit{E}$ & $\Es$ & $\inherit{\Em}$ \\
%   enthalpy (total) & \verb"\Ht" & $\Ht$ & $H$ & $H$ & $\Ht$ & $H$ & $H$ & $H$ & $H$ & $H$ & $H^t$ & $\Ht$ & $\Ht$ \\
%   enthalpy (molar) & \verb"\Hm" & $\Hm$ & $\overline{h}$ & $\overline{h}$ & $H$ & $H_{\textrm{m}}$ & $h$ & $\overline{h}$ & $h$ & \begin{thermoextensiveplain}$\Hm$\end{thermoextensiveplain} & $H$ & $\Hm$ & $\Hm$ \\
%   enthalpy (specific) & \verb"\Hs" & $\Hs$ & $h$ & $h$ & $H$ & $\inherit{\Hs}$ & $\hat h$ & $h$ & $\inherit{\hat h}$ & $\hat H$ & $H$ & $\Hs$ & $\inherit{\Hs}$ \\
%   enthalpy (partial molar) of $i$ & \verb"\Hpm_i" & $\Hpm_i$ & $\inherit{\overline{h}_i}$ & $\widetilde{h}_i$ & $\overline{H}_i$ & $H_{\mathrm{m}i}$ & $\overline{H}_i$ & $\Hpm_i$ & $\overline{h}_i$ & \begin{thermoshortpm}$\Hpm_i$\end{thermoshortpm} & $\overline{H}_i$ & $\Hpm_i$ & $\Hpm_i$ \\
%   enthalpy of reaction & \verb"\Deltarxn\Hm" & $\Deltarxn\Hm$ & $\inherit{\Delta\overline{h}_\text{rxn}}$ & $\overline{h}_R$ & $\Delta H$ & $\Delta H_{\mathrm{m}}$ & $\Delta h_\text{rxn}$ & $\inherit{\Delta\overline{h}_\text{rxn}}$ & $\inherit{\Delta h_\text{rxn}}$ & \begin{thermoextensiveplain}$\Delta_{\text{rxn}}\Hm$\end{thermoextensiveplain} & $\Delta H$ & $\Delta H_{rx}$ & $\Delta H_R$ \\
%   enthalpy of fusion & \verb"\Deltafus\Hm" & $\Deltafus\Hm$ & $\overline{h}_{sf}$ & $\overline{h}_{sf}$ & $\Delta H^{fus}$ & $\Delta H_{\mathrm{m}}$ & $\Delta h_\text{fus}$ & $\inherit{\overline{h}^\text{fus}}$ & $\inherit{\Delta h^\text{fus}}$ & \begin{thermoextensiveplain}$\Delta_\text{fus}\Hm$\end{thermoextensiveplain} & $\Delta H^{sl}$ & $\inherit{\Deltafus H}$ & $\Delta H^{SL}$ \\
%   enthalpy of vaporization & \verb"\Deltavap\Hm" & $\Deltavap\Hm$ & $\overline{h}_{sf}$ & $\overline{h}_{fg}$ & $\Delta H^{vap}$ & $\Delta H_{\mathrm{m}}$ & $\Delta h_\text{vap}$ & $\inherit{\overline{h}^\text{vap}}$ & $\inherit{\Delta h^\text{vap}}$ & \begin{thermoextensiveplain}$\Delta_\text{vap}\Hm$\end{thermoextensiveplain} & $\Delta H^{vl}$ & $\inherit{\Deltavap H}$ & $\Delta H^{LV}$ \\
%   enthalpy of sublimation & \verb"\Deltasub\Hm" & $\Deltasub\Hm$ & $\overline{h}_{sg}$ & $\overline{h}_{sg}$ & $\inherit{\Delta H^{sub}}$ & $\Delta H_{\mathrm{m}}$ & $\Delta h_\text{sub}$ & $\inherit{\overline{h}^\text{sub}}$ & $\inherit{\Delta h^\text{sub}}$ & $\Delta_\text{sub}\Ht$ & $\Delta H^{vs}$ & $\inherit{\Deltasub H}$ & $\inherit{\Delta H^{SV}}$ \\
%   entropy (total) & \verb"\St" & $\St$ & $S$ & $S$ & $\St$ & $S$ & $S$ & $S$ & $S$ & $S$ & $S^t$ & $\St$ & $\St$ \\
%   entropy (molar) & \verb"\Sm" & $\Sm$ & $\overline{s}$ & $\overline{s}$ & $S$ & $S_{\mathrm{m}}$ & $s$ & $\overline{s}$ & $s$ & $\St$ & $S$ & $S$ & $S$ \\
%   entropy (specific) & \verb"\Ss" & $\Ss$ & $s$ & $s$ & $S$ & $\inherit{\Ss}$ & $\hat s$ & $s$ & $\inherit{\hat s}$ & $\hat S$ & $S$ & $\hat S$ & $\inherit{\Ss}$ \\
%   entropy (partial molar) of $i$ & \verb"\Spm_i" & $\Spm_i$ & $\overline{S}_i$ & $\widetilde{s}_i$ & $\overline{S}_i$ & $S_{\mathrm{m}i}$ & $\overline{S}_i$ & $\Spm_i$ & $\overline{s}_i$ & \begin{thermoshortpm}$\Spm_i$\end{thermoshortpm} & $\overline{S}_i$ & $\Spm_i$ & $\Spm_i$ \\
%   extent of reaction & \verb"\xrxn" & $\xrxn$ & $\zeta$ & $\inherit{\xrxn}$ & $\xi$ & $\xiup$ & $\xi$ & $\varepsilon$ & $\inherit{\xi}$ & $X$ & $\varepsilon$ & $\xiup$ & $\xi$ \\
%   fugacity of pure substance & \verb"\fpure" & $\fpure$ & $f$ & $\inherit{\fpure}$ & $f$ & $f$ & $f$ & $f$ & $f_\text{pure}$ & $f$ & $f$ & $f$ & $f$ \\
%   fugacity of pure $i$ & \verb"\fpure_i" & $\fpure_i$ & $\inherit{f_i^\bullet}$ & $\inherit{\fpure_i}$ & $f_i$ & $f_i^\bullet$ & $f_i$ & $f_i$ & $f_{\text{pure}\,i}$ & $f_i$ & $f_i$ & $f_i$ & $f_i^\bullet$ \\
%   fugacity of $i$ in mixture & \verb"\fmix_i" & $\fmix_i$ & $f_i$ & $\inherit{\fmix_i}$ & $\hat f_i$ & $f_i$ & $\hat f_i$ & $\bar f_i$ & $f_i$ & $\bar f_i$ & $\hat f_i$ & $\hat f_i$ & $\widehat{f}_i$ \\
%   fugacity at saturation & \verb"\fsat" & $\fsat$ & $\inherit{f^\sat}$ & $\inherit{\fsat}$ & $f^{sat}$ & $\inherit{f^\text{sat}}$ & $\inherit{f^\text{sat}}$ & $\inherit{f^\text{sat}}$ & $f^s_\text{pure}$ & $f^\text{sat}$ & $f^\text{sat}$ & $\inherit{\fsat}$ & $f^\text{sat}$ \\
%   fugacity coefficient of pure substance & \verb"\phipure" & $\phipure$ & $\inherit{\phi}$ & $\inherit{\phipure}$ & $\phi$ & $\gamma$ & $\varphi$ & $\inherit{\phi}$ & $\varphi_{\text{pure}}$ & $\phi$ & $\phi$ & $\phiup$ & $\phi$ \\
%   fugacity coefficient of pure $i$ & \verb"\phipure_i" & $\phipure_i$ & $\inherit{\phi_i^\bullet}$ & $\inherit{\phipure_i}$ & $\phi_i$ & $\gamma_i^\bullet$ & $\varphi_i$ & $\inherit{\phi_i}$ & $\varphi_{\text{pure}\,i}$ & $\phi_i$ & $\phi_i$ & $\phiup_i$ & $\phi_i^\bullet$ \\
%   fugacity coefficient of $i$ in mixture & \verb"\phimix_i" & $\phimix_i$ & $\inherit{\phi_i}$ & $\inherit{\phimix_i}$ & $\hat\phi_i$ & $\gamma_i$ & $\hat\varphi_i$ & $\bar\phi_i$ & $\varphi_i$ & $\bar\phi_i$ & $\hat\phi_i$ & $\hat\phiup_i$ & $\widehat{\phi}_i$ \\
%   fugacity coefficient at saturation & \verb"\phisat" & $\phisat$ & $\inherit{\phisat}$ & $\inherit{\phisat}$ & $\phi^{sat}$ & $\inherit{\gamma^\text{sat}}$ & $\varphi^\text{sat}$ & $\inherit{\phi^\text{sat}}$ & $\varphi^s$ & $\phi^\text{sat}$ & $\phi^\text{sat}$ & $\inherit{\phiup^\sat}$ & $\phi^\text{sat}$ \\
%   Gibbs free energy (total) & \verb"\Gt" & $\Gt$ & $G$ & $G$ & $\Gt$ & $G$ & $G$ & $G$ & $G$ & $G$ & $G^t$ & $\Gt$ & $\Gt$ \\
%   Gibbs free energy (molar) & \verb"\Gm" & $\Gm$ & $\overline{g}$ & $\overline{g}$ & $G$ & $G_{\mathrm{m}}$ & $g$ & $\overline{g}$ & $g$ & $\Gt$ & $G$ & $G$ & $G$ \\
%   Gibbs free energy (specific) & \verb"\Gs" & $\Gs$ & $g$ & $g$ & $G$ & $\inherit{\Gs}$ & $\hat g$ & $g$ & $\inherit{\hat g}$ & $\hat G$ & $G$ & $\Gs$ & $\inherit{\Gs}$ \\
%   Gibbs free energy (partial molar) & \verb"\Gpm_i" & $\Gpm_i$ & $\overline{G}_i$ & $\widetilde{g}_i$ & $\Gpm_i$ & $G_{\mathrm{m}i}$ & $\overline{G}_i$ & $\Gpm_i$ & $\partialmolar{g}_i$ & \begin{thermoshortpm}$\Gpm_i$\end{thermoshortpm} & $\Gpm_i$ & $\Gpm_i$ & $\partialmolar{G}_i$ \\
%   Gibbs free energy of mixing & \verb"\Deltamix\Gt" & $\Deltamix\Gt$ & $\inherit{\Deltamix G}$ & $\inherit{\Deltamix G}$ & $\Delta\Gt_\text{mix}$ & $\Delta G_\text{mix}$ & $\Delta G_\text{mix}$ & $\inherit{\Deltamix G}$ & $\Delta G_\text{mixing}$ & $\Delta_\text{mix}G$ & $\Delta G^t$ & $\Deltamix\Gt$ & $\Delta_{MIX}\Gt$ \\
%   Gibbs free energy of reaction & \verb"\Deltarxn\Gm" & $\Deltarxn\Gm$ & $\inherit{\Deltarxn{\bar{g}}}$ & $\overline{g}_R$ & $\Delta G$ & $\Delta G_{\mathrm{m}}$ & $\Delta g_\text{rxn}$ & $\inherit{\Deltarxn{\overline{g}}}$ & $\inherit{\Delta g_\text{rxn}}$ & $\Delta_\text{rxn}\Gt$ & $\Delta G$ & $\Delta G_{rx}$ & $\Delta G_R$ \\
%   grand potential (total) & \verb"\Lt" & $\Lt$ & $F_\mu$ & $\inherit{\Omega}$ & $\inherit{\Lt}$ & $\inherit{\Omega}$ & $\inherit{\Omega}$ & $\inherit{\Omega}$ & $\inherit{\Omega}$ & $\inherit{\Omega}$ & $\inherit{\Lt}$ & $\inherit{\Lt}$ & $\inherit{\Lt}$ \\
%   grand potential (molar) & \verb"\Lm" & $\Lm$ & $\overline{f}_\mu$ & $\inherit{\overline{\omega}}$ & $\inherit{\Lm}$ & $\inherit{\Omega_{\mathrm{m}}}$ & $\inherit{\omega}$ & $\inherit{\overline{\omega}}$ & $\inherit{\omega}$ & $\inherit{\Lt}$ & $\inherit{\Lm}$ & $\inherit{\Lm}$ & $\inherit{\Lm}$ \\
%   grand potential (specific) & \verb"\Ls" & $\Ls$ & $f_\mu$ & $\inherit{\omega}$ & $\inherit{\Ls}$ & $\inherit{\Ls}$ & $\inherit{\hat\omega}$ & $\inherit{\omega}$ & $\inherit{\hat\omega}$ & $\inherit{\Ls}$ & $\inherit{\Lm}$ & $\inherit{\Ls}$ & $\inherit{\Ls}$ \\
%   heat (total) & \verb"\Qt" & $\Qt$ & $Q$ & $Q$ & $\Qt$ & $Q$ & $Q$ & $Q$ & $Q$ & $Q$ & $Q^t$ & $\inherit{\Qt}$ & $\inherit{\Qt}$ \\
%   heat (molar) & \verb"\Qm" & $\Qm$ & $\overline{q}$ & $\overline{q}$ & $Q$ & $\inherit{Q_{\mathrm{m}}}$ & $q$ & $\overline{q}$ & $\inherit{q}$ & $\inherit{\Qt}$ & $Q$ & $Q$ & $Q$ \\
%   heat (specific) & \verb"\Qs" & $\Qs$ & $q$ & $q$ & $Q$ & $\inherit{\Qs}$ & $\hat q$ & $q$ & $\inherit{\hat q}$ & $\inherit{\Qs}$ & $Q$ & $\inherit{\hat Q}$ & $\inherit{\Qs}$ \\
%   heat capacity (isobaric, total) & \verb"\cPt" & $\cPt$ & $C_P$ & $\inherit{C_p}$ & $\underline{C}_P$ & $C_P$ & $\inherit{C_P}$ & $\inherit{C_p}$ & $C_p$ & $NC_P$ & $nC_P$ & $\inherit{\underline{C}_p}$ & $\inherit{\cPt}$ \\
%   heat capacity (isobaric, molar) & \verb"\cP"  & $\cP$ & $\overline{c}_P$ & $\overline{c}_p$ & $C_P$ & $C_{P\mathrm{m}}$ & $c_P$ & $\overline{c}_p$ & $c_p$ & $C_P$ & $C_P$ & $C_p$ & $C_P$ \\
%   heat capacity of $i$ (isobaric, molar) & \verb"\cP_i" & $\cP_i$ & $\overline{c}_{P,i}$ & $\overline{c}_{p,i}$ & $C_{P,i}$ & $C_{P\mathrm{m}i}^\bullet$ & $C_{P,i}$ & $\overline{c}_{p,i}$ & $c_{p\,i}$ & $C_{P,i}$ & ${C_P}_i$ & $C_{pi}$ & $C_{P,i}$ \\
%   heat capacity (isobaric, specific) & \verb"\cPs" & $\cPs$ & $c_P$ & $c_p$ & $C_P$ & $\inherit{\cPs}$ & $\hat c_P$ & $c_p$ & $\inherit{\hat c_p}$ & $\hat C_P$ & $C_P$ & $\inherit{\hat C_p}$ & $\inherit{\hat C_p}$ \\
%   heat capacity (isobaric, partial molar) & \verb"\cPpm_i" & $\cPpm_i$ & $\overline{c}_{P,i}$ & $\inherit{\widetilde{C}_{p,i}}$ & $\overline{C}_{P,i}$ & $C_{P\mathrm{m}i}$ & $\overline{C}_{P,i}$ & \begin{thermoshortpm}$\partialmolar{C}_{p,i}$\end{thermoshortpm} & $\inherit{\bar c_{p\,i}}$ & \begin{thermoshortpm}$\cPpm_i$\end{thermoshortpm} & ${\overline{C}_P}_i$ & $\overline{C}_{pi}$ & \begin{thermoshortpm}$\inherit{\cPpm_i}$\end{thermoshortpm} \\
%   heat capacity (isochoric, total) & \verb"\cVt" & $\cVt$ & $C_V$ & $\inherit{C_V}$\footref{fn:XeTeX} & $\underline{C}_V$ & $C_V$ & $C_V$ & $C_v$ & $C_v$ & $NC_V$ & $nC_V$ & $\inherit{\underline{C}_v}$ & $\inherit{\cVt}$ \\
%   heat capacity (isochoric, molar) & \verb"\cV"  & $\cV$ & $\overline{c}_v$ & $\overline{c}_V$\footref{fn:XeTeX} & $C_V$ & $C_{V\mathrm{m}}$ & $c_V$ & $\overline c_v$ & $c_v$ & $C_V$ & $C_V$ & $C_v$ & $C_V$ \\
%   heat capacity (isochoric, specific) & \verb"\cVs" & $\cVs$ & $c_v$ & $c_V$\footref{fn:XeTeX} & $C_V$ & $\inherit{\cVs}$ & $\hat c_v$ & $c_v$ & $\inherit{\hat c_p}$ & $\hat C_V$ & $C_V$ & $\inherit{\hat C_v}$ & $\inherit{\cVs}$ \\
%   heat capacity (isochoric, partial molar) & \verb"\cVpm_i" & $\cVpm_i$ & $\overline{c}_{v,i}$ & $\widetilde{C}_{V,i}$\footref{fn:XeTeX} & $\overline{C}_{V,i}$ & $C_{V\mathrm{m}i}$ & $\overline{C}_V$ & \begin{thermoshortpm}$\partialmolar{C}_{v,i}$\end{thermoshortpm} & $\inherit{\bar c_{v\,i}}$ & \begin{thermoshortpm}$\cVpm_i$\end{thermoshortpm} & ${\overline{C}_V}_i$ & $\overline{C}_{vi}$ & \begin{thermoshortpm}$\inherit{\cVpm_i}$\end{thermoshortpm} \\
%   Helmholtz free energy (total) & \verb"\Ft" & $\Ft$ & $F$ & $A$ & $\underline{A}$ & $A$ & $A$ & $\Psi$ & $A$ & $A$ & $A^t$ & $\Ft$ & $\Ft$ \\
%   Helmholtz free energy (molar) & \verb"\Fm" & $\Fm$ & $\bar{f}$ & $\overline{a}$ & $A$ & $A_{\mathrm{m}}$ & $a$ & $\overline{\psi}$ & $a$ & $\Ft$ & $A$ & $A$ & $A$ \\
%   Helmholtz free energy (specific) & \verb"\Fs" & $\Fs$ & $f$ & $a$ & $A$ & $\inherit{\Fs}$ & $\hat a$ & $\psi$ & $\inherit{\hat a}$ & $\hat A$ & $A$ & $\Fs$ & $\inherit{\Fs}$ \\
%   Helmholtz free energy (partial molar) & \verb"\Fpm_i" & $\Fpm_i$ & $\overline{f}_i$ & $\widetilde{a}_i$ & $\overline{A}_i$ & $A_{\mathrm{m}i}$ & $\overline{A}_i$ & $\overline{\Psi}_i$ & $\overline a_i$ & \begin{thermoshortpm}$\Fpm_i$\end{thermoshortpm} & $\begin{thermoshortpm}\Fpm_i\end{thermoshortpm}$ & $\partialmolar{A}_i$ & \begin{thermoshortpm}$\partialmolar{A}_i$\end{thermoshortpm} \\
%   Henry's constant (rational basis) & \verb"\Henryrat_i" & $\Henryrat_i$ & $\inherit{\Henryrat_i}$ & $\inherit{\Henryrat_i}$ & $h_i$ & $k_i$ & $\mathcal{H}_i$ & $\inherit{\Henryrat_i}$ & $H_i$ & $H_i$ & $\mathcal{H}_i$ & $f^{**}$ & $k_{H,i}$ \\
%   Henry's constant (molal basis) & \verb"\Henrymol_i" & $\Henrymol_i$ & $\inherit{\Henrymol_i}$ & $\inherit{\Henrymol_i}$ & $\inherit{\Henrymol_i}$ & $k''_i$ & $\inherit{\Henrymol_i}$ & $\inherit{\Henrymol_i}$ & $\inherit{\Henrymol_i}$ & $\mathcal{H}_i$ & $\inherit{\Henrymol_i}$ & $f^*$ & $k_{H,i}$ \\
%   ideal gas enthalpy & \verb"\Hm^\IG" & $\Hm^\IG$ & $\inherit{\bar{h}^\IG}$ & $\inherit{\overline{h}^\IG}$ & $H^{ig}$ & $\inherit{H_{\mathrm{m}}^\IG}$ & $h^\text{ideal~gas}$ & $\smash{\overline{h}}^\ast$ & $h^\text{id}$ & $H^\text{IG}$ & $H^{ig}$ & $H^o$ & $H^{IG}$ \\
%   ideal gas mixture enthalpy & \verb"\Hm^\IGM" & $\Hm^\IGM$ & $\inherit{\bar{h}^\IG}$ & $\inherit{\overline{h}^\IGM}$ & $H^{ig}$ & $\inherit{H_{\mathrm{m}}^\IGM}$ & $h^\text{ideal}$ & $\smash{\overline{h}}^\ast$ & $h^\text{id}$ & $H^\text{IGM}$ & $H^{ig}$ & $H^o$ & $H^{IG}$ \\
%   ideal solution enthalpy & \verb"\Hm^\IS" & $\Hm^\IS$ & $\inherit{\bar{h}^\IS}$ & $\inherit{\overline{h}^\IS}$ & $H^{is}$ & $\inherit{H_{\mathrm{m}}^\IS}$ & $h^\text{ideal}$ & $\inherit{\smash{\overline{h}}^\IS}$ & $h^\text{(ideal)}$ & $H^\text{IM}$ & $H^{id}$ & $H^{ID}$ & $H^{IS}$ \\
%   inexact differential & \verb"\dbar" & $\dbar$ & $\delta$ & $\delta$ & $d$ & $d$ & $\delta$ & $\delta$ & $\inherit{\dbar}$ & $\inherit{\dbar}$ & $\dbar$ & $\delta$ & $\delta$ \\
%   internal energy (total) & \verb"\Ut" & $\Ut$ & $U$ & $U$ & $\underline{U}$ & $U$ & $U$ & $U$ & $U$ & $U$ & $U^t$ & $\Ut$ & $\Ut$ \\
%   internal energy (molar) & \verb"\Um" & $\Ut$ & $\bar{u}$ & $\overline{u}$ & $U$ & $U_{\mathrm{m}}$ & $u$ & $\overline{u}$ & $u$ & $\Ut$ & $U$ & $U$ & $U$ \\
%   internal energy (specific) & \verb"\Us" & $\Us$ & $u$ & $u$ & $U$ & $\inherit{\Us}$ & $\hat u$ & $u$ & $\inherit{\hat u}$ & $\hat U$ & $U$ & $u$ & $\inherit{\Us}$ \\
%   internal energy (partial molar) & \verb"\Upm_i" & $\Upm_i$ & $\overline{u}_i$ & $\widetilde{u}_i$ & $\overline{U}_i$ & $U_{\mathrm{m}i}$ & $\overline{U}_i$ & $\Upm_i$ & $\overline{u}_i$ & \begin{thermoshortpm}$\Upm_i$\end{thermoshortpm} & \begin{thermoshortpm}$\Upm_i$\end{thermoshortpm} & $\Upm_i$ & $\Upm_i$ \\
%   isothermal compressibility & \verb"\kappaT" & $\kappaT$ & $\kappa$ & $\alpha$ & $\kappa_T$ & $\betaup$ & $\kappa$ & $\kappa$ & $\beta$ & $\kappa_T$ & $\kappa$ & $\kappa_T$ & $\inherit{\kappaT}$ \\
%   isentropic compressibility & \verb"\kappaS" & $\kappaS$ & $\inherit{\kappaS}$ & $\inherit{\alpha_S}$ & $\inherit{\kappa_S}$ & $\inherit{\beta_S}$ & $\inherit{\kappaS}$ & $\alpha$ & $\inherit{\beta_S}$ & $\inherit{\kappaS}$ & $\inherit{\kappaS}$ & $\inherit{\kappaS}$ & $\inherit{\kappaS}$ \\
%   isobaric expansivity & \verb"\alphaP" & $\alphaP$ & $\beta$ & $\beta$ & $\alpha_P$ & $\alpha$ & $\beta$ & $\beta$ & $\alpha$ & $\alpha$ & $\beta$ & $\alpha_P$ & $\inherit{\alphaP}$ \\
%   isentropic expansivity & \verb"\alphaS" & $\alphaS$ & $\inherit{\beta_S}$ & $\inherit{\beta_S}$ & $\inherit{\alpha_S}$ & $\inherit{\alpha_S}$ & $\inherit{\beta_S}$ & $\inherit{\beta_S}$ & $\alpha_S$ & $\inherit{\alphaS}$ & $\inherit{\beta_S}$ & $\inherit{\alphaS}$ & $\inherit{\alphaS}$ \\
%   Joule--Thomson coefficient & \verb"\muJT" & $\muJT$ & $\mu_J$ & $\mu_\text{JT}$ & $\mu_{JT}$ & $\mu_\text{J.T.}$ & $\mu_\text{JT}$ & $\mu_J$ & $\inherit{\muJT}$ & $\mu$ & $\mu$ & $\alpha_H$ & $\alpha_H$ \\
%   moles & \verb"\Nt" & $\Nt$ & $N$ & $N$ & $n$ & $n$ & $n$ & $n$ & $n$ & $N$ & $n$ & $N$ & $n$ \\
%   saturation pressure & \verb"\Psat" & $\Psat$ & $\inherit{\Psat}$ & $P^v$ & $P^{sat}$ & $p$ & $P^\text{sat}$ & $\inherit{P^\text{sat}}$ & $P^s$ & $P^\text{sat}$ & $P^\text{sat}$ & $P^\text{sat}$ & $P^\text{sat}$ \\
%   saturation pressure of $i$ & \verb"\Psat_i" & $\Psat_i$ & $\inherit{\Psat_i}$ & $P^v_i$ & $P^{sat}_i$ & $p^\bullet_i$ & $P^\text{sat}_i$ & $\inherit{P^\text{sat}_i}$ & $P^s_i$ & $P^\text{sat}_i$ & $P^\text{sat}_i$ & $P^\text{sat}_i$ & $P^\text{sat}_i$ \\
%   standard molality & \verb"\Cstd_i" & $\Cstd_i$ & $\inherit{\Cstd_i}$ & $\inherit{\Cstd_i}$ & $m_i^\circ$ & $m_i^\circ$ & $\inherit{C_i^o}$ & $\inherit{\Cstd_i}$ & $C_i^0$ & \text{1~molal} & $m^\circ$ & $m^+$ & $m_i^\circ$ \\
%   standard chemical potential & \verb"\mustd" & $\mustd$ & $\inherit{\mustd}$ & $\inherit{\mustd}$ & $\mu^\circ$ & $\muup^\circ$ & $\mu^o$ & $\overline{g}^\circ$ & $\mu^0$ & $\mu^\circ$ & $G^\circ$ & $\muup^o$ & $\Gamma$ \\
%   standard enthalpy & \verb"\Hm^\std" & $\Hm^\std$ & $\bar{h}^\circ$ & $\smash{\overline{h}}^\circ$ & $H^\circ$ & $H^\circ_{\mathrm{m}}$ & $h^o$ & $\overline{h}^\circ$ & $h^0$ & $\Ht^\circ$ & $H^\circ$ & $H^o$ & $H^\circ$ \\
%   standard enthalphy of formation & \verb"\Deltaf\Hm^std" & $\Deltaf\Hm^\std$ & $\bar{h}^\circ_f$ & $\smash{\overline{h}}_f^\circ$ & $\Delta H_f^\circ$ & $\Delta_f H^\circ_{\mathrm{m}}$ & $\Delta h_f^o$ & $\bar{h}^\circ_{\mathrm{f}}$ & $\Delta h_f^0$ & $\Delta_{\mathrm{f}}\Ht^\circ$ & $\Delta H^\circ_{f298}$ & $\Delta H_f^o$ & $\Delta H_F^\circ$ \\
%   standard enthalphy of formation of $i$ & \verb"\Deltaf\Hm^std_i" & $\Deltaf\Hm^\std_i$ & $\bar{h}^\circ_{f,i}$ & $\smash{\overline{h}}_{f,i}^\circ$ & $\Delta H_{f,i}^\circ$ & $\Delta_f H^\circ_{\mathrm{m}i}$ & $(\Delta h_f^o)_i$ & $(\bar{h}^\circ_{\mathrm{f}})_i$ & $\Delta h_{f\,i}^0$ & $\Delta_{\mathrm{f}}\Ht^\circ_i$ & $\Delta H^\circ_{f298i}$ & $\Delta H^o_{fi}$ & $\Delta H_{F,i}^\circ$ \\
%   standard enthalphy of reaction & \verb"\Deltarxn\Hm^std" & $\Deltarxn\Hm^\std$ & $\inherit{\bar{h}^\circ_\reaction}$ & $\smash{\overline{h}}_R^\circ$ & $\Delta H^\circ$ & $\Delta H_{\mathrm{m}}$ & $\Delta h^o_\text{rxn}$ & $\inherit{\Delta\bar{h}^\circ_\text{rxn}}$ & $\Delta h^0_\text{rxn}$ & $\Delta_\text{rxn}\Ht^\circ$ & $\Delta H^\circ$ & $\Delta H_{rx}^o$ & $\Delta H_R^\circ$ \\
%   standard free energy of formation & \verb"\Deltaf\Gm^std" & $\Deltaf\Gm^\std$ & $\bar{g}^\circ$ & $\smash{\bar{g}}_f^\circ$ & $\Delta G_f^\circ$ & $\Delta_f G^\circ_{\mathrm{m}}$ & $\Delta g_f^o$ & $\bar{g}^\circ_{\mathrm{f}}$ & $\Delta g_f^0$ & $\Delta_{\mathrm{f}}\Gt^\circ$ & $\Delta G^\circ_{f298}$ & $\Delta G_f^o$ & $\Delta G_F^\circ$ \\
%   standard free energy of formation of $i$ & \verb"\Deltaf\Gm_i^std" & $\Deltaf\Gm_i^\std$ & $\bar{g}^\circ_{f,i}$ & $\smash{\bar{g}}_{f,i}^\circ$ & $\Delta G_{f,i}^\circ$ & $\Delta_f G^\circ_{\mathrm{m}i}$ & $(\Delta g_f^o)_i$ & $(\bar{g}^\circ_{\mathrm{f}})_i$ & $\Delta g_{f\,i}^0$ & $\Delta_{\mathrm{f}}\Gt^\circ_i$ & $\Delta G^\circ_{f298i}$ & $\Delta G^o_{fi}$ & $\Delta G_{F,i}^\circ$ \\
%   standard free energy of reaction & \verb"\Deltarxn\Gm^std" & $\Deltarxn\Gm^\std$ & $\inherit{\bar{g}^\circ_\reaction}$ & $\smash{\bar{g}}^\circ_R$ & $\Delta G^\circ$ & $\Delta G_{\mathrm{m}}$ & $\Delta g^o_\text{rxn}$ & $\inherit{\Delta\bar{g}^\circ_\text{rxn}}$ & $\Delta g_\text{rxn}^0$ & $\Delta_\text{rxn}\Gt^\std$ & $\Delta G^\circ$ & $\Delta G^o_{rx}$ & $\Delta G_R^\circ$ \\
%   standard fugacity & \verb"\fstd" & $\fstd$ & $\inherit{f^\circ}$ & $\inherit{f^\circ}$ & $f^\circ$ & $f^\circ$ & $f^o$ & $\inherit{f^\circ}$ & $f^0$ & $\bar f^\circ$ & $f^\circ$ & $\inherit{\fstd}$ & $f^\circ$ \\
%   standard Gibbs free energy & \verb"\Gm^\std" & $\Gm^\std$ & $\bar{g}^\circ$ & $\bar{g}^\circ$ & $G^\circ$ & $G^\circ_{\mathrm{m}}$ & $g^o$ & $\overline{g}^\circ$ & $g^0$ & $\Gt^\circ$ & $G^\circ$ & $G^o$ & $G^\circ$ \\
%   standard Gibbs free energy of $i$ & \verb"\Gm^\std_i" & $\Gm^\std_i$ & $\bar{g}^\circ_i$ & $\bar{g}_i^\circ$ & $G^\circ_i$ & $G^\circ_{\mathrm{m}i}$ & $g_i^o$ & $\overline{g}^\circ_i$ & $g^0_i$ & $\Gt^\circ_i$ & $G^\circ_i$ & $G^o_i$ & $G^\circ_i$ \\
%   standard pressure & \verb"\Pstd" & $\Pstd$ & $P_0$ & $P_0$ & $P^\circ$ & $P^\circ$ & $\inherit{P^o}$ & $p_\text{ref}$ & $P^0$ & \text{1~bar} & $P^\circ$ & $P^\ast$ & $P^\circ$ \\
%   vapor pressure & \verb"\Pvap" & $\Pvap$ & $\inherit{\Pvap}$ & $P^v$ & $P^{std}$ & $p$ & $\inherit{P^\text{sat}}$ & $p_\text{ref}$ & $P^s$ & $P^\text{vap}$ & $P^\text{sat}$ & $P^\text{sat}$ & $P^\text{sat}$ \\
%   volume (total) & \verb"\Vt" & $\Vt$ & $V$ & $V$\footref{fn:XeTeX} & $\Vt$ & $V$ & $V$ & $V$ & $V$ & $V$ & $V^t$ & $\Vt$ & $\Vt$ \\
%   volume (molar) & \verb"\Vm" & $\Vm$ & $\bar{v}$ & $\overline{v}$\footref{fn:XeTeX} & $V$ & $V_{\mathrm{m}}$ & $v$ & $\overline{v}$ & $v$ & $\Vt$ & $V$ & $V$ & $V$ \\
%   volume (specific) & \verb"\Vs" & $\Vs$ & $v$ & $v$\footref{fn:XeTeX} & $V$ & $\inherit{\Vs}$ & $\hat v$ & $v$ & $\inherit{\hat v}$ & $\hat V$ & $V$ & $\inherit{v}$ & $\inherit{\Vs}$ \\
%   volume (molar, residual) & \verb"\VR" & $\VR$ & $\inherit{\bar{v}^\residual}$ & $\inherit{\overline{v}^\residual}$\footref{fn:XeTeX} & $\inherit{V^R}$ & $\inherit{V^{\mathrm{R}}_{\mathrm{m}}}$ & $v^\text{dep}$ & $\inherit{\overline{v}^R}$ & $v^R$ & $\Vt^r$ & $V^R$ & $\inherit{\VR}$ & $V^R$ \\
%   volume (molar, excess) & \verb"\VE" & $\VE$ & $\inherit{\bar{v}^\excess}$ & $\inherit{\overline{v}^\excess}$\footref{fn:XeTeX} & $V^E$ & $V^{\mathrm{E}}_{\mathrm{m}}$ & $v^E$ & $\inherit{\overline{v}^E}$ & $v^E$ & $\Vt^\text{ex}$ & $V^E$ & $V^{EX}$ & $V^{EX}$ \\
%   volume (partial molar, excess) & \verb"\VEpm_i" & $\VEpm_i$ & $\inherit{\overline{v}_i^\excess}$ & $\inherit{\widetilde{v}^\excess}$\footref{fn:XeTeX} & $\smash{\overline{V}}^E_i$ & $V^{\mathrm{E}}_{\mathrm{m}i}$ & $\smash{\overline{V}}^E_i$ & $\inherit{\overline{V}^E_i}$ & $\overline{v}^E_i$ & \begin{thermoshortpm}$\Vpm^{\text{ex}}_i$\end{thermoshortpm} & \begin{thermoshortpm}$\VEpm_i$\end{thermoshortpm} & \begin{thermoshortpm}$\Vpm^{EX}_i$\end{thermoshortpm} & \begin{thermoshortpm}$\Vpm^{EX}_i$\end{thermoshortpm} \\
%   work (total) & \verb"\Wt" & $\Wt$ & $W$ & $W$ & $\underline{W}$ & $W$ & $W$ & $W$ & $W$ & $W$ & $\inherit{W^t}$ & $\inherit{\Wt}$ & $\inherit{\Wt}$ \\
%   work (molar) & \verb"\Wm" & $\Wm$ & $\bar{w}$ & $\overline{w}$ & $W$ & $\inherit{W_{\mathrm{m}}}$ & $w$ & $\inherit{\overline{w}}$ & $\inherit{w}$ & $\inherit{\Wt}$ & $W$ & $W$ & $W$ \\
%   work (specific) & \verb"\Ws" & $\Ws$ & $w$ & $w$ & $W$ & $\inherit{\Ws}$ & $\hat w$ & $\inherit{w}$ & $\inherit{\hat w}$ & $\inherit{\hat W}$ & $\inherit{W}$ & $w$ & $\inherit{\Ws}$ \\
% \end{mpsupertabular}
% \end{landscape}
%
%^^X \end{documentation}
%
% \setcounter{IndexColumns}{2}
% \StopEventually{\PrintChanges\PrintIndex}
%
% ^^A--------------------------------------------------------------------------
% \iffalse
%<*package>
%<@@=thermodynamics>
% \fi
%
%^^X\begin{implementation}
% \section{Implementation}
% We set up some non-standard token comparison variants; these are designed
% to catch both \cs{ncomponents}=\cs{ncomponents} and \cs{ncomponents}=$C$
% (using the default options); we have to define \cs{ncomponents} to be
% expandable to make these work at all.
%    \begin{macrocode}
\ExplSyntaxOn
\cs_generate_variant:Nn \tl_if_eq:nnTF { xxTF }
%    \end{macrocode}
%
% This package requires the \pkg{amstext} package, as \tn{text} is used to
% handle \cs{sat}, \cs{IS}, \cs{IG}, \cs{IGM}, \cs{Henrymol}, \cs{fusion},
% \cs{reaction}, \cs{vaporization}, and \cs{sublimation} by default, as well
% as several other macros defined by package options.
%    \begin{macrocode}
\RequirePackage{amstext}
%    \end{macrocode}
%
% \subsection{Symbols Controlled by Package Options}
% We set some symbols prior to declaring the package options. The default
% symbols follow package option |EUAGHan|, even though the macros follow
% the option |EUFGHAN|.
%
% \begin{macro}{\dbar}
% The way \cs{dbar} is defined depends on the typeface you are using.
% We try to determine, at \verb"\begin{document}", which typeface you chose
% based on the packages that are loaded and some of their internal definitions.
% The \textsf{thermodynamics} package currently supports
% Computer Modern (the default or through \pkg{lmodern}),
% Palatino (through \pkg{pxfonts} or \pkg{newpxmath}),
% Times (through \pkg{txfonts}, \pkg{mathptmx}, or \pkg{newtxmath}),
% Utopia (through \pkg{mathdesign}),
% Bitstream Charter (through \pkg{mathdesign}), and
% Garamond (through \pkg{mathdesign}).
% Definitions of \cs{dbar} (with \cs{newcommand*}, \cs{providecommand*},
% \cs{NewDocumentCommand}, or \cs{ProvideDocumentCommand})
% in the preamble will override the ones here.
%    \begin{macrocode}
\AtBeginDocument{
    \@ifpackageloaded{pxfonts}{%
        \ProvideDocumentCommand{\dbar}{}
            {\mkern5mu\mathchar'26\mkern-10mu d}
    }{}
    \@ifpackageloaded{newpxmath}{%
        \ProvideDocumentCommand{\dbar}{}
            {\mkern5mu\mathchar'26\mkern-10mu d}
    }{}
    \@ifpackageloaded{txfonts}{%
        \ProvideDocumentCommand{\dbar}{}
            {\mkern5mu\mathchar'26\mkern-11mu d}
    }{}
    \@ifpackageloaded{mathptmx}{%
        \ProvideDocumentCommand{\dbar}{}
            {\mkern5mu\mathchar'26\mkern-10mu d}
    }{}
    \@ifpackageloaded{newtxmath}{%
        \ProvideDocumentCommand{\dbar}{}
            {\mkern5mu\mathchar'26\mkern-11mu d}
    }{}
    \@ifpackageloaded{mathdesign}{%
        \tl_const:Nn \c_@@_charter_tl {mdbch}
        \tl_const:Nn \c_@@_utopia_tl {mdput}
        \tl_const:Nn \c_@@_garamond_tl {mdugm}
        \tl_if_eq:NNT \MD@default@family \c_@@_utopia_tl
        { \ProvideDocumentCommand{\dbar}{}
            {\mkern5mu\mathchar'26\mkern-20mu d}
        }
        \tl_if_eq:NNT \MD@default@family \c_@@_charter_tl
        { \ProvideDocumentCommand{\dbar}{}
            {\mkern5mu\mathchar'26\mkern-15mu d}
        }
        \tl_if_eq:NNT \MD@default@family \c_@@_garamond_tl
        { \ProvideDocumentCommand{\dbar}{}
            {\mkern5mu\mathchar'26\mkern-17mu d}
        }
    }{}
    % Defaults to Computer Modern
    \ProvideDocumentCommand{\dbar}{}
        {\mkern3mu\mathchar'26\mkern-12mu d}
}
%    \end{macrocode}
% \end{macro}
%
% Symbols are defined for the total energy, internal energy, Helmholtz free
% energy, Gibbs free energy, grand potential (Landau free energy), enthalpy,
% entropy, surface area, volume, number of moles, heat, and work; these are
% $E$, $U$, $A$, $G$, $\Omega$, $H$, $S$, $a$, $V$, $n$, $Q$, and $W$,
% respectively. These commands should not be used on their own, but rather
% accessed through the macros \cs{Ut}, \cs{Um}, and \cs{Us} (using the internal
% energy as an example).
%
% The default symbols are not intended to be easy to change---the intended
% mechanism is through package options. If you want to use a non-standard
% symbol that is not available through one of the package options, you can
% redefine the internal token lists inside
% \cs{ExplSyntaxOn}\,\dots\!\cs{ExplSyntaxOff}. For example,
% \begin{verbatim}
%    \ExplSyntaxOn
%       \tl_gset:Nn \g__thermodynamics_Helmholtz_symbol {H}
%       \tl_gset:Nn \g__thermodynamics_enthalpy_symbol {h}
%    \ExplSyntaxOff
%\end{verbatim}
% would define the ill-advised notation that I have nonetheless heard of
% that uses $H$ for Helmholtz free energy and $h$ for enthalpy.
% Note that the macros for temperature and pressure are only used inside
% the definitions of the compressibilities, expansivities, and heat
% capacities; there is no user-level macro for the temperature or the pressure,
% so it is up to the user to use consistent symbols for those properties.
%    \begin{macrocode}
\tl_new:N \g_@@_total_energy_symbol
\tl_new:N \g_@@_internal_energy_symbol
\tl_new:N \g_@@_Helmholtz_symbol
\tl_new:N \g_@@_Gibbs_symbol
\tl_new:N \g_@@_Landau_symbol
\tl_new:N \g_@@_enthalpy_symbol
\tl_new:N \g_@@_entropy_symbol
\tl_new:N \g_@@_area_symbol
\tl_new:N \g_@@_volume_symbol
\tl_new:N \g_@@_mole_symbol
\tl_new:N \g_@@_heat_symbol
\tl_new:N \g_@@_work_symbol
\tl_new:N \g_@@_temperature_symbol
\tl_new:N \g_@@_pressure_symbol

\tl_gset:Nn \g_@@_total_energy_symbol E
\tl_gset:Nn \g_@@_internal_energy_symbol U
\tl_gset:Nn \g_@@_Helmholtz_symbol A
\tl_gset:Nn \g_@@_Gibbs_symbol G
\cs_if_exist:NTF \Omegait
{ \tl_gset:Nn \g_@@_Landau_symbol \Omegait }
{ \tl_gset:Nn \g_@@_Landau_symbol \Omega }
\tl_gset:Nn \g_@@_enthalpy_symbol H
\tl_gset:Nn \g_@@_entropy_symbol S
\tl_gset:Nn \g_@@_area_symbol a
\tl_gset:Nn \g_@@_volume_symbol V
\tl_gset:Nn \g_@@_mole_symbol n
\tl_gset:Nn \g_@@_heat_symbol Q
\tl_gset:Nn \g_@@_work_symbol W
\tl_gset:Nn \g_@@_temperature_symbol T
\tl_gset:Nn \g_@@_pressure_symbol P
%    \end{macrocode}
%
% We then define two functions and several lengths that we shall use when
% drawing rules above or below a symbol. The default is to use underlined
% symbols for extensive quantities, plain symbols for molar quantities, and
% carets for specific quantities, but this can be changed using package
% options.
%^^A TODO these might work better as kern 0.1*width, symbol, kern 0.2*width
%    \begin{macrocode}
\cs_new:Nn \@@_underline:n
{ \mkern1mu\underline{\mkern-1mu #1\mkern-4mu}\mkern4mu }
\cs_new:Nn \@@_overline:n
{ \mkern2mu\overline{\mkern-2mu #1\mkern-1mu}\mkern1mu }
%    \end{macrocode}
%
% \begin{macro}{\PartialOpen,\PartialClose,\PartialEmptyClose}
% We define three commands to use to denote the beginning and end of partial
% derivatives. These symbols can be customized by package options. Default
% is |parentheses|, meaning that \verb"\[ \Partial{f}{x}{y} \]" renders as
% \[ \left(\frac{\partial f}{\partial x}\right)_y \]
% with the defaults. The macro \cs{PartialEmptyClose} is used when the last
% argument to \cs{Partial} is empty, which is important for the |bar|
% option to the document class or inside the \env{thermobar} environment.
%    \begin{macrocode}
\tl_new:N \l_@@_PartialOpen_tl
\tl_new:N \l_@@_PartialEmptyClose_tl
\tl_new:N \l_@@_PartialClose_tl

\tl_set:Nn \l_@@_PartialOpen_tl {(}
\tl_set:Nn \l_@@_PartialClose_tl {)}
\tl_set:Nn \l_@@_PartialEmptyClose_tl {)}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Package Options}
% We declare a bunch of options for which sets of symbols to use.
% These are summarized in Table~\ref{table:symbol-sets}.
% \changes{v1.01}{2023/09/15}{Changed options with two $E$ or two $A$
%    variables to use calligraphic letters for the less-common of the two.}
%    \begin{macrocode}
\DeclareOption{EUAGHan}{}% the default
\DeclareOption{EUAGHaN}{\tl_gset:Nn \g_@@_mole_symbol N}%
\DeclareOption{EUHAGan}{\ExecuteOptions{EUAGHan}}
\DeclareOption{EUHAGaN}{\ExecuteOptions{EUAGHaN}}
\DeclareOption{EUFGHAn}{%
  \tl_gset:Nn \g_@@_Helmholtz_symbol F
  \tl_gset:Nn \g_@@_area_symbol A
}
\DeclareOption{EUFGHAN}{%
  \tl_gset:Nn \g_@@_Helmholtz_symbol F
  \tl_gset:Nn \g_@@_area_symbol A
  \tl_gset:Nn \g_@@_mole_symbol N
}
\DeclareOption{EEFGHAn}{%
  \tl_gset:Nn \g_@@_total_energy_symbol {\mathcal{E}}
  \tl_gset:Nn \g_@@_internal_energy_symbol E
  \tl_gset:Nn \g_@@_Helmholtz_symbol F
  \tl_gset:Nn \g_@@_area_symbol A
}
\DeclareOption{EEFGHAN}{%
  \tl_gset:Nn \g_@@_total_energy_symbol {\mathcal{E}}
  \tl_gset:Nn \g_@@_internal_energy_symbol E
  \tl_gset:Nn \g_@@_Helmholtz_symbol F
  \tl_gset:Nn \g_@@_area_symbol A
  \tl_gset:Nn \g_@@_mole_symbol N
}
\DeclareOption{EEFGHan}{%
  \tl_gset:Nn \g_@@_total_energy_symbol {\mathcal{E}}
  \tl_gset:Nn \g_@@_internal_energy_symbol E
  \tl_gset:Nn \g_@@_Helmholtz_symbol F
}
\DeclareOption{EEFGHaN}{%
  \tl_gset:Nn \g_@@_total_energy_symbol {\mathcal{E}}
  \tl_gset:Nn \g_@@_internal_energy_symbol E
  \tl_gset:Nn \g_@@_Helmholtz_symbol F
  \tl_gset:Nn \g_@@_mole_symbol N
}
\DeclareOption{EEAGHan}{%
  \tl_gset:Nn \g_@@_total_energy_symbol {\mathcal{E}}
  \tl_gset:Nn \g_@@_internal_energy_symbol E
}
\DeclareOption{EEAGHaN}{%
  \tl_gset:Nn \g_@@_total_energy_symbol {\mathcal{E}}
  \tl_gset:Nn \g_@@_internal_energy_symbol E
  \tl_gset:Nn \g_@@_mole_symbol N
}
\DeclareOption{EUAGHAn}{%
  \tl_gset:Nn \g_@@_area_symbol {\mathcal{A}}
}
\DeclareOption{EUAGHAN}{%
  \tl_gset:Nn \g_@@_area_symbol {\mathcal{A}}
  \tl_gset:Nn \g_@@_mole_symbol N
}
\DeclareOption{EUFGHan}{%
  \tl_gset:Nn \g_@@_Helmholtz_symbol F
}
\DeclareOption{EUFGHaN}{%
  \tl_gset:Nn \g_@@_Helmholtz_symbol F
  \tl_gset:Nn \g_@@_mole_symbol N
}
%    \end{macrocode}
% The |delta| option redefines \cs{dbar} to produce the symbol $\delta$.
% The default is to use a $d$ with a slash through it ($\dbar$) for inexact
% differentials unless the user overrides it with this option. The macro could
% also be redefined manually, of course.
%    \begin{macrocode}
\DeclareOption{delta}{ \cs_set_eq:NN \dbar \delta }
%    \end{macrocode}
%
% Next, we define options for the set of notation. The default is
% |intensive-plain|, which produces things like $V$ for molar volume,
% $\Vt$ for total volume, and $\hat V$ for specific volume.
% The symbols themselves are produced via internal (non-user-facing) macros.
%    \begin{macrocode}
\cs_new:Nn \@@_extensive:n {#1}
\cs_new:Nn \@@_intensive:n {#1}
\cs_new:Nn \@@_specific:n {\hat{#1}}

\cs_new:Npn \@@_set_intensive_plain
{
  \cs_set:Nn \@@_extensive:n {\@@_underline:n{##1}}
  \cs_set:Nn \@@_intensive:n {##1}
}
\cs_new:Npn \@@_set_extensive_plain
{
  \cs_set:Nn \@@_extensive:n {##1}
  \cs_set:Nn \@@_intensive:n {\@@_underline:n{##1}}
}
\cs_new:Npn \@@_set_lowercase_pms
{
  \RenewDocumentCommand{\partialmolar}{m}
  {
    \tl_set:Nn \l_@@_pm_symbol_tl {\text_lowercase:n {##1}}
    \@@_generic_pm:
  }
}
\cs_new:Npn \@@_set_intensive_lowercase
{
  \cs_set:Nn \@@_extensive:n {\text_uppercase:n {##1}}
  \cs_set:Nn \@@_intensive:n {\text_lowercase:n {##1}}
  \cs_set:Nn \@@_specific:n {\hat{\text_lowercase:n {##1}}}
}
\cs_new:Npn \@@_set_extensive_superscripts
{
  \cs_set:Nn \@@_extensive_one:n
  { \c_math_superscript_token {##1\l_@@_super_separator_tl t} }
  \cs_set:Nn \@@_extensive:n
  {
     \peek_catcode_remove:NTF \c_math_superscript_token
     { ##1 \@@_extensive_one:n }
     { ##1 \c_math_superscript_token t }
  }
  \cs_set:Nn \@@_intensive:n {##1}
}
\DeclareOption{extensive-plain}{\@@_set_extensive_plain}
\DeclareOption{intensive-plain}{\@@_set_intensive_plain} % the default
\DeclareOption{intensive-lowercase}{% PLEASE don't use this!
  \@@_set_intensive_lowercase
  \AtEndOfPackage{
    \@@_set_lowercase_pms
  }
}
\DeclareOption{extensive-superscript}{%
  \@@_set_extensive_superscripts
%^^A  \AtEndOfPackage{%
%^^A    \RenewDocumentCommand{\URt}{}{\g_@@_internal_energy_symbol
%^^A      \c_math_superscript_token{\residual,t}}
%^^A    \RenewDocumentCommand{\HRt}{}{\g_@@_enthalpy_symbol
%^^A      \c_math_superscript_token{\residual,t}}
%^^A    \RenewDocumentCommand{\FRt}{}{\g_@@_Helmoholtz_symbol
%^^A      \c_math_superscript_token{\residual,t}}
%^^A    \RenewDocumentCommand{\GRt}{}{\g_@@_Gibbs_symbol
%^^A      \c_math_superscript_token{\residual,t}}
%^^A    \RenewDocumentCommand{\VRt}{}{\g_@@_volume_symbol
%^^A      \c_math_superscript_token{\residual,t}}
%^^A    \RenewDocumentCommand{\SRt}{}{\g_@@_entropy_symbol
%^^A      \c_math_superscript_token{\residual,t}}
%^^A    \RenewDocumentCommand{\UEt}{}{\g_@@_internal_energy_symbol
%^^A      \c_math_superscript_token{\excess,t}}
%^^A    \RenewDocumentCommand{\HEt}{}{\g_@@_enthalpy_symbol
%^^A      \c_math_superscript_token{\excess,t}}
%^^A    \RenewDocumentCommand{\FEt}{}{\g_@@_Helmoholtz_symbol
%^^A      \c_math_superscript_token{\excess,t}}
%^^A    \RenewDocumentCommand{\GEt}{}{\g_@@_Gibbs_symbol
%^^A      \c_math_superscript_token{\excess,t}}
%^^A    \RenewDocumentCommand{\VEt}{}{\g_@@_volume_symbol
%^^A      \c_math_superscript_token{\excess,t}}
%^^A    \RenewDocumentCommand{\SEt}{}{\g_@@_entropy_symbol
%^^A      \c_math_superscript_token{\excess,t}}
%^^A  }
}
%    \end{macrocode}
% \begin{environment}{thermolongpm,thermoshortpm}
% The |longpm| option (the default) makes partial molar quantities that
% look like \(\UEpm_i\). The |shortpm| option (which is used by several
% textbooks) makes partial molar quantities look like
% \(\smash{\mkern2mu\overline{\mkern-2mu U}}_i^E\).
% The environments \env{thermolongpm} and \env{thermoshortpm} do the same
% thing locally.
% \changes{v2.02}{2024/06/14}{Added ``longpm'' and ``shortpm'' options to
%   control how partial molar properties are rendered along with the
%   environments \env{thermolongpm} and \env{thermoshortpm} to change them
%   locally.}
%    \begin{macrocode}
\bool_new:N \l_@@_longpm_bool
\DeclareOption{longpm}{\bool_set_true:N \l_@@_longpm_bool}
\cs_set_eq:NN \@@_overline_copy:n \@@_overline:n
\DeclareOption{shortpm}{
  \bool_set_false:N \l_@@_longpm_bool
  \AtEndOfPackage{
    \RenewDocumentCommand{\cPpm}{}
    {
      \cs_set:Nn \@@_overline:n {##1}
      \partialmolar{\cPpmshort}
    }
    \RenewDocumentCommand{\cVpm}{}
    {
      \cs_set:Nn \@@_overline:n {##1}
      \partialmolar{\cVpmshort}
    }
  }
}
\NewDocumentEnvironment{thermolongpm}{}{%
  \bool_set_true:N \l_@@_longpm_bool
}{}
\NewDocumentEnvironment{thermoshortpm}{}{%
  \bool_set_false:N \l_@@_longpm_bool
     \RenewSubscriptedSymbol{\cPpm}{\@@_overline:n \heatcapacitysymbol}
        {\g_@@_pressure_symbol}
     \RenewSubscriptedSymbol{\cVpm}{\@@_overline:n \heatcapacitysymbol}
        {\g_@@_volume_symbol}
}{}
%    \end{macrocode}
% \end{environment}
%
% The next two options choose whether variables held constant are subscripted
% (the default) or placed next to the function. The difference is
%  \[ \Partial{\Um}{\Sm}{\Vm} \quad\text{versus}\quad
%     \begin{thermoNOsubscripts}
%       \Partial{\Um}{\Sm}{\Vm}
%     \end{thermoNOsubscripts} \]
% for \verb"subscripts" and \verb"nosubscripts", respectively.
%    \begin{macrocode}
\bool_new:N \l_@@_subscripted_bool
\bool_set_true:N \l_@@_subscripted_bool
\DeclareOption{subscripts}{\bool_set_true:N \l_@@_subscripted_bool}
\DeclareOption{nosubscripts}{\bool_set_false:N \l_@@_subscripted_bool}
%    \end{macrocode}
% These options change how \cs{Partial} and friends render derivatives.
% The default is parentheses, but other options include brackets, braces,
% a vertical bar on the right side, or plain (undecorated) derivatives.
%    \begin{macrocode}
\DeclareOption{parentheses}{}
\DeclareOption{brackets}{%
  \tl_set:Nn \l_@@_PartialOpen_tl {[}
  \tl_set:Nn \l_@@_PartialClose_tl {]}
  \tl_set:Nn \l_@@_PartialEmptyClose_tl {]}
}
\DeclareOption{braces}{%
  \tl_set:Nn \l_@@_PartialOpen_t1 {\{}
  \tl_set:Nn \l_@@_PartialClose_t1 {\}}
  \tl_set:Nn \l_@@_PartialEmptyClose_tl {\}}
}
\DeclareOption{bar}{%
  \tl_set:Nn \l_@@_PartialOpen_tl {.}
  \tl_set:Nn \l_@@_PartialClose_tl {\rvert}
  \tl_set:Nn \l_@@_PartialEmptyClose_tl {.}
}
\DeclareOption{plain-derivatives}{% This implies dU(S,V,N)/dS notation
  \tl_set:Nn \l_@@_PartialOpen_tl {.}
  \tl_set:Nn \l_@@_PartialClose_tl {.}
  \tl_set:Nn \l_@@_PartialEmptyClose_tl {.}
  \ExecuteOptions{nosubscripts}
}
%    \end{macrocode}
% \subsection{The Number of Moles Macros}
% \begin{macro}{\ncomponents}
% We define the number of components, default $C$, for use in the ``all moles''
% and related macros. The command is expandable so we can perform comparisons
% to user-entered values.
%    \begin{macrocode}
\NewExpandableDocumentCommand \ncomponents {} {C}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\allNs,\allXs,\allYs,\allmus,\allMs,\allWs}
% Several macros define a shorthand for ``moles of all species'' (\cs{allNs})
% and ``moles of all species except'' (\cs{allNsbut}), as well as similar
% quantities for masses (\cs{allMs}, \cs{allMsbut}) and chemical potentials
% (\cs{allmus}, \cs{allmusbut}), which occur frequently in mixture
% thermodynamics. The default is for \cs{allNs} to become $\vec{n}$ and
% \verb"allNsbut{i}" to become $n_{j\neq i}$. The optional argument changes
% which index (default: $j$) to use in the left side of the inequality.\relax
% \footnote{The index \!$j$ is automatically replaced with $k$ if the user
%   issues \texttt{\textbackslash allNsbut\{j\}}.}
% Essentially identical commands are defined for chemical potentials and
% masses: \cs{allmus} and \cs{allmusbut} and \cs{allMs} and \cs{allMsbut},
% respectively.
%    \begin{macrocode}
\NewDocumentCommand{\allNs}{O{i}}{\allcomponents[#1]{\Nt}}
\NewDocumentCommand{\allXs}{O{i}}{\allcomponents[#1]{x}}
\NewDocumentCommand{\allYs}{O{i}}{\allcomponents[#1]{y}}
\NewDocumentCommand{\allmus}{O{i}}{\allcomponents[#1]{\mu}}
\NewDocumentCommand{\allMs}{O{i}}{\allcomponents[#1]{m}}
\NewDocumentCommand{\allWs}{O{i}}{\allcomponents[#1]{w}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\allNsbut,\allXsbut,\allYsbut,\allMsbut,\allWsbut}
% Similar commands are defined for mole fractions (\cs{allXs}, \cs{allYs},
% etc.), but these assume the last mole fraction is \emph{not} one of the
% variables---that is, \cs{allXsbut} and \cs{allYsbut} assume the argument
% \emph{and} \cs{ncomponents} are held constant. For example,
% \begin{verbatim}
%   \[ \Partial{\Gm}{T}{P,\allXs} = -\Sm \qquad
%      \Partial{\Gm}{x_i}{T,P,\allXsbut{i}} \neq \Gpm_i \]
%\end{verbatim}
% yields
% \[ \Partial{G}{T}{P,\allXs} = -S \qquad
%    \Partial{G}{x_i}{T,P,x_{j\neq i,C}} \neq \Gpm{i}. \]
%    \begin{macrocode}
\NewDocumentCommand{\allNsbut}{O{j} m} {\allbut[#1]{#2}{\Nt}}
\NewDocumentCommand{\allXsbut}{O{j} m} {\allbutlastand[#1]{#2}{x}}
\NewDocumentCommand{\allYsbut}{O{j} m} {\allbutlastand[#1]{#2}{y}}
\NewDocumentCommand{\allmusbut}{O{j} m} {\allbut[#1]{#2}{\mu}}
\NewDocumentCommand{\allMsbut}{O{j} m} {\allbut[#1]{#2}{m}}
\NewDocumentCommand{\allWsbut}{O{j} m} {\allbutlastand[#1]{#2}{w}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\allbutlastand,\allbut,\allcomponents}
% \changes{v1.01}{10/04/2023}{Updated \cs{allcomponents} to include an
%   optional argument that changes $N_i$ to $N_j$, say, when using
%   TesterModell or other options that denote moles of all components that
%   way. Similar updates to \cs{allNs} and friends.}
% The \cs{allcomponents}, \cs{allbut}, and \cs{allbutlastand} macros can be
% used to define new entities; say, if you want to use $z_i$ as a mole
% fraction, then use
% \begin{verbatim}
%   \NewDocumentCommand{\allZsbut}{O{j} m}{\allbutlastand[#1]{#2}{z}}
%\end{verbatim}
% Similarly, something meaning the concentrations of every species could be
% defined via
% \begin{verbatim}
%   \NewDocumentCommand{\allCs}{O{}}{\allcomponents{C}}
%\end{verbatim}
%    \begin{macrocode}
\NewDocumentCommand{\allcomponents}{O{} m}{\vec{#2}}
\NewDocumentCommand{\allbut}{O{j} m m}
{ \tl_if_eq:nnTF {#1} {#2}
  { {#3}\c_math_subscript_token{k \neq #2} }
  { {#3}\c_math_subscript_token{#1 \neq #2} }
}
\NewDocumentCommand{\allbutlastand}{O{j} m m}
{ \tl_if_eq:xxTF {#2} {\ncomponents}
  { {#3}\c_math_subscript_token{#1 \neq #2} }
  { \tl_if_eq:nnTF {#1} {#2}
    { {#3}\c_math_subscript_token{k \neq #2,\ncomponents} }
    { {#3}\c_math_subscript_token{#1 \neq #2,\ncomponents} }
  }
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Package Options}
% We define two package options that change how to render \cs{allNs} and
% friends.\relax
% \changes{v1.01}{2022/05/04}{Fixed bug in \cs{allbutlastand} when using the
%   |moles-range| option ($C$ should have been $C-1$ in the last option).}
%    \begin{macrocode}
\DeclareOption{moles-index}{}
\DeclareOption{moles-range}{ \@@_set_moles_range }
\cs_new:Npn \@@_set_moles_range {%
  \RenewDocumentCommand{\allcomponents}{O{} m}
  { {##2}\c_math_subscript_token 1,\dots,
        {##2}\c_math_subscript_token{\ncomponents} }
  \RenewDocumentCommand{\allbut}{O{j} m m}
  { \tl_if_eq:nnTF {##2} {1}
    { {##3}\c_math_subscript_token 2,\dots,
        {##3}\c_math_subscript_token{\ncomponents} }
    { \tl_if_eq:xxTF {##2} {\ncomponents}
      { {##3}\c_math_subscript_token 1,\dots,
          {##3}\c_math_subscript_token{\ncomponents-1} }
      { {##3}\c_math_subscript_token 1,\dots,
            [{##3}\c_math_subscript_token{##2}],
            \dots,{##3}\c_math_subscript_token{\ncomponents} }
    }
  }
  \RenewDocumentCommand{\allbutlastand}{O{j} m m}
  { \tl_if_eq:nnTF {##2} {1}
    { {##3}\c_math_subscript_token 2,\dots,
        {##3}\c_math_subscript_token{\ncomponents-1} }
    { \tl_if_eq:xxTF {##2} {\ncomponents}
      { {##3}\c_math_subscript_token 1,\dots,
        {##3}\c_math_subscript_token{\ncomponents-1}
      }
      { \tl_if_eq:xxTF {##2} {\ncomponents-1}
        { {##3}\c_math_subscript_token 1,\dots,
          {##3}\c_math_subscript_token{\ncomponents-2} }
        {
          {##3}\c_math_subscript_token 1,\dots,
          [{##3}\c_math_subscript_token{##2}],\dots,
           {##3}\c_math_subscript_token{\ncomponents-1}
        }
      }
    }
  }
}
%    \end{macrocode}
% The remaining options define textbook-specific notation.
% \changes{v2.02}{2024/06/14}{Added \texttt{KlotzRosenberg} option.}
%    \begin{macrocode}
\DeclareOption{Bejan}{
  \ExecuteOptions{EUFGHAN,intensive-lowercase,delta,shortpm}
  \AtEndOfPackage{
    \cs_set:Nn \@@_specific:n {\text_lowercase:n {#1}}
    \cs_set:Nn \@@_intensive:n {\bar{\text_lowercase:n {#1}}}
    \cs_set:Nn \@@_extensive:n {\text_uppercase:n {#1}}
    \tl_gset:Nn \g_@@_volume_symbol v
    \RenewExpandableDocumentCommand{\ncomponents}{}{n}
    \RenewSubscriptedSymbol{\Lt}{\g_@@_Helmholtz_symbol}{\mu}
    \RenewSubscriptedSymbol{\Lm}
        {\bar{\text_lowercase:n \g_@@_Helmholtz_symbol}}{\mu}
    \RenewSubscriptedSymbol{\Ls}
        {\text_lowercase:n \g_@@_Helmholtz_symbol}{\mu}
    \cs_new:Npn \Delta_vap_sym {} {}
    \NewSubscriptedSymbol{\Delta_vap}{\Delta_vap_sym}{{fg}}
    \RenewDocumentCommand{\Deltavap}{m}{
      \cs_set:Npn \Delta_vap_sym {} {#1}
      \Delta_vap
    }
    \cs_new:Npn \Delta_fus_sym {} {}
    \NewSubscriptedSymbol{\Delta_fus}{\Delta_fus_sym}{{sf}}
    \RenewDocumentCommand{\Deltafus}{m}{
      \cs_set:Npn \Delta_fus_sym {} {#1}
      \Delta_fus
    }
    \cs_new:Npn \Delta_sub_sym {} {}
    \NewSubscriptedSymbol{\Delta_sub}{\Delta_sub_sym}{{sg}}
    \RenewDocumentCommand{\Deltasub}{m}{
      \cs_set:Npn \Delta_sub_sym {} {#1}
      \Delta_sub
    }
    \RenewExpandableDocumentCommand{\heatcapacitysymbol}{}{c}
    \RenewSubscriptedSymbol{\cV}{\@@_intensive:n {\heatcapacitysymbol}}
        {\text_lowercase:n \g_@@_volume_symbol}
    \RenewSubscriptedSymbol{\cVt}{\@@_extensive:n {\heatcapacitysymbol}}
        {\text_uppercase:n \g_@@_volume_symbol}
    \RenewSubscriptedSymbol{\cVpm}{\heatcapacitysymbol}
        {\text_lowercase:n \g_@@_volume_symbol}
    \RenewSubscriptedSymbol{\cPpm}{\heatcapacitysymbol}
        {\text_lowercase:n \g_@@_pressure_symbol}
    \RenewExpandableDocumentCommand{\xrxn}{}{\zeta}
    \RenewDocumentCommand{\fmix}{}{f}
    \RenewDocumentCommand{\Qm}{}{Q}
    \RenewDocumentCommand{\Qs}{}{Q}
    \RenewExpandableDocumentCommand{\kappaT}{}{\compressibilitysymbol}
    \RenewExpandableDocumentCommand{\expansivitysymbol}{}{\beta}
    \RenewExpandableDocumentCommand{\alphaP}{}{\expansivitysymbol}
    \RenewSubscriptedSymbol{\muJT}{\JTsymbol}{J}
    \RenewDocumentCommand{\Deltaf}{m}
    { \tl_set:Nn \l_@@_Deltaf_sym_tl {#1} \@@_Deltaf }
    \RenewDocumentCommand{\Pstd}{}{P\c_math_subscript_token 0}
    \RenewDocumentCommand{\Wm}{}{W}
    \RenewDocumentCommand{\Ws}{}{W}
    \cs_new:Nn \@@_fpure_one:n
    {
      f\c_math_subscript_token{#1}
      \peek_catcode_remove:NF \c_math_superscript_token
      { \c_math_superscript_token\bullet }
    }
    \RenewDocumentCommand{\fpure}{}
    {
      \peek_catcode_remove:NTF \c_math_subscript_token
      { \@@_fpure_one:n }
      { f }
    }
    \cs_new:Nn \@@_phipure_one:n
    {
      \phi\c_math_subscript_token{#1}
      \peek_catcode:NF \c_math_superscript_token
      { \c_math_superscript_token\bullet }
    }
    \RenewDocumentCommand{\phipure}{}
    {
      \peek_catcode_remove:NTF \c_math_subscript_token
      {
        \@@_phipure_one:n
      }
      {\phi}
    }
    \RenewDocumentCommand{\phimix}{}{\phi}
  }
}
\DeclareOption{CBK}{
  \ExecuteOptions{EUAGHAN,intensive-lowercase,delta,shortpm}
  \AtEndOfPackage{
    \cs_set:Nn \@@_overline:n {\widetilde #1}
    \cs_set:Nn \@@_overline_copy:n {\widetilde #1}
    \cs_set:Nn \@@_specific:n {\text_lowercase:n {#1}}
    \cs_set:Nn \@@_intensive:n {\bar{\text_lowercase:n{#1}}}
    \tl_gset:Nn \g_@@_area_symbol A
    \RenewExpandableDocumentCommand{\reaction}{}{R}
    \cs_new:Npn \Delta_vap_sym {} {}
    \NewSubscriptedSymbol{\Delta_vap}{\Delta_vap_sym}{{fg}}
    \RenewDocumentCommand{\Deltavap}{m}{
      \cs_set:Npn \Delta_vap_sym {} {#1}
      \Delta_vap
    }
    \cs_new:Npn \Delta_fus_sym {} {}
    \NewSubscriptedSymbol{\Delta_fus}{\Delta_fus_sym}{{sf}}
    \RenewDocumentCommand{\Deltafus}{m}{
      \cs_set:Npn \Delta_fus_sym {} {#1}
      \Delta_fus
    }
    \cs_new:Npn \Delta_sub_sym {} {}
    \NewSubscriptedSymbol{\Delta_sub}{\Delta_sub_sym}{{sg}}
    \RenewDocumentCommand{\Deltasub}{m}{
      \cs_set:Npn \Delta_sub_sym {} {#1}
      \Delta_sub
    }
    \tl_gset:Nn \g_@@_pressure_symbol p
    \RenewExpandableDocumentCommand{\compressibilitysymbol}{}{\alpha}
    \RenewExpandableDocumentCommand{\expansivitysymbol}{}{\beta}
    \RenewExpandableDocumentCommand{\kappaT}{}{\compressibilitysymbol}
    \RenewExpandableDocumentCommand{\alphaP}{}{\expansivitysymbol}
    \RenewSuperscriptedSymbol{\Psat}{P}{v}
    \RenewDocumentCommand{\Deltaf}{m}
    { \tl_set:Nn \l_@@_Deltaf_sym_tl {#1}
      \@@_Deltaf
    }
    \RenewDocumentCommand{\Pstd}{}{P\c_math_subscript_token 0}
    \RenewDocumentCommand{\Lm}{}{\@@_intensive:n\omega}
    \RenewDocumentCommand{\Ls}{}{\@@_specific:n\omega}
  }
}
\DeclareOption{ElliottLira}{
  \ExecuteOptions{shortpm}
  \AtEndOfPackage{
    \cs_gset_eq:NN \@@_specific:n \@@_intensive:n
    %^^A\RenewDocumentCommand{\partialmolar}{m}{\@@_overline:n #1}
    \RenewDocumentCommand{\allcomponents}{O{} m}{#2}
    \RenewDocumentCommand{\Deltarxn}{m}{\Delta #1}
    \RenewDocumentCommand{\fusion}{}{{fus}}
    \RenewDocumentCommand{\sublimation}{}{{sub}}
    \RenewDocumentCommand{\vaporization}{}{{vap}}
    \RenewDocumentCommand{\sat}{}{{sat}}
    %^^A\RenewSubscriptedSymbol{\Henrymol}{/K}{H} %^^A FIXME
    \RenewDocumentCommand{\IG}{}{{ig}}
    \RenewDocumentCommand{\IGM}{}{{ig}}
    \RenewDocumentCommand{\IS}{}{{is}}
    \RenewDocumentCommand{\Cstd}{}{m\c_math_superscript_token \std}
    \RenewDocumentCommand{\muJT}{}{\mu\c_math_subscript_token{JT}}
  }
}
\DeclareOption{KlotzRosenberg}{
  \ExecuteOptions{delta}
  \AtEndOfPackage{
    \tl_set:Nn \l_@@_sub_separator_tl {}
    \cs_set:Nn \@@_extensive:n {#1}
    \cs_new:Nn \@@_intensive_one:n
    {
      \c_math_superscript_token {#1}
      \peek_catcode_remove:NTF \c_math_subscript_token
      { \@@_intensive_three:n }
      { \c_math_subscript_token{\mathrm{m}} }
    }
    \cs_new:Nn \@@_intensive_three:n
    { \c_math_subscript_token{\mathrm{m}\l_@@_sub_separator_tl #1} }
    \cs_new:Nn \@@_intensive_two:n
    {
      \c_math_subscript_token{\mathrm{m}\l_@@_sub_separator_tl #1}
      \peek_catcode:NF \c_math_superscript_token
      { \c_math_superscript_token\bullet }
    }
    \cs_set:Nn \@@_intensive:n
    {
      #1
      \peek_catcode_remove:NTF \c_math_superscript_token
      { \@@_intensive_one:n }
      { \peek_catcode_remove:NTF \c_math_subscript_token
        { \@@_intensive_two:n }
        { \c_math_subscript_token{\mathrm{m}} }
      }
    }
    \cs_new:Nn \@@_fpure_one:n
    {
      f\c_math_subscript_token{#1}
      \peek_catcode_remove:NF \c_math_superscript_token
      { \c_math_superscript_token\bullet }
    }
    \RenewDocumentCommand{\fpure}{}
    {
      \peek_catcode_remove:NTF \c_math_subscript_token
      { \@@_fpure_one:n }
      { f }
    }
    \cs_new:Nn \@@_phipure_one:n
    {
      \gamma\c_math_subscript_token{#1}
      \peek_catcode_remove:NF \c_math_superscript_token
      { \c_math_superscript_token\bullet }
    }
    \RenewDocumentCommand{\phipure}{}
    {
      \peek_catcode_remove:NTF \c_math_subscript_token
      { \@@_phipure_one:n }
      { \gamma }
    }
    \RenewDocumentCommand{\fmix}{}{f}
    \RenewDocumentCommand{\phimix}{}{\gamma}
    \RenewDocumentCommand{\phisat}{}{\gamma^\sat}
    \cs_if_exist:NTF \gammaup
    { \RenewDocumentCommand{\gamma}{}{\gammaup} }
    { \cs_if_exist:NT \upgamma
        { \RenewDocumentCommand{\gamma}{}{\upgamma} }
    }
    \RenewDocumentCommand{\gammarat}{}{\gamma}
    \RenewDocumentCommand{\gammamol}{}{\gamma}
    \cs_if_exist:NTF \muup
      {\RenewDocumentCommand{\mu}{}{\muup}}
      {\cs_if_exist:NT \upmu
          {\RenewDocumentCommand{\mu}{}{\upmu}}
      }
    \cs_if_exist:NTF \alphaup
      {\RenewExpandableDocumentCommand{\expansivitysymbol}{}{\alphaup}}
      {\cs_if_exist:NTF \upalpha
        {\RenewExpandableDocumentCommand{\compressibilitysymbol}{}{\alphaup}}
        {\RenewExpandableDocumentCommand{\compressibilitysymbol}{}{\alpha}}
      }
    \cs_if_exist:NTF \betaup
      {\RenewExpandableDocumentCommand{\compressibilitysymbol}{}{\betaup}}
      {\cs_if_exist:NTF \upbeta
        {\RenewExpandableDocumentCommand{\compressibilitysymbol}{}{\betaup}}
        {\RenewExpandableDocumentCommand{\compressibilitysymbol}{}{\beta}}
      }
    \cs_if_exist:NTF \xiup
      {\RenewDocumentCommand{\xrxn}{}{\xiup}}
      {\cs_if_exist:NT \upxi
          {\RenewDocumentCommand{\xrxn}{}{\upxi}}
      }
    \RenewDocumentCommand{\kappaT}{}{\compressibilitysymbol}
    \RenewDocumentCommand{\alphaP}{}{\expansivitysymbol}
    \RenewSubscriptedSymbol{\muJT}{\JTsymbol}{\text{J.T.}}
    \RenewDocumentCommand{\Deltarxn}{m}{\Delta #1}
    \RenewDocumentCommand{\Deltaf}{}{\Delta\c_math_subscript_token\formation}
    \RenewDocumentCommand{\Deltafus}{}{\Delta}
    \RenewDocumentCommand{\Deltavap}{}{\Delta}
    \RenewDocumentCommand{\Deltasub}{}{\Delta}
%^^A FIXME: should be \Delta G_{\text{mix},\mathrm{m}} not other way around
    \RenewDocumentCommand{\Deltamix}{m}{
      \tl_set:Nn \l_@@_sub_separator_tl {,}
      \Delta #1\c_math_subscript_token{\mixing}
    }
    \RenewDocumentCommand{\excess}{}{{\mathrm{E}}}
    \RenewDocumentCommand{\residual}{}{{\mathrm{R}}}
    \cs_set:Nn \@@_overline:n {#1}
    \RenewDocumentCommand{\IS}{}{{\mathrm{I}}}
    \RenewDocumentCommand{\Psat}{}
    {
      \peek_catcode:NTF \c_math_subscript_token
        {p\c_math_superscript_token\bullet}
        {p}
    }
    \RenewDocumentCommand{\Cstd}{}{m^\std}
    \RenewDocumentCommand{\Henryrat}{}{k}
    \RenewDocumentCommand{\Henrymol}{}{k''}

    % Fix partial molar properties
    \cs_set:Npn \@@_pm_case_one #1
    {
      \l_@@_pm_symbol_tl\c_math_subscript_token{\mathrm{m}#1}
    }
    \cs_set:Npn \@@_pm_case_two [#1]#2
    {
      \l_@@_pm_symbol_tl
        \c_math_superscript_token{#1}\c_math_subscript_token{\mathrm{m}#2}
    }
    \cs_set:Npn \@@_pm_case_three_part_two #1
    {
      \l_@@_pm_symbol_tl
        \c_math_superscript_token{\l_@@_pm_arg_tl}
        \c_math_subscript_token{\mathrm{m}#1}
    }
    \cs_set:Npn \@@_pm_case_four #1
    {
      \l_@@_pm_symbol_tl\c_math_superscript_token{#1}
        \c_math_subscript_token{\mathrm{m}\l_@@_pm_arg_tl}
    }
    \cs_set:Npn \@@_pm_case_five
    {
      \l_@@_pm_symbol_tl
        \c_math_subscript_token{\mathrm{m}\l_@@_pm_arg_tl}
    }

    % fix heat capacities
    \RenewSubscriptedSymbol{\cP}{\heatcapacitysymbol}
        {\g_@@_pressure_symbol\mathrm{m}}
    \RenewSubscriptedSymbol{\cV}{\heatcapacitysymbol}
        {\g_@@_volume_symbol\mathrm{m}}
    \RenewDocumentCommand{\cPpm}{}{\partialmolar{\cPt}}
    \RenewDocumentCommand{\cVpm}{}{\partialmolar{\cVt}}

    \cs_set:Npn \cP_two:n #1
    { \heatcapacitysymbol
      \c_math_subscript_token{\g_@@_pressure_symbol\mathrm{m}
        \l_@@_sub_separator_tl #1}
      \peek_catcode:NF \c_math_superscript_token
      { \c_math_superscript_token\bullet }
    }
    \cs_set:Npn \cV_two:n #1
    { \heatcapacitysymbol
      \c_math_subscript_token{\g_@@_volume_symbol\mathrm{m}
        \l_@@_sub_separator_tl #1}
      \peek_catcode:NF \c_math_superscript_token
      { \c_math_superscript_token\bullet }
    }
  }
  \AtBeginDocument{
    \@ifpackageloaded{emf}{\RenewDocumentCommand{\Epot}{}{\emf}}
    {%
      \PackageWarningNoLine{thermodynamics}
        {Package~emf~not~loaded;~load~to~make~Epot~match~Klotz~
         and~Rosenberg's~notation}%
    }
  }
}
\DeclareOption{Koretsky}{
  \ExecuteOptions{EUAGHAn,brackets,intensive-lowercase,delta,shortpm}
  \AtEndOfPackage{
    \tl_gset:Nn \g_@@_area_symbol {A}
    \RenewExpandableDocumentCommand{\std}{}{o}
    \RenewExpandableDocumentCommand{\ncomponents}{}{m}
    \RenewDocumentCommand{\partialmolar}{m}
    {
      \tl_set:Nn \l_@@_pm_symbol_tl {#1}
      \@@_generic_pm:
    }
    \RenewDocumentCommand{\expansivitysymbol}{}{\beta}
    \RenewDocumentCommand{\IS}{}{{\text{ideal}}}
    \RenewDocumentCommand{\residual}{}{{\text{dep}}}
    \RenewDocumentCommand{\IG}{}{{\text{ideal~gas}}}
    \RenewDocumentCommand{\IGM}{}{{\text{ideal}}}
    \RenewDocumentCommand{\Henryrat}{}{{\mathcal{H}}}
    \RenewDocumentCommand{\gammarat}{}
        {\gamma\c_math_superscript_token\text{Henry's}}
    \RenewDocumentCommand{\gammamol}{}{\gamma\c_math_superscript_token{m}}
    \RenewDocumentCommand{\phipure}{}{\varphi}
    \RenewDocumentCommand{\phimix}{}{\hat\varphi}
    \RenewDocumentCommand{\phisat}{}{\varphi\c_math_superscript_token\sat}
    \cs_new:Npn \Delta_fus_sym {} {}
    \NewSubscriptedSymbol{\Delta_fus}{\Delta_fus_sym}{\fusion}
    \RenewDocumentCommand{\Deltafus}{m}{
      \cs_set:Npn \Delta_fus_sym {} { \Delta #1 }
      \Delta_fus
    }
    \cs_new:Npn \Delta_vap_sym {} {}
    \NewSubscriptedSymbol{\Delta_vap}{\Delta_vap_sym}{\vaporization}
    \RenewDocumentCommand{\Deltavap}{m}{
      \cs_set:Npn \Delta_vap_sym {} { \Delta #1 }
      \Delta_vap
    }
    \cs_new:Npn \Delta_sub_sym {} {}
    \NewSubscriptedSymbol{\Delta_sub}{\Delta_sub_sym}{\sublimation}
    \RenewDocumentCommand{\Deltasub}{m}{
      \cs_set:Npn \Delta_sub_sym {} { \Delta #1 }
      \Delta_sub
    }
    \tl_new:N \l_@@_Deltaf_superscript_tl
    \tl_new:N \l_@@_Deltaf_subscript_tl
    \bool_new:N \l_@@_Deltaf_parentheses_bool
    \tl_new:N \l_@@_Deltaf_entity_tl
    \cs_set:Nn \@@_Deltaf_one:n
    {
      \tl_set:Nn \l_@@_Deltaf_superscript_tl {#1}
      \peek_catcode_remove:NTF \c_math_subscript_token
      {
        \bool_set_true:N \l_@@_Deltaf_parentheses_bool
        \@@_Deltaf_two:n
      }
      {
        \bool_if:NTF \l_@@_Deltaf_parentheses_bool
        {
          (\Delta\l_@@_Deltaf_entity_tl\c_math_subscript_token\formation
            \tl_if_empty:NF \l_@@_Deltaf_superscript_tl
            { \c_math_superscript_token\l_@@_Deltaf_superscript_tl }
          )
          \tl_if_empty:NF \l_@@_Deltaf_subscript_tl
          { \c_math_subscript_token\l_@@_Deltaf_subscript_tl }
        }
        {
          \Delta\l_@@_Deltaf_entity_tl\c_math_subscript_token\formation
            \tl_if_empty:NF \l_@@_Deltaf_superscript_tl
            { \c_math_superscript_token\l_@@_Deltaf_superscript_tl }
        }
      }
    }
    \cs_set:Nn \@@_Deltaf_two:n
    {
      \tl_set:Nn \l_@@_Deltaf_subscript_tl {#1}
      % check for case 4
      \peek_catcode_remove:NTF \c_math_superscript_token
      { \@@_Deltaf_one:n }
      {
        \bool_if:NTF \l_@@_Deltaf_parentheses_bool
        {
          (\Delta\l_@@_Deltaf_entity_tl\c_math_subscript_token\formation
            \tl_if_empty:NF \l_@@_Deltaf_superscript_tl
              {\c_math_superscript_token\l_@@_Deltaf_superscript_tl}
          )
          \tl_if_empty:NF \l_@@_Deltaf_subscript_tl
            \c_math_subscript_token\l_@@_Deltaf_subscript_tl
        }
        {
          \Delta\l_@@_Deltaf_entity_tl\c_math_subscript_token\formation
            \tl_if_empty:NF \l_@@_Deltaf_superscript_tl
              {\c_math_superscript_token\l_@@_Deltaf_superscript_tl}
        }
      }
    }
    \RenewDocumentCommand{\Deltaf}{m}
    {
      \tl_clear:N \l_@@_Deltaf_superscript_tl
      \tl_clear:N \l_@@_Deltaf_subscript_tl
      \tl_set:Nn \l_@@_Deltaf_entity_tl {#1}
      \bool_set_false:N \l_@@_Deltaf_parentheses_bool
      \peek_catcode_remove:NTF \c_math_superscript_token
      {
        \@@_Deltaf_one:n
      }
      {
        \peek_catcode_remove:NTF \c_math_subscript_token
        {
          \bool_set_true:N \l_@@_Deltaf_parentheses_bool
          \@@_Deltaf_two:n
        }
        {
          \Delta #1\c_math_subscript_token \formation
        }
      }
    }
    \RenewDocumentCommand{\kappaT}{}{\compressibilitysymbol}
    \RenewDocumentCommand{\alphaP}{}{\expansivitysymbol}
    \RenewSubscriptedSymbol{\cV}{\@@_intensive:n \heatcapacitysymbol}
        {\@@_intensive:n \g_@@_volume_symbol}
    \RenewSubscriptedSymbol{\cVs}{\@@_specific:n \heatcapacitysymbol}
        {\@@_intensive:n \g_@@_volume_symbol}
    \RenewDocumentCommand{\Lm}{}{\omega}
    \RenewDocumentCommand{\Ls}{}{\hat\omega}
  }
}
\DeclareOption{MSBB}{
  \ExecuteOptions{EUFGHAn,intensive-lowercase,delta,shortpm}
  \AtEndOfPackage{
    \RenewDocumentCommand{\IGM}{}{\ast} % FIXME: is this * or \circ?
    \RenewDocumentCommand{\IG}{}{\ast}
    \RenewDocumentCommand{\expansivitysymbol}{}{\beta}
    \RenewDocumentCommand{\muJT}{}{\mu\c_math_subscript_token J}
    \RenewDocumentCommand{\allcomponents}{O{} m}{#2}
    \RenewDocumentCommand{\allbut}{O{j} m m}
    {
      \tl_if_eq:nnTF {#1} {#2}
      { {#3}\c_math_subscript_token k }
      { {#3}\c_math_subscript_token{#1} }
    }
    \tl_gset_eq:NN \g_@@_Helmholtz_symbol \psi
    \RenewDocumentCommand{\Ft}{}{\Psi}
    \RenewDocumentCommand{\Fpm}{}{\partialmolar{\Psi}}
    \cs_set:Nn \@@_intensive:n {\@@_overline:n{\text_lowercase:n{#1}}}
    \cs_set:Nn \@@_specific:n {\text_lowercase:n{#1}}
    \RenewDocumentCommand{\fmix}{}{\bar f}
    \RenewDocumentCommand{\phimix}{}{\bar\phi}
    \RenewDocumentCommand{\phimix}{}{\bar\phi}
    \tl_gset:Nn \g_@@_pressure_symbol p
    \tl_gset:Nn \g_@@_volume_symbol v
    \RenewDocumentCommand{\partialmolar}{m}
    {
      \tl_set:Nn \l_@@_pm_symbol_tl {\text_uppercase:n #1}
      \@@_generic_pm:
    }
    \RenewDocumentCommand{\kappaT}{}{\compressibilitysymbol}
    \RenewDocumentCommand{\alphaP}{}{\expansivitysymbol}
    \RenewDocumentCommand{\mustd}{}{\Gm^\std}
    \RenewExpandableDocumentCommand{\formation}{}{{\mathrm{f}}}
    \RenewDocumentCommand{\Pstd}{}
      {\g_@@_pressure_symbol\c_math_subscript_token\text{ref}}
    \RenewExpandableDocumentCommand{\xrxn}{}{\varepsilon}
    \RenewExpandableDocumentCommand{\Lm}{}{\@@_intensive:n \omega}
    \RenewExpandableDocumentCommand{\Ls}{}{\@@_specific:n \omega}
    \RenewExpandableDocumentCommand{\heatcapacitysymbol}{}{C}
    \tl_new:N \l_@@_Deltaf_superscript_tl
    \tl_new:N \l_@@_Deltaf_subscript_tl
    \bool_new:N \l_@@_Deltaf_parentheses_bool
    \tl_new:N \l_@@_Deltaf_entity_tl
    \cs_set:Nn \@@_Deltaf_one:n
    {
      \tl_set:Nn \l_@@_Deltaf_superscript_tl {#1}
      \peek_catcode_remove:NTF \c_math_subscript_token
      {
        \bool_set_true:N \l_@@_Deltaf_parentheses_bool
        \@@_Deltaf_two:n
      }
      {
        \bool_if:NTF \l_@@_Deltaf_parentheses_bool
        {
          (\l_@@_Deltaf_entity_tl\c_math_subscript_token\formation
            \tl_if_empty:NF \l_@@_Deltaf_superscript_tl
            { \c_math_superscript_token\l_@@_Deltaf_superscript_tl }
          )
          \tl_if_empty:NF \l_@@_Deltaf_subscript_tl
          { \c_math_subscript_token\l_@@_Deltaf_subscript_tl }
        }
        {
          \l_@@_Deltaf_entity_tl\c_math_subscript_token{\formation}
            \tl_if_empty:NF \l_@@_Deltaf_superscript_tl
            { \c_math_superscript_token\l_@@_Deltaf_superscript_tl }
        }
      }
    }
    \cs_set:Nn \@@_Deltaf_two:n
    {
      \tl_set:Nn \l_@@_Deltaf_subscript_tl {#1}
      % check for case 4
      \peek_catcode_remove:NTF \c_math_superscript_token
      { \@@_Deltaf_one:n }
      {
        \bool_if:NTF \l_@@_Deltaf_parentheses_bool
        {
          (\l_@@_Deltaf_entity_tl\c_math_subscript_token\formation
            \tl_if_empty:NF \l_@@_Deltaf_superscript_tl
            { \c_math_superscript_token\l_@@_Deltaf_superscript_tl }
          )
          \tl_if_empty:NF \l_@@_Deltaf_subscript_tl
          { \c_math_subscript_token\l_@@_Deltaf_subscript_tl }
        }
        {
          \l_@@_Deltaf_entity_tl\c_math_subscript_token\formation
            \tl_if_empty:NF \l_@@_Deltaf_superscript_tl
            { \c_math_superscript_token\l_@@_Deltaf_superscript_tl }
        }
      }
    }
    \RenewDocumentCommand{\Deltaf}{m}
    {
      \tl_clear:N \l_@@_Deltaf_superscript_tl
      \tl_clear:N \l_@@_Deltaf_subscript_tl
      \tl_set:Nn \l_@@_Deltaf_entity_tl {#1}
      \bool_set_false:N \l_@@_Deltaf_parentheses_bool
      \peek_catcode_remove:NTF \c_math_superscript_token
      {
        \@@_Deltaf_one:n
      }
      {
        \peek_catcode_remove:NTF \c_math_subscript_token
        {
          \bool_set_true:N \l_@@_Deltaf_parentheses_bool
          \@@_Deltaf_two:n
        }
        {
          \Delta #1\c_math_subscript_token \formation
        }
      }
    }
  }
}
\DeclareOption{Prausnitz}{
  \ExecuteOptions{intensive-lowercase,shortpm}
  \AtEndOfPackage{
    \RenewExpandableDocumentCommand{\ncomponents}{}{m}
    \RenewDocumentCommand{\fmix}{}{f}
    \RenewDocumentCommand{\fsat}{}{\fpure\c_math_superscript_token\sat}
    % TODO: this should pick up H_2 and make it into H_{2,1} (assuming
    % the solvent is always 1...?)
    \RenewDocumentCommand{\Henryrat}{}{H}
    %^^A\RenewDocumentCommand{\residual}{}{{{\mathcal{R}}}}
    \RenewDocumentCommand{\allcomponents}{O{i} m}
      { {#2}\c_math_subscript_token{#1} }
    \RenewDocumentCommand{\allbut}{O{i} m m}
    { \tl_if_eq:nnTF {#1} {#2}
        { {#3}\c_math_subscript_token k }
        { {#3}\c_math_subscript_token{#1} }
    }
    \tl_set:Nn \l_@@_sub_separator_tl {\,}
    \tl_gset:Nn \g_@@_pressure_symbol {p}
    \tl_gset:Nn \g_@@_volume_symbol {v}
    \RenewSubscriptedSymbol{\fpure}{f}{{\text{pure}}}
    \RenewDocumentCommand{\phimix}{}{\varphi}
    \RenewDocumentCommand{\phisat}{}{\varphi^\sat}
    \RenewDocumentCommand{\sat}{}{s}
    \RenewDocumentCommand{\mixing}{}{\text{mixing}}
    \RenewDocumentCommand{\Lm}{}{\omega}
    \RenewDocumentCommand{\Ls}{}{\@@_specific:n \omega}
    \RenewSubscriptedSymbol{\phipure}{\varphi}{{\text{pure}}}
    \RenewDocumentCommand{\IG}{}{{\text{id}}}
    \RenewDocumentCommand{\IGM}{}{{\text{id}}}
    \RenewDocumentCommand{\IS}{}{{\text{(ideal)}}}
    \RenewExpandableDocumentCommand{\compressibilitysymbol}{}{\beta}
    \RenewDocumentCommand{\kappaT}{}{\compressibilitysymbol}
    \RenewDocumentCommand{\alphaP}{}{\expansivitysymbol}
    \RenewExpandableDocumentCommand{\std}{}{0}
    \@ifpackageloaded{emf}
      {\RenewDocumentCommand{\Epot}{}{\emf}}
      {\RenewDocumentCommand{\Epot}{}{\mathcal{E}}}
    \DeclareMathAlphabet{\mathdutchcal}{U}{dutchcal}{m}{n}
    \RenewExpandableDocumentCommand{\actrel}{}{\mathdutchcal{a}}
  }
}
\DeclareOption{Sandler}{
  \ExecuteOptions{EUAGHaN,extensive-plain,shortpm}
  \AtEndOfPackage{
    \RenewDocumentCommand{\Pvap}{}
        {{P\c_math_superscript_token{\text{vap}}}}
    \RenewDocumentCommand{\excess}{}{{\text{ex}}}
    \RenewDocumentCommand{\residual}{}{{\text{r}}}
    \RenewExpandableDocumentCommand{\ncomponents}{}{\mathcal{C}}
    \RenewDocumentCommand{\fmix}{}{\bar f}
    \RenewDocumentCommand{\fstd}{}{\bar f\c_math_superscript_token\std}
    \RenewDocumentCommand{\phimix}{}{\bar\phi}
    \RenewDocumentCommand{\allcomponents}{O{} m}{\@@_underline:n{#2}}
    \RenewDocumentCommand{\IG}{}{{\text{IG}}}
    \RenewDocumentCommand{\IGM}{}{{\text{IGM}}}
    \RenewDocumentCommand{\IS}{}{{\text{IM}}}
    \RenewDocumentCommand{\Deltamix}{m}
        {\Delta\c_math_subscript_token\mixing #1}
    \RenewDocumentCommand{\Deltarxn}{m}
        {\Delta\c_math_subscript_token\reaction #1}
    \RenewDocumentCommand{\Deltasub}{m}
        {\Delta\c_math_subscript_token\sublimation #1}
    \RenewDocumentCommand{\Deltafus}{m}
        {\Delta\c_math_subscript_token\fusion #1}
    \RenewDocumentCommand{\Deltavap}{m}
        {\Delta\c_math_subscript_token\vaporization #1}
    \RenewDocumentCommand{\Pstd}{}{\text{1~bar}
      \peek_catcode_remove:NT \c_math_subscript_token {\use_none:n}
    }
    \RenewDocumentCommand{\Cstd}{}{\text{1~molal}
      \peek_catcode_remove:NT \c_math_subscript_token {\use_none:n}
    }
    \RenewDocumentCommand{\Henryrat}{}{H}
    \RenewSubscriptedSymbol{\cV}
        {\heatcapacitysymbol}{\g_@@_volume_symbol}
    \RenewSubscriptedSymbol{\cP}
        {\heatcapacitysymbol}{\g_@@_pressure_symbol}
    \RenewSubscriptedSymbol{\cVt}
        {\Nt\heatcapacitysymbol}{\g_@@_volume_symbol}
    \RenewSubscriptedSymbol{\cPt}
        {\Nt\heatcapacitysymbol}{\g_@@_pressure_symbol}
    \RenewDocumentCommand{\formation}{}{\mathrm{f}}
    \RenewDocumentCommand{\Deltaf}{}
        {\Delta\c_math_subscript_token\formation}
    \RenewDocumentCommand{\alphaP}{}{\expansivitysymbol}
    \RenewDocumentCommand{\muJT}{}{\mu}
    \RenewDocumentCommand{\xrxn}{}{X}
  }
}
\DeclareOption{SVNAS}{
  \ExecuteOptions{extensive-superscript,shortpm}
  \AtEndOfPackage{
    \RenewDocumentCommand{\allcomponents}{O{} m}{#2}
    \RenewDocumentCommand{\allbut}{O{j} m m}
    {
      \tl_if_eq:nnTF {#1} {#2}
      { {#3}\c_math_subscript_token k }
      { {#3}\c_math_subscript_token{#1} }
    }
    \RenewDocumentCommand{\IG}{}{{ig}}
    \RenewDocumentCommand{\IGM}{}{{ig}}
    \RenewDocumentCommand{\IS}{}{{id}}
    \RenewDocumentCommand{\IS}{}{{id}}
    \RenewDocumentCommand{\fusion}{}{{sl}}
    \RenewDocumentCommand{\vaporization}{}{{vl}}
    \RenewDocumentCommand{\sublimation}{}{{vs}}
    \RenewDocumentCommand{\expansivitysymbol}{}{\beta}
    \RenewDocumentCommand{\xrxn}{}{\varepsilon}
    \RenewDocumentCommand{\Deltarxn}{m}{\Delta #1}
    \RenewDocumentCommand{\Deltamix}{m}{\Delta #1}
    \RenewSubscriptedSymbol{\cVt}
        {\Nt\heatcapacitysymbol}{\g_@@_volume_symbol}
    \RenewSubscriptedSymbol{\cPt}
        {\Nt\heatcapacitysymbol}{\g_@@_pressure_symbol}
    % FIXME
    \RenewDocumentCommand{\cP}{}
        {{\heatcapacitysymbol\c_math_subscript_token\g_@@_pressure_symbol}}
    \RenewDocumentCommand{\cV}{}
        {{\heatcapacitysymbol\c_math_subscript_token\g_@@_volume_symbol}}
    \RenewDocumentCommand{\kappaT}{}{\compressibilitysymbol}
    \RenewDocumentCommand{\alphaP}{}{\expansivitysymbol}
    \RenewDocumentCommand{\muJT}{}{\mu}
    \RenewDocumentCommand{\Cstd}{}{m\c_math_superscript_token\std
      \peek_catcode_remove:NT \c_math_subscript_token {\use_none:n}
    }
    \RenewDocumentCommand{\mustd}{}{\Gm\c_math_superscript_token\std}
    \RenewDocumentCommand{\Henryrat}{}{\mathcal{H}}
    \RenewDocumentCommand{\formation}{}
    {
      \tl_set:Nn \l_@@_sub_separator_tl {}
      f298
    }
    \cs_set:Nn \@@_specific:n {#1}
  }
}
\DeclareOption{ModellReid}{\ExecuteOptions{TesterModell}}
\DeclareOption{TesterModell}{
  \ExecuteOptions{EUAGHaN,delta,shortpm}
  \AtEndOfPackage{
    \cs_set:Nn \@@_specific:n {\text_lowercase:n{#1}}
    \RenewExpandableDocumentCommand{\ncomponents}{}{n}
    \RenewDocumentCommand{\allcomponents}{O{i} m}
    {
      {#2}\c_math_subscript_token{#1}
    }
    \RenewDocumentCommand{\allbut}{O{i} m m}
    { \tl_if_eq:nnTF {#1} {#2}
      { {#3}\c_math_subscript_token{k}[#2] }
      { {#3}\c_math_subscript_token{#1}[#2] }
    }
    \RenewDocumentCommand{\allbutlastand}{O{j} m m}
    { \tl_if_eq:xxTF {#2} {\ncomponents}
      { {#3}\c_math_subscript_token{#1}\relax[#2] }
      { \tl_if_eq:nnTF {#1} {#2}
        { {#3}\c_math_subscript_token{k}[#2,\ncomponents] }
        { {#3}\c_math_subscript_token{#1}[#2,\ncomponents] }
      }
    }
    \RenewDocumentCommand{\IG}{}{{o}}
    \RenewDocumentCommand{\IGM}{}{{o}}
    \RenewDocumentCommand{\IS}{}{{ID}}
    \RenewDocumentCommand{\excess}{}{{EX}}
    \RenewDocumentCommand{\reaction}{}{{rx}}
    \RenewDocumentCommand{\Henryrat}{}
        {f\c_math_superscript_token{\ast\ast}}
    \RenewDocumentCommand{\Henrymol}{}{f\c_math_superscript_token\ast}
    \cs_if_exist:NTF \gammaup
    { \RenewDocumentCommand{\gamma}{}{\gammaup} }
    { \cs_if_exist:NT \upgamma
        { \RenewDocumentCommand{\gamma}{}{\upgamma} }
    }
    \RenewDocumentCommand{\gammarat}{}
        {\gamma\c_math_superscript_token{\ast\ast}}
    \RenewDocumentCommand{\gammamol}{}
        {\gamma\c_math_superscript_token\ast}
    \RenewExpandableDocumentCommand{\JTsymbol}{}{\alpha}
    \RenewSubscriptedSymbol{\muJT}{\JTsymbol}{H}
    \cs_if_exist:NTF \xiup
    { \RenewDocumentCommand{\xrxn}{}{\xiup} }
    { \cs_if_exist:NT \upxi
        { \RenewDocumentCommand{\xrxn}{}{\upxi} }
    }
    \cs_if_exist:NTF \phiup
    {
      \RenewDocumentCommand{\phipure}{}{\phiup}
      \RenewDocumentCommand{\phimix}{}{\hat\phiup}
      \RenewDocumentCommand{\phisat}{}{\phiup\c_math_superscript_token\sat}
    }
    { \cs_if_exist:NT \upphi
      {
        \RenewDocumentCommand{\phipure}{}{\upphi}
        \RenewDocumentCommand{\phimix}{}{\hat\upphi}
        \RenewDocumentCommand{\phisat}{}{\upphi\c_math_superscript_token\sat}
      }
    }
    \RenewDocumentCommand{\Cstd}{}{m\c_math_superscript_token+
      \peek_catcode_remove:NT \c_math_subscript_token {\use_none:n}
    }
    \cs_if_exist:NTF \muup
    { \RenewDocumentCommand{\mu}{}{\muup} }
    { \cs_if_exist:NT \upmu
      { \RenewDocumentCommand{\mu}{}{\upmu} }
    }
    \RenewDocumentCommand{\std}{}{o}
    \RenewDocumentCommand{\Pstd}{}{P^\ast}
    \tl_gset:Nn \g_@@_area_symbol {\text{\large\(\mathit{a}\)}}
    \RenewDocumentCommand{\Epot}{}{\exists}
    \tl_set:Nn \l_@@_sub_separator_tl {}
    \tl_gset:Nn \g_@@_pressure_symbol {p}
    \RenewSubscriptedSymbol{\cVt}{\@@_extensive:n {\heatcapacitysymbol}}{v}
    \RenewSubscriptedSymbol{\cV}{\@@_intensive:n {\heatcapacitysymbol}}{v}
    \RenewSubscriptedSymbol{\cVs}{\@@_specific:n {\heatcapacitysymbol}}{v}
  }
}
\DeclareOption{Thompson}{
  \ExecuteOptions{EUAGHAn,delta,shortpm}
  \AtEndOfPackage
  {
    \RenewDocumentCommand{\excess}{}{{EX}}
    \RenewDocumentCommand{\residual}{}{{R}}
    \RenewDocumentCommand{\actrel}{}{\widehat{a}}
    \RenewSubscriptedSymbol{\Henryrat}{k}{H}
    \RenewSubscriptedSymbol{\Henrymol}{k}{H}
    \RenewDocumentCommand{\allcomponents}{O{j} m}
    {
      {#2}\c_math_subscript_token{#1}
    }
    \RenewDocumentCommand{\allNs}{O{j}}{\allcomponents[#1]{\Nt}}
    \RenewDocumentCommand{\allXs}{O{j}}{\allcomponents[#1]{x}}
    \RenewDocumentCommand{\allYs}{O{j}}{\allcomponents[#1]{y}}
    \RenewDocumentCommand{\allmus}{O{j}}{\allcomponents[#1]{\mu}}
    \RenewDocumentCommand{\allMs}{O{j}}{\allcomponents[#1]{m}}
    \RenewDocumentCommand{\allWs}{O{j}}{\allcomponents[#1]{w}}
    \RenewExpandableDocumentCommand{\ncomponents}{}{c}
    \RenewDocumentCommand{\IS}{}{{IS}}
    \RenewDocumentCommand{\IG}{}{{IG}}
    \RenewDocumentCommand{\IGM}{}{{IG}}
    \cs_new:Nn \@@_fpure_one:n
    {
      f\c_math_subscript_token{#1}
      \peek_catcode_remove:NF \c_math_superscript_token
      { \c_math_superscript_token\bullet }
    }
    \RenewDocumentCommand{\fpure}{}
    {
      \peek_catcode_remove:NTF \c_math_subscript_token
      { \@@_fpure_one:n }
      { f }
    }
    \cs_new:Nn \@@_intensive_two:n
    {
      \c_math_subscript_token{#1}
      \peek_catcode:NF \c_math_superscript_token
      {
        \c_math_superscript_token\bullet
      }
    }
    \cs_set:Nn \@@_intensive:n
    {
      #1
      \peek_catcode_remove:NT \c_math_subscript_token
      { \@@_intensive_two:n }
    }
    \cs_new:Nn \@@_phipure_one:n
    {
      \phi\c_math_subscript_token{#1}
      \peek_catcode:NF \c_math_superscript_token
      { \c_math_superscript_token\bullet }
    }
    \RenewDocumentCommand{\phipure}{}
    {
      \peek_catcode_remove:NTF \c_math_subscript_token
      {
        \@@_phipure_one:n
      }
      {\phi}
    }
    \RenewDocumentCommand{\phimix}{}{\widehat\phi}
    \RenewDocumentCommand{\fmix}{}{\widehat f}
    \RenewDocumentCommand{\mixing}{}{{MIX}}
    \RenewDocumentCommand{\muJT}{}{\alpha\c_math_subscript_token H}
    \RenewDocumentCommand{\Deltamix}{m}
        {\Delta\c_math_subscript_token\mixing #1}
    \RenewDocumentCommand{\reaction}{}{R}
    \RenewDocumentCommand{\fusion}{}{{SL}}
    \RenewDocumentCommand{\vaporization}{}{{LV}}
    \RenewDocumentCommand{\sublimation}{}{{SV}}
    \RenewDocumentCommand{\allbut}{O{j} m m}
    { \tl_if_eq:nnTF {#1} {#2}
      {
        {#3}\c_math_subscript_token k\neq{#3}\c_math_subscript_token{#2}
      }
      {
        {#3}\c_math_subscript_token{#1}\neq{#3}\c_math_subscript_token{#2}
      }
    }
    \RenewDocumentCommand{\Cstd}{}{m^\std}
    \RenewDocumentCommand{\mustd}{}{\Gamma}
    \RenewDocumentCommand{\formation}{}{F}
%^^A    \RenewDocumentCommand{\Deltarxn}{}{\Delta}
  }
}
%    \end{macrocode}
% We execute the default options below.
%    \begin{macrocode}
\ExecuteOptions{EUAGHan,subscripts,parentheses,intensive-plain,
    moles-index,longpm}
\ProcessOptions
%    \end{macrocode}
% \subsection{Variable Order}
% We next encode a routine to sort non-subscripted variables into a consistent
% order. It currently does not sort variables with subscripts.
% \changes{v2.00}{2023/11/16}{Added a sorting routine to make function
%       arguments be in a consistent order using the \texttt{nosubscripts}
%       option.}
%    \begin{macrocode}
\tl_const:Nn \c_@@_sort_order_tl
    {\Et\Em\Es\Ut\Um\Us\Ht\Hm\Hs\Ft\Fm\Fs\Gt\Gm\Gs\Lt\Lm\Ls T\St\Sm\Ss
        P\Vt\Vm\Vs\mu\Nt mwxyz\At\Am\As\sigma
        ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklnopqrstuvwxyz}
\clist_new:N \l_@@_in_list_clist
\clist_new:N \l_@@_sorted_list_clist
\clist_new:N \l_@@_remaining_list_clist
\cs_new:Nn \@@_sort_clist:n
{% Sort the list in the order of \c_@@_sort_order_tl

  % Wipe out any remnants from the last sort
  \clist_clear:N \l_@@_in_list_clist
  \clist_clear:N \l_@@_sorted_list_clist

  % Make a copy of the list
  \clist_set:Nn \l_@@_remaining_list_clist {#1}

  % Make a list of everything that's in the known sort order list
  % and put everything else in the "not in sort order list" list.
  \tl_map_inline:Nn \c_@@_sort_order_tl
  {
    \clist_if_in:NnT \l_@@_remaining_list_clist {##1}
    { \clist_put_right:Nn \l_@@_in_list_clist {##1} }

    \clist_remove_all:Nn \l_@@_remaining_list_clist {##1}
  }

  % Then merge the lists back together again.
  \clist_if_empty:NF \l_@@_in_list_clist
  {
    \clist_put_right:Nn \l_@@_sorted_list_clist \l_@@_in_list_clist
  }
  \clist_if_empty:NF \l_@@_remaining_list_clist
  {
    \clist_put_right:Nn \l_@@_sorted_list_clist \l_@@_remaining_list_clist
  }
  \clist_use:Nn \l_@@_sorted_list_clist ,
}
%    \end{macrocode}
%
% \subsection{Commands for Partial Derivatives}
% The \cs{Partial} command and its second-order siblings are defined as below.
% They typeset partial derivatives of the first argument with respect to
% the second (and third, in the case of mixed second partial derivatives)
% arguments, holding the last argument constant.
%
% The starred forms adjust the spacing after the partial derivative so the
% trailing binary operator (assumed to be the same width as an equals sign)
% overhangs the variables held constant.
% We thus set \verb"operator_width" to be \emph{just} greater than the width of
% an equals sign.
%    \begin{macrocode}
\dim_new:N \l_@@_Partial_const_dim
\dim_new:N \l_@@_operator_width_dim
\dim_new:N \l_@@_adjust_width_dim
\settowidth{\l_@@_operator_width_dim}{=}
\dim_set:Nn \l_@@_adjust_width_dim {0.1\l_@@_operator_width_dim}
\dim_add:Nn \l_@@_operator_width_dim \l_@@_adjust_width_dim
%    \end{macrocode}
% \begin{macro}{\Partial}
% The command \cs{Partial} and its friends drastically simplify the creation
% of partial derivatives. The command \cs{Partial*} is the same as
% \cs{Partial} except that it adjusts the spacing so the (presumably) binary
% operator that follows it slightly overlaps the subscripts.
% \changes{v1.01}{2022/03/01}{Changed \cs{adjust@width} to 2pt (up from 1pt).}
% \changes{v1.01}{2022/04/21}{Changed \cs{adjust@width} 0.1\cs{operator@width}
%   (from 2pt).}
% \changes{v2.00}{2023/11/16}{Changed length added to
% \ExplSyntaxOn
%   \cs{l_@@_Partial_const_dim}~
% \ExplSyntaxOff
% from $-0.15$ to $-0.20$.}
%    \begin{macrocode}
\tl_new:N \l_@@_Partial_start_tl
\tl_new:N \l_@@_Partial_end_tl
\tl_new:N \l_@@_Partial_empty_end_tl
\tl_new:N \l_@@_Partial_middle_tl
\tl_set:Nn \l_@@_Partial_start_tl {\left\l_@@_PartialOpen_tl}
\tl_set:Nn \l_@@_Partial_end_tl {\right\l_@@_PartialClose_tl}
\tl_set:Nn \l_@@_Partial_empty_end_tl {\right\l_@@_PartialEmptyClose_tl}
\tl_set:Nn \l_@@_Partial_middle_tl {\middle}
\cs_set_eq:NN \@@_frac:nn \frac
\NewDocumentCommand{\Partial}{s m m m}
{ \bool_if:nTF {#1}
  {% Starred form (recursive)
    \settowidth{\l_@@_Partial_const_dim}{\ensuremath{#4}}%
    \dim_add:Nn \l_@@_Partial_const_dim {-0.20\l_@@_Partial_const_dim}%
    \Partial{#2}{#3}{#4}%
    \bool_if:NT \l_@@_subscripted_bool
    { \dim_compare:nNnTF \l_@@_operator_width_dim
                       < \l_@@_Partial_const_dim
      { \kern -\l_@@_operator_width_dim }
      { \kern -\l_@@_Partial_const_dim }
    }
  }
  {% Unstarred form
    \bool_if:NTF \l_@@_subscripted_bool
    {% Handle case of empty variables held constant
      \tl_if_eq:nnTF {#4} {}
      { \l_@@_Partial_start_tl
        \@@_frac:nn{\partial #2}{\partial #3}\l_@@_Partial_empty_end_tl
      }
      { \l_@@_Partial_start_tl\@@_frac:nn{\partial #2}
                                         {\partial #3}\l_@@_Partial_end_tl
        \c_math_subscript_token{#4}%
      }
    }
    {% Check whether #4 contains \allNsbut{i} and #3 is \Nt_i
      \tl_if_in:nnTF {#3} {\Nt}
      { \RenewDocumentCommand{\allbut}{O{j} m m}{\allcomponents{##3}}
        \l_@@_Partial_start_tl
        \@@_frac:nn{\partial #2(\@@_sort_clist:n{#4})}
                   {\partial #3}\l_@@_Partial_end_tl
      }
      { \l_@@_Partial_start_tl
        \@@_frac:nn{\partial #2(\@@_sort_clist:n{#3,#4})}
                   {\partial #3}\l_@@_Partial_end_tl
      }
    }
  }
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PartialBigg}
% The \cs{PartialBigg} macro (and its starred form) replace the \tn{left}
% and \tn{right} commands in \cs{Partial} with \pkg{amsmath}'s \tn{Biggl}
% and \tn{Biggr} variants. The starred form is inherited from \cs{Partial}
% without modification.
%    \begin{macrocode}
\NewDocumentCommand{\PartialBigg}{}
  { \tl_set:Nn \l_@@_Partial_start_tl {\Biggl\l_@@_PartialOpen_tl}
    \tl_set:Nn \l_@@_Partial_end_tl {\Biggr\l_@@_PartialClose_tl}
    \tl_set:Nn \l_@@_Partial_Empty_end_tl
        {\Biggr\l_@@_PartialEmptyClose_tl}
    \Partial
  }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Partialbigg}
% The \cs{Partialbigg} macro does the same thing as \cs{PartialBigg}, except
% using \pkg{amsmath}'s \tn{biggl}/\tn{biggr} variants.
%    \begin{macrocode}
\NewDocumentCommand{\Partialbigg}{}
  { \tl_set:Nn \l_@@_Partial_start_tl {\biggl\l_@@_PartialOpen_tl}
    \tl_set:Nn \l_@@_Partial_end_tl {\biggr\l_@@_PartialClose_tl}
    \tl_set:Nn \l_@@_Partial_empty_end_tl
        {\biggr\l_@@_PartialEmptyClose_tl}
    \Partial
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PartialSecond}
% The second partial derivatives are defined similarly to \cs{Partial}.
%    \begin{macrocode}
\NewDocumentCommand{\PartialSecond}{s m m m}
{
  \bool_if:nTF {#1}
  {% Starred form
    \settowidth{\l_@@_Partial_const_dim}{\ensuremath{#4}}%
    \dim_add:Nn \l_@@_Partial_const_dim {-0.20\l_@@_Partial_const_dim}
    \PartialSecond{#2}{#3}{#4}%
    \bool_if:nT \l_@@_subscripted_bool
    {  \dim_compare:nNnTF {\l_@@_operator_width_dim}
                        < {\l_@@_Partial_const_dim}
      { \kern -\l_@@_operator_width_dim }
      { \kern -\l_@@_Partial_const_dim }
    }
  }
  {% Unstarred form
    \bool_if:NTF \l_@@_subscripted_bool
    {% Handles case of empty variables held constant
      \tl_if_eq:nnTF {#4} {}
      { \l_@@_Partial_start_tl
            \@@_frac:nn{\partial\c_math_superscript_token 2 #2}
        {\partial #3\c_math_superscript_token 2}\l_@@_Partial_empty_end_tl
      }
      { \l_@@_Partial_start_tl
        \@@_frac:nn{\partial\c_math_superscript_token 2 #2}
            {\partial #3\c_math_superscript_token 2}\l_@@_Partial_end_tl
            \c_math_subscript_token{#4}%
      }
    }
    {% Check whether #4 contains \allNsbut{i} and #3 is \Nt_i
      \tl_if_in:nnTF {#2} {\Nt}
      { \RenewDocumentCommand{\allbut}{O{j} m m}{\allcomponents{##3}}
        \l_@@_Partial_start_tl
        \@@_frac:nn{\partial\c_math_superscript_token 2 #2(#4)}
            {\partial\c_math_superscript_token 2 #3}\l_@@_Partial_end_tl
      }
      { \l_@@_Partial_start_tl
        \@@_frac:nn{\partial\c_math_superscript_token 2
                      #2(\@@_sort_clist:n{#3,#4})}
            {\partial #3\c_math_superscript_token 2}\l_@@_Partial_end_tl
      }
    }
  }
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\PartialSecondBigg}
% The \cs{PartialSecondBigg} macro and its starred variant replace \cs{left}
% and \tn{right} with \pkg{amsmath}'s \cs{Biggl} and
% \cs{Biggr}.
%    \begin{macrocode}
\NewDocumentCommand{\PartialSecondBigg}{}
{ \tl_set:Nn \l_@@_Partial_start_tl {\biggl\l_@@_PartialOpen_tl}
  \tl_set:Nn \l_@@_Partial_end_tl {\biggl\l_@@_PartialClose_tl}
  \tl_set:Nn \l_@@_Partial_empty_end_tl {\biggl\l_@@_PartialClose_tl}
  \PartialSecond
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\PartialSecondbigg}
% The \cs{PartialSecondbigg} macro and its starred variant replace \tn{left}
% and \tn{right} with \pkg{amsmath}'s \cs{biggl} and
% \cs{biggr}.
%    \begin{macrocode}
\NewDocumentCommand{\PartialSecondbigg}{}
{ \tl_set:Nn \l_@@_Partial_start_tl {\biggl\l_@@_PartialOpen_tl}
  \tl_set:Nn \l_@@_Partial_end_tl {\biggl\l_@@_PartialClose_tl}
  \tl_set:Nn \l_@@_Partial_empty_end_tl {\biggl\l_@@_PartialClose_tl}
  \PartialSecond
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PartialMixSecond}
% The macro \cs{PartialMixSecond} takes an extra argument, but is otherwise
% the same as its same-variable cousin.
%    \begin{macrocode}
\bool_new:N \l_@@_has_x_or_y_bool
\NewDocumentCommand{\PartialMixSecond}{s m m m m}
{
  \bool_if:nTF {#1}
  {% Starred version
    \settowidth{\l_@@_Partial_const_dim}{\ensuremath{#4}}%
    \dim_add:Nn \l_@@_Partial_const_dim {-0.20\l_@@_Partial_const_dim}
    \PartialMixSecond{#2}{#3}{#4}{#5}
    \bool_if:nT \l_@@_subscripted_bool
    { \dim_compare:nNnTF {\l_@@_operator_width_dim}
                       < {\l_@@_Partial_const_dim}
      { \kern -\l_@@_operator_width_dim }
      { \kern -\l_@@_Partial_const_dim }
    }
  }
  {% Unstarred version
    \bool_if:nTF \l_@@_subscripted_bool
    {% subscripted version
      \tl_if_eq:nnTF {#5} {}
      {% Handle case of empty variables held constant
        \l_@@_Partial_start_tl
        \@@_frac:nn{\partial\c_math_superscript_token 2 #2}
            {\partial #3\partial #4}\l_@@_Partial_empty_end_tl
      }
      { \l_@@_Partial_start_tl
        \@@_frac:nn{\partial\c_math_superscript_token 2 #2}
            {\partial #3\partial #4}\l_@@_Partial_end_tl
            \c_math_subscript_token{#5}
      }
    }
    {% not subscripted
      \tl_if_eq:nnTF {#5} {}
      {% empty argument
        \l_@@_Partial_start_tl
        \@@_frac:nn{\partial\c_math_superscript_token 2
                        #2(\@@_sort_clist:n{#3,#4,#5})}
                   {\partial #3\partial #4}\l_@@_Partial_empty_end_tl
      }
      {% Check whether #3 OR #4 are \Nt_i/etc.
        \tl_if_in:nnTF {#3} {\Nt}
        { \RenewDocumentCommand{\allbut}{O{j} m m}{\allcomponents{##3}}%
          \l_@@_Partial_start_tl
          \@@_frac:nn{\partial\c_math_superscript_token 2
                        #2(\@@_sort_clist:n{#4,#5})}
                     {\partial #3\partial #4}\l_@@_Partial_end_tl
        }
        { \tl_if_in:nnTF {#4} {\Nt}
          { \RenewDocumentCommand{\allbut}{O{j} m m}{\allcomponents{##3}}%
            \l_@@_Partial_start_tl
            \@@_frac:nn{\partial\c_math_superscript_token 2
                            #2(\@@_sort_clist:n{#3,#5})}
                       {\partial #3\partial #4}\l_@@_Partial_end_tl
          }
          {% Check for x, y, or w
            \bool_set_false:N \l_@@_has_x_or_y_bool
            \tl_if_in:nnT {#3} {x}
            { \l_@@_has_x_or_y_bool }
            \tl_if_in:nnT {#3} {y}
            { \l_@@_has_x_or_y_bool }
            \tl_if_in:nnT {#3} {w}
            { \l_@@_has_x_or_y_bool }
            \bool_if:NTF \l_@@_has_x_or_y_bool
            { \RenewDocumentCommand{\allbutlastand}{O{j} m m}
                {\allcomponents{##3}}
              \l_@@_Partial_start_tl
              \@@_frac:nn{\partial\c_math_superscript_token 2
                            #2(\@@_sort_clist:n{#4,#5})}
                         {\partial #3\partial #4}\l_@@_Partial_end_tl
            }
            {
              \l_@@_Partial_start_tl
              \@@_frac:nn{\partial\c_math_superscript_token 2
                            #2(\@@_sort_clist:n{#3,#4,#5})}
                         {\partial #3\partial #4}\l_@@_Partial_end_tl
            }
          }
        }
      }
    }
  }
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\PartialMixSecondBigg,\PartialMixSecondbigg}
% The macro \cs{PartialMixSecondBigg} is analogous to the aforementioned macros
% \cs{PartialBigg} and \cs{PartialSecondBigg}. \cs{PartialMixSecondbigg} is
% analogous to \cs{Partialbigg} and \cs{PartialSecondbigg}.
%    \begin{macrocode}
\NewDocumentCommand{\PartialMixSecondBigg}{}
{ \tl_set:Nn \l_@@_Partial_start_tl {\Biggl\l_@@_PartialOpen_tl}
  \tl_set:Nn \l_@@_Partial_end_tl {\Biggl\l_@@_PartialClose_tl}
  \tl_set:Nn \l_@@_Partial_empty_end_tl {\Biggl\l_@@_PartialClose_tl}
  \PartialMixSecond
}
\NewDocumentCommand{\PartialMixSecondbigg}{}
{ \tl_set:Nn \l_@@_Partial_start_tl {\biggl\l_@@_PartialOpen_tl}
  \tl_set:Nn \l_@@_Partial_end_tl {\biggl\l_@@_PartialClose_tl}
  \tl_set:Nn \l_@@_Partial_empty_end_tl {\biggl\l_@@_PartialClose_tl}
  \PartialMixSecond
}
%    \end{macrocode}
%
% If the user does not load the \pkg{amsmath} package, we will not have access
% to \cs{Biggl}, \cs{Biggr}, \cs{biggl}, and \cs{biggr}, so we revert them back
% to the ordinary \cs{left} and \cs{right} versions and warn the user.
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifpackageloaded{amsmath}{}{%
      \PackageWarningNoLine{thermodynamics}
        {Package~amsmath~not~loaded;~load~to~make~PartialBigg~and~friends~
            work~correctly}%
      \cs_set_eq:NN \PartialBigg \Partial
      \cs_set_eq:NN \Partialbigg \Partial
      \cs_set_eq:NN \PartialSecondBigg \PartialSecond
      \cs_set_eq:NN \PartialSecondbigg \PartialSecond
      \cs_set_eq:NN \PartialMixSecondBigg \PartialMixSecond
      \cs_set_eq:NN \PartialMixSecondbigg \PartialMixSecond
      \ProvideDocumentCommand{\rvert}{}{|}
      \ProvideDocumentCommand{\lvert}{}{|}
  }%
}
%    \end{macrocode}
% \end{macro}
% \changes{v1.01}{2023/09/15}{Added \cs{Partialinline} and friends to
%   facilitate in-line (non-display-mode) partial derivatives, with
%   corresponding changes to \cs{Partial} and friends for ease of
%   implementation. Also added \cs{Partialinlinetext} and friends for
%   non-expanding delimiters.}
% \begin{macro}{\Partialinline,\PartialSecondinline,\PartialMixSecondinline}
% Inline partial derivatives.
%    \begin{macrocode}
\NewDocumentCommand{\Partialinline}{}
{
  \cs_set:Nn \@@_frac:nn { ##1 \l_@@_Partial_middle_tl / ##2 }
  \Partial
}
\NewDocumentCommand{\PartialSecondinline}{}
{
  \cs_set:Nn \@@_frac:nn { ##1 \l_@@_Partial_middle_tl / ##2 }
  \PartialSecond
}
\NewDocumentCommand{\PartialMixSecondinline}{}
{
  \cs_set:Nn \@@_frac:nn { ##1 \l_@@_Partial_middle_tl / ##2 }
  \PartialMixSecond
}
%    \end{macrocode}
% \end{macro}
% \pagebreak[1]
% \setmarginparsize{\footnotesize}
% \begin{macro}{\Partialinlinetext}
% \begin{macro}{\PartialSecondinlinetext}
% \begin{macro}{\PartialMixSecondinlinetext}
% Text-only (non-extensible delimiter) versions of \cs{Partialinline}
% and friends.
%^^A TODO: These currently "pollute" other partial derivatives until the end
%^^A       of the line (i.e., \Partialinline{z}{x}{y} = \Partial{z}{x}{y} will
%^^A       produce identical things on both sides). For now, it's a "feature."
%   \begin{macrocode}
\NewDocumentCommand{\Partialinlinetext}{}
{ \cs_set_eq:NN \l_@@_Partial_start_tl \l_@@_PartialOpen_tl
  \cs_set_eq:NN \l_@@_Partial_end_tl \l_@@_PartialClose_tl
  \cs_set_eq:NN \l_@@_Partial_empty_end_tl \l_@@_PartialEmptyClose_tl
  \cs_set_eq:NN \l_@@_Partial_middle_tl \relax
  \Partialinline
}
\NewDocumentCommand{\PartialSecondinlinetext}{}
{ \cs_set_eq:NN \l_@@_Partial_start_tl \l_@@_PartialOpen_tl
  \cs_set_eq:NN \l_@@_Partial_end_tl \l_@@_PartialClose_tl
  \cs_set_eq:NN \l_@@_Partial_empty_end_tl \l_@@_PartialEmptyClose_tl
  \cs_set_eq:NN \l_@@_Partial_middle_tl \relax
  \PartialSecondinline
}
\NewDocumentCommand{\PartialMixSecondinlinetext}{}
{ \cs_set_eq:NN \l_@@_Partial_start_tl \l_@@_PartialOpen_tl
  \cs_set_eq:NN \l_@@_Partial_end_tl \l_@@_PartialClose_tl
  \cs_set_eq:NN \l_@@_Partial_empty_end_tl \l_@@_PartialEmptyClose_tl
  \cs_set_eq:NN \l_@@_Partial_middle_tl \relax
  \PartialMixSecondinline
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \restoremarginparsize
%
% \subsection{Local Override of Delimiters}
% We define several environments that \emph{locally} override the delimiters on
% partial derivatives generated with \cs{Partial} and friends, the
% subscript notation for partial derivatives, and/or the definitions of
% range-oriented macros such as \cs{allNs}. These environments can be nested;
% the inner-most one will be honored if conflicts occur.
% \begin{environment}{thermoparentheses}
% Inside this environment, partial derivatives will have parentheses around
% them, regardless of package options.
%    \begin{macrocode}
\NewDocumentEnvironment{thermoparentheses}{}
{ \cs_set:Nn \l_@@_PartialOpen_tl {(}
  \cs_set:Nn \l_@@_PartialClose_tl {)}
  \cs_set:Nn \l_@@_PartialEmptyClose_tl {)}
}{}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{thermobrackets}
% Inside this environment, partial derivatives will have brackets around
% them, regardless of package options.
%    \begin{macrocode}
\NewDocumentEnvironment{thermobrackets}{}
{ \tl_set:Nn \l_@@_PartialOpen_tl {[}
  \tl_set:Nn \l_@@_PartialClose_tl {]}
  \tl_set:Nn \l_@@_PartialEmptyClose_tl {]}
}{}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{thermobraces}
% Inside this environment, partial derivatives will have braces around
% them, regardless of package options.
%    \begin{macrocode}
\NewDocumentEnvironment{thermobraces}{}
{ \tl_set:Nn \l_@@_PartialOpen_tl {\{}
  \tl_set:Nn \l_@@_PartialClose_tl {\}}
  \tl_set:Nn \l_@@_PartialEmptyClose_tl {\}}
}{}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{thermobar}
% Inside this environment, partial derivatives will have a trailing vertical
% bar, regardless of package options.
%    \begin{macrocode}
\NewDocumentEnvironment{thermobar}{}
{ \tl_set:Nn \l_@@_PartialOpen_tl {.}
  \tl_set:Nn \l_@@_PartialClose_tl {\rvert}
  \tl_set:Nn \l_@@_PartialEmptyClose_tl {.}
}{}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{thermoplain}
% Inside this environment, partial derivatives will have no decorations
% around them, regardless of package options.
%    \begin{macrocode}
\NewDocumentEnvironment{thermoplain}{}
{ \tl_set:Nn \l_@@_PartialOpen_tl {.}
  \tl_set:Nn \l_@@_PartialClose_tl {.}
  \tl_set:Nn \l_@@_PartialEmptyClose_tl {.}
  \bool_set_false:N \l_@@_subscripted_bool
}{}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{thermoNOsubscripts}
% Inside this environment, subscripts will not be displayed to the right of
% partial derivatives, regardless of package options.
%    \begin{macrocode}
\NewDocumentEnvironment{thermoNOsubscripts}{}
    {\bool_set_false:N \l_@@_subscripted_bool}
    {}
%    \end{macrocode}
% \begin{environment}{thermosubscripts}
% Inside this environment, subscripts will be displayed to the right of
% partial derivatives, regardless of package options.
% \end{environment}
%    \begin{macrocode}
\NewDocumentEnvironment{thermosubscripts}{}
    {\bool_set_true:N \l_@@_subscripted_bool}
    {}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{thermomolesrange}
% Inside this environment, the macro \cs{allNs} will expand to
% $n_1,\dotsc,n_C$ (or equivalent symbols if \cs{Nt} and/or \cs{ncomponents}
% have been redefined), regardless of package options. Similar expansions will
% result for \cs{allXs}, \cs{allYs}, \cs{allMs}, and so on.
% \changes{v2.00}{2023/11/16}{Added environment to invoke the ``moles-range''
%     definitions of \cs{allNs} and friends locally.}
%    \begin{macrocode}
\NewDocumentEnvironment{thermomolesrange}{}
    { \@@_set_moles_range }
    {}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{thermointensiveplain}
% \changes{v2.00}{2023/11/16}{Added environment to invoke the
%     ``intensive-plain'' option locally.}
%    \begin{macrocode}
%    \begin{macrocode}
\NewDocumentEnvironment{thermointensiveplain}{}
    { \@@_set_intensive_plain }
    {}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{thermoextensiveplain}
% \changes{v2.00}{2023/11/16}{Added environment to invoke the
%     ``extensive-plain'' option locally.}
%    \begin{macrocode}
\NewDocumentEnvironment{thermoextensiveplain}{}
    { \@@_set_extensive_plain }
    {}
%    \end{macrocode}
% \end{environment}
% \setmarginparsize{\scriptsize}
% \begin{environment}{thermointensivelowercase}
% \changes{v2.00}{2023/11/16}{Added environment to invoke the
%     ``intensive-lowercase'' option locally.}
%    \begin{macrocode}
\NewDocumentEnvironment{thermointensivelowercase}{}
    {% {
% \RenewExpandableDocumentCommand{\MacroFont}{}{
%   \fontencoding\encodingdefault
%   \fontfamily\ttdefault
%   \fontseries\mddefault
%   \fontshape\shapedefault
%   \footnotesize}

      \@@_set_intensive_lowercase
      \@@_set_lowercase_pms
    }
    {}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{thermoextensivesuperscript}
% \changes{v2.00}{2023/11/16}{Added environment to invoke the
%     ``extensive-superscript'' option locally.}
%    \begin{macrocode}
\NewDocumentEnvironment{thermoextensivesuperscript}{}
    {
      \@@_set_extensive_superscripts
    }
    {}
%    \end{macrocode}
% \end{environment}
% \restoremarginparsize
%
% \subsection{User-Interface Macros to Define Symbols}
% \begin{macro}{\NewSubscriptedSymbol}
% First, we define a command that serves to create ``subscripted''
% symbols; for example, typing \verb"\cP_i" should yield $C_{P,i}$ rather
% than $C_{Pi}$, ${C_P}_i$, or ${C_{P_i}}$. Superscripts are also handled
% properly and can be in either order.
% \changes{v2.00}{2023/11/16}{Deleted \cs{DeclareSubscriptedSymbol} in favor
%   of \pkg{xparse}-based \cs{NewSubscriptedSymbol} and
%   \cs{RenewSubscriptedSymbol}.}
%    \begin{macrocode}
\str_new:N \l_@@_tmp_str
\cs_new:Npn \@@_check_definable:nN #1#2
{
  \tl_trim_spaces_apply:nN {#1} \tl_if_single_token:nTF
  {
    \str_set:Nx \l_@@_tmp_str {\tl_to_str:n {#1}}
    \int_compare:nNnT {\str_count:N \l_@@_tmp_str} = 1
    { \PackageError{thermodynamics}
        {First~argument~of~'\tl_trim_spaces:o {\tl_to_str:n {#2}}'~
         must~be~a~command}
        {The~first~argument~of~'\tl_trim_spaces:o {\tl_to_str:n {#2}}'~
         should~be~the~macro~that~will~be~used~to~refer~to~the~symbol.~
         The~provided~argument~'\tl_trim_spaces:o {\tl_to_str:n {#1}}'~
         is~a~single~character.
         \MessageBreak Perhaps~a~backslash~is~missing?}
    }
  }
  { \PackageError{thermodynamics}
      {First~argument~of~'\tl_trim_spaces:o {\tl_to_str:n {#2}}'~
       must~be~a~command}
      {The~first~argument~of~'\tl_trim_spaces:o {\tl_to_str:n {#2}}'~
       should~be~the~macro~that~will~be~used~to~refer~to~the~symbol.~
       The~provided~argument~'\tl_trim_spaces:o {\tl_to_str:n {#1}}'~
       contains~more~than~one~token.
       \MessageBreak Perhaps~a~backslash~is~missing?}
  }
} 
\tl_new:N \l_@@_super_separator_tl
\tl_new:N \l_@@_sub_separator_tl
\tl_set:Nn \l_@@_super_separator_tl {,}
\tl_set:Nn \l_@@_sub_separator_tl {,}
\NewDocumentCommand{\NewSubscriptedSymbol}{m m m}
{
  \@@_check_definable:nN {#1} \NewSubscriptedSymbol
  \cs_if_exist:NT #1
  { \PackageError{thermodynamics}
      {Command~'\tl_trim_spaces:o {\tl_to_str:n {#1}}'~already~defined}
      {You~have~used~
       '\tl_trim_spaces:o {\tl_to_str:n {\NewSubscriptedSymbol}}'~
       with~a~command~that~already~has~a~definition}
  }
  \cs_new:cpn {\cs_to_str:N #1_one:n} ##1
  {
    {#2}\c_math_superscript_token{##1}
    \peek_catcode_remove:NTF \c_math_subscript_token
    { \use:c {\cs_to_str:N #1_three:n} }
    { \c_math_subscript_token{#3} }
  }

  \cs_new:cpn {\cs_to_str:N #1_two:n} ##1
  { {#2}\c_math_subscript_token{#3\l_@@_sub_separator_tl ##1} }

  \cs_new:cpn {\cs_to_str:N #1_three:n} ##1
  { \c_math_subscript_token{#3\l_@@_sub_separator_tl ##1} }

  \NewDocumentCommand{#1}{}
  {% @branch
    \peek_catcode_remove:NTF \c_math_superscript_token
    { \use:c {\cs_to_str:N #1_one:n} }
    { \peek_catcode_remove:NTF \c_math_subscript_token
      { \use:c {\cs_to_str:N #1_two:n} }
      { {#2}\c_math_subscript_token{#3} }
    }
  }
}
\NewDocumentCommand{\RenewSubscriptedSymbol}{m m m}
{
  \@@_check_definable:nN {#1} \RenewSubscriptedSymbol
  \cs_if_exist:NF #1
  { \PackageError{thermodynamics}
      {Command~'\tl_trim_spaces:o {\tl_to_str:n {#1}}'~not~defined}
      {You~have~used~
       '\tl_trim_spaces:o {\tl_to_str:n {\RenewSubscriptedSymbol}}'~
       with~a~command~that~does~not~have~a~definition}
  }
  \cs_set:cpn {\cs_to_str:N #1_one:n} ##1
  {
    {#2}\c_math_superscript_token{##1}
    \peek_catcode_remove:NTF \c_math_subscript_token
    { \use:c {\cs_to_str:N #1_three:n} }
    { \c_math_subscript_token{#3} }
  }

  \cs_set:cpn {\cs_to_str:N #1_two:n} ##1
  { {#2}\c_math_subscript_token{#3\l_@@_sub_separator_tl ##1} }

  \cs_set:cpn {\cs_to_str:N #1_three:n} ##1
  { \c_math_subscript_token{#3\l_@@_sub_separator_tl ##1} }

  \RenewDocumentCommand{#1}{}
  {% @branch
    \peek_catcode_remove:NTF \c_math_superscript_token
    { \use:c {\cs_to_str:N #1_one:n} }
    { \peek_catcode_remove:NTF \c_math_subscript_token
      { \use:c {\cs_to_str:N #1_two:n} }
      { {#2}\c_math_subscript_token{#3} }
    }
  }
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\NewSuperscriptedSymbol}
% \changes{v2.00}{2023/11/16}{Created \cs{NewSuperscriptedSymbol} to handle
%   superscripted excess and residual properties without intervention.}
% \changes{v2.01}{2023/12/05}{Fixed two typos in \cs{NewSuperscriptedSymbol}.}
%    \begin{macrocode}
\NewDocumentCommand{\NewSuperscriptedSymbol}{m m m}
{
  \@@_check_definable:nN {#1} \NewSuperscriptedSymbol
  \cs_if_exist:NT #1
  { \PackageError{thermodynamics}
      {Command~'\tl_trim_spaces:o {\tl_to_str:n {#1}}'~already~defined}
      {You~have~used~
       '\tl_trim_spaces:o {\tl_to_str:n {\NewSuperscriptedSymbol}}'~
       with~a~command~that~already~has~a~definition}
  }
  \cs_new:cpn {\cs_to_str:N #1_one:n} ##1
  {
    {#2}\c_math_subscript_token{##1}
    \peek_catcode_remove:NTF \c_math_superscript_token
    { \use:c {\cs_to_str:N #1_three:n} }
    { \c_math_superscript_token{#3} }
  }

  \cs_new:cpn {\cs_to_str:N #1_two:n} ##1
  { {#2}\c_math_superscript_token{#3\l_@@_super_separator_tl ##1} }

  \cs_new:cpn {\cs_to_str:N #1_three:n} ##1
  { {#2}\c_math_superscript_token{#3\l_@@_super_separator_tl ##1} }

  \NewDocumentCommand{#1}{}
  {
    \peek_catcode_remove:NTF \c_math_subscript_token
    { \use:c {\cs_to_str:N #1_one:n} }
    { \peek_catcode_remove:NTF \c_math_superscript_token
      { \use:c {\cs_to_str:N #1_two:n} }
      { {#2}\c_math_superscript_token{#3} }
    }
  }
}
\NewDocumentCommand{\RenewSuperscriptedSymbol}{m m m}
{
  \@@_check_definable:nN {#1} \RenewSuperscriptedSymbol
  \cs_if_exist:NF #1
  { \PackageError{thermodynamics}
      {Command~'\tl_trim_spaces:o {\tl_to_str:n {#1}}'~not~defined}
      {You~have~used~
       '\tl_trim_spaces:o {\tl_to_str:n {\RenewSuperscriptedSymbol}}'~
       with~a~command~that~does~not~have~a~definition}
  }
  \cs_set:cpn {\cs_to_str:N #1_one:n} ##1
  {
    {#2}\c_math_subscript_token{##1}
    \peek_catcode_remove:NTF \c_math_superscript_token
    { \use:c {\cs_to_str:N #1_three:n} }
    { \c_math_superscript_token{#3} }
  }

  \cs_set:cpn {\cs_to_str:N #1_two:n} ##1
  { {#2}\c_math_superscript_token{#3\l_@@_super_separator_tl ##1} }

  \cs_set:cpn {\cs_to_str:N #1_three:n} ##1
  { \c_math_superscript_token{#3\l_@@_super_separator_tl ##1} }

  \RenewDocumentCommand{#1}{}
  {% @branch
    \peek_catcode_remove:NTF \c_math_subscript_token
    { \use:c {\cs_to_str:N #1_one:n} }
    { \peek_catcode_remove:NTF \c_math_superscript_token
      { \use:c {\cs_to_str:N #1_two:n} }
      { {#2}\c_math_superscript_token{#3} }
    }
  }
}
\cs_new:Nn \@@_subscripted_and_superscripted_core:nnnn
{
  \cs_set:cpn {\cs_to_str:N #1_one:n} ##1
  {
    {#2}\c_math_superscript_token{##1}
    \peek_catcode_remove:NTF \c_math_subscript_token
    { \use:c {\cs_to_str:N #1_three:n} }
    { \c_math_subscript_token{#3} }
  }
  \cs_set:cpn {\cs_to_str:N #1_two:n} ##1
  {
    {#2}\c_math_subscript_token{#3 ##1}
    \peek_catcode_remove:NTF \c_math_superscript_token
    { \use:c {\cs_to_str:N #1_four:n} }
    { \c_math_superscript_token{#4 \bullet} }
  }
  \cs_set:cpn {\cs_to_str:N #1_three:n} ##1
  { \c_math_subscript_token{#3 ##1} }
  \cs_set:cpn {\cs_to_str:N #1_four:n} ##1
  { \c_math_superscript_token{#4 ##1} }
}
\NewDocumentCommand{\NewSubscriptedandSuperscriptedSymbol}{m m m m}
{
  \@@_check_definable:nN {#1} \NewSubscriptedandSuperscriptedSymbol
  \cs_if_exist:NT #1
  { \PackageError{thermodynamics}
      {Command~'\tl_trim_spaces:o {\tl_to_str:n {#1}}'~already~defined}
      {You~have~used~
       '\tl_trim_spaces:o
          {\tl_to_str:n {\NewSubscriptedandSuperScriptedSymbol}}'~
           with~a~command~that~already~has~a~definition}
  }
  \@@_subscripted_and_superscripted_core:nnnn {#1} {#2} {#3} {#4}
  \NewDocumentCommand{#1}{}
  {
    \peek_catcode_remove:NTF \c_math_superscript_token
    { \use:c {\cs_to_str:N #1_one:n} }
    { \peek_catcode_remove:NTF \c_math_subscript_token
      { \use:c {\cs_to_str:N #1_two:n} }
      { {#2}\c_math_subscript_token{#3}\c_math_superscript_token{#4} }
    }
  }
}
\NewDocumentCommand{\RenewSubscriptedandSuperscriptedSymbol}{m m m m}
{
  \@@_check_definable:nN {#1} \RenewSubscriptedandSuperscriptedSymbol
%^^A  \cs_if_exist:NF #1
%^^A  { \PackageError{thermodynamics}
%^^A      {Command~'\tl_trim_spaces:o {\tl_to_str:n {#1}}'~not~already~defined}
%^^A      {You~have~used~
%^^A       '\tl_trim_spaces:o
%^^A          {\tl_to_str:n {\RenewSubscriptedandSuperScriptedSymbol}}'~
%^^A           with~a~command~that~does~not~have~a~definition}
%^^A  }
%^^A  \@@_subscripted_and_superscripted_core:nnnn {#1} {#2} {#3} {#4}
%^^A  \RenewDocumentCommand{#1}{}
%^^A  {
%^^A    \peek_catcode_remove:NTF \c_math_superscript_token
%^^A    { \use:c {\cs_to_str:N #1_one:n} }
%^^A    { \peek_catcode_remove:NTF \c_math_subscript_token
%^^A      { \use:c {\cs_to_str:N #1_two:n} }
%^^A      { {#2}\c_math_subscript_token{#3}\c_math_superscript_token{#4} }
%^^A    }
%^^A  }
}
%    \end{macrocode}
% \end{macro}
% \subsection{Symbol Definitions}
% \begin{macro}{\heatcapacitysymbol,\compressibilitysymbol,\expansivitysymbol}
% We define symbols for the heat capacities, compressibilities, and so forth.
%    \begin{macrocode}
\NewExpandableDocumentCommand{\heatcapacitysymbol}{}{C}
\NewExpandableDocumentCommand{\compressibilitysymbol}{}{\kappa}
\NewExpandableDocumentCommand{\expansivitysymbol}{}{\alpha}
\NewExpandableDocumentCommand{\JTsymbol}{}{\mu}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cV,\cP}
% The heat capacities are molar by default; we also declare extensive and
% specific heat capacities.
% The heat capacities themselves are defined to be ``smart'': \verb"\cV_i" will
% recognize the subscript appropriately and render $C_{V,i}$ rather than
% ${C_V}_i$ or some other unintended symbol. Superscripts are also handled
% appropriately and can be in either order.
%    \begin{macrocode}
\NewSubscriptedSymbol{\cV}{\@@_intensive:n \heatcapacitysymbol}
    {\g_@@_volume_symbol}
\NewSubscriptedSymbol{\cP}{\@@_intensive:n \heatcapacitysymbol}
    {\g_@@_pressure_symbol}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cVt,\cPt}
% We also introduce \emph{extensive} (rather than molar) heat capacity macros.
%    \begin{macrocode}
\NewSubscriptedSymbol{\cVt}{\@@_extensive:n \heatcapacitysymbol}
    {\g_@@_volume_symbol}
\NewSubscriptedSymbol{\cPt}{\@@_extensive:n \heatcapacitysymbol}
    {\g_@@_pressure_symbol}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cVs,\cPs}
% \cs{cPs} and \cs{cVs} are the specific heat capacities.
%    \begin{macrocode}
\NewSubscriptedSymbol{\cVs}{\@@_specific:n \heatcapacitysymbol}
    {\g_@@_volume_symbol}
\NewSubscriptedSymbol{\cPs}{\@@_specific:n \heatcapacitysymbol}
    {\g_@@_pressure_symbol}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\kappaT,\kappaS}
% The isothermal and adiabatic compressibilities are defined similarly, but
% those do not have extensive versions for obvious reasons.
%    \begin{macrocode}
\NewSubscriptedSymbol{\kappaT}{\compressibilitysymbol}
    {\g_@@_temperature_symbol}
\NewSubscriptedSymbol{\kappaS}{\compressibilitysymbol}
    {\g_@@_entropy_symbol}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\alphaP,\alphaS}
% The macro \cs{alphaP} is intended to refer to the isobaric volume
% expansivity, while \cs{alphaS} is the isentropic volume expansivity.
%    \begin{macrocode}
\NewSubscriptedSymbol{\alphaP}{\expansivitysymbol}{\g_@@_pressure_symbol}
\NewSubscriptedSymbol{\alphaS}{\expansivitysymbol}{\g_@@_entropy_symbol}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muJT}
% The macro \cs{muJT} renders the Joule--Thomson coefficient.
%    \begin{macrocode}
\NewSubscriptedSymbol{\muJT}{\JTsymbol}{\text{JT}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Psat,\Pvap,\phisat,\fsat,\sat}
% The \cs{Psat} macro (and its clone, the \cs{Pvap} macro) should be used for
% the saturation pressure.
% Similarly, a \cs{phisat} macro typesets the fugacity coefficient at
% saturation. The \cs{fsat} macro similarly renders the fugacity at saturation.
% Other saturation properties should use \verb"M^\sat" or similar, preferably
% by defining another macro such as \verb"\Gmsat".
%    \begin{macrocode}
\NewDocumentCommand{\sat}{}{{\text{sat}}}
\NewDocumentCommand{\Psat}{}{P\c_math_superscript_token\sat}
\NewDocumentCommand{\Pvap}{}{\Psat}
\NewDocumentCommand{\phisat}{}{\phi\c_math_superscript_token\sat}
\NewDocumentCommand{\fsat}{}{\fpure\c_math_superscript_token\sat}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\std,\Pstd,\fstd,\Cstd,\mustd}
% The \cs{std} macro denotes standard properties. \cs{Pstd}, \cs{Cstd},
% \cs{fstd}, and \cs{mustd} are defined for convenience and for consistency
% across textbooks.
% \changes{v2.02}{2024/06/14}{Added \cs{Cstd} and \cs{mustd} to standardize
%   standard molalities and chemical potentials across textbooks.}
%    \begin{macrocode}
\NewDocumentCommand{\std}{}{\circ}
\NewDocumentCommand{\Pstd}{}{P\c_math_superscript_token \std}
\NewDocumentCommand{\Cstd}{}{C\c_math_superscript_token \std}
\NewDocumentCommand{\fstd}{}{f\c_math_superscript_token \std}
\NewDocumentCommand{\mustd}{}{\mu\c_math_superscript_token \std}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xrxn}
% The \cs{xrxn} macro denotes the extent of reaction.
% \changes{v2.02}{2024/06/14}{Added \cs{xrxn} macro to standardize the
%   extent of reaction macro across textbooks.}
%    \begin{macrocode}
\NewDocumentCommand{\xrxn}{}{\xi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\fmix}
% The \cs{fmix} command is intended to describe fugacities in mixtures.
% It renders as $\hat f$ by default, and would be used as \verb"\fmix_i" or
% the like, producing $\hat f_i$; some authors like to use $\bar f_i$ or
% just $f_i$, and this command creates a consistent way to change between
% such options.
%    \begin{macrocode}
\NewDocumentCommand{\fmix}{}{\hat{f}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\phimix}
% A similar command, \cs{phimix}, renders $\hat\phi$ by default to represent
% the fugacity coefficient in a mixture.
%    \begin{macrocode}
\NewDocumentCommand{\phimix}{}{\hat\phi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fpure}
% The \cs{fpure} command is intended to describe fugacities in pure substances.
% It renders as $f$ by default, and would be used as \verb"\fpure" or
% \verb"\fpure_i" or the like, producing $f_i$; some authors like to use
% $f_{\text{pure}\,i}$, and others like to use $f_i^\bullet$; this command
% creates a consistent way to change between the these options. A similar
% command for $\phi$ is given, \cs{phipure}, for fugacity coefficients.
%    \begin{macrocode}
\NewDocumentCommand{\fpure}{}{f}
\NewDocumentCommand{\phipure}{}{\phi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\actabs,\actrel}
% The \cs{actabs} and \cs{actrel} macros are intended to standardize the macro
% for the absolute and relative activities, respectively, across textbooks.
% The defaults are \(\actabs\) and \(\actrel\), respectively.
% \changes{v2.02}{2024/06/14}{Added \cs{actabs} and \cs{actrel} to make
%   absolute and relative activity symbols consistent.}
%    \begin{macrocode}
\NewExpandableDocumentCommand{\actabs}{}{\lambda}
\NewExpandableDocumentCommand{\actrel}{}{a}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Property Changes}
% \begin{macro}{\Deltamix,\mixing}
% Mixing properties, such as $\Deltamix\Gm$, should be accessed using
% \verb"\Deltamix\Gm" and similar constructions---this construct will typeset
% as $\Delta_{MIX}G$ using the |Thompson| package option, for example,
% and as $\Delta_\text{mix}\Gt$ using the |Sandler| package option.
%    \begin{macrocode}
\NewDocumentCommand{\mixing}{}{{\text{mix}}}
\NewDocumentCommand{\Deltamix}{m}
    {\Delta{#1}\c_math_subscript_token\mixing}
%    \end{macrocode}
% \end{macro}
%
% \pagebreak[2]%
% \begin{macro}{\formation,\fusion,\reaction,\sublimation,\vaporization}
% Macros for subscripts/superscripts on property changes,
%    \begin{macrocode}
\NewDocumentCommand{\formation}{}{f}
\NewDocumentCommand{\fusion}{}{{\text{fus}}}
\NewDocumentCommand{\reaction}{}{{\text{rxn}}}
\NewDocumentCommand{\sublimation}{}{{\text{sub}}}
\NewDocumentCommand{\vaporization}{}{{\text{vap}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Deltafus,\Deltasub,\Deltavap,\Deltarxn}
% and similar macros for the property changes themselves. Some of these may
% be redefined by package options that select a particular textbook.
% \changes{v2.02}{2024/06/14}{Changed implementation of \cs{Deltarxn} to
%   handle subscripts.}
%    \begin{macrocode}
\NewDocumentCommand{\Deltafus}{m}
    {\Delta #1\c_math_superscript_token\fusion}
\NewDocumentCommand{\Deltasub}{m}
    {\Delta #1\c_math_superscript_token\sublimation}
\NewDocumentCommand{\Deltavap}{m}
    {\Delta #1\c_math_superscript_token\vaporization}
\NewDocumentCommand{\Deltarxn}{m}
{
  \cs_set:Npn \@@_Deltarxn_one ##1
  {
      \Delta #1\c_math_subscript_token{\reaction,##1}
  }
  \peek_catcode_remove:NTF \c_math_subscript_token
  {
    \@@_Deltarxn_one
  }
  {
    \Delta #1\c_math_subscript_token{\reaction}
  }
}
\tl_new:N \l_@@_Deltaf_sym_tl
\NewSubscriptedSymbol{\@@_Deltaf}{\l_@@_Deltaf_sym_tl}{\formation}
\NewDocumentCommand{\Deltaf}{m}
{ \tl_set:Nn \l_@@_Deltaf_sym_tl {\Delta #1}
  \@@_Deltaf
}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Partial Molar Quantities}
% \begin{macro}{\partialmolar}
% Partial molar quantities with superscripts appear as $\Gpm[\IG]{i}$ or
% $\GRpm{i}$ (or, with the |shortpm| option, as
% \begin{thermoshortpm}$\Gpm[\IG]{i}$ or $\GRpm{i}$\end{thermoshortpm}),
% rather than something like $\overline{G}^\IG_i$ or $\overline{G}_i^R$; the
% former looks better but is harder to implement for obvious reasons. Their
% definitions allow them to be used as symbols, something like \verb"\Gpm_i",
% \verb"\Gpm^{\IGM}_i", \verb"\Gpm^{\IGM}_i", and even \verb"\Gpm_i^{\IGM}";
% they can also be treated as commands: \verb"\Gpm{i}" is equivalent to
% \verb"\Gpm_i" and \verb"\Gpm[\IGM]{i}" is equivalent to \verb"\Gpm_i^{\IGM}".
% The macro \cs{partialmolar} can be used to create an arbitrary partial
% molar symbol.
%    \begin{macrocode}
\tl_new:N \l_@@_pm_symbol_tl
\tl_new:N \l_@@_pm_arg_tl
\NewDocumentCommand{\partialmolar}{m}
{
  \tl_set:Nn \l_@@_pm_symbol_tl {#1}
  \@@_generic_pm:
}
%% cases to consider:
%% (1) \Mpm{i}
%% (2) \Mpm[S]{i}
%% (3) \Mpm^S_i
%% (4) \Mpm_i^S
%% (5) \Mpm_i
%% note that \Mpm^S with no subscript makes no sense and is thus forbidden
\cs_new:Nn \@@_generic_pm:
{
  \peek_catcode_remove:NTF \c_math_subscript_token
  {% case 4 or case 5
    \@@_pm_case_four_or_five
  }
  {% look for superscript token
    \peek_catcode_remove:NTF \c_math_superscript_token
    {% case 3: \Mpm^{#1}_{#2} or \Mpm^{#1}{#2}
      \@@_pm_case_three
    }
    {% Look for optional argument [...]
      \peek_charcode:NTF [
      {% case 2: \Mpm[S]{i}
        \@@_pm_case_two
      }
      {% case 1: \Mpm{i}
        \@@_pm_case_one
      }
    }
  }
}
\cs_new:Npn \@@_pm_case_one #1
{
  \bool_if:NTF \l_@@_longpm_bool
  { \@@_overline:n {\l_@@_pm_symbol_tl\c_math_subscript_token{#1}} }
  {
    \@@_overline:n {\l_@@_pm_symbol_tl}\c_math_subscript_token{#1}
  }
}
\cs_new:Npn \@@_pm_case_two [#1]#2
{
  \bool_if:NTF \l_@@_longpm_bool
  {  \@@_overline:n {\l_@@_pm_symbol_tl
       \c_math_superscript_token{#1}\c_math_subscript_token{#2}}
  }
  {  \@@_overline:n {\l_@@_pm_symbol_tl}
       \c_math_superscript_token{#1}\c_math_subscript_token{#2}
  }
}
\cs_new:Npn \@@_pm_case_three #1
{
  \tl_set:Nn \l_@@_pm_arg_tl {#1}
  \peek_catcode_remove:NTF \c_math_subscript_token
  { \@@_pm_case_three_part_two }
  { \@@_pm_case_three_part_two }
}
\cs_new:Npn \@@_pm_case_three_part_two #1
{
  \bool_if:NTF \l_@@_longpm_bool
  { \@@_overline:n {\l_@@_pm_symbol_tl
      \c_math_superscript_token{\l_@@_pm_arg_tl}
      \c_math_subscript_token{#1}}
  }
  { \@@_overline:n {\l_@@_pm_symbol_tl}
      \c_math_superscript_token{\l_@@_pm_arg_tl}
      \c_math_subscript_token{#1}
  }
}
\cs_new:Npn \@@_pm_case_four_or_five #1
{
  \tl_set:Nn \l_@@_pm_arg_tl {#1}
  \peek_catcode_remove:NTF \c_math_superscript_token
  { \@@_pm_case_four }
  { \@@_pm_case_five }
}
\cs_new:Npn \@@_pm_case_four #1
{
  \bool_if:NTF \l_@@_longpm_bool
  { \@@_overline:n {\l_@@_pm_symbol_tl\c_math_superscript_token{#1}
      \c_math_subscript_token{\l_@@_pm_arg_tl}}
  }
  { \@@_overline:n {\l_@@_pm_symbol_tl}\c_math_superscript_token{#1}
      \c_math_subscript_token{\l_@@_pm_arg_tl}
  }
}
\cs_new:Npn \@@_pm_case_five
{
  \bool_if:NTF \l_@@_longpm_bool
  { \@@_overline:n {\l_@@_pm_symbol_tl
      \c_math_subscript_token{\l_@@_pm_arg_tl}}
  }
  { \@@_overline:n {\l_@@_pm_symbol_tl}
      \c_math_subscript_token{\l_@@_pm_arg_tl}
  }
}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Thermodynamic Property Definitions}
% These macros define the user interface to the symbols for energy, volume,
% and so forth. There are five commands that define thermodynamic properties.
%
% \begin{macro}{\NewExtensiveProperty}
% The command \cs{NewExtensiveProperty} declares macros for a total, molar, and
% specific version of the symbol; for example, a second heat-like property
% could be defined via
% \begin{verbatim}
%  \NewExtensiveProperty{R}{\mathcal{Q}}
%\end{verbatim}
% \NewExtensiveProperty{R}{\mathcal{Q}}\relax
% The command above would declare the macros \cs{Rt}, \cs{Rm}, and \cs{Rs}
% that expand to $\Rt$, $\Rm$, and $\Rs$, respectively, using the default
% package options.
% \end{macro}
%
% \begin{macro}{\NewPartialMolarProperty}
% The command \cs{NewPartialMolarProperty} declares a macro for the partial
% molar quantity. For example,
% \begin{verbatim}
%  \NewPartialMolarProperty{I}{\Psi}
%\end{verbatim}
% \NewPartialMolarProperty{I}{\Psi}\relax
% would create the command \cs{Ipm}, which would typeset a partial molar
% command with the base symbol $\Psi$, yielding $\Ipm{i}$.
% \end{macro}
%
% \begin{macro}{\NewThermodynamicProperty}
% Declaring a new potential is handled by the
% \cs{NewThermodynamicProperty} macro, which takes two arguments. The first
% is the base of the name, and the second is the base of the symbol. This
% declares four new commands for the extensive, molar, specific, and partial
% molar properties. These commands consist of the first argument followed by
% \verb"t", \verb"m", \verb"s", and \verb"pm", respectively. For example, one
% might define the entropy via
% \begin{verbatim}
%  \NewThermodynamicProperty{S}{S}
%\end{verbatim}
% and it would define the macros \cs{St}, \cs{Sm}, \cs{Ss}, and \cs{Spm} that
% yield, respectively, $\St$, S, $\hat S$, and $\Spm{i}$ (assuming the
% subscript to the partial molar quantity was $i$).
% It would also declare residual and excess properties for that base symbol.
% Note that the actual definition of the entropy and the other standard
% properties is slightly more complicated so as to allow for different symbols
% to be used in different textbooks.
%    \begin{macrocode}
\NewDocumentCommand{\NewThermodynamicProperty}{m m}
{
  \NewExtensiveProperty{#1}{#2}
  \NewPartialMolarProperty{#1}{#2}
  \NewResidualProperty{#1}{#2}
  \NewExcessProperty{#1}{#2}
}
\ProvideDocumentCommand{\NewExtensiveProperty}{m m}
{
  % Extensive property
  \exp_after:wN \NewDocumentCommand \exp_after:wN
    {\cs:w #1t\cs_end:}{}{\@@_extensive:n {#2}}
  % Molar property
  \exp_after:wN \NewDocumentCommand \exp_after:wN
    {\cs:w #1m\cs_end:}{}{\@@_intensive:n {#2}}
  % Specific property
  \exp_after:wN \NewDocumentCommand \exp_after:wN
    {\cs:w #1s\cs_end:}{}{\@@_specific:n {#2}}
}
\NewDocumentCommand{\NewPartialMolarProperty}{m m}
{
  % Partial molar property
  \exp_after:wN \NewDocumentCommand \exp_after:wN
    {\cs:w #1pm\cs_end:}{}{\partialmolar{#2}}
}
\ProvideDocumentCommand{\NewExcessProperty}{m m}
{
  \exp_after:wN \NewSuperscriptedSymbol \exp_after:wN
    {\cs:w #1 Et\cs_end:}{\@@_extensive:n{#2}}{\excess}
  \exp_after:wN \NewSuperscriptedSymbol \exp_after:wN
    {\cs:w #1 E\cs_end:}{\@@_intensive:n{#2}}{\excess}
  \exp_after:wN \NewSuperscriptedSymbol \exp_after:wN
    {\cs:w #1 Es\cs_end:}{\@@_specific:n{#2}}{\excess}

  % Excess partial molar property
  \exp_after:wN \NewDocumentCommand \exp_after:wN
    {\cs:w #1Epm\cs_end:}{}{\partialmolar{#2}
       \c_math_superscript_token\excess}
}
\ProvideDocumentCommand{\NewResidualProperty}{m m}
{
  \exp_after:wN \NewSuperscriptedSymbol \exp_after:wN
    {\cs:w #1 Rt\cs_end:}{\@@_extensive:n{#2}}{\residual}
  \exp_after:wN \NewSuperscriptedSymbol \exp_after:wN
    {\cs:w #1 R\cs_end:}{\@@_intensive:n{#2}}{\residual}
  \exp_after:wN \NewSuperscriptedSymbol \exp_after:wN
    {\cs:w #1 Rs\cs_end:}{\@@_specific:n{#2}}{\residual}

  % Residual partial molar property
  \exp_after:wN \NewDocumentCommand \exp_after:wN
    {\cs:w #1Rpm\cs_end:}{}{\partialmolar{#2}
        \c_math_superscript_token\residual}
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Nt,\Et,\Em,\Es,\Epm}
% \penalty-600%
% We define \cs{Nt} as the number of moles, as that changes between books a
% lot, but it does not have extensive, molar, and specific equivalents.
% Heat and work are defined, but lack partial molar properties. Area does not
% have excess or residual properties.
%    \begin{macrocode}
\NewDocumentCommand{\Nt}{}{\g_@@_mole_symbol}
\NewThermodynamicProperty{E}{\g_@@_total_energy_symbol}
\NewThermodynamicProperty{U}{\g_@@_internal_energy_symbol}
\NewThermodynamicProperty{F}{\g_@@_Helmholtz_symbol}
\NewThermodynamicProperty{G}{\g_@@_Gibbs_symbol}
\NewThermodynamicProperty{H}{\g_@@_enthalpy_symbol}
\NewThermodynamicProperty{L}{\g_@@_Landau_symbol}
\NewThermodynamicProperty{V}{\g_@@_volume_symbol}
\NewThermodynamicProperty{S}{\g_@@_entropy_symbol}
\NewExtensiveProperty{A}{\g_@@_area_symbol}
\NewPartialMolarProperty{A}{\g_@@_area_symbol}
\NewExtensiveProperty{Q}{\g_@@_heat_symbol}
\NewExtensiveProperty{W}{\g_@@_work_symbol}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cVpm,\cPpm}
% Partial molar heat capacities are \emph{hard}, but the following
% implementation seems to work flawlessly\dots so far.
% \changes{v2.02}{2024/06/14}{Simplified implementations of partial molar
%   heat capacities that take advantage of \cs{NewPartialMolarProperty} and
%   \cs{NewSubscriptedProperty}. This fixes the issue of the subscripts being
%   ``persistent'' after \cs{cPpm} is used in a line. Also declared alternative
%   symbols for use with the \texttt{shortpm} option.}
%    \begin{macrocode}
\NewPartialMolarProperty{cP}{\cP}
\NewPartialMolarProperty{cV}{\cV}
\NewSubscriptedSymbol{\cPpmshort}{\@@_overline_copy:n{\heatcapacitysymbol}}
    {\g_@@_pressure_symbol}
\NewSubscriptedSymbol{\cVpmshort}{\@@_overline_copy:n{\heatcapacitysymbol}}
    {\g_@@_volume_symbol}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Electrochemistry}
% \begin{macro}{\Epot}
% \changes{v2.02}{2024/06/14}{Added \cs{Epot} to standardize the electric
%   potential across textbooks for electrochemistry.}
% The \cs{Epot} command can be used for the electric potential.
%    \begin{macrocode}
\NewExpandableDocumentCommand{\Epot}{}{E}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Residual and Excess Properties}
% \begin{macro}{\residual,\excess}
% Macros are defined for residual properties (departure from ideal gases)
% and excess properties (departure from ideal solutions). We begin with two
% macros to use for defining generic residual and excess properties that are
% not already defined.
%    \begin{macrocode}
\NewDocumentCommand{\residual}{}{R}
\NewDocumentCommand{\excess}{}{E}
%    \end{macrocode}
% \end{macro}
%
% \pagebreak[1]\relax
% \begin{macro}{\prodall,\sumall,\summallbutlast}
% The \cs{sumall} macro and its cousin, \cs{sumallbutlast}, simplify the
% typesetting of commonly-used sums; the command \cs{prodall} does the same
% thing for products, viz.,
% \begin{verbatim}
%   \[ \sumall_i x_i = 1 \qquad \sumallbutlast_i x_i = 1 - x_\ncomponents
%       \qquad K = \exp\left(\frac{-\Deltarxn\Gm^\std}{RT}\right)
%                = \prodall_i a_i^{\nu_i} \]
%\end{verbatim}
% gives
%   \[ \sumall_i x_i = 1 \qquad \sumallbutlast_i x_i = 1 - x_\ncomponents
%       \qquad K = \exp\left(\frac{-\Deltarxn\Gm^\std}{RT}\right)
%                = \prodall_i a_i^{\nu_i} \]
%    \begin{macrocode}
\NewDocumentCommand{\sumall}{m m}
  { \sum\c_math_subscript_token{#2=1}
      \c_math_superscript_token{\ncomponents} }
\NewDocumentCommand{\sumallbutlast}{m m}
  { \sum\c_math_subscript_token{#2=1}
      \c_math_superscript_token{\ncomponents-1} }
\NewDocumentCommand{\prodall}{m m}
  { \prod\c_math_subscript_token{#2=1}
       \c_math_superscript_token{\ncomponents} }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\IG,\IGM,\IS}
% The \cs{IG}, \cs{IGM}, and \cs{IS} macros (meaning ``ideal gas,'' ``ideal
% gas mixture,'' and ``ideal solution,'' respectively) should be used to
% make clean transitions between textbooks---some use ``IM'' or ``ID'' rather
% than ``IS,'' for example.
%    \begin{macrocode}
\NewDocumentCommand{\IG}{}{{\text{IG}}}
\NewDocumentCommand{\IGM}{}{{\text{IGM}}}
\NewDocumentCommand{\IS}{}{{\text{IS}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Henryrat,\Henrymol}
% \subsubsection{Henry's Law Constants and Activity Coefficients}
% The Henry's Law constants for the rational basis ($y_i P = x_i h_i$) and
% the molal basis ($y_i P = C_i \mathcal{H}_i$) are given by the macros
% \cs{Henryrat} and \cs{Henrymol}, respectively. Using them this way
% consistently allows for easy switching back and forth.
%    \begin{macrocode}
\NewDocumentCommand{\Henryrat}{}{h}
\NewDocumentCommand{\Henrymol}{}{\mathcal{H}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\gammait,\muit}
% \changes{v2.02}{2024/06/14}{Added \cs{muit} and \cs{gammait} to preserve
%       symbols in case the base macros are redefined by a package.}
% \begin{macro}{\gammarat,\gammamol}
% The ordinary activity coefficient is typically denoted $\gamma$ or
% $\gammaup$, so the base symbol will still be \cs{gamma}. The macro
% \cs{gammait} is defined just in case \cs{gamma} is redefined by a package
% option. However, symbols for the Henry's Law activity coefficients are far
% from universal, so I have defined macros to make their use consistent. The
% defaults render \cs{gammarat} as $\gamma^\ast$ and \cs{gammamol} as
% $\gamma^\square$. \cs{gammamol} will use \cs{square} from packages if it is
% defined; if not, it ``fakes it'' with the definition below.
% The symbol for the chemical potential is \cs{mu}, but \cs{muit} is defined
% so the symbol is still available, should \cs{mu} be redefined later.
%^^A Backup for \square adapted from amsthm.sty with tweaks to make it
%^^A look reasonably similar to that from newpx (i.e., smaller than the
%^^A amsfonts version)
%    \begin{macrocode}
\cs_gset_eq:NN \gammait \gamma
\cs_gset_eq:NN \muit \mu
\AtBeginDocument{%
  \ProvideDocumentCommand{\square}{}{%
    \text{\leavevmode
      \hbox to.65em{%
      \hfil\vrule
      \vbox to.53em{\hrule width.45em\vfil\hrule}%
      \vrule\hfil}%
    }%
  }%
}
\NewDocumentCommand{\gammarat}{}{\gamma\c_math_superscript_token\ast}
\NewDocumentCommand{\gammamol}{}{\gamma\c_math_superscript_token\square}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \subsection{Jacobians}
% \begin{environment}{thermovmatrix}
% This is a non-user-interface wrapper environment used to detect, in
% effect, whether \pkg{amsmath} has been loaded. If so, it uses its
% \env{vmatrix} environment for Jacobians; if not, it fakes it with
% \env{array} (which does not look nearly as good).
%    \begin{macrocode}
\NewDocumentEnvironment{thermovmatrix}{}
{ \cs_if_exist:NTF \vmatrix
  { \begin{vmatrix} }
  { \left|\begin{array}{c c c c c c c c c c} }
}
{ \cs_if_exist:NTF \endvmatrix
  {  \end{vmatrix} }
  {  \end{array}\right| }
}
%    \end{macrocode}
% \end{environment}
% \begin{macro}{Jacobian}
% The \cs{Jacobian} command typesets the Leibnitz notation for the Jacobian
% determinant.\relax
% \changes{v2.00}{2023/11/16}{Reimplemented \cs{Jacobian} to handle an
%     arbitary number of variables and implemented \cs{Jacobiandet} to
%     handle the matrix representation of the Jacobian.}
%    \begin{macrocode}
\NewDocumentCommand{\Jacobian}{m m}
    {\@@_frac:nn{\partial(#1)}{\partial{(#2)}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{Jacobiandet}
% Similarly, the \cs{Jacobiandet} macro typesets the actual determinant that
% the Jacobian notation represents.
%    \begin{macrocode}
\NewDocumentCommand{\Jacobiandet}{O{} O{} m m}
{
  \@@_Jacobian_set_ncomponents:nn {#3} {#4}
  \begin{thermovmatrix}
    \@@_Jacobianmatrix:nnnn {#1} {#2} {#3} {#4}
  \end{thermovmatrix}
}
\seq_new:N \l_@@_row_seq
\seq_new:N \l_@@_matrix_seq
\clist_new:N \l_@@_other_vars_clist
\clist_new:N \l_@@_other_vars_copy_clist
\tl_new:N \l_@@_Jacobian_x_tl
\tl_new:N \l_@@_Jacobian_n_tl
\tl_new:N \l_@@_Jacobian_temp_tl
\bool_new:N \l_@@_found_dots_bool
\cs_new:Nn \@@_Jacobian_set_ncomponents:nn
{
  % If any entry is \dots, we assume the Jacobian is of the form
  % d(f_1,\dots,f_n)/d(x_1,\dots,x_n) where f is some function
  % (any symbol) and x is some variable (any symbol).
  \tl_if_in:nnTF {#1} {\dots}
  {% Has dots
    \bool_set_true:N \l_@@_found_dots_bool
    % look for what "x" is
    \tl_set:Nn \l_@@_Jacobian_x_tl {\tl_head:n {#2}}
    % look for what "n" is and set \ncomponents to it
    \tl_set:Nx \l_@@_Jacobian_n_tl {\tl_item:nn {#2} {-1}}
    \RenewExpandableDocumentCommand{\ncomponents}{}{\l_@@_Jacobian_n_tl}
  }
  {% Does not have dots; proceed accordingly
    \bool_set_false:N \l_@@_found_dots_bool
  }
}
\cs_new_protected:Nn \@@_Jacobianmatrix:nnnn
{
  \seq_clear:N \l_@@_matrix_seq
  \clist_set:Nn \l_@@_other_vars_clist {#4}
  \clist_set_eq:NN \l_@@_other_vars_copy_clist \l_@@_other_vars_clist

  \clist_map_inline:nn {#3}
  {
    \seq_clear:N \l_@@_row_seq
    \tl_if_in:nnTF {##1} {\dots}
    {% The current row has "dots" => row is \vdots && \vdots
      \seq_put_right:Nn \l_@@_matrix_seq
        { \vdots \c_alignment_token \c_alignment_token \vdots }
    }
    {% Ordinary row
      \clist_map_inline:nn {#4}
      {
        \tl_if_in:nnTF {####1} {\dots}
        {% this column has "dots" in it
          \seq_put_right:Nn \l_@@_row_seq \dots
        }
        {% Normal column
          \clist_set_eq:NN \l_@@_other_vars_clist
                           \l_@@_other_vars_copy_clist
          \clist_remove_all:Nn \l_@@_other_vars_clist {####1}
          \bool_if:NTF \l_@@_found_dots_bool
          { \tl_set:Nn \l_@@_Jacobian_temp_tl {\tl_item:nn {####1} {-1}}
            \seq_put_right:Nx \l_@@_row_seq
            {
              #1\Partial{##1}{####1}
                  {\allbut{\l_@@_Jacobian_temp_tl}{\l_@@_Jacobian_x_tl}}
            }
          }
          { \seq_put_right:Nx \l_@@_row_seq
            {
              #1\Partial{##1}{####1}
                        {\clist_use:Nn \l_@@_other_vars_clist ,}
            }
          }
        }
      }
      \seq_put_right:Nx \l_@@_matrix_seq
      {
        \seq_use:Nn \l_@@_row_seq { \c_alignment_token }
      }
    }
  }
  \tl_if_empty:nTF {#2}
  {
    \tl_if_eq:nnTF {#1} {\displaystyle}
    { \seq_use:Nn \l_@@_matrix_seq { \\[2.75ex] } }
    { \seq_use:Nn \l_@@_matrix_seq { \\[1.25ex] } }
  }
  {
    \seq_use:Nn \l_@@_matrix_seq { \\[#2] }
  }
}
%    \end{macrocode}
% \end{macro}
%^^X\end{implementation}
%
% \Finale
% \iffalse
%</package>
%<*example>
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{thermodynamics}
\title{Examples to Accompany the \textsf{thermodynamics} Package}
\author{Karl D. Hammond}
\date{}
\begin{document}
\NewThermodynamicProperty{B}{B}
\maketitle\noindent
The combined laws:
\begin{align*}
  d\Et &= d\Ut + d\left(\frac12 m v^2\right) - d(m\phi) \\
  d\Ut &= \dbar\Qt + \dbar\Wt + \Um d\Nt
        = \dbar\Qt - P d\Vt + \Hm d\Nt
    \\ &= \Partial*{\Ut}{\St}{\Vt,\allNs} d\St
        + \Partial*{\Ut}{\Vt}{\St,\allNs} d\Vt
        + \sumall_i \Partial*{\Ut}{\Nt_i}{\Vt,\St,\allNsbut{i}} d\Nt_i
    \\ &= T d\St - P d\Vt + \sumall_i \mu_i d\Nt_i
\end{align*}
With surfaces present:
\begin{gather*}
   d\Ut = T d\St - P d\Vt  + \sigma d\At + \sumall_i \mu_i d\Nt_i \\
   d\Ht = T d\St + \Vt dP  + \sigma d\At + \sumall_i \mu_i d\Nt_i \\
   d\Ft = -\St dT - P d\Vt + \sigma d\At + \sumall_i \mu_i d\Nt_i \\
   d\Gt = -\St dT + \Vt dP + \sigma d\At + \sumall_i \mu_i d\Nt_i \\
   d\Lt = -\St dT - P d\Vt + \sigma d\At - \sumall_i \Nt_i d\mu_i \\
    \Bt = \Ut + P\Vt - T\St - \sigma\At \\
   d\Bt = -\St dT + \Vt dP - \At d\sigma + \sumall_i \mu_i d\Nt_i \\
   \mu_i = \Bpm_i = \Gpm_i + \sigma \Apm_i
\end{gather*}
Some Maxwell reciprocity relations:
\begin{gather*}
  \Partial*{\Vt}{T}{P,\allNs}
    = \PartialMixSecond*{\Gt}{T}{P}{\allNs}
    = \PartialMixSecond*{\Gt}{P}{T}{\allNs}
    = -\Partial{\St}{P}{T,\allNs}
\\
    \Partial*{\Gpm_i}{T}{P,\allXs}
    = \PartialMixSecond*{\Gt}{T}{\Nt_i}{P,\allNsbut{i}}
    = \PartialMixSecond*{\Gt}{\Nt_i}{T}{P,\allNsbut{i}}
    = -\Partial*{\St}{\Nt_i}{T,P,\allNsbut{i}}
    = -\Spm_i
\end{gather*}
Temporary changes of derivative delimiters:
\begin{gather*}
  \begin{thermobrackets}
    \Partial*{\Vt}{T}{P,\allNs}
  \end{thermobrackets}
  \begin{thermobar}
    = \PartialMixSecond*{\Gt}{T}{P}{\allNs}
  \end{thermobar}
  \begin{thermomolesrange}
    = \PartialMixSecond*{\Gt}{P}{T}{\allNs}
  \end{thermomolesrange}
  \begin{thermobraces}
      = -\Partial*{\St}{P}{T,\allNs}
    \begin{thermoNOsubscripts}
      \begin{thermomolesrange}
        = -\Partial{\St}{P}{T,\allNs}
      \end{thermomolesrange}
    \end{thermoNOsubscripts}
  \end{thermobraces}
\end{gather*}
Inline derivatives:
\begin{gather*}
  \mu_i = \Partialinline{\Gt}{\Nt_i}{T,P,\allNsbut{i}}
        = \Partialinline{\Ft}{\Nt_i}{T,\Vt,\allNsbut{i}}
        = \Partialinline{\Ht}{\Nt_i}{\St,P,\allNsbut{i}}
        = \Partialinline{\Ut}{\Nt_i}{\St,\Vt,\allNsbut{i}}
\end{gather*}
The heat capacities:
\begin{gather*}
  \cV = T \Partial*{\Sm}{T}{\Vm,\allXs} = \Partial*{\Um}{T}{\Vm,\allXs}
      = -T\PartialSecond{\Fm}{T}{\Vm,\allXs}
  \\
  \cP^\IGM = T \Partial*{\Sm^\IGM}{T}{P,\allYs}
           = \Partial*{\Hm^\IGM}{T}{P,\allYs}
    \begin{thermobrackets}
      = -T\PartialSecond{\Gm^\IGM}{T}{P,\allYs}
    \end{thermobrackets}
  \\
  \cVt = T \Partial*{\St}{T}{\Vt,\allNs} = \Partial*{\Ut}{T}{\Vt,\allNs}
    \begin{thermobraces}
       = -T\PartialSecond{\Ft}{T}{\Vm,\allNs}
    \end{thermobraces}
  \\
    \begin{thermobar}
  \cPt = T \Partial*{\St}{T}{P,\allNs} = \Partial*{\Ht}{T}{P,\allNs}
       = -T\PartialSecond{\Gt}{T}{P,\allNs}
    \end{thermobar}
  \\
  \cVs = T \Partial*{\Ss}{T}{\Vs,\allWs} = \Partial*{\Us}{T}{\Vs,\allWs}
    \begin{thermoplain}
       = -T\PartialSecond{\Fs}{T}{\Vs,\allWs}
    \end{thermoplain}
  \\
  \cPs = T \Partialbigg*{\Ss}{T}{P,\allWs} = \Partialbigg*{\Hs}{T}{P,\allWs}
       = -T\PartialSecondbigg{\Gs}{T}{P,\allWs}
  \\
\begin{split}
  \cPpm_i &= \Partial*{\cPt}{\Nt_i}{T,P,\allNsbut{i}}
           = T \PartialMixSecond*{\St}{\Nt_i}{T}{P,\allNsbut{i}}
           = T \PartialMixSecond*{\St}{T}{\Nt_i}{P,\allNsbut{i}}
       \\ &= T \Partial*{\Spm_i}{T}{P,\allXs}
           = \Partial*{\Hpm_i}{T}{P,\allXs}
           = \PartialMixSecond*{\Ht}{T}{\Nt_i}{P,\allNsbut{i}}
           = \PartialMixSecond*{\Ht}{\Nt_i}{T}{P,\allNsbut{i}}
       \\ &= -T\PartialSecond*{\Gpm_i}{T}{P,\allXs}
           = -T\Partial{{}^3 \Gt}{T^2\partial \Nt_i}{P,\allNsbut{i}}
\end{split}
\end{gather*}
Other measurable quantities:
\begin{align*}
  \alphaS &= \frac{1}{\Vm} \Partial{\Vm}{T}{\Sm} &
  \alphaP &= \frac{1}{\Vm} \Partial{\Vm}{T}{P} \\
  \kappaS &= -\frac{1}{\Vm} \Partial{\Vm}{P}{\Sm} &
  \kappaT &= -\frac{1}{\Vm} \Partial{\Vm}{P}{T}
\end{align*}
The chemical potential, fugacity, and activity:
\[ \mu_i = \Gpm_i = \Gm_i^\std + RT \ln a_i
         = \Gm_i^\std + RT\ln\left(\frac{\fmix_i}{\fstd_i}\right) \]
Equilibrium in a chemical reaction:
\[ \sumall_i \nu_i \mu_i = 0
    \Rightarrow
    \exp\left(\frac{-\Delta\Gm^\std}{RT}\right) = K = \prodall_i a_i^{\nu_i} \]
Partial molar quantities:
\begin{align*}
  \Hpm{i} &= \Partial*{\Ht}{\Nt_i}{T,P,\allNsbut{i}}
           = \Hm + \Nt \Partial*{\Hm}{\Nt_i}{T,P,\allNsbut{i}}
       \\ &= \Hm + \Partial*{\Hm}{x_i}{T,P,\allXsbut{i}}
                 - \sumallbutlast_j x_j \Partial*{\Hm}{x_j}{T,P,\allXsbut{j}}
           = \Partial*{\Hm}{x_i}{T,P,\allXsbut{i}} + \Hpm_\ncomponents
\end{align*}
\[ \Vpm_i = \Partial{\Vt}{\Nt_i}{T,P,\allNsbut{i}} \]
Fugacity and related properties:
\begin{gather*}
  \Gpm_i = \mu_i
         = \Gm_i^\std(T) + RT\ln a_i
         = \Gm_i^\std(T) + RT\ln\left(\frac{\fmix_i}{\fstd_i}\right)
  \\
  a_i = \frac{\fmix_i}{\fstd_i}
      = x_i \gamma_i
                \exp\left(\frac{1}{RT} \int_{\Pstd}^P \Vm_i(T,p)\,dp\right)
      \approx x_i \gamma_i
  \\
  \begin{split}
  \fmix_i &= x_i \phimix_i P
           = x_i \gamma_i \fpure_i = x_i \gamma_i \phipure_i P
           = x_i \gammarat_i \Henryrat_i
           = C_i \gammamol_i \Henrymol_i
           = x_i \gamma_i \fsat_i
                 \exp\left(\frac{1}{RT} \int_{\Psat_i}^P \Vm_i(T,p)\,dp\right)
       \\ &= x_i \gamma_i \Psat_i \phisat_i
                \exp\left(\frac{1}{RT} \int_{\Psat_i}^P \Vm_i(T,p)\,dp\right)
          \approx x_i \gamma_i \Psat_i
  \end{split}
\end{gather*}
Chemical Equilibria:
\begin{gather*}
  \Deltarxn\Hm^\std = \sumall_i \nu_i \Deltaf\Hm_i^\std \\
  \Deltarxn\Gm^\std = \sumall_i \nu_i \Deltaf\Gm_i^\std
                    = \sumall_i \nu_i \mu_i^\std \\
  \Deltarxn\cP^\std = \sumall_i \nu_i \cP_i^\std \\
  \mu_i = \mu_i^\std + RT\ln a_i \\
  a_i = \begin{cases}
\displaystyle
     \frac{y_i \phimix_i P}{\Pstd} \approx \frac{y_i P}{\Pstd}
        & \text{(gases)} \\
\rule{0pt}{5ex}%
\displaystyle
     x_i \gamma_i \exp\left(\frac{1}{RT} \int_{\Pstd}^P \Vm_i(T,p)\,dp\right)
     \approx
     x_i \gamma_i \exp\left(\frac{\Vm_i(P-\Pstd)}{RT}\right)
     \approx x_i \gamma_i \approx 1
        & \text{(solids, solvents)} \\
\displaystyle
\rule{0pt}{5ex}%
     \frac{C_i \gammamol_i}{C_i^\std}
        \exp\left(\frac{1}{RT}
        \int_{\Pstd}^P \Vpm_i^\infty(T,p,\allXs)\,dp\right)
     \approx
     \frac{C_i \gammamol_i}{C_i^\std} \approx \frac{C_i}{C_i^\std}
        & \text{(solutes)}
        \end{cases}
\end{gather*}
Phase change properties:
\begin{gather*}
  \Deltafus\Sm = \Sm^L - \Sm^S \\
  \Deltasub\Vm = \Vm^V - \Vm^S \\
  \Deltavap\Gm = \Gm^V - \Gm^L
\end{gather*}
Specific properties:
\newcommand*{\Btilde}[2][]{\widetilde{B}_{#2}^{#1}}
\[ \Btilde{j} \equiv \Partial{\Bt}{m_j}{T,\Vs,\allMsbut[i]{j}} \]
and thus
\[ \Btilde{i}
    = \frac{\Bpm{i}}{M_i}
        + \Biggl(\Vs - \frac{\Vpm_i}{M_i}\Biggr)
          \Partial*{\Bs}{\Vs}{T,\allMs}
    = \frac{\Bpm{i}}{M_i}
        + \Biggl(\Vs - \frac{\Vpm_i}{M_i}\Biggr)
          \Partial{\Bs}{\Vs}{T,m,\allWs} \]
and
\[ \Bs = \sumall_i w_i \Btilde{i}. \]
Excess and Residual (Departure) Properties:
\begin{align*}
  \HR &= \Hm - \Hm^\IG &
  \FR &= \Fm - \Fm^\IGM \\
  \SE &= \Sm - \Sm^\IS &
  \VRpm_k &= \Vpm_k - \Vpm_k^\IGM
\end{align*}
Jacobians:
\begin{gather*}
  \Jacobian{\St,\Vt}{T,P} = \Jacobiandet{\St,\Vt}{T,P} \\
  \Jacobian{f,g,h}{x,y,z} = \Jacobiandet[\displaystyle]{f,g,h}{x,y,z} \\
  \Jacobian{h_1,\dots,h_k}{z_1,\dots,z_k} =
      \Jacobiandet{h_1,\dots,h_k}{z_1,\dots,z_k} \\
  \cP = T\Partial{\Sm}{T}{P}
      = T\Jacobian{\Sm,P}{T,P}
      = -T\Jacobian{\Sm,P}{T,\Vm} \Jacobian{T,\Vm}{T,P}
      = -T\Jacobian{P,\Sm}{\Vm,\Sm} \Jacobian{\Vm,\Sm}{T,\Vm}
          \Jacobian{T,\Vm}{T,P}
      = \gamma \cV
\end{gather*}
\end{document}
%</example>
% \fi
%
% \Finale
\endinput
