summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-11-18 03:01:07 +0000
committerNorbert Preining <norbert@preining.info>2023-11-18 03:01:07 +0000
commitbcd1a2a7dfe36b38f10a8fa23b4b6f0c325ca899 (patch)
tree2df3f6c998a7a44c9c5365c0ab78e7c152bc0082 /macros/latex
parentd91bb5cad66508ec34d77ea60c0a02c79308edef (diff)
CTAN sync 202311180301
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/contrib/mnras/LEGACY/legacy.txt (renamed from macros/latex/contrib/mnras/legacy/legacy.txt)0
-rw-r--r--macros/latex/contrib/mnras/LEGACY/mn2e.bst (renamed from macros/latex/contrib/mnras/legacy/mn2e.bst)0
-rw-r--r--macros/latex/contrib/mnras/LEGACY/mn2e.cls (renamed from macros/latex/contrib/mnras/legacy/mn2e.cls)0
-rw-r--r--macros/latex/contrib/mnras/README.txt8
-rw-r--r--macros/latex/contrib/mnras/mnras.cls6
-rw-r--r--macros/latex/contrib/mnras/mnras_guide.pdfbin284323 -> 329563 bytes
-rw-r--r--macros/latex/contrib/mnras/mnras_guide.tex10
-rw-r--r--macros/latex/contrib/mnras/mnras_template.tex9
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/CHANGELOG.md9
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/README.md6
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/color-ltx.sty2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/colorspace-patches-tmp-ltx.sty2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx121
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.pdfbin965250 -> 961151 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.dtx62
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.pdfbin706581 -> 704199 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.dtx4
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.pdfbin606541 -> 606092 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.dtx4
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.pdfbin516165 -> 515694 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.dtx2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.pdfbin559398 -> 559040 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.dtx2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.pdfbin542491 -> 542123 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.dtx2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.pdfbin544767 -> 544422 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.dtx2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.pdfbin537893 -> 537538 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.dtx2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.pdfbin594970 -> 594612 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.dtx2
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.pdfbin517104 -> 516740 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield.dtx6
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffield.pdfbin751518 -> 750981 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffile.dtx6
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdffile.pdfbin567485 -> 566955 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.dtx4
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.pdfbin683358 -> 682850 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx4
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.pdfbin815504 -> 815060 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdftools.dtx4
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdftools.pdfbin532573 -> 532095 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.dtx4
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.pdfbin427900 -> 427405 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/l3ref-tmp.sty124
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/ltdocinit.dtx44
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/ltdocinit.pdfbin590956 -> 587741 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx4
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.pdfbin449226 -> 448754 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.dtx14
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.pdfbin464495 -> 464434 bytes
-rw-r--r--macros/latex/contrib/pdfmanagement-testphase/xcolor-patches-tmp-ltx.sty2
-rw-r--r--macros/latex/contrib/q-and-a/Q-and-A.cls164
-rw-r--r--macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex85
-rw-r--r--macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.pdfbin0 -> 29394 bytes
-rw-r--r--macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.tex33
-rw-r--r--macros/latex/contrib/q-and-a/doc/Q-and-A-doc.pdfbin102869 -> 108248 bytes
-rw-r--r--macros/latex/contrib/q-and-a/doc/Q-and-A-doc.tex36
-rw-r--r--macros/latex/contrib/q-and-a/doc/code/Q-and-A-doc-code-sample-document.tex3
-rw-r--r--macros/latex/contrib/thermodynamics/README.md18
-rw-r--r--macros/latex/contrib/thermodynamics/thermodynamics.dtx4627
-rw-r--r--macros/latex/contrib/thermodynamics/thermodynamics.ins13
-rw-r--r--macros/latex/contrib/thermodynamics/thermodynamics.pdfbin201715 -> 273124 bytes
63 files changed, 3064 insertions, 2386 deletions
diff --git a/macros/latex/contrib/mnras/legacy/legacy.txt b/macros/latex/contrib/mnras/LEGACY/legacy.txt
index f8df2a813b..f8df2a813b 100644
--- a/macros/latex/contrib/mnras/legacy/legacy.txt
+++ b/macros/latex/contrib/mnras/LEGACY/legacy.txt
diff --git a/macros/latex/contrib/mnras/legacy/mn2e.bst b/macros/latex/contrib/mnras/LEGACY/mn2e.bst
index 2011d74499..2011d74499 100644
--- a/macros/latex/contrib/mnras/legacy/mn2e.bst
+++ b/macros/latex/contrib/mnras/LEGACY/mn2e.bst
diff --git a/macros/latex/contrib/mnras/legacy/mn2e.cls b/macros/latex/contrib/mnras/LEGACY/mn2e.cls
index 8972a31653..8972a31653 100644
--- a/macros/latex/contrib/mnras/legacy/mn2e.cls
+++ b/macros/latex/contrib/mnras/LEGACY/mn2e.cls
diff --git a/macros/latex/contrib/mnras/README.txt b/macros/latex/contrib/mnras/README.txt
index 1e28e500c3..26a035a39e 100644
--- a/macros/latex/contrib/mnras/README.txt
+++ b/macros/latex/contrib/mnras/README.txt
@@ -1,7 +1,7 @@
% readme.txt
%
% MNRAS journal LaTeX package
-% v3.0 for LaTeX 2e
+% v3.2 for LaTeX 2e
%
%
% This work may be distributed and/or modified under the
@@ -15,14 +15,14 @@
% This work has the LPPL maintenance status `author-maintained'.
%
% The Current Maintainer of this work is: Royal Astronomical Society,
-% MNRAS Editorial Office, who can be contacted on mn@ras.org.uk
+% MNRAS Editorial Office, who can be contacted on mn@ras.ac.uk
%
% This work consists of all the files listed in readme.txt
%
%
-% Last updated 22 May 2015
+% Last updated 20 July 2023
%
-% Copyright (C) Royal Astronomical Society 2015, Blackwell Science 2001,
+% Copyright (C) Royal Astronomical Society 2021, Blackwell Science 2001,
% Cambridge University Press 1994
%
% See each file for a detailed author list and change log.
diff --git a/macros/latex/contrib/mnras/mnras.cls b/macros/latex/contrib/mnras/mnras.cls
index ddf3c30148..b02f7f413e 100644
--- a/macros/latex/contrib/mnras/mnras.cls
+++ b/macros/latex/contrib/mnras/mnras.cls
@@ -1,7 +1,7 @@
% mnras.cls
%
% MNRAS journal document class file
-% v3.0 for LaTeX 2e
+% v3.2 for LaTeX 2e
%
% Copyright (C) Royal Astronomical Society 2015, Blackwell Science 2001,
% Cambridge University Press 1994
@@ -32,8 +32,8 @@
% Preamble to this style file
-\def\@version{3.0}
-\def\@releasedate{2015/05/22}
+\def\@version{3.2}
+\def\@releasedate{2023/07/20}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mnras}[\@releasedate\ v\@version\ LaTeX2e MNRAS document class]
diff --git a/macros/latex/contrib/mnras/mnras_guide.pdf b/macros/latex/contrib/mnras/mnras_guide.pdf
index ebb59e9f0a..1deefd0a84 100644
--- a/macros/latex/contrib/mnras/mnras_guide.pdf
+++ b/macros/latex/contrib/mnras/mnras_guide.pdf
Binary files differ
diff --git a/macros/latex/contrib/mnras/mnras_guide.tex b/macros/latex/contrib/mnras/mnras_guide.tex
index 1bb1591957..e0350f1e4d 100644
--- a/macros/latex/contrib/mnras/mnras_guide.tex
+++ b/macros/latex/contrib/mnras/mnras_guide.tex
@@ -2,6 +2,8 @@
%
% MNRAS LaTeX user guide
%
+% v3.2 released 20 July 2023
+%
% v3.1 released 11 June 2020
%
% v3.0 released 22 May 2015
@@ -13,6 +15,9 @@
% Change log
%
+% v3.2 July 2023
+% Updated guidance on use of amssymb package
+%
% v3.0 September 2013 - May 2015
% First version: complete rewrite of the user guide
% Basic structure taken from mnras_template.tex by the same author
@@ -23,10 +28,9 @@
%%%%% AUTHORS - PLACE YOUR OWN PACKAGES HERE %%%%%
-% Only include extra packages if you really need them. Common packages are:
+% Only include extra packages if you really need them. Avoid using amssymb if newtxmath is enabled, as these packages can cause conflicts. newtxmatch covers the same math symbols while producing a consistent Times New Roman font. Common packages are:
\usepackage{graphicx} % Including figure files
\usepackage{amsmath} % Advanced maths commands
-\usepackage{amssymb} % Extra maths symbols
\usepackage{multicol} % Multi-column entries in tables
\usepackage{bm} % Bold maths symbols, including upright Greek
\usepackage{pdflscape} % Landscape pages
@@ -168,7 +172,7 @@ The available options are:
\item \verb'landscape' -- \textit{(deprecated)} sets the whole document on landscape paper.
\item \verb"usenatbib" -- \textit{(all papers should use this)} this uses Patrick Daly's \verb"natbib.sty" package for citations.
\item \verb"usegraphicx" -- \textit{(most papers will need this)} includes the \verb'graphicx' package, for inclusion of figures and images.
-\item \verb'useAMS' -- adds support for upright Greek characters \verb'\upi', \verb'\umu' and \verb'\upartial' ($\upi$, $\umu$ and $\upartial$). Only these three are included, if you require other symbols you will need to include the \verb'amsmath' or \verb'amsymb' packages (see section~\ref{sec:packages}).
+\item \verb'useAMS' -- adds support for upright Greek characters \verb'\upi', \verb'\umu' and \verb'\upartial' ($\upi$, $\umu$ and $\upartial$). Only these three are included, if you require other symbols you will need to include the \verb'amsmath' package (see section~\ref{sec:packages}).
\item \verb"usedcolumn" -- includes the package \verb"dcolumn", which includes two new types of column alignment for use in tables.
\end{itemize}
diff --git a/macros/latex/contrib/mnras/mnras_template.tex b/macros/latex/contrib/mnras/mnras_template.tex
index ca61f04f42..22eeff7f7e 100644
--- a/macros/latex/contrib/mnras/mnras_template.tex
+++ b/macros/latex/contrib/mnras/mnras_template.tex
@@ -2,7 +2,7 @@
%
% LaTeX template for creating an MNRAS paper
%
-% v3.0 released 14 May 2015
+% v3.2 released 20 July 2023
% (version numbers match those of mnras.cls)
%
% Copyright (C) Royal Astronomical Society 2015
@@ -11,6 +11,8 @@
% Change log
%
+% v3.2 July 2023
+% Updated guidance on use of amssymb package
% v3.0 May 2015
% Renamed to match the new package name
% Version number matches mnras.cls
@@ -44,10 +46,9 @@
%%%%% AUTHORS - PLACE YOUR OWN PACKAGES HERE %%%%%
-% Only include extra packages if you really need them. Common packages are:
+% Only include extra packages if you really need them. Avoid using amssymb if newtxmath is enabled, as these packages can cause conflicts. newtxmatch covers the same math symbols while producing a consistent Times New Roman font. Common packages are:
\usepackage{graphicx} % Including figure files
\usepackage{amsmath} % Advanced maths commands
-\usepackage{amssymb} % Extra maths symbols
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -68,7 +69,7 @@
% The list of authors, and the short list which is used in the headers.
% If you need two or more lines of authors, add an extra line using \newauthor
\author[K. T. Smith et al.]{
-Keith T. Smith,$^{1}$\thanks{E-mail: mn@ras.org.uk (KTS)}
+Keith T. Smith,$^{1}$\thanks{E-mail: publications@ras.ac.uk (KTS)}
A. N. Other,$^{2}$
Third Author$^{2,3}$
and Fourth Author$^{3}$
diff --git a/macros/latex/contrib/pdfmanagement-testphase/CHANGELOG.md b/macros/latex/contrib/pdfmanagement-testphase/CHANGELOG.md
index 972c49380d..c3bc86cfc0 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/CHANGELOG.md
+++ b/macros/latex/contrib/pdfmanagement-testphase/CHANGELOG.md
@@ -5,6 +5,15 @@ first release 0.95a, 2021-02-23 will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
this project uses date-based 'snapshot' version identifiers.
+## [2023-11-17]
+Version: 2023-11-17, 0.96c
+
+ - remove dependency to ltxcmds in the hyperref driver
+ - correct a local/global assigment
+ - remove l3ref-tmp.sty
+ - l3pdffile.dtx: change mimetype of xml to application/xml
+
+
## [2023-11-05]
Version: 2023-11-05, 0.96b
diff --git a/macros/latex/contrib/pdfmanagement-testphase/README.md b/macros/latex/contrib/pdfmanagement-testphase/README.md
index 35361e0a49..94a0136f3d 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/README.md
+++ b/macros/latex/contrib/pdfmanagement-testphase/README.md
@@ -1,6 +1,6 @@
# LaTeX PDF management testphase bundle
-Version: 0.96b, 2023-11-05
+Version: 0.96c, 2023-11-17
This package is used during a test phase to load the new PDF management code
of LaTeX.
@@ -19,8 +19,8 @@ Bug reports and feedback are welcome and should be made at
https://github.com/latex3/pdfresources
## Requirements
-The package requires a LaTeX format 2022-06-01 or newer.
-It requires an L3 programming 2022-08-30 or newer.
+The package requires a current LaTeX format
+and L3 programming layer.
## Installation
diff --git a/macros/latex/contrib/pdfmanagement-testphase/color-ltx.sty b/macros/latex/contrib/pdfmanagement-testphase/color-ltx.sty
index ac0a4e5f86..6b86bc4c17 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/color-ltx.sty
+++ b/macros/latex/contrib/pdfmanagement-testphase/color-ltx.sty
@@ -24,7 +24,7 @@
%% This file has the LPPL maintenance status "maintained".
%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesPackage{color-ltx}[2023-11-05 v0.96b
+\ProvidesPackage{color-ltx}[2023-11-17 v0.96c
Standard LaTeX Color (patched for l3color, part of pdfmanagement-testphase, original version 2022/01/06 v1.3d) (DPC)]
\edef\Gin@codes{%
\catcode`\noexpand\^^A\the\catcode`\^^A\relax
diff --git a/macros/latex/contrib/pdfmanagement-testphase/colorspace-patches-tmp-ltx.sty b/macros/latex/contrib/pdfmanagement-testphase/colorspace-patches-tmp-ltx.sty
index 8e03acf112..c6f186877a 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/colorspace-patches-tmp-ltx.sty
+++ b/macros/latex/contrib/pdfmanagement-testphase/colorspace-patches-tmp-ltx.sty
@@ -19,7 +19,7 @@
%
% for those people who are interested.
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
-\ProvidesExplPackage{colorspace-patches-tmp-ltx}{2023-11-05}{0.96b}
+\ProvidesExplPackage{colorspace-patches-tmp-ltx}{2023-11-17}{0.96c}
{temporay patches to for the colorspace package to test pdfresource management ... UF}
% colorspace can define more models, that l3color can't yet handle.
diff --git a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx
index 47b957c2ec..c03d57a7fc 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.dtx
@@ -82,7 +82,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -913,8 +913,8 @@
%^^A %%
%^^A %% References (ref)
%^^A %% *\@@_property_record:nn
-%^^A %% *\@@_property_if_recorded:nn
-%^^A %% *\@@_property_ref_undefined_warn:nn,
+%^^A %% *\property_if_recorded:nn
+%^^A %% *\property_ref_undefined_warn:nn,
%^^A %% % helps to display key list messages
%^^A %% \@@_clist_display:n
%^^A %%
@@ -956,11 +956,15 @@
%<@@=hyp>
% \end{macrocode}
% \begin{macrocode}
-\ProvidesFile{hgeneric-testphase.def}[2023-11-05 v0.96b %
+\ProvidesFile{hgeneric-testphase.def}[2023-11-17 v0.96c %
generic Hyperref driver for the LaTeX PDF management testphase bundle]
\RequirePackage{etoolbox} %why?
% \end{macrocode}
+% Temporary command definition, can be remove when hyperref is update too.
+% \begin{macrocode}
+\long\def\Hy@ReturnAfterFi#1\fi{\fi#1}
+% \end{macrocode}
% \begin{macrocode}
\ExplSyntaxOn
\file_input:n {hyperref-colorschemes.def}
@@ -1535,85 +1539,28 @@
% \end{macrocode}
%
% \section{Reference and label commands}
-% The code uses in older LaTeX the l3ref-tmp package which
-% must have been loaded as pdfmanagement is a requirement.
-% In newer LaTeX it uses the in-built property module.
+% This uses the in-built property module.
%
% \begin{macro}
% {
% \@@_property_record:nn,
-% \@@_property_if_recorded:nn,
-% \@@_property_ref_undefined_warn:nn,
-% \@@_property_ref:nn
% }
% \begin{macrocode}
%
-\cs_if_exist:NTF \property_new:nnnn
- {
-% \end{macrocode}
-% At first a label command which adds the space commands from LaTeX:
-% \begin{macrocode}
- \cs_new_protected:Npn \@@_property_record:nn #1 #2 %label/attributes
- {
- \@bsphack
- \property_record:nn{#1}{#2}
- \@esphack
- }
-% \end{macrocode}
-% This provides a conditional which tests if a label/property combination is known
-% \begin{macrocode}
- \prg_new_eq_conditional:NNn
- \@@_property_if_recorded:nn \property_if_recorded:nn { T }
-% \end{macrocode}
-% This checks if the label/property is known and issues a warning if not.
-% It then also triggers the standard rerun message.
-% \begin{macrocode}
- \cs_new_eq:NN \@@_property_ref_undefined_warn:nn \property_ref_undefined_warn:nn
-% \end{macrocode}
-%
-% \begin{macrocode}
- \cs_new_eq:NN \@@_property_ref:nn \property_ref:nn
- }
% \end{macrocode}
-% and now the same with the older l3ref-tmp.
-% This can go once LaTeX has been released.
+% A label command which adds the space commands from LaTeX:
% \begin{macrocode}
- {
- \cs_new_protected:Npn \@@_property_record:nn #1 #2 %label/attributes
- {
- \@bsphack
- \ref_label:nn{#1}{#2}
- \@esphack
- }
-
- \prg_new_eq_conditional:NNn \@@_property_if_recorded:nn \ref_if_exist:nn { T }
-
- \cs_new_protected:Npn \@@_property_ref_undefined_warn:nn #1 #2 %label/attribute
- {
- \@@_property_if_recorded:nnF {#1}{#2}
- {
- \protect\G@refundefinedtrue
- \@latex@warning
- {
- Reference~'\tl_to_str:n {#1}'~with~attribute~'\tl_to_str:n {#2}'~
- on~page~\thepage~\space undefined
- }
- }
- }
-
- \cs_new:Npn \@@_property_ref:nn #1 #2
- {
- \ref_value:nn{#1}{#2}
- }
- }
+\cs_new_protected:Npn \@@_property_record:nn #1 #2 %label/attributes
+ {
+ \@bsphack
+ \property_record:nn{#1}{#2}
+ \@esphack
+ }
% \end{macrocode}
-% At last we generate a few variants. We use ee-variants as they already exist
+% we generate a few variants. We use ee-variants as they already exist
% in the module and once this is there it can go here.
% \begin{macrocode}
\cs_generate_variant:Nn \@@_property_record:nn {ee}
-\prg_generate_conditional_variant:Nnn \@@_property_if_recorded:nn {ee} { T }
-\cs_generate_variant:Nn \@@_property_ref_undefined_warn:nn {ee}
-\cs_generate_variant:Nn \@@_property_ref:nn {ee}
% \end{macrocode}
% \end{macro}
% \section{Variables}
@@ -4248,11 +4195,8 @@
\prop_new:N \g_@@_AcroForm_CoFields_prop
\prop_new:N \g_@@_AcroForm_Fields_prop
-\let\HyField@afields\ltx@empty
-\let\HyField@cofields\ltx@empty
-%% UF test for old pdftex removed
-%\let\HyField@AuxAddToFields\ltx@gobble
-%\let\HyField@AuxAddToCoFields\ltx@gobbletwo
+\let\HyField@afields\@empty
+\let\HyField@cofields\@empty
\def\HyField@AfterAuxOpen{\Hy@AtBeginDocument}%
% the value doesn't matter, but with a prop we avoid duplicates and it is
@@ -4288,7 +4232,7 @@
{
\pdfannot_box_ref_last:
}
- \ifx\Fld@calculate@code\ltx@empty
+ \ifx\Fld@calculate@code\@empty
\else
\begingroup
\Hy@safe@activestrue
@@ -4375,29 +4319,30 @@
}
}
\ExplSyntaxOff
-\let\@endForm\ltx@empty
-\let\HyAnn@AbsPageLabel\ltx@empty
-\let\Fld@pageobjref\ltx@empty
+\let\@endForm\@empty
+\let\HyAnn@AbsPageLabel\@empty
+\let\Fld@pageobjref\@empty
\ExplSyntaxOn
\newcount\HyAnn@Count
-\HyAnn@Count=\ltx@zero
+\HyAnn@Count=\z@
\def\HyAnn@AbsPageLabel
{
- \global\advance\HyAnn@Count by\ltx@one
+ \global\advance\HyAnn@Count by\@ne
%\zref@labelbyprops{HyAnn@\the\HyAnn@Count}{abspage}%
%\zref@labelbylist {HyAnn@\the\HyAnn@Count} {l3pdf}
%\zref@refused{HyAnn@\the\HyAnn@Count}%
\@@_property_record:ee {HyAnn@\the\HyAnn@Count}{abspage}
- \@@_property_ref_undefined_warn:ee {HyAnn@\the\HyAnn@Count}{abspage}
+ \property_ref_undefined_warn:ee {HyAnn@\the\HyAnn@Count}{abspage}
}%
+\prg_generate_conditional_variant:Nnn \property_if_recorded:nn {ee} {T}
\def\Fld@pageobjref
{
- \@@_property_if_recorded:eeT {HyAnn@\the\HyAnn@Count}{abspage}
+ \property_if_recorded:eeT {HyAnn@\the\HyAnn@Count}{abspage}
{
/P~\pdf_pageobject_ref:e
{
- \@@_property_ref:ee{HyAnn@\the\HyAnn@Count}{abspage}
+ \property_ref:ee{HyAnn@\the\HyAnn@Count}{abspage}
}
}
}
@@ -4408,7 +4353,7 @@
%% check if options are missing.
\def\@TextField[#1]#2{% parameters, label
\def\Fld@name{#2}%
- \let\Fld@default\ltx@empty
+ \let\Fld@default\@empty
\let\Fld@value\@empty
\def\Fld@width{\DefaultWidthofText}%
\def\Fld@height{%
@@ -4864,7 +4809,7 @@
\else
\expandafter
\Hy@pstringdef\csname Hy@esc@\string#2\endcsname{#2}% probably string-hex
- \ltx@ReturnAfterFi{%
+ \Hy@ReturnAfterFi{%
\Hy@@escapeform#3\@nil
}%
\fi
@@ -5334,7 +5279,7 @@
\endgroup
\H@old@schapter{#1}%
}
-\ltx@IfUndefined{@chapter}{}{%
+\@ifundefined{@chapter}{}{%
\let\Hy@org@chapter\@chapter
\def\@chapter{%
\def\Hy@next{%
@@ -5344,7 +5289,7 @@
}%
}%
\ifnum\c@secnumdepth>\m@ne
- \ltx@IfUndefined{if@mainmatter}%
+ \@ifundefined{if@mainmatter}%
\iftrue{\csname if@mainmatter\endcsname}%
\let\Hy@next\relax
\fi
diff --git a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.pdf b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.pdf
index 4b4d37a989..9318d060f9 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/hyperref-generic.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.dtx
index 4d557d276b..37e47d5c91 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.dtx
@@ -45,7 +45,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
%
@@ -56,27 +56,27 @@
% \begin{macrocode}
%<drivers>\ProvidesExplFile
%<*dvipdfmx>
- {l3backend-testphase-dvipdfmx.def}{2023-11-05}{}
+ {l3backend-testphase-dvipdfmx.def}{2023-11-17}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: dvipdfmx}
%</dvipdfmx>
%<*dvips>
- {l3backend-testphase-dvips.def}{2023-11-05}{}
+ {l3backend-testphase-dvips.def}{2023-11-17}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: dvips}
%</dvips>
%<*dvisvgm>
- {l3backend-testphase-dvisvgm.def}{2023-11-05}{}
+ {l3backend-testphase-dvisvgm.def}{2023-11-17}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: dvisvgm}
%</dvisvgm>
%<*luatex>
- {l3backend-testphase-luatex.def}{2023-11-05}{}
+ {l3backend-testphase-luatex.def}{2023-11-17}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: PDF output (LuaTeX)}
%</luatex>
%<*pdftex>
- {l3backend-testphase-pdftex.def}{2023-11-05}{}
+ {l3backend-testphase-pdftex.def}{2023-11-17}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: PDF output (pdfTeX)}
%</pdftex>
%<*xdvipdfmx>
- {l3backend-testphase-xetex.def}{2023-11-05}{}
+ {l3backend-testphase-xetex.def}{2023-11-17}{}
{LaTeX~PDF~management~testphase~bundle~backend~support: XeTeX}
%</xdvipdfmx>
% \end{macrocode}
@@ -167,48 +167,22 @@
% \end{macro}
% \subsection{Crossreferences}
-% This uses the temporary l3ref-tmp.sty. It will
-% will be replaced by kernel code later.
-% It is only needed to get a reference for the absolute page counter.
-% This uses the counter from the new lthooks/ltshipout package.
+% Commands to get a reference for the absolute page counter.
% \begin{macrocode}
%<*drivers>
% \end{macrocode}
-% l3ref-tmp is loaded until all files in latex-lab and tagpdf has been
-% cleared:
% \begin{macrocode}
-\RequirePackage{l3ref-tmp}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\cs_if_exist:NTF \property_new:nnnn
- {
- \cs_new_protected:Npn \@@_backend_record_abspage:n #1
- {
- \@bsphack
- \property_record:nn{#1}{abspage}
- \@esphack
- }
- \cs_new:Npn \@@_backend_ref_abspage:n #1
- {
- \property_ref:nn{#1}{abspage}
- }
+\cs_new_protected:Npn \@@_backend_record_abspage:n #1
+ {
+ \@bsphack
+ \property_record:nn{#1}{abspage}
+ \@esphack
+ }
+\cs_new:Npn \@@_backend_ref_abspage:n #1
+ {
+ \property_ref:nn{#1}{abspage}
+ }
- }
- {
- \cs_new_protected:Npn \@@_backend_record_abspage:n #1
- %% \@@_backend_ref_label:nn #1 #2
- {
- \@bsphack
- \ref_label:nn{#1}{abspage}
- \@esphack
- }
- \cs_new:Npn \@@_backend_ref_abspage:n #1
- %% \@@_backend_ref_value:nn #1 #2
- {
- \ref_value:nn{#1}{abspage}
- }
- }
\cs_generate_variant:Nn \@@_backend_record_abspage:n {e}
\cs_generate_variant:Nn \@@_backend_ref_abspage:n {e}
%</drivers>
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.pdf
index 233f89550f..3c292b8dfa 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3backend-testphase.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.dtx
index 73b309615c..4c0942ad72 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.dtx
@@ -48,7 +48,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -432,7 +432,7 @@
% \begin{macrocode}
%<@@=pdfannot>
%<*header>
-\ProvidesExplPackage{l3pdfannot}{2023-11-05}{0.96b}
+\ProvidesExplPackage{l3pdfannot}{2023-11-17}{0.96c}
{PDF-annotations}
\RequirePackage{l3pdfdict}
%</header>
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.pdf
index 4871acbc4b..8db999acd8 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfannot.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.dtx
index 88f6f1bd1c..abb1d33936 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.dtx
@@ -49,7 +49,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -208,7 +208,7 @@
% \begin{macrocode}
%<@@=pdfdict>
%<*header>
-\ProvidesExplPackage{l3pdfdict}{2023-11-05}{0.96b}
+\ProvidesExplPackage{l3pdfdict}{2023-11-17}{0.96c}
{Tools for PDF dictionaries (LaTeX PDF management testphase bundle)}
%</header>
% \end{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.pdf
index 5c0de310c3..c488bc77bf 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfdict.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.dtx
index 3948784b33..b4d535bfc2 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.dtx
@@ -49,7 +49,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.pdf
index 11934af61c..1ad47b14fb 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-action.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.dtx
index cb16c8f00d..dfbf0c3af3 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.dtx
@@ -64,7 +64,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.pdf
index 3ebc6e7caa..e0f6b1fc9a 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-checkbox.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.dtx
index 23d142d089..c94891b733 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.dtx
@@ -49,7 +49,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.pdf
index 3bf4f3e933..80cb55d643 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-choice.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.dtx
index 38f3b91b12..fb7b913a76 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.dtx
@@ -55,7 +55,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.pdf
index afb6ed1e8e..c9b9cd1aef 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-pushbutton.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.dtx
index 3c82cdde97..e951990650 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.dtx
@@ -83,7 +83,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.pdf
index 8a7962663b..b66ff7f3cb 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-radiobutton.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.dtx
index df091d3e60..7922c659a7 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.dtx
@@ -49,7 +49,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.pdf
index 38c9534fda..3d40a66eee 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield-textfield.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.dtx
index 9261078e98..59275311f4 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.dtx
@@ -69,7 +69,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -972,7 +972,7 @@
%<*package>
%<@@=pdffield>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesExplPackage{l3pdffield-testphase}{2023-11-05}{0.96b}%
+\ProvidesExplPackage{l3pdffield-testphase}{2023-11-17}{0.96c}%
{form fields}
% \end{macrocode}
% \subsection{hyperref specific command}
@@ -1230,7 +1230,7 @@
{
\prop_if_empty:NF \g_@@_CO_sortkeys_prop
{
- \seq_sort:Nn \g_@@_CO_sortkeys_seq
+ \seq_gsort:Nn \g_@@_CO_sortkeys_seq
{
\str_compare:eNeTF
{ \prop_item:Nn \g_@@_CO_sortkeys_prop {#1} }
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.pdf
index 0f29cb9597..e4171c07e0 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffield.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.dtx
index 08ec26e76f..5a11d41e7e 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.dtx
@@ -49,7 +49,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -398,7 +398,7 @@
%
% \begin{macrocode}
%<*header>
-\ProvidesExplPackage{l3pdffile}{2023-11-05}{0.96b}
+\ProvidesExplPackage{l3pdffile}{2023-11-17}{0.96c}
{embedding and referencing files in PDF---LaTeX PDF management testphase bundle}
\RequirePackage{l3pdftools} %temporarly!!
%</header>
@@ -481,7 +481,7 @@
,.tex = application/x-tex %not in iana.org list but probably better
,.txt = text/plain
,.sty = text/plain
- ,.xml = text/xml
+ ,.xml = application/xml
}
% \end{macrocode}
% \begin{variable}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.pdf
index 4b75eb1797..cc338aff79 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdffile.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.dtx
index cdedd54040..88704f2e51 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.dtx
@@ -57,7 +57,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -632,7 +632,7 @@
%<@@=pdfmanagement>
%<*header>
%
-\ProvidesExplPackage{l3pdfmanagement}{2023-11-05}{0.96b}
+\ProvidesExplPackage{l3pdfmanagement}{2023-11-17}{0.96c}
{Management of core PDF dictionaries (LaTeX PDF management testphase bundle)}
%</header>
% \end{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.pdf
index c43e204e23..9ddc2d15a7 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmanagement.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx
index 0a55e2b9d7..6d6b19b2de 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.dtx
@@ -49,7 +49,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -566,7 +566,7 @@
% \begin{macrocode}
%<@@=pdfmeta>
%<*header>
-\ProvidesExplPackage{l3pdfmeta}{2023-11-05}{0.96b}
+\ProvidesExplPackage{l3pdfmeta}{2023-11-17}{0.96c}
{PDF-Standards---LaTeX PDF management testphase bundle}
%</header>
% \end{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.pdf
index 060a1e2326..ccbfc2789e 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfmeta.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.dtx
index ce9958a9bb..c6efc127f3 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.dtx
@@ -49,7 +49,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -231,7 +231,7 @@
%
% \begin{macrocode}
%<*header>
-\ProvidesExplPackage{l3pdftools}{2023-11-05}{0.96b}
+\ProvidesExplPackage{l3pdftools}{2023-11-17}{0.96c}
{candidate commands for l3pdf---LaTeX PDF management testphase bundle}
%</header>
% \end{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.pdf
index 8e72e27da0..6711cd498c 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdftools.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.dtx b/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.dtx
index bb25497b41..0f3196cb0a 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.dtx
@@ -48,7 +48,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -132,7 +132,7 @@
% \begin{macrocode}
%<@@=pdf>
%<*header>
-\ProvidesExplPackage{l3pdfxform}{2023-11-05}{0.96b}
+\ProvidesExplPackage{l3pdfxform}{2023-11-17}{0.96c}
{command to create xforms (beta)---LaTeX PDF management testphase bundle}
%</header>
% \end{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.pdf b/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.pdf
index ea4ecb57a5..b013fc980d 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/l3pdfxform.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/l3ref-tmp.sty b/macros/latex/contrib/pdfmanagement-testphase/l3ref-tmp.sty
deleted file mode 100644
index f5d2a8ba3a..0000000000
--- a/macros/latex/contrib/pdfmanagement-testphase/l3ref-tmp.sty
+++ /dev/null
@@ -1,124 +0,0 @@
-%% This is file `l3ref-tmp.sty',
-%%
-%% Copyright (C) 2020-2021 The LaTeX Project
-%%
-%% It may be distributed and/or modified under the conditions of
-%% the LaTeX Project Public License (LPPL), either version 1.3c of
-%% this license or (at your option) any later version. The latest
-%% version of this license is in the file:
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is a tmp file in place of a future kernel module
-%% and subject to change without notice.
-%%
-\ProvidesExplPackage{l3ref-tmp}{2021-06-23}{}
- {L3 Experimental cross-referencing}
-\cs_new_protected:Npn \ref_attribute_gset:nnnn #1#2#3#4
- {
- \exp_args:Nx \__ref_attribute_gset:nnnn { \tl_to_str:n {#1} }
- {#2} {#3} {#4}
- }
-\cs_new_protected:Npn \__ref_attribute_gset:nnnn #1#2#3#4
- {
- \cs_gset:cpn { __ref_attribute_ #1 : } {#4}
- \tl_gclear_new:c { g__ref_default_ #1 _tl }
- \tl_gset:cn { g__ref_default_ #1 _tl } {#2}
- \bool_if_exist:cF { g__ref_shipout_ #1 _tl }
- { \bool_new:c { g__ref_shipout_ #1 _tl } }
- \str_case:nnF {#3}
- {
- { now } { { \bool_gset_false:c { g__ref_shipout_ #1 _tl } } }
- { shipout }
- { \bool_gset_true:c { g__ref_shipout_ #1 _tl } }
- }
- { \msg_error:nnnn { ref } { unknown-setpoint } {#1} {#3} }
- }
-\cs_new_protected:Npn \ref_label:nN #1#2
- { \ref_label:nV {#1} #2 }
-\cs_new_protected:Npn \ref_label:nn #1#2
- { \exp_args:Nx \__ref_label:nn { \tl_to_str:n {#1} } {#2} }
-\cs_generate_variant:Nn \ref_label:nn { nV }
-\cs_new_protected:Npn \__ref_label:nn #1#2
- {
- \legacy_if:nT { @filesw }
- {
- \iow_shipout_x:Nx \@auxout
- {
- \token_to_str:N \newlabeldata
- {#1}
- { \clist_map_function:nN {#2} \__ref_label_attribute:n }
- }
- }
- }
-\cs_new:Npn \__ref_label_attribute:n #1
- { \exp_args:Ne \__ref_label_attribute_aux:n { \tl_to_str:n {#1} } }
-\cs_new:Npn \__ref_label_attribute_aux:n #1
- {
- \cs_if_exist:cTF { __ref_attribute_ #1 : }
- {
- {#1}
- {
- \bool_if:cTF { g__ref_shipout_ #1 _tl }
- { \exp_not:c }
- { \use:c }
- { __ref_attribute_ #1 : }
- }
- }
- { \msg_expandable_error:nnn { ref } { attribute-not-defined } {#1} }
- }
-\cs_new:Npn \ref_value:nn #1#2
- {
- \exp_args:Nee \__ref_value:nn { \tl_to_str:n {#1} } { \tl_to_str:n {#2} }
- }
-\cs_new:Npn \__ref_value:nn #1#2
- {
- \tl_if_exist:cTF { g__ref_label_ #1 _ #2 _tl }
- { \tl_use:c { g__ref_label_ #1 _ #2 _tl } }
- {
- \tl_if_exist:cTF { g__ref_default_ #2 _tl }
- { \tl_use:c { g__ref_default_ #2 _tl } }
- { \exp_not:n { \textbf { ?? } } }
- }
- }
-\prg_new_conditional:Npnn \ref_if_exist:nn #1#2 { p , T , F, TF } % #1 label #2 attribute
- {
- \tl_if_exist:cTF { g__ref_label_ \tl_to_str:n {#1} _ \tl_to_str:n {#2} _tl }
- {
- \prg_return_true:
- }
- {
- \prg_return_false:
- }
- }
-\cs_new_protected:Npn \newlabeldata #1#2
- {
- \__ref_data:nnn {#1} #2 { \q_recursion_tail } { ? } \q_recursion_stop
- }
-\cs_new_protected:Npn \__ref_data:nnn #1#2#3
- {
- \quark_if_recursion_tail_stop:n {#2}
- \tl_gclear_new:c { g__ref_label_ \tl_to_str:n {#1} _ \tl_to_str:n {#2} _tl }
- \tl_gset:cn { g__ref_label_ \tl_to_str:n {#1} _ \tl_to_str:n {#2} _tl } {#3}
- \__ref_data:nnn {#1}
- }
-\ref_attribute_gset:nnnn { abspage } { 0 } { shipout }
- { \int_use:N \g_shipout_readonly_int }
-\ref_attribute_gset:nnnn { page } { 0 } { shipout } { \thepage }
-\clist_new:N \g_ref_main_clist
-\clist_gput_right:Nn \g_ref_main_clist { page }
-\msg_new:nnnn { ref } { attribute-not-defined }
- { Attribute~'#1'~not~defined. }
- {
- LaTeX~has~been~asked~to~use~attribute~'#1',~but~this~
- name~has~not~been~defined.
- }
-\msg_new:nnnn { ref } { unknown-setpoint }
- { Unknown~keyword~'#3'~for~setting~attribute~'#1'. }
- {
- LaTeX~has~been~asked~to~set~the~attribute~'#1',~but~the~keyword~
- '#3'~is~not~one~of~the~two~known~values:~'now'~or~'shipout'.
- }
-%%
-%%
-%% End of file `l3ref.sty'.
diff --git a/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.dtx b/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.dtx
index 6501ef6715..332012c4dc 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.dtx
@@ -47,7 +47,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -220,48 +220,34 @@
% \begin{macrocode}
%<@@=pdfmanagement>
%<*header>
-\ProvidesExplPackage{ltdocinit}{2023-11-05}{0.96b}
+\ProvidesExplPackage{ltdocinit}{2023-11-17}{0.96c}
{Initialize document metadata}
%</header>
% \end{macrocode}
-% \cs{DocumentMetadata} will be defined by the kernel in short time.
-% So we define it and the keys here only if it is not already defined.
-% \subsection{The keys for \cs{DocumentMetadata}}
-% We define the keys first so that we can test if \cs{DocumentMetadata}
-% exist (testing for the format date would be nice but would fail for the current
-% latex-dev).
-% \begin{variable}{\g_@@_firstaidoff_clist}
-% A list to store the firstaid code which should be disabled
% \begin{macrocode}
%<*package>
-\clist_new:N \g_@@_firstaidoff_clist
% \end{macrocode}
+% \subsection{Variables}
+% This variable definitions can be remove once latex-lab has been updated to
+% provide them too.
+% \begin{variable}{\g_@@_firstaidoff_clist}
+% A list to store the firstaid code which should be disabled
+% \begin{macrocode}
+\clist_if_exist:NF \g_@@_firstaidoff_clist
+ { \clist_new:N \g_@@_firstaidoff_clist }
+% \end{macrocode}
% \end{variable}
% \begin{variable}{\g_@@_testphase_tl}
% a tl to store the testphase loading code so that we can load them at
% the end of the command.
% \begin{macrocode}
-\tl_new:N \g_@@_testphase_tl
+\tl_if_exist:NF \g_@@_testphase_tl
+ { \tl_new:N \g_@@_testphase_tl }
% \end{macrocode}
% \end{variable}
-% \begin{macrocode}
-\keys_define:nn { document / metadata }
- {
- ,testphase / new-or-1 .code:n =
- {
- \tl_gput_right:Nn\g_@@_testphase_tl
- {
- \file_if_exist_input:nF {new-or-1-latex-lab-testphase.ltx}
- {
- \RequirePackage{output-patches-tmp-ltx}
- }
- }
- }
- }
-% \end{macrocode}
-%
% \subsection{\cs{DeclareDocumentMetadata}}
-% We define the older alias \cs{DeclareDocumentMetadata}
+% \cs{DocumentMetadata} is defined by the kernel.
+% We only define the older alias \cs{DeclareDocumentMetadata}
%
% \begin{macro}{\DeclareDocumentMetadata}
% \begin{macrocode}
diff --git a/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.pdf b/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.pdf
index 4c2d341ee6..d8c5ab0934 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/ltdocinit.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx
index 3835be9ef2..6154ccf3e3 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx
@@ -47,7 +47,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -63,7 +63,7 @@
% |debug={firstaidoff={name1,name2,...},...}|.
% \begin{macrocode}
%<*package>
-\ProvidesExplPackage{pdfmanagement-firstaid}{2023-11-05}{0.96b}
+\ProvidesExplPackage{pdfmanagement-firstaid}{2023-11-17}{0.96c}
{LaTeX PDF management testphase bundle / firstaid-patches}
%<@@=pdfmanagement>
diff --git a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.pdf b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.pdf
index e6911957d3..5b95298b42 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.dtx b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.dtx
index bb6140dd31..a685374c52 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.dtx
@@ -47,7 +47,7 @@
% }^^A
% }
%
-% \date{Version 0.96b, released 2023-11-05}
+% \date{Version 0.96c, released 2023-11-17}
%
% \maketitle
% \begin{documentation}
@@ -232,9 +232,11 @@
% \cs{pdfmanagement_if_active:TF} can be used, see the documentation of \pkg{l3pdfmanagement}.
%
% \section{Requirements}
-% The new PDF management requires a \LaTeX{} format from 2020/10/01 or later
-% and an L3 programming layer of 2021-02-18 or later.
-% It currently depends on the experimental packages \pkg{l3ref-tmp} and \pkg{l3bitset}.
+% The new PDF management is developed parallel to the \LaTeX{} format
+% and should be updated together with the format. It
+% requires currently a \LaTeX{} format from 2023/11/01 or later
+% and an L3 programming layer of 2023-11-01 or later.
+% It currently depends on the experimental package and \pkg{l3bitset}.
% In some places, e.g. when writing strings to the pdf it assumes that
% the file is utf8 encoded -- ascii will naturally work too, but legacy 8bit encodings are
% not supported.
@@ -395,7 +397,7 @@
% \begin{macrocode}
%<@@=pdf>
%<*package>
-\ProvidesExplPackage{pdfmanagement-testphase}{2023-11-05}{0.96b}
+\ProvidesExplPackage{pdfmanagement-testphase}{2023-11-17}{0.96c}
{LaTeX PDF management testphase bundle}
\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
\IfFormatAtLeastTF{2020-10-01}{}{
@@ -423,7 +425,7 @@
% to allow to set it in the document.
% \begin{macrocode}
%<*header>
-\ProvidesExplFile{pdfmanagement-testphase.ltx}{2023-11-05}{0.96b}
+\ProvidesExplFile{pdfmanagement-testphase.ltx}{2023-11-17}{0.96c}
{PDF~management~code~(testphase)}
% \end{macrocode}
% We define a boolean for the new delayed shipout. This is temporary. At some
diff --git a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.pdf b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.pdf
index db319ff855..041de89f5e 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.pdf
+++ b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-testphase.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfmanagement-testphase/xcolor-patches-tmp-ltx.sty b/macros/latex/contrib/pdfmanagement-testphase/xcolor-patches-tmp-ltx.sty
index 597c4669a2..98d5aaf4e9 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/xcolor-patches-tmp-ltx.sty
+++ b/macros/latex/contrib/pdfmanagement-testphase/xcolor-patches-tmp-ltx.sty
@@ -1,6 +1,6 @@
%% LaTeX2e file `xcolor-patches-tmp-ltx.sty'
%%
-\ProvidesPackage{xcolor-patches-tmp-ltx}[2023-11-05 v0.96b patch xcolor for l3color]
+\ProvidesPackage{xcolor-patches-tmp-ltx}[2023-11-17 v0.96c patch xcolor for l3color]
\@ifundefined{color_set:nn}{\RequirePackage{l3color}}{}
\ExplSyntaxOn
diff --git a/macros/latex/contrib/q-and-a/Q-and-A.cls b/macros/latex/contrib/q-and-a/Q-and-A.cls
index 184cde054b..c865647b68 100644
--- a/macros/latex/contrib/q-and-a/Q-and-A.cls
+++ b/macros/latex/contrib/q-and-a/Q-and-A.cls
@@ -12,13 +12,21 @@
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplClass
{Q-and-A}
- {2023/11/11} {}
+ {2023/11/17a} {}
{Document class for typesetting Q&A conversation}
\keys_define:nn { Q-and-A }
{
- , scroll .bool_set:N = \l__QA_scroll_bool
- , scroll .initial:n = { false }
+ , scroll .bool_set:N = \l__QA_scroll_bool
+ , scroll .initial:n = { false }
+
+ , enlarge-left-margin-by .dim_set:N = \l__QA_extra_left_margin_dim
+ , enlarge-left-margin-by .initial:n = { 0pt }
+ , enlarge~left~margin~by .dim_set:N = \l__QA_extra_left_margin_dim
+ , enlarge left margin by .dim_set:N = \l__QA_extra_left_margin_dim
+ , increase-left-margin-by .dim_set:N = \l__QA_extra_left_margin_dim
+ , increase~left~margin~by .dim_set:N = \l__QA_extra_left_margin_dim
+ , increase left margin by .dim_set:N = \l__QA_extra_left_margin_dim
, theme .str_set:N = \l__QA_theme_str
, theme .initial:n = { default }
@@ -49,6 +57,21 @@
, answer~number .bool_set:N = \l__QA_numbered_answer_bool
, answer number .bool_set:N = \l__QA_numbered_answer_bool
+ , multiple-question .bool_set:N = \l__QA_multiple_question_bool
+ , multiple-question .initial:n = { false }
+ , multiple~question .bool_set:N = \l__QA_multiple_question_bool
+ , multiple question .bool_set:N = \l__QA_multiple_question_bool
+
+ , multiple-answer .bool_set:N = \l__QA_multiple_answer_bool
+ , multiple-answer .initial:n = { false }
+ , multiple~answer .bool_set:N = \l__QA_multiple_answer_bool
+ , multiple answer .bool_set:N = \l__QA_multiple_answer_bool
+
+ , smaller-subcounter .bool_set:N = \l__QA_smaller_subcounter_bool
+ , smaller-subcounter .initial:n = { false }
+ , smaller~subcounter .bool_set:N = \l__QA_smaller_subcounter_bool
+ , smaller subcounter .bool_set:N = \l__QA_smaller_subcounter_bool
+
, answer-outside-the-box .bool_set:N = \l__QA_answer_outside_the_box_bool
, answer-outside-the-box .initial:n = { false }
, answer~outside~the~box .bool_set:N = \l__QA_answer_outside_the_box_bool
@@ -157,19 +180,19 @@
\dim_new:N \l_QA_item_indentation_dim
\dim_set:Nn \l_QA_item_indentation_dim { 1.5em }
\dim_new:N \l_QA_list_indentation_dim
-\dim_set:Nn \l_QA_list_indentation_dim { 3em }
+\dim_set:Nn \l_QA_list_indentation_dim { 3em + \l__QA_extra_left_margin_dim }
\dim_new:N \l_QA_list_labelsep_dim
\dim_set:Nn \l_QA_list_labelsep_dim { 1em }
\exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
{
\dim_set:Nn \l_QA_item_indentation_dim { .33em }
- \dim_set:Nn \l_QA_list_indentation_dim { 4.5em }
+ \dim_set:Nn \l_QA_list_indentation_dim { 4.5em + \l__QA_extra_left_margin_dim }
\dim_set:Nn \l_QA_list_labelsep_dim { 1.5em }
}
\newlist { QA-entry } { description } { 1 }
-\setlist [ QA-entry ] { font = \normalfont\sffamily, leftmargin = \l_QA_list_indentation_dim, labelsep = \l_QA_list_labelsep_dim, labelwidth=3em, itemindent=0pt, parsep=\parskip }
+\setlist [ QA-entry ] { font = \normalfont\sffamily, leftmargin = \l_QA_list_indentation_dim, labelsep = \l_QA_list_labelsep_dim, labelwidth=4em, itemindent=0pt, parsep=\parskip }
\renewcommand{\descriptionlabel}[1]{#1}
\bool_new:N \l__QA_inside_list_bool
@@ -352,6 +375,7 @@
includegraphics,
definecolor, colorlet, color, textcolor,
tikz, draw, fill, filldraw, node, clip,
+ smaller,larger,
}
{% LaTeX3 commands
}
@@ -361,6 +385,12 @@
UseLanguage,
TheDate,
SetLogoCode,
+ SetSubcounterStyle,
+ SetSubcounterSeparator,
+ EnableMultipleQuestion,
+ EnableMultipleAnswer,
+ DisableMultipleQuestion,
+ DisableMultipleAnswer,
}
{% LaTeX3 commands
}
@@ -464,7 +494,7 @@
}
\NewDocumentCommand \QAEnum { s m m }
{
- \tl_if_blank:nTF { #1 }
+ \tl_if_blank:nTF { #2 }
{
\tl_set:Nn \l_tmpa_tl { }
}
@@ -735,10 +765,11 @@
}
}
-\NewDocumentCommand \SetLogoCode { O{void} m }
+\NewDocumentCommand \QASetLogoCode { O{void} m }
{
\tl_set:cn { l_QA_logo_code_ #1 _tl } { #2 }
}
+\NewCommandCopy \SetLogoCode \QASetLogoCode
% Set default logo code
\SetLogoCode[Q]{\textbf{\l_QA_label_Q_tl}}
@@ -746,11 +777,122 @@
\newcounter{QA_Q}
\newcounter{QA_A}
+
+\def\QASubcounterStyle{}
+\def\QASubcounterSeparator{.}
+\NewDocumentCommand \QASetSubcounterStyle { m }
+ {
+ \def\QASubcounterStyle{#1}
+ }
+\NewCommandCopy \SetSubcounterStyle \QASetSubcounterStyle
+\NewDocumentCommand \QASetSubcounterSeparator { m }
+ {
+ \def\QASubcounterSeparator{#1}
+ }
+\NewCommandCopy \SetSubcounterSeparator \QASetSubcounterSeparator
+
+\bool_if:NT \l__QA_smaller_subcounter_bool
+ {
+ \QASetSubcounterStyle{\smaller}
+ }
+
+\cs_new_protected:Nn \QA_show_subcounter_with_style:n
+ {
+ \group_begin:
+ \tl_set:Nx \l_tmpa_tl { #1 }
+ \regex_replace_once:nnN { \. (.*) } { \c{QASubcounterStyle}{\c{QASubcounterSeparator}\1} } \l_tmpa_tl
+ \tl_use:N \l_tmpa_tl
+ \group_end:
+ }
\NewDocumentCommand \QAShowCounter { m }
{
\stepcounter{QA_#1}
- \tl_use:c {theQA_#1}
+ \QA_show_subcounter_with_style:n { \tl_use:c {theQA_#1} }
+ }
+
+\newcounter{QA_Q_aux}
+\newcounter{QA_A_aux}
+
+\bool_new:N \g__QA_Q_multiple_counter_already_enabled_bool
+\bool_new:N \g__QA_Q_multiple_counter_already_updated_bool
+\bool_gset_false:N \g__QA_Q_multiple_counter_already_enabled_bool
+\NewDocumentCommand \EnableMultipleQuestion { }
+ {
+ \bool_if:NF \g__QA_Q_multiple_counter_already_enabled_bool
+ {
+ \setcounter{QA_Q_aux}{\value{QA_Q}} % set the outer counter
+ \addtocounter{QA_Q_aux}{1}
+ \setcounter{QA_Q}{0} % reset the inner counter
+ \counterwithin{QA_Q}{QA_Q_aux}
+ \hook_gput_code:nnn { env/QA_Q/begin } { Q-and-A-multi-Q }
+ {
+ \bool_gset_false:N \g__QA_Q_multiple_counter_already_updated_bool
+ }
+ \hook_gput_code:nnn { env/QA_A/begin } { Q-and-A-multi-Q }
+ {
+ \bool_if:NF \g__QA_Q_multiple_counter_already_updated_bool
+ {
+ \stepcounter{QA_Q_aux}
+ }
+ \bool_gset_true:N \g__QA_Q_multiple_counter_already_updated_bool
+ }
+ }
+ \bool_gset_true:N \g__QA_Q_multiple_counter_already_enabled_bool
}
+\NewDocumentCommand \DisableMultipleQuestion { }
+ {
+ \bool_if:NT \g__QA_Q_multiple_counter_already_enabled_bool
+ {
+ \counterwithout{QA_Q}{QA_Q_aux}
+ \setcounter{QA_Q}{\value{QA_Q_aux}} % set the outer counter
+ \addtocounter{QA_Q}{-1}
+ \hook_gremove_code:nn { env/QA_Q/begin } { Q-and-A-multi-Q }
+ \hook_gremove_code:nn { env/QA_A/begin } { Q-and-A-multi-Q }
+ }
+ \bool_gset_false:N \g__QA_Q_multiple_counter_already_enabled_bool
+ }
+
+\bool_new:N \g__QA_A_multiple_counter_already_enabled_bool
+\bool_new:N \g__QA_A_multiple_counter_already_updated_bool
+\bool_gset_false:N \g__QA_A_multiple_counter_already_enabled_bool
+\NewDocumentCommand \EnableMultipleAnswer { }
+ {
+ \bool_if:NF \g__QA_A_multiple_counter_already_enabled_bool
+ {
+ \setcounter{QA_A_aux}{\value{QA_A}} % set the outer counter
+ % \addtocounter{QA_A_aux}{1}
+ \setcounter{QA_A}{0} % reset the inner counter
+ \counterwithin{QA_A}{QA_A_aux}
+ \hook_gput_code:nnn { env/QA_A/begin } { Q-and-A-multi-A }
+ {
+ \bool_gset_false:N \g__QA_A_multiple_counter_already_updated_bool
+ }
+ \hook_gput_code:nnn { env/QA_Q/begin } { Q-and-A-multi-A }
+ {
+ \bool_if:NF \g__QA_A_multiple_counter_already_updated_bool
+ {
+ \stepcounter{QA_A_aux}
+ }
+ \bool_gset_true:N \g__QA_A_multiple_counter_already_updated_bool
+ }
+ }
+ \bool_gset_true:N \g__QA_A_multiple_counter_already_enabled_bool
+ }
+\NewDocumentCommand \DisableMultipleAnswer { }
+ {
+ \bool_if:NT \g__QA_A_multiple_counter_already_enabled_bool
+ {
+ \counterwithout{QA_A}{QA_A_aux}
+ \setcounter{QA_A}{\value{QA_A_aux}} % set the outer counter
+ % \addtocounter{QA_A}{-1}
+ \hook_gremove_code:nn { env/QA_A/begin } { Q-and-A-multi-A }
+ \hook_gremove_code:nn { env/QA_Q/begin } { Q-and-A-multi-A }
+ }
+ \bool_gset_false:N \g__QA_A_multiple_counter_already_enabled_bool
+ }
+
+\bool_if:NT \l__QA_multiple_question_bool { \EnableMultipleQuestion }
+\bool_if:NT \l__QA_multiple_answer_bool { \EnableMultipleAnswer }
\bool_if:NTF \l__QA_numbered_question_bool
{
@@ -827,18 +969,22 @@
\prop_gput_if_new:Nnn \g__QA_prefix_type_prop { ##1 } { #1 }
}
}
+\NewCommandCopy \SetTypePrefix \QASetTypePrefix
\NewDocumentCommand \QAAddTypePrefix { m m }
{
\prop_gput_if_new:Nnn \g__QA_prefix_type_prop { #2 } { #1 }
}
+\NewCommandCopy \AddTypePrefix \QAAddTypePrefix
\NewDocumentCommand \QARemovePrefix { m }
{
\prop_gremove:Nn \g__QA_prefix_type_prop { #1 }
}
+\NewCommandCopy \RemovePrefix \QARemovePrefix
\NewDocumentCommand \QARemoveAllPrefix { }
{
\prop_gclear:N \g__QA_prefix_type_prop
}
+\NewCommandCopy \RemoveAllPrefix \QARemoveAllPrefix
% \QASetTypePrefix { void } { VOID }
% \QASetTypePrefix { Q } { Q: , ? }
diff --git a/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex b/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex
new file mode 100644
index 0000000000..a7ee5787ed
--- /dev/null
+++ b/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex
@@ -0,0 +1,85 @@
+"
+ We start with the **normal** mode.
+
+?
+ Question.
+
+:
+ Answer.
+
+?
+ Question.
+
+:
+ Answer.
+
+"
+ Now start the **multiple question** mode.
+
+\EnableMultipleQuestion
+
+?
+ Question.
+
+?
+ Question.
+
+:
+ Answer.
+
+"
+ Now stop the **multiple question** mode, and start the **multiple answer** mode.
+
+\DisableMultipleQuestion
+
+\EnableMultipleAnswer
+
+?
+ Question.
+
+:
+ Answer.
+
+:
+ Answer.
+
+"
+ Now start both the **multiple question** mode and the **multiple answer** mode.
+
+\EnableMultipleQuestion
+
+\EnableMultipleAnswer
+
+?
+ Question.
+
+?
+ Question.
+
+:
+ Answer.
+
+:
+ Answer.
+
+:
+ Answer.
+
+"
+ Back to the **normal** mode.
+
+\DisableMultipleQuestion
+
+\DisableMultipleAnswer
+
+?
+ Question.
+
+:
+ Answer.
+
+?
+ Question.
+
+:
+ Answer.
diff --git a/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.pdf b/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.pdf
new file mode 100644
index 0000000000..8c7b209882
--- /dev/null
+++ b/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.tex b/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.tex
new file mode 100644
index 0000000000..3e04ada640
--- /dev/null
+++ b/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.tex
@@ -0,0 +1,33 @@
+\documentclass[%11pt,
+ numbered question,
+ numbered answer,
+ % multiple question,
+ % multiple answer,
+ enlarge left margin by = .5cm,
+ scroll,
+]{Q-and-A}
+
+\SetSubcounterStyle{\smaller}
+\SetSubcounterSeparator{\,/\,}
+% \SetSubcounterSeparator{-}
+
+\begin{document}
+
+
+:: {Q-and-A-demo-multiple-content}
+
+
+---
+
+"
+ Below is the code of this conversation.
+
+ == {Q-and-A-demo-multiple-content}
+
+"
+ Below is the code of the main document.
+
+ == [latex] {\jobname}
+
+
+\end{document} \ No newline at end of file
diff --git a/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.pdf b/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.pdf
index 4f5d79d7e6..f810f598d1 100644
--- a/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.pdf
+++ b/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.tex b/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.tex
index 4043c4cb91..369b6efd90 100644
--- a/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.tex
+++ b/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.tex
@@ -5,8 +5,8 @@
scroll,
]{Q-and-A}
-\def\PackageVersion{2023/11/11}
-\def\PackageSubVersion{}
+\def\PackageVersion{2023/11/17}
+\def\PackageSubVersion{a}
\newcommand{\QApackage}{{\normalfont\textsf{Q-and-A}}}
@@ -75,6 +75,10 @@
\item `use theme = \meta{theme}`: use the selected theme, available choices include: `default` (like the current document), `ChatGPT-light` and `ChatGPT-dark` (see the demo documents).
\item `numbered question`, or `question number`: enable the numbering of questions.
\item `numbered answer`, or `answer number`: enable the numbering of answers.
+ \item `multiple question` and `multiple answer`: enable subcounter for questions and answers. This can also be enabled/disabled manually in the middle of the document, via `\textbackslash EnableMultipleQuestion` / `\textbackslash DisableMultipleQuestion` and `\textbackslash EnableMultipleAnswer` / `\textbackslash DisableMultipleAnswer`.
+ \item `smaller subcounter`: when `multiple question` (and/or `multiple answer`) is enabled, use this option to show the subcounter in a smaller size.
+ \item `enlarge left margin by = \meta{length}`, or `increase left margin by = \meta{length}`: enlarge the left margin by the amount of `\meta{length}`. This would be useful if there are so many questions/answers that the numbering becomes too long to fit in the margin.
+ \QANote{Here `\meta{length}` should be specified with absolute unit like `pt`, `cm`, `mm`, `in`, etc., but not with unit like `ex` or `em`.}
\item `answer outside the box`, or `answer out of the box` (or even omit `the`): enable another implementation for printing the answer that does not involve putting it into a colored box. This would be useful if the answers contain many long pieces of code while you still want the pages to break normally.
\end{itemize}
@@ -135,13 +139,13 @@
\begin{itemize}
\item For centered image, the caption can be written via `\textgreater\textgreater{} \meta{caption text}`.
\end{itemize}
- \QANote{Currently, the `\meta{caption text}` shall be directly printed in the center. You may wish to add a pair of parentheses around it.}
+ % \QANote{Currently, the `\meta{caption text}` shall be directly printed in the center. You may wish to add a pair of parentheses around it.}
[Code]
Due to the current implementation of this document class, it is unfortunate that you cannot directly insert source code in your document. There are some workarounds, though.
\begin{itemize}
\item For *inline* code, you may simply write it between two backticks `\textbacktick\meta{code}\textbacktick`, similar to the Markdown syntax. However, be aware that special characters need to be escaped, for example, `\textbackslash` should be written as `\textbackslash textbackslash`, `\{` should be written as `\textbackslash\{`, `\%` should be written as `\textbackslash\%`, etc.
- \item For *displayed* code, stored the code into a separate file, and then use `\textequalsign\textequalsign{} \{\meta{file name}\}` to print~it. You may also use an optional argument like `\textequalsign\textequalsign{} [\meta{language}] \{\meta{file name}\}` to select the language of your code.
+ \item For *displayed* code, store the code into a separate file, and then use `\textequalsign\textequalsign{} \{\meta{file name}\}` to print~it. You may also use an optional argument like `\textequalsign\textequalsign{} [\meta{language}] \{\meta{file name}\}` to select the language of your code.
\QANote{If the answers contain many long pieces of code, you may consider using the class option `answer outside the box`.}
\end{itemize}
@@ -166,6 +170,8 @@
And don't forget that you are still using \LaTeX, so images, tables and lists can be written as usual.
+ \medskip
+
>>> Currently, the default style for showing tables has not been settled (since the color configuration for tables with or without headers would be slightly different). As a temporary solution, it is recommended for you to consult the several nice answers of this question: \url{https://tex.stackexchange.com/q/10224}.
@@ -220,21 +226,31 @@
Here, \meta{identifier} is a comma list of your specified identifiers. For example, the default identifier for narrations is preset via `\textbackslash QASetTypePrefix\{N\}\{N:,",“,”,「\}`.
\QANote{Note that, due to its implementation, the identifier cannot contain comma `,` in it. If you wish to use an identifier that contains a comma, you may use `\textbackslash QAAddTypePrefix` instead, which only adds *one* identifier per use.}
\QANote{Note also that, the identifiers are *reset* upon changing of language. Thus, you need to put your setting into the corresponding language configuration, for example, via `\textbackslash AddLanguageSetting[\meta{language name}]\{\meta{settings}\}`}
+ \QANote{You may use `\textbackslash QARemovePrefix\{\meta{identifier}\}` to remove a certain identifier, or use `\textbackslash QARemoveAllPrefix` to remove all of them. This is especially useful if you wish to clear all the previous setting in the language configuration.}
[Changing labels]
- You may also change the labels. For example, from the text \textquote{Q:} to a logo icon. This can be done via the use of `\textbackslash SetLogoCode` in the preamble of your document.
+ You may also change the labels. For example, from the text \textquote{Q:} to a logo icon. This can be done via the use of `\textbackslash QASetLogoCode` in the preamble of your document.
\begin{itemize}
- \item Use `\textbackslash SetLogoCode\{Q\}\{\meta{logo code}\}` to set the labels for questions.
- \item Use `\textbackslash SetLogoCode\{A\}\{\meta{logo code}\}` to set the labels for answers.
+ \item Use `\textbackslash QASetLogoCode\{Q\}\{\meta{logo code}\}` to set the labels for questions.
+ \item Use `\textbackslash QASetLogoCode\{A\}\{\meta{logo code}\}` to set the labels for answers.
\end{itemize}
- Here, \meta{logo code} is the actual code for displaying the corresponding label. For example, the default label for (unnumbered) questions is preset via `\textbackslash SetLogoCode\{Q\}\{\textbackslash textbf\{Q\textbackslash,:\}\}`.
+ Here, \meta{logo code} is the actual code for displaying the corresponding label. For example, the default label for (unnumbered) questions is preset via `\textbackslash QASetLogoCode\{Q\}\{\textbackslash textbf\{Q\textbackslash,:\}\}`.
\QANote{In the demo document, you can find an example on how to use this command to specify a logo for each role in the conversation.}
If you wish to include the question number or answer number, you may use the command `\textbackslash QAShowCounter`:
\begin{itemize}
\item Use `\textbackslash QAShowCounter\{Q\}` to step the counter of question and print it.
\item Use `\textbackslash QAShowCounter\{A\}` to step the counter of answer and print it.
\end{itemize}
- For example, the default label for numbered questions is preset by adding `\textbackslash QAShowCounter\{Q\}` to the unnumbered version: `\textbackslash SetLogoCode\{Q\}\{\textbackslash textbf\{Q\textbackslash QAShowCounter\{Q\}\textbackslash,:\}\}`.
+ For example, the default label for numbered questions is preset by adding `\textbackslash QAShowCounter\{Q\}` to the unnumbered version: `\textbackslash QASetLogoCode\{Q\}\{\textbackslash textbf\{Q\textbackslash QAShowCounter\{Q\}\textbackslash,:\}\}`.
+
+ [Controlling subcounters]
+ When using `\textbackslash QAShowCounter` to show a counter that contains a subcounter, it is possible to control the style and the separator of the subcounter:
+ \begin{itemize}
+ \item Use `\textbackslash QASetSubcounterStyle\{\meta{style code}\}` to define the style of the subcounter. For example, the class option `smaller subcounter` is equivalent to `\textbackslash QASetSubcounterStyle\{\textbackslash smaller\}`.
+ \item Use `\textbackslash QASetSubcounterSeparator\{\meta{separator}\}` to define the separator between the parent and child counters. By default it is `.`, but you may set it to, say, `-`, or `/`.
+ \end{itemize}
+
+ >>> In this section, all commands with the prefix `QASet` also has an abbreviation form with the prefix `Set`. For example, instead of `\textbackslash QASetLogoCode`, you may simply write `\textbackslash SetLogoCode`.
##+ {Known Issues}
@@ -260,7 +276,7 @@
\end{itemize}
-##+ {Get Support}
+##+ {Getting Support}
?
What should I do if I encounter any problem?
diff --git a/macros/latex/contrib/q-and-a/doc/code/Q-and-A-doc-code-sample-document.tex b/macros/latex/contrib/q-and-a/doc/code/Q-and-A-doc-code-sample-document.tex
index 29aa3599e1..e8f259f068 100644
--- a/macros/latex/contrib/q-and-a/doc/code/Q-and-A-doc-code-sample-document.tex
+++ b/macros/latex/contrib/q-and-a/doc/code/Q-and-A-doc-code-sample-document.tex
@@ -2,6 +2,9 @@
use theme = (@@@\meta{theme}),
numbered question,
numbered answer,
+ % multiple question,
+ % multiple answer,
+ % smaller subcounter,
% answer outside the box,
scroll,
]{Q-and-A}
diff --git a/macros/latex/contrib/thermodynamics/README.md b/macros/latex/contrib/thermodynamics/README.md
index ec0d2d5001..ca1aee6385 100644
--- a/macros/latex/contrib/thermodynamics/README.md
+++ b/macros/latex/contrib/thermodynamics/README.md
@@ -4,13 +4,13 @@ thermodynamics - A package for chemical engineers and others
Thermodynamics texts (textbooks, articles, and so forth) are typically filled
with underlined and overlined symbols, partial derivatives surrounded by
delimiters and containing subscripts, sums over multiple components, and a
-myriad of symbols, including superscript and subscript modifiers. This package
-provides a robust, flexible set of macros to define notation for symbols,
-partial derivatives, sums, and products frequently encountered in mixture
-thermodynamics. Changing one's notes from one textbook to another or from one
-notation style to another can be achieved relatively easily by changing package
-options, without any changes to the user's code (other than perhaps adjusting
-line breaks).
+myriad of symbols, including superscript and subscript modifiers. This
+package provides a robust, flexible set of macros to define notation for
+symbols, partial derivatives, sums, and products frequently encountered in
+mixture thermodynamics. Changing one's notes from one textbook to another or
+from one notation style to another can be achieved relatively easily by
+changing package options, without any changes to the user's code (other than
+perhaps adjusting line breaks).
Installation
------------
@@ -18,8 +18,10 @@ Installation
The package is suppled in `dtx` format with an accompanying `ins` file to
install the package. Run `latex thermodynamics.ins` to extract the package;
instructions for building the documentation are included in the `ins` file.
+Note that the package itself (`sty` file) is required to typeset the
+documentation.
-This package requires the `amstext` package.
+This package requires the `amstext` and `expl3` packages.
Typesetting the documentation requires several other packages:
- `geometry`
diff --git a/macros/latex/contrib/thermodynamics/thermodynamics.dtx b/macros/latex/contrib/thermodynamics/thermodynamics.dtx
index a9c8348997..7d6904c9ee 100644
--- a/macros/latex/contrib/thermodynamics/thermodynamics.dtx
+++ b/macros/latex/contrib/thermodynamics/thermodynamics.dtx
@@ -1,5 +1,5 @@
% \iffalse meta-comment
-% File: thermodynamics.dtx Copyright (C) 2021 Karl D. Hammond
+% File: thermodynamics.dtx Copyright (C) 2022-2023 Karl D. Hammond
%
% Karl D. Hammond
% Chemical Engineering Program
@@ -15,7 +15,7 @@
% 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
@@ -24,40 +24,54 @@
% \fi
%
% \iffalse
+%^^A FIXME: need correct date of release once you update this
+%^^X\GetIdInfo $Id: thermodynamics.dtx 2.00 2023/11/16 Karl D. Hammond <hammondkd@missouri.edu> $
+%^^X {thermodynamics notation}
%<*driver>
+%^^X\ProvidesFile{\ExplFileName}
\ProvidesFile{thermodynamics.dtx}
%</driver>
%
%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\RequirePackage{expl3}
%<package>\ProvidesPackage{thermodynamics}
%<*package>
- [2022/04/29 v1.00 thermodynamics package]
+ [2023/11/16 v2.00 thermodynamics notation]
%</package>
-%
+%^^X {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
%<*driver>
\documentclass[11pt,letterpaper]{ltxdoc}
-\usepackage[margin=1in,left=1.85in]{geometry}
+%^^X\bool_set_false:N \l__codedoc_allow_indexing_bool
+\usepackage[margin=0.80in,left=2.05in]{geometry}
\usepackage[T1]{fontenc}
-\usepackage[full]{textcomp}
+\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{pxfonts}
\usepackage{array}
\usepackage{booktabs}
\usepackage{footmisc}
-\usepackage[labelfont=bf,labelsep=period]{caption}
-%\EnableCrossrefs
-%\CodelineIndex
+\usepackage[labelfont=bf,labelsep=period,font=small]{caption}
+\GetFileInfo{thermodynamics.dtx}
+\usepackage{thermodynamics}[\filedate\space\fileversion]
+\DisableCrossrefs
+\CodelineIndex
\PageIndex
\CodelineNumbered
\RecordChanges
-%\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
\begin{document}
\DocInput{thermodynamics.dtx}
\end{document}
%</driver>
% \fi
%
-% \CheckSum{2286}
+% \CheckSum{2387}
%
% \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
@@ -76,12 +90,28 @@
% 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}
%
-% \GetFileInfo{thermodynamics.dtx}
+% \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.}}
+% corresponds to \textsf{thermodynamics}~\fileversion,
+% dated \filedate.}}
% \author{Karl D. Hammond \\ \texttt{hammondkd@missouri.edu}}
+%^^X \date{\ExplFileDate}
% \date{\filedate}
% \maketitle
%
@@ -97,48 +127,21 @@
% options.
% \end{abstract}
%
-% \newcommand*{\thermounderline}[1]{%
-% \mkern2mu\underline{\mkern-2mu #1\mkern-3mu}\mkern3mu%
-% }
-% \newcommand*{\thermooverline}[1]{%
-% \mkern2mu\overline{\mkern-2mu #1\mkern-2mu}\mkern2mu%
-% }
-% \newcommand*{\Partial}[3]{\ensuremath{\left(\frac{\partial #1}{\partial #2}\right)_{#3}}}
-% \newcommand*{\Ut}{\mkern1mu\underline{\mkern-1mu U\mkern-4mu}\mkern4mu}
-% \newcommand*{\Upm}[2][]{\mkern2mu\overline{\mkern-2mu U_{#2}^{#1}\mkern-2mu}\mkern2mu}
-% \newcommand*{\Ht}{\mkern1mu\underline{\mkern-1mu H\mkern-4mu}\mkern4mu}
-% \newcommand*{\Hm}{H}
-% \newcommand*{\Hpm}[2][]{\mkern2mu\overline{\mkern-2mu H_{#2}^{#1}\mkern-1mu}\mkern1mu}
-% \newcommand*{\Ft}{\mkern1mu\underline{\mkern-1mu A\mkern-4mu}\mkern4mu}
-% \newcommand*{\Gt}{\mkern1mu\underline{\mkern-1mu G\mkern-4mu}\mkern4mu}
-% \newcommand*{\Gpm}[2][]{\mkern2mu\overline{\mkern-2mu G_{#2}^{#1}\mkern-1mu}\mkern1mu}
-% \newcommand*{\Spm}[2][]{\mkern2mu\overline{\mkern-2mu S_{#2}^{#1}\mkern-1mu}\mkern1mu}
-% \newcommand*{\Vpm}[2][]{\mkern1mu\overline{\mkern-1mu V_{\mkern-2mu #2}^{#1}\mkern-2mu}\mkern2mu}
-% \newcommand*{\St}{\mkern1mu\underline{\mkern-1mu S\mkern-3mu}\mkern3mu}
-% \newcommand*{\Vt}{\mkern3mu\underline{\mkern-3mu V\mkern-4mu}\mkern4mu}
-% \newcommand*{\Lt}{\mkern1mu\underline{\mkern-1mu \Omega\mkern-4mu}\mkern4mu}
-% \newcommand*{\cPpm}[2][]{\mkern2mu\overline{\mkern-2mu C_{P,#2}^{#1}\mkern-1mu}\mkern1mu}
-%
-% \newcommand*{\Nt}{n}
-% \newcommand*{\allNs}{\vec\Nt}
-% \newcommand*{\allNsbut}[2][j]{\Nt_{#1\neq #2}}
-% \newcommand*{\allXs}{\vec x}
-%
+%^^X \begin{documentation}
% \section{Introduction}
% The purpose of this package is to simplify the typesetting of equations in
-% thermodynamics, specifically chemical engineering thermodynamics, which are
+% 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} \mkern-10mu d\St
-% + \Partial{\Ut}{\Vt}{\St,\allNs} \mkern-10mu d\Vt
-% + \sum_{i=1}^C \Partial{\Ut}{\Nt_i}{\St,\Vt,\allNsbut{i}}
-% \mkern-10mu d\Nt_i.
+% 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} =
+% \[ d\underline{U} =
% \left(\frac{\partial\underline{U}}
% {\partial\underline{S}}\right)_{\underline{V},\vec{n}}
% d\underline{S}
@@ -147,7 +150,7 @@
% 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.
+% dn_i. \]
%\end{verbatim}
% This is a lot of code, and even then the output is slightly clunky:
% \[ d\underline{U} =
@@ -162,15 +165,19 @@
% dn_i.
% \]
% It is also frustratingly difficult to change one's notes or handouts from one
-% textbook that uses, say, $n_1$ to denotes moles of component 1 to another
+% 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
-% \[
-% dU = \Partial{U}{S}{V,N_1,\dotsc,N_n} \mkern-15mu dS
-% + \Partial{U}{V}{S,N_1,\dotsc,N_n} \mkern-15mu dV
-% + \sum_{i=1}^n \Partial{U}{N_i}{S,V,N_1,\dotsc,[N_i],\dotsc,N_n}
-% \mkern-20mu dN_i
+% \[\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
@@ -193,43 +200,36 @@
%
% 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
+% \[ \Partial*{\Hm}{T}{P} = T\Partial*{\Sm}{T}{P}
+% = -T\PartialSecond*{\Gm}{T}{P} = \cP \]
%\end{verbatim}
% renders (using the default options)
-% \[ \left(\frac{\partial H}{\partial T}\right)_P \mkern-8mu
-% = T\left(\frac{\partial S}{\partial T}\right)_P \mkern-8mu
-% = -T\left(\frac{\partial^2 G}{\partial T^2}\right)_P \mkern-8mu
-% = C_P \]
+% \[ \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}
+% \[ \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
+% = \Partial*{\Vt}{\Nt_i}{T,P,\allNsbut{i}} = \Vpm_i \],
%\end{verbatim}
% which renders
-% \[ \left(\frac{\partial \Gpm{i}}{\partial P}\right)_{T,\allNs}
-% \mkern-15mu%
-% = \left(\frac{\partial^2 \Gt}{\partial P\partial n_i}\right)_{T,\allNsbut{i}}
-% \mkern-15mu%
-% = \left(\frac{\partial^2 \Gt}{\partial n_i\partial P}\right)_{T,\allNsbut{i}}
-% \mkern-15mu%
-% = \left(\frac{\partial \Vt}{\partial n_i}\right)_{T,P,\allNsbut{i}}
-% \mkern-15mu%
-% = \Vpm{i}
+% \[ \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-------------------------------------------------------------------------
+%^^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 switch locally
-% between different delimiters on partial derivatives.
+% 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
@@ -255,10 +255,10 @@
% 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, $\thermounderline{U}$ to $U^t$ for extensive properties is trivial.
+% from, say, $\Ut$ to $U^t$ for extensive properties is trivial.
%
-% ^^A \DescribeMacro{\cP}
-% ^^A \DescribeMacro{\cV}
+% \DescribeMacro{\cP}
+% \DescribeMacro{\cV}
% \DescribeMacro{\cPt}
% \DescribeMacro{\cVt}
% \DescribeMacro{\cPs}
@@ -268,31 +268,28 @@
% 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 $\hat C_P$ and $\hat C_V$,
+% \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 $\thermounderline{C}_P$ and $\thermounderline{C}_V,$
+% will render as $\cPt$ and $\cVt,$
% respectively. Note that \cs{cP} and friends require you to surround
-% \cs{text} with brackets if the portion with \cs{text} in it is not the last
-% argument. For example, \verb"\cP_i^\text{A}" will work as expected, but
-% \verb"\cP^\text{A}_i" will not: you need to use \verb"\cP^{\text{A}}_i".
-% Using \verb"\cP^\IG_i" will work as expected.
+% \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}}
+% \[ \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
-% \[ \thermooverline{C_{V,i}}
-% = \left(\frac{\partial\thermounderline{C}_V}
-% {\partial\Nt_i}\right)_{T,P,\allNsbut{i}}
+% \[ \cVpm{i} = \Partial*{\cVt}{\Nt_i}{T,P,\allNsbut{i}}
% = \frac{\partial}{\partial\Nt_i}
-% \left[ -T\left(\frac{\partial^2\Ft}{\partial T^2}\right)_{\Vt,\allNs}
-% \right]_{T,P,\allNsbut{i}} \]
+% \left[ -T\PartialSecond{\Ft}{T}{\Vt,\allNs}
+% \right]_{T,P,\allNsbut{i}}. \]
%
% \begin{table}
% \caption{Commands defined in this package to represent extensive
@@ -300,80 +297,152 @@
% 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
-% $\thermounderline{A}$)\@.
+% $\Ft$)\@.
% }
% \label{table:symbols}
-% \SpecialUsageIndex{\Qt}\relax
-% \SpecialUsageIndex{\Qm}\relax
-% \SpecialUsageIndex{\Qs}\relax
-% \SpecialUsageIndex{\Wt}\relax
-% \SpecialUsageIndex{\Wm}\relax
-% \SpecialUsageIndex{\Ws}\relax
-% \SpecialUsageIndex{\Et}\relax
-% \SpecialUsageIndex{\Em}\relax
-% \SpecialUsageIndex{\Es}\relax
-% \SpecialUsageIndex{\Epm}\relax
-% \SpecialUsageIndex{\Ut}\relax
-% \SpecialUsageIndex{\Um}\relax
-% \SpecialUsageIndex{\Us}\relax
-% \SpecialUsageIndex{\Upm}\relax
-% \SpecialUsageIndex{\Ht}\relax
-% \SpecialUsageIndex{\Hm}\relax
-% \SpecialUsageIndex{\Hs}\relax
-% \SpecialUsageIndex{\Hpm}\relax
-% \SpecialUsageIndex{\St}\relax
-% \SpecialUsageIndex{\Sm}\relax
-% \SpecialUsageIndex{\Ss}\relax
-% \SpecialUsageIndex{\Spm}\relax
-% \SpecialUsageIndex{\Ft}\relax
-% \SpecialUsageIndex{\Fm}\relax
-% \SpecialUsageIndex{\Fs}\relax
-% \SpecialUsageIndex{\Fpm}\relax
-% \SpecialUsageIndex{\Gt}\relax
-% \SpecialUsageIndex{\Gm}\relax
-% \SpecialUsageIndex{\Gs}\relax
-% \SpecialUsageIndex{\Gpm}\relax
-% \SpecialUsageIndex{\At}\relax
-% \SpecialUsageIndex{\Am}\relax
-% \SpecialUsageIndex{\As}\relax
-% \SpecialUsageIndex{\Apm}\relax
-% \SpecialUsageIndex{\Nt}\relax
-% \SpecialUsageIndex{\Lt}\relax
-% \SpecialUsageIndex{\Lm}\relax
-% \SpecialUsageIndex{\Ls}\relax
-% \SpecialUsageIndex{\Lpm}\relax
-% \SpecialUsageIndex{\Bt}\relax
-% \SpecialUsageIndex{\Bm}\relax
-% \SpecialUsageIndex{\Bs}\relax
-% \SpecialUsageIndex{\Bpm}\relax
-% \SpecialUsageIndex{\Mt}\relax
-% \SpecialUsageIndex{\Mm}\relax
-% \SpecialUsageIndex{\Ms}\relax
-% \SpecialUsageIndex{\Mpm}\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{\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}{4.12in}\renewcommand*{\footnoterule}{\vskip-1ex}%
-% \centering\small
-% \begin{tabular}{l l l l l}
+% \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
-% Property & Total & Molar & Specific & Partial Molar \\
+% & & & & & \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} & N/A \\
-% Work & \cs{Wt} & \cs{Wm} & \cs{Ws} & N/A \\
-% Total energy & \cs{Et} & \cs{Em} & \cs{Es} & \cs{Epm} \\
-% Internal energy & \cs{Ut} & \cs{Um} & \cs{Us} & \cs{Upm} \\
-% Enthalpy & \cs{Ht} & \cs{Hm} & \cs{Hs} & \cs{Hpm} \\
-% Entropy & \cs{St} & \cs{Sm} & \cs{Ss} & \cs{Spm} \\
-% Volume & \cs{Vt} & \cs{Vm} & \cs{Vs} & \cs{Vpm} \\
-% Helmholtz free energy & \cs{Ft} & \cs{Fm} & \cs{Fs} & \cs{Fpm} \\
-% Gibbs free energy & \cs{Gt} & \cs{Gm} & \cs{Gs} & \cs{Gpm} \\
+% 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,
-% $\Lt(T,\Vt,\vec{\mu}\mkern1mu) = \Ut - T\St - \sum_i^C \mu_i \Nt_i,$
+% $\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} \\
-% Moles & \cs{Nt} & N/A & N/A & N/A \\
-% $B$ (generic property) & \cs{Bt} & \cs{Bm} & \cs{Bs} & \cs{Bpm} \\
-% $M$ (generic property) & \cs{Mt} & \cs{Mm} & \cs{Ms} & \cs{Mpm} \\
+% & \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}
@@ -383,46 +452,52 @@
% \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 circ} renders as
+% \texttt{\textbackslash cP\_i\^{}\textbackslash std} renders as
% $C_{P,i}^\circ$, also as expected. You can also reverse it:
-% \texttt{\textbackslash cP\^{}\textbackslash circ\_i} becomes
+% \texttt{\textbackslash cP\^{}\textbackslash std\_i} becomes
% $C^\circ_{P,i}$.}
% \label{table:conveniences}
-% \SpecialUsageIndex{\cP}\relax
-% \SpecialUsageIndex{\cV}\relax
-% \SpecialUsageIndex{\kappaT}\relax
-% \SpecialUsageIndex{\kappaS}\relax
-% \SpecialUsageIndex{\alphaP}\relax
-% \SpecialUsageIndex{\alphaS}\relax
-% \SpecialUsageIndex{\heatcapacitysymbol}\relax
-% \SpecialUsageIndex{\compressibilitysymbol}\relax
-% \SpecialUsageIndex{\expansivitysymbol}\relax
-% \SpecialUsageIndex{\fpure}\relax
-% \SpecialUsageIndex{\fmix}\relax
-% \SpecialUsageIndex{\fsat}\relax
-% \SpecialUsageIndex{\phipure}\relax
-% \SpecialUsageIndex{\phimix}\relax
-% \SpecialUsageIndex{\phisat}\relax
-% \SpecialUsageIndex{\Psat}\relax
-% \SpecialUsageIndex{\Pvap}\relax
-% \SpecialUsageIndex{\sat}\relax
-% \SpecialUsageIndex{\Henryrat}\relax
-% \SpecialUsageIndex{\Henrymol}\relax
-% \SpecialUsageIndex{\gammarat}\relax
-% \SpecialUsageIndex{\gammamol}\relax
-% \SpecialUsageIndex{\Deltamix}\relax
-% \SpecialUsageIndex{\Deltarxn}\relax
-% \SpecialUsageIndex{\Deltavap}\relax
-% \SpecialUsageIndex{\Deltasub}\relax
-% \SpecialUsageIndex{\Deltafus}\relax
-% \SpecialUsageIndex{\mixing}\relax
-% \SpecialUsageIndex{\reaction}\relax
-% \SpecialUsageIndex{\fusion}\relax
-% \SpecialUsageIndex{\vaporization}\relax
-% \SpecialUsageIndex{\sublimation}\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{\amix}\relax
+% \SpecialMacroIndex{\fpure}\relax
+% \SpecialMacroIndex{\fmix}\relax
+% \SpecialMacroIndex{\fsat}\relax
+% \SpecialMacroIndex{\phipure}\relax
+% \SpecialMacroIndex{\phimix}\relax
+% \SpecialMacroIndex{\phisat}\relax
+% \SpecialMacroIndex{\Psat}\relax
+% \SpecialMacroIndex{\Pvap}\relax
+% \SpecialMacroIndex{\sat}\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
% \begin{minipage}{\linewidth}
% \small
-% \addtolength{\tabcolsep}{-2pt}\relax
+% \addtolength{\tabcolsep}{-2.75pt}\relax
% \addtolength{\extrarowheight}{0.75ex}\relax
% \renewcommand*{\footnoterule}{\vskip-1.5ex}\relax
% \begin{tabular}{l l l l l}
@@ -430,76 +505,78 @@
% \\[-1.5\normalbaselineskip]
% Name & Macro & Sym. & Definition & Base Symbol Macro \\
% \midrule
-% Isobaric heat capacity & \verb"\cP"\footnote{\relax
+% Isobaric heat capacity & \cmd\cP\footnote{\relax
% Extensive and specific (per-unit-mass) versions are available
-% as \texttt{\textbackslash cPt} and \texttt{\textbackslash cPs},
-% respectively, with similar macros for the isochoric heat capacity.
-% \label{fn:cP}}
-% & $C_P$ & $\displaystyle T\left(\frac{\partial S}{\partial T}\right)_P$
-% & \verb"\heatcapacitysymbol" \\[2.0ex]
-% Isochoric heat capacity & \verb"\cV"\footref{fn:cP} & $C_V$
-% & $\displaystyle T\left(\frac{\partial S}{\partial T}\right)_V$
-% & \verb"\heatcapacitysymbol" \\[2.0ex]
-% Isothermal compressibility & \verb"\kappaT" & $\kappa_T$ &
-% \(\displaystyle -\frac{1}{V} \left(\frac{\partial V}{\partial P}\right)_T \)
-% & \verb"\compressibilitysymbol" \\[2.0ex]
-% Isentropic compressibility & \verb"\kappaS" & $\kappa_S$ &
-% \(\displaystyle -\frac{1}{V} \left(\frac{\partial V}{\partial P}\right)_S\)
-% & \verb"\compressibilitysymbol" \\[2.0ex]
-% Isobaric expansivity & \verb"\alphaP" & $\alpha_P$ &
-% \(\displaystyle \frac{1}{V} \left(\frac{\partial V}{\partial T}\right)_P\)
-% & \verb"\expansivitysymbol" \\[2.0ex]
-% Isentropic expansivity & \verb"\alphaS" & $\alpha_S$ &
-% \(\displaystyle \frac{1}{V} \left(\frac{\partial V}{\partial T}\right)_S\)
-% & \verb"\expansivitysymbol" \\[2.0ex]
-% Pure fugacity & \verb"\fpure" & $f$ & $\phi P$ \\
-% Mixture fugacity & \verb"\fmix" & $\hat f$ & $\hat f_i = x_i\hat\phi_i P$ \\[0.5ex]
-% Saturation fugacity & \verb"\fsat" & $f^\text{sat}$
-% & $\phi^\text{sat} P^\text{sat}$ & \cs{sat} \\
-% Pure fugacity coeff.\ & \verb"\phipure" & $\phi$ &
-% \multicolumn{2}{l}{\( \phi_i
-% = \exp\left(\frac{1}{RT}\int_0^P V_i(T,p)
+% 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 \\[2.0ex]
+% Isochoric heat capacity & \verb"\cV"\footref{fn:cP} & \(\cV\)
+% & \(\displaystyle T\Partial{\Sm}{T}{\Vm}\)
+% & \cmd\heatcapacitysymbol \\[2.0ex]
+% Isothermal compressibility & \cmd\kappaT & $\kappaT$
+% & \(\displaystyle -\frac{1}{\Vm} \Partial{\Vm}{P}{T} \)
+% & \cmd\compressibilitysymbol \\[2.0ex]
+% Isentropic compressibility & \cmd\kappaS & $\kappaS$
+% & \(\displaystyle -\frac{1}{\Vm} \Partial{\Vm}{P}{\Sm}\)
+% & \cmd\compressibilitysymbol \\[2.0ex]
+% Isobaric expansivity & \cmd\alphaP & $\alphaP$
+% & \(\displaystyle \frac{1}{\Vm} \Partial{\Vm}{T}{P}\)
+% & \cmd\expansivitysymbol \\[2.0ex]
+% Isentropic expansivity & \cmd\alphaS & $\alphaS$
+% & \(\displaystyle \frac{1}{\Vm} \Partial{\Vm}{T}{\Sm}\)
+% & \cmd\expansivitysymbol \\[2.0ex]
+% Joule--Thomson coeff. & \cmd\muJT & $\muJT$
+% & \(\displaystyle \Partial{T}{P}{\Hm}\) & \cmd\JTsymbol \\
+% Pure fugacity & \cmd\fpure & $f$ & $\phi P$ \\
+% Mixture fugacity & \cmd\fmix & $\fmix$
+% & $\fmix_i = x_i\phimix_i P$ \\[0.5ex]
+% Saturation fugacity & \cmd\fsat & $\fsat$
+% & $\phisat \Psat$ & \cmd\sat \\
+% 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) \)} \\
-% Mixture fugacity coeff.\ & \verb"\phimix" & $\hat\phi$
-% & \multicolumn{2}{l}{\( \hat\phi_i
+% 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) \)} \\
-% Henry's constant (rational) & \verb"\Henryrat" & $h$
+% Henry's constant (rational) & \cmd\Henryrat & $\Henryrat$
% & $\gamma_i^\infty f_i$ \\
-% Henry's constant (molal) & \verb"\Henrymol" & $\mathcal{H}$
+% Henry's constant (molal) & \cmd\Henrymol & $\Henrymol$
% & $M_s \gamma_i^\infty f_i$ \\
-% Rational activity coeff.\ & \verb"\gammarat" & $\gamma^\ast$
+% Rational activity coeff.\ & \cmd\gammarat & $\gammarat$
% & $\gamma/\gamma^\infty$ \\
-% Molal activity coeff.\ & \verb"\gammamol" & $\gamma^\square$
+% Molal activity coeff.\ & \cmd\gammamol & $\gammamol$
% & $x_s \gamma/\gamma^\infty$ \\
-% Saturation fugacity coeff.\ & \verb"\phisat" & $\phi^\text{sat}$
-% & $\phi(T,P^\text{sat})$ & \cs{sat} \\
-% Saturation pressure & \verb"\Psat" & $P^\text{sat}$ && \cs{sat} \\
-% Vapor pressure & \verb"\Pvap" & \multicolumn{3}{l}{Currently a synonym
+% Saturation fugacity coeff.\ & \cmd\phisat & $\phisat$
+% & $\phipure(T,\Psat)$ & \cmd\sat \\
+% Saturation pressure & \cmd\Psat & $\Psat$ && \cmd\sat \\
+% Vapor pressure & \cmd\Pvap & \multicolumn{3}{l}{Currently a synonym
% for \cs{Psat}\footnote{If you want \cs{Pvap} to produce $P^\text{vap}$
-% instead of $P^\text{sat}$, you should redefine the \cs{sat} macro.}} \\
-% Standard state & \verb"\std"\footnote{Typical usage would be
+% instead of $\Psat$, you should redefine the \cs{sat} macro.}} \\
+% 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^\circ + RT \log a_i$.} & $\circ$ \\
-% Standard pressure & \verb"\Pstd" & $P^\circ$ & & \cs{std} \\
-% Standard fugacity & \verb"\fstd" & $f^\circ$ & $f(T,P^\circ)$ & \cs{std}
+% yielding $\mu_i = \mu_i^\std + RT \log a_i$.} & $\std$ \\
+% Standard pressure & \cmd\Pstd & $\Pstd$ & & \cs{std} \\
+% Standard fugacity & \cmd\fstd & $\fstd$ & $\fpure(T,\Pstd)$ & \cs{std}
% \\
-% Change on mixing & \verb"\Deltamix"\footnote{The usual usage would be
+% 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 - \sum_i x_i M_i$ & \verb"\mixing" \\
-% Change on reaction & \verb"\Deltarxn"\footref{fn:Deltausage}
-% & $\Delta M_\text{rxn}$
-% & $\sum_i \nu_i M_i$ & \verb"\reaction" \\
-% Change on melting & \verb"\Deltafus"\footref{fn:Deltausage}
-% & $\Delta M^\text{fus}$ & $M^L - M^S$ & \verb"\fusion" \\
-% Change on boiling & \verb"\Deltavap"\footref{fn:Deltausage}
-% & $\Delta M^\text{vap}$ & $M^V - M^L$ & \verb"\vaporization" \\
-% Change on subliming & \verb"\Deltasub"\footref{fn:Deltausage}
-% & $\Delta M^\text{sub}$ & $M^V - M^S$ & \verb"\sublimation" \\
+% & $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 \\
% \bottomrule
% \end{tabular}
% \end{minipage}
@@ -507,19 +584,19 @@
%
% \subsection{Partial Molar Properties}
% \DescribeMacro{\Upm}
-% \DescribeMacro{\Hpm}
-% Partial molar quantities are typically defined with the suffix \verb"pm".
+% \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 \Hpm_i \quad \Hpm^\IG_i \]
+% \[ \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 \Hpm{i} \quad \Hpm[\text{IG}]{i}\]
-% There are also partial molar heat capacities available via \cs{cPpm} and
-% \cs{cVpm}.
-% \textbf{Important}: The \cs{text} command defined by the \verb"amstext"
+% \[ \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
@@ -530,15 +607,63 @@
% 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 defined via the macro
+% is effectively defined via the macro
% \DescribeMacro{\Gpm}
% \begin{verbatim}
-% \newcommand*{\Gpm}{\partialmolar{\Gibbs@symbol}}
+% \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
@@ -562,12 +687,20 @@
% \cs{expansivitysymbol}, which is done automatically by some of the
% package options that create notation specific to a particular textbook.
%
+% \subsubsection{Joule--Thomson Coefficients}
+% \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 be 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{Fugacities and Fugacity Coefficients}
% \DescribeMacro{\fpure}
% \DescribeMacro{\fmix}
% \DescribeMacro{\phipure}
% \DescribeMacro{\phimix}
-% Different textbooks use different modifications of the symbol $f$ for
+% 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
@@ -576,25 +709,30 @@
% 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. \]
+% \[ \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
-% \[ \hat f_j = x_j \hat\phi_j P = x_j \gamma_j f_j. \]
+% \[ \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. \]
+% \[ \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}, \]
+% \[ 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. \]
+% \[ \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{\gammarat}
% \DescribeMacro{\gammamol}
% \DescribeMacro{\Henryrat}
% \DescribeMacro{\Henrymol}
-% The activity coefficient can be generated with \cs{gamma}, as usual.
-% The Henry's Law activity coefficients should be produced with \cs{gammarat}
-% (rational basis) and \cs{gammamol} (molal basis).
+% The activity coefficient based on the Lewis--Randall rule can be generated
+% with \cs{gamma}, as usual. 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:
@@ -603,9 +741,24 @@
% = C_i \gammamol_i \Henrymol_i \]
%\end{verbatim}
% produces
-% \[ \hat f_i = x_i \gamma_i f_i = x_i \gamma^*_i h_i
-% = C_i \gamma^\square_i \mathcal{H}_i \]
+% \[ \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
+%%^^A = C_i \gammamol_i \Henrymol_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}
@@ -620,11 +773,11 @@
%
% \DescribeMacro{\sat}
% The \cs{sat} macro is used ``behind the scenes'' as part of
-% \cs{Psat}, \cs{fsat}, and \cs{phisat}, which produce $P^\text{sat}$,
-% $f^\text{sat}$, and $\phi^\text{sat}$, respectively. If you wanted to
+% \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"\renewcommand*{\sat}{{\text{vap}}}".
+% \verb"\RenewDocumentCommand{\sat}{}{{\text{vap}}}".
% This is done automatically using package option |Sandler|.
%
% \subsubsection{Standard States}
@@ -635,21 +788,19 @@
% 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 pressures, and \cs{fstd} is defined for standard fugacities so as to
-% ease implementation across textbooks.
+% standard pressures, and \cs{fstd} is defined for standard fugacities 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 \mu^\std_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] \]
+% = \Deltarxn\Gm^\std + RT \log\left[\prodall_i a_i^{\nu_i} \right] \],
%\end{verbatim}
% which produces
-% \[ \Delta G_\text{rxn} = \sum_{i=1}^C \nu_i \mu_i
-% = \sum_{i=1}^C \left[ \nu_i \mu^\circ_i
-% + \nu_i RT \log\left(\frac{\hat f_i}{f_i^\circ}\right) \right]
-% = \Delta G^\circ_\text{rxn}
-% + RT \log\left[\prod_{i=1}^C a_i^{\nu_i} \right] \]
+% \[ \Deltarxn\Gm = \sumall_i \nu_i \mu_i = \sumall_i \left[ \nu_i \mu^\std_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.
%
% \subsubsection{Changes on Mixing, Reaction, Fusion, Vaporization, and
@@ -658,11 +809,11 @@
% 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 \]
+% \[ \Deltamix\Gm = \Gm - \sumall_i x_i \Gm_i
+% = \Deltamix\Hm - T\Deltamix\Sm \],
%\end{verbatim}
-% which yields
-% \[ \Delta G_\text{mix} = G - \sum_{i=1}^C x_i G_i
-% = \Delta H_\text{mix} - T\Delta S_\text{mix}. \]
+% 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.
@@ -678,13 +829,15 @@
% 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 \]
+% = \Deltafus\Hm + \Deltavap\Hm \],
%\end{verbatim}
% yielding
-% \[ \Delta\Hm^\text{sub} = \Hm^V - \Hm^S = \Hm^V - \Hm^L + (\Hm^L - \Hm^S)
-% = \Delta\Hm^\text{vap} + \Delta\Hm^\text{fus} \]
+% \[ \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.
+% 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}
@@ -694,7 +847,7 @@
% \[ \Deltarxn\Hm^\std = \sumall_i \nu_i \Deltaf\Hm_i^\std \]
%\end{verbatim}
% results in
-% \[ \Delta\Hm_\text{rxn}^\circ = \sum_{i=1}^C \nu_i \Delta\Hm_{f,i}^\circ. \]
+% \[ \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.
@@ -713,50 +866,54 @@
% 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,$
-% $\thermounderline{U}^R,$ $\hat U^R, $ and $\smash[t]{\Upm[R]{i}}$ (the last
+% $\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}.
%
-% \DescribeMacro{\excess}
-% \DescribeMacro{\residual}
% 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
-% want \cs{SE}, which normally produces $S^E$, to give you $S^{EX}$---and let's
+% \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}
-% \renewcommand*{\excess}{{EX}}
+% \RenewDocumentCommand{\excess}{}{{EX}},
%\end{verbatim}
% or possibly
% \begin{verbatim}
-% \renewcommand*{\excess}{{\mathrm{EX}}}
+% \RenewDocumentCommand{\excess}{}{{\mathrm{EX}}}
%\end{verbatim}
% or even
% \begin{verbatim}
-% \renewcommand*{\excess}{\text{EX}}
+% \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 not possible to use superscripts with the excess or
-% residual properties; in the event the user needs this, the \cs{excess} and
-% \cs{residual} macros can be used directly, viz.,
+% 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*}
-% \Hm^{\excess,\std} = \HE(T,\Pstd) \\
-% \renewcommand*{\excess}{EX}
-% \Hm^{\excess,\std} = \HE(T,\Pstd)
-% \end{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*}
-% \Hm^{E,\circ} = H^E(T,P^\circ) \\
-% \Hm^{EX,\circ} = H^{EX}(T,P^\circ)
+% \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.
-% \clearpage
%
% \subsection{Partial Derivatives}
% \DescribeMacro{\Partial}%
@@ -764,18 +921,36 @@
% 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:
+% that the following binary operator will overhang the subscripts.
+% Compare the following:
% \begin{verbatim}
-% \begin{gather*}
-% \Partial{\Hm}{T}{P} = \cP \qquad \Partial*{\Hm}{T}{P} = \cP
-% \end{gather*}
+% \[ \Partial{\Hm}{T}{P} = \cP \qquad \Partial*{\Hm}{T}{P} = \cP \],
%\end{verbatim}
% which yields
-% \begin{gather*}
-% \left(\frac{\partial\Hm}{\partial T}\right)_{P} = C_P \qquad
-% \left(\frac{\partial\Hm}{\partial T}\right)_{P} \mkern-8mu = C_P
-% \end{gather*}
+% \[ \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}%
@@ -793,35 +968,46 @@
% = \Partial{\Gpm_i}{P}{T,\allNs} \]
%\end{verbatim}
% looks like
-% \[ \Vpm{i} = \left(\frac{\partial\Vt}
-% {\partial\Nt_i}\right)_{T,P,\allNsbut{i}}
-% \mkern-15mu
-% = \left(\frac{\partial^2\Gt}
-% {\partial\Nt_i\partial P}\right)_{T,\allNsbut{i}}
-% \mkern-15mu
-% = \left(\frac{\partial^2\Gt}
-% {\partial P\partial\Nt_i}\right)_{T,\allNsbut{i}}
-% \mkern-15mu
-% = \left(\frac{\partial\Gpm{i}}{\partial P}\right)_{T,\allNs}. \]
-% \DescribeMacro{\PartialBigg}
-% \SpecialUsageIndex{\PartialBigg*}\relax
-% \DescribeMacro{\PartialSecondBigg}
-% \SpecialUsageIndex{\PartialSecondBigg*}\relax
-% \DescribeMacro{\PartialMixSecondBigg}
-% \SpecialUsageIndex{\PartialMixSecondBigg*}\relax
-% \DescribeMacro{\Partialbigg}
-% \SpecialUsageIndex{\Partialbigg*}\relax
-% \DescribeMacro{\PartialSecondbigg}
-% \SpecialUsageIndex{\PartialSecondbigg*}\relax
-% \DescribeMacro{\PartialMixSecondbigg}
-% \SpecialUsageIndex{\PartialMixSecondbigg*}\relax
+% \[ \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}
+% \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 \verb"amsmath"'s \cs{Biggl} and \cs{Biggr} macros in place of \cs{left}
-% and \cs{right} to size the parentheses accordingly; \cs{Partiallbigg} uses
-% \cs{biggl} and \cs{biggr} in a similar fashion. For example, compare the
+% 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}}
@@ -829,55 +1015,65 @@
% = \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} \]
+% = RT\,\Partialbigg{\log\fmix_i}{P}{T,\allNs} \],
%\end{verbatim}
% which typesets as
-% \[ \Vpm{i}
-% = \left(\frac{\partial\Vt}{\partial \Nt_i}\right)_{T,P,\allNsbut{i}}
-% \mkern-15mu
-% = \left(\frac{\partial\Gpm{i}}{\partial P}\right)_{T,\allNs}
-% \mkern-15mu
-% = \Biggl(\frac{\partial\Gpm{i}}{\partial P}\Biggr)_{T,\allNs}
-% \mkern-15mu
-% = RT\left(\frac{\partial\log\hat f_i}{\partial P}\right)_{T,\allNs}
-% \mkern-15mu
-% = RT\,\Biggl(\frac{\partial\log\hat f_i}{\partial P}\Biggr)_{T,\allNs}
-% \mkern-15mu
-% = RT\,\biggl(\frac{\partial\log\hat f_i}{\partial P}\biggr)_{T,\allNs} \]
+% \[ \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 \verb"amsmath"'s \cs{smash} command, which has the effect of
+% 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}}
+% \[ \Vpm_i = \Partial*{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
% = \Partial{\smash{\Gpm_i}}{P}{T,\allNs} \]
-% \end{verbatim}
+%\end{verbatim}
% produces
-% \[ \Vpm{i}
-% = \left(\frac{\partial\Vt}{\partial \Nt_i}\right)_{T,P,\allNsbut{i}}
-% = \left(\frac{\partial\smash{\Gpm{i}}}{\partial P}\right)_{T,\allNs}. \]
-% Note that the vertical spacing is not quite as good here as it was above.
-% This can be fixed by using the optional argument to \cs{smash}, viz.,
+% \[ \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 = \Partial{\Vt}{\Nt_i}{T,P,\allNsbut{i}}
-% = \Partial{\smash[t]{\Gpm_i}}{P}{T,\allNs} \]
+% \[ \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}
-% \[ \Vpm{i}
-% = \left(\frac{\partial\Vt}{\partial \Nt_i}\right)_{T,P,\allNsbut{i}}
-% = \left(\frac{\partial\smash[t]{\Gpm{i}}}{\partial P}\right)_{T,\allNs}. \]
+% 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\PartialSecond{\St}{T}{\Nt_i}{P,\allNsbut{i}}
+% \[ \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\Partial{^2\St}{T\partial\Nt_i}{P,\allNsbut{i}}
+% \[ \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 as well, and the use of
+% 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.
%
@@ -895,16 +1091,22 @@
% \DescribeMacro{\allWs}%
% \DescribeMacro{\allWsbut}%
% It is common in thermodynamics to use notation such as
-% \[ \Vpm{k} = \left(\frac{\partial\Vt}{\partial\Nt_k}\right)_{T,P,\Nt_{j\neq k}} \]
+% \[ \Vpm_k = \Partial{\Vt}{\Nt_k}{T,P,\allNsbut{k}}, \]
% or perhaps
-% \[ \Vpm{k} = \left(\frac{\partial\Vt}{\partial\Nt_k}\right)_{T,P,\Nt_1,\dotsc,[\Nt_k],\dots,\Nt_C} \]
+% \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
-% \[ C_P = \left(\frac{\partial\Hm}{\partial T}\right)_{P,\vec{x}} \]
+% \[ \cP = \Partial{\Hm}{T}{P,\allXs}, \]
% or perhaps
-% \[ C_P = \left(\frac{\partial\Hm}{\partial T}\right)_{P,x_1,\dotsc,x_C}. \]
+% \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
@@ -915,62 +1117,106 @@
% 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. The macros \cs{allNsbut},
-% \cs{allMsbut}, \cs{allmusbut}, \cs{allXsbut}, \cs{allYsbut}, and
-% \cs{allWsbut} take an optional argument; for example,
+% \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
+% \[ \Partial{\Ht}{\Nt_1}{T,P,\allNsbut{1}} =
+% \Partial{\Ht}{\Nt_1}{T,P,\allNsbut[m]{1}} = \Hpm_1 \]
%\end{verbatim}
% typesets as
-% \[ \left(\frac{\partial\Ht}{\partial\Nt_1}\right)_{T,P,\Nt_{j\neq 1}}
-% = \left(\frac{\partial\Ht}{\partial\Nt_1}\right)_{T,P,\Nt_{m\neq 1}}
-% = \Hpm{1} \]
+% \[ \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
+% \[ \Partial{\Hm}{x_i}{T,P,\allXsbut{i}}
+% = \Partial{\Hm}{x_i}{T,P,\allXsbut[m]{i}}
+% = \Hpm_i - \Hpm_\ncomponents \]
%\end{verbatim}
% becomes
-% \[ \left(\frac{\partial\Hm}{\partial x_i}\right)_{T,P,x_{j\neq i,C}}
-% = \left(\frac{\partial\Hm}{\partial x_i}\right)_{T,P,x_{m\neq i,C}}
-% = \Hpm{i} - \Hpm{C} \]
-% The user must supply their own redefinition if they wish to hold something
-% other than \cs{ncomponents} constant in addition to the argument.
+% \[ \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 $x_1,\dotsc,[x_k],\dotsc,x_{C-1}$ rather than $x_{j \neq k,C}$,
-% the optional argument is ignored.
+% 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}
-% \newcommand*{\allNsbut}[2][j]{\allbut[#1]{#2}{\Nt}}
-% \newcommand*{\allXsbut}[2][j]{\allbutlastand[#1]{#2}{x}}
+% \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
-% \[ \sum_{i=1}^C x_i = 1 \quad \text{or} \quad
-% x_C = 1 - \sum_{i=1}^{C-1} x_i \quad \text{or} \quad
-% \Gt = \sum_{j=1}^C \mu_j\Nt_j \quad \text{and} \quad
-% K = \prod_{k=1}^C a_k^{\nu_k}. \]
+% \[ \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}. \]
+% K = \prodall_k a_k^{\nu_k} \].
%\end{verbatim}
-% The symbol $C$ can be changed by redefining \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$).
+% 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:
@@ -981,9 +1227,11 @@
% \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; and the
-% manner of denoting extensive, molar, and specific properties. The default
-% behavior can be altered by options in the following section.
+% 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
@@ -995,6 +1243,10 @@
% 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
@@ -1010,169 +1262,79 @@
% Option & \verb"\Et" & \verb"\Ut" & \verb"\Ft" & \verb"\Gt" & \verb"\Ht"
% & \verb"\At" & \verb"\Nt" \\
% \midrule
-% \verb"EUAGHan" & $\thermounderline{E}$
-% & $\thermounderline{U}$
-% & $\thermounderline{A}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{a}$
-% & $n$
-% \\
-% \verb"EUAGHaN" & $\thermounderline{E}$
-% & $\thermounderline{U}$
-% & $\thermounderline{A}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{a}$
-% & $N$
-% \\
-% \verb"EUHAGan" & \multicolumn{7}{l}{(synonym for \texttt{EUAGHan})} \\
-% \verb"EUHAGaN" & \multicolumn{7}{l}{(synonym for \texttt{EUAGHaN})} \\
-% \verb"EUFGHAn" & $\thermounderline{E}$
-% & $\thermounderline{U}$
-% & $\thermounderline{F}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{A}$
-% & $n$
-% \\
-% \verb"EUFGHAN" & $\thermounderline{E}$
-% & $\thermounderline{U}$
-% & $\thermounderline{F}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{A}$
-% & $N$
-% \\
-% \verb"EEFGHAn" & $\thermounderline{E}$
-% & $\thermounderline{E}$
-% & $\thermounderline{F}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{A}$
-% & $n$
-% \\
-% \verb"EEFGHAn" & $\thermounderline{E}$
-% & $\thermounderline{E}$
-% & $\thermounderline{F}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{A}$
-% & $N$
-% \\
-% \verb"EEFGHan" & $\thermounderline{E}$
-% & $\thermounderline{E}$
-% & $\thermounderline{F}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{a}$
-% & $n$
-% \\
-% \verb"EEFGHaN" & $\thermounderline{E}$
-% & $\thermounderline{E}$
-% & $\thermounderline{F}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{a}$
-% & $N$
-% \\
-% \verb"EEAGHaN" & $\thermounderline{E}$
-% & $\thermounderline{E}$
-% & $\thermounderline{A}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{a}$
-% & $N$
-% \\
-% \verb"EUAGHAn" & $\thermounderline{E}$
-% & $\thermounderline{U}$
-% & $\thermounderline{A}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{A}$
-% & $n$
-% \\
-% \verb"EUAGHAN" & $\thermounderline{E}$
-% & $\thermounderline{U}$
-% & $\thermounderline{A}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{A}$
-% & $N$
-% \\
-% \verb"EUFGHan" & $\thermounderline{E}$
-% & $\thermounderline{U}$
-% & $\thermounderline{F}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{a}$
-% & $n$
-% \\
-% \verb"EUFGHaN" & $\thermounderline{E}$
-% & $\thermounderline{U}$
-% & $\thermounderline{F}$
-% & $\thermounderline{G}$
-% & $\thermounderline{H}$
-% & $\thermounderline{a}$
-% & $N$
-% \\
+% |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 + \sum_i \mu_i \Nt_i + \sigma d\At
-% \qquad \Hm = \Um + P\Vm \qquad \Et = \Ut + \frac12 mv^2 \]
+% \[ \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
-% \[ \thermounderline{A}
-% = \thermounderline{U} - T\thermounderline{S}
-% = -P\thermounderline{V} + \sum_i \mu_i n_i + \sigma d\thermounderline{a}
-% \qquad H = U + PV
-% \qquad \thermounderline{E} = \thermounderline{U} + \frac12 mv^2. \]
-% Using the \verb"EUFGHAN" option, the same markup would yield
-% \[ \thermounderline{F}
-% = \thermounderline{U} - T\thermounderline{S}
-% = -P\thermounderline{V} + \sum_i \mu_i N_i + \sigma d\thermounderline{A}
+% \[ \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 \thermounderline{E} = \thermounderline{U} + \frac12 mv^2. \]
+% \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 $\thermounderline{V},$ $V,$ $\hat V,$ and $\Vpm{j},$
+% respectively, as $\Vt,$ $\Vm,$ $\Vs,$ and $\Vpm{j},$
% respectively.
%
% 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}}
+% \[ \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} &= \left(\frac{\partial\thermounderline{H}}
-% {\partial n_i}\right)_{T,P,n_{j\neq i}}
-% = \left(\frac{\partial nH}
-% {\partial n_i}\right)_{T,P,n_{j\neq i}}
+% \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} &= \left(\frac{\partial H}
-% {\partial n_i}\right)_{T,P,n_{j\neq i}}
-% = \left(\frac{\partial n\thermounderline{H}}
-% {\partial n_i}\right)_{T,P,n_{j\neq i}}
+% \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} &= \left(\frac{\partial H^t}
-% {\partial n_i}\right)_{T,P,n_{j\neq i}}
-% = \left(\frac{\partial nH}
-% {\partial n_i}\right)_{T,P,n_{j\neq i}}
+% \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}} \\
-% \Hpm{i} &= \left(\frac{\partial H}
-% {\partial n_i}\right)_{T,P,n_{j\neq i}}
-% = \left(\frac{\partial nh}
-% {\partial n_i}\right)_{T,P,n_{j\neq i}}
+% \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.
@@ -1183,28 +1345,52 @@
% \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},
-% respectively. Note that specific quantities are generally assumed to
-% look like the molar symbol with a caret on top.}
+% \texttt{extensive-superscript}, and \texttt{intensive-lowercase}.}
% \label{table:extensive}
% \centering\small
-% \newcommand*{\vpm}[2][]{\mkern1mu\overline{\mkern-1mu v_{\mkern-2mu #2}^{#1}\mkern-2mu}\mkern2mu}
% \begin{tabular}{l l l l l l}
% \toprule
% Option & \verb"\Vt" & \verb"\Vm" & \verb"\Vs" & \verb"\Vpm_i" \\
% \midrule
-% \verb"intensive-plain" & $\thermounderline{V}$ & $V$ & $\hat V$
-% & $\Vpm{i}$ \\
-% \verb"extensive-plain" & $V$ & $\thermounderline{V}$ & $\hat V$
-% & $\Vpm{i}$\rule{0pt}{2.5ex} \\
-% \verb"extensive-superscript" & $V^t$ & $V$ & $\hat V$
-% & $\Vpm{i}$\rule{0pt}{2.5ex} \\
-% \verb"intensive-lowercase" & $V$ & $v$ & $\hat v$
-% & $\vpm{i}$\rule{0pt}{2.5ex} \\
+% \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 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
@@ -1214,148 +1400,184 @@
% = \PartialMixSecond{\Gm}{P}{T}{}
% = -\Partial{\Sm}{P}{T}. \]
%\end{verbatim}
-% Using the \verb"parentheses" option (the default), this gives
-% \[ \left(\frac{\partial V}{\partial T}\right)_{P} \mkern-8mu
-% = \left(\frac{\partial^2 G}{\partial T \partial P}\right)
-% = \left(\frac{\partial^2 G}{\partial P \partial T}\right)
-% = -\left(\frac{\partial S}{\partial P}\right)_{T}. \]
-% The option \verb"brackets" changes the output to
-% \[ \left[\frac{\partial V}{\partial T}\right]_{P} \mkern-8mu
-% = \left[\frac{\partial^2 G}{\partial T \partial P}\right]
-% = \left[\frac{\partial^2 G}{\partial P \partial T}\right]
-% = -\left[\frac{\partial S}{\partial P}\right]_{T}. \]
+% 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
-% \[ \left.\frac{\partial V}{\partial T}\right\rvert_{P} \mkern-8mu
-% = \left.\frac{\partial^2 G}{\partial T \partial P}\right.
-% = \left.\frac{\partial^2 G}{\partial P \partial T}\right.
-% = -\left.\frac{\partial S}{\partial P}\right\rvert_{T}. \]
+% \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
-% \[ \left.\frac{\partial V(T,P)}{\partial T}\right.
-% = \left.\frac{\partial^2 G(T,P)}{\partial T \partial P}\right.
-% = \left.\frac{\partial^2 G(P,T)}{\partial P \partial T}\right.
-% = -\left.\frac{\partial S(P,T)}{\partial P}\right. \]
-%
+% \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
-% \[ \left(\frac{\partial V}{\partial P}\right)_{T}
-% \qquad \text{(\texttt{subscripts} option)}, \]
+% \[ \begin{thermosubscripts}
+% \Partial{\Vm}{P}{T} \qquad \text{(\texttt{subscripts} option)},
+% \end{thermosubscripts}\relax \]
% and instead renders them
-% \[ \left(\frac{\partial V(P,T)}{\partial P}\right)
-% \qquad \text{(\texttt{nosubscripts} option)}. \]
+% \[ \begin{thermoNOsubscripts}
+% \Partial{\Vm}{P}{T} \qquad \text{(\texttt{nosubscripts} option)},
+% \end{thermoNOsubscripts} \]
% Combined with \verb"plain-derivatives", this would give
-% \[ \left.\frac{\partial V(P,T)}{\partial P}\right.
-% \qquad \text{(\texttt{nosubscripts} and \texttt{plain-derivatives}
-% options)} . \]
-% The order of the variables is determined by the arguments given: it is
-% always written with the variable that is changing first, and the other
-% variables in the order given in the final argument to \cs{Partial} and
-% friends. This will result in things like the following:
-% \begin{verbatim}
-% \[ \Partial{\Vm}{T}{P} = \PartialMixSecond{\Gm}{T}{P}{}
-% = \PartialMixSecond{\Gm}{P}{T}{} = -\Partial{\Sm}{P}{T}, \]
-%\end{verbatim}
-% which would produce (using \verb"plain-derivatives")
-% \[ \frac{\partial V(T,P)}{\partial T}
-% = \frac{\partial^2 G(T,P)}{\partial T\partial P}
-% = \frac{\partial^2 G(P,T)}{\partial P\partial T}
-% = - \frac{\partial S(P,T)}{\partial P} \]
-% This is not unclear, but the variables appear in a different order.
+% \[ \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{thermobar}
% \DescribeEnv{thermoplain}
% If you want to use parentheses \emph{locally}, even though your overall
-% document uses another delimiter, the |thermoparentheses| environment will do
-% that. Similarly, |thermobrackets| will temporarily switch to brackets,
-% |thermobar| will temporarily switch to a tailing vertical bar, and
-% |thermoplain| will remove delimiters altogether.
+% 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 |thermosubscripts| and |thermoNOsubscripts| force the
-% use or disuse of subscripts, respectively.
+% 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}
+% \DescribeMacro{\allNs}%
+% \DescribeMacro{\allNsbut}%
% The default option \verb"moles-index" defines the macro \cs{allNs} to expand
-% to $\vec{n}$ and the macro \verb"\allNsbut{i}" to expand to $n_{j\neq i}$.
+% 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
-% $n_{k\neq i}$ by default. This is typically not necessary, however: if you
-% type \verb"\allNsbut{j}", the package will figure out that you want
-% $\Nt_{k\neq j}$ rather than $\Nt_{j\neq j}$. The time to use the optional
+% $\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}{\Nt_{i\neq k}}, \]
+% \[ \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 $n_1,\dotsc,n_C$ and \verb"\allNsbut{i}"
-% as $n_1,\dotsc,[n_i],\dotsc,n_C$. The optional argument is ignored in this
-% set of notation. Examples of these options are shown in
-% Table~\ref{table:allNs}.
+% 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}
+% \DescribeMacro{\ncomponents}%
% You can change the symbol for the number of components (default: $C$) by
-% redefining the macro \cs{ncomponents}.
+% 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}
-% \SpecialUsageIndex{\allNs}\relax
-% \SpecialUsageIndex{\allNsbut}\relax
-% \SpecialUsageIndex{\allXs}\relax
-% \SpecialUsageIndex{\allXsbut}\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{\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 $C-1$ to $C-2$ (or, say, $M-1$ to
-% $M-2$) if you want to redefine \cs{ncomponents} later.}
+% 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" & $\vec{n}$ & $n_1,\dotsc,n_C$ \\
-% \verb"\allNsbut{1}" & $n_{j\neq 1}$ & $n_2,\dotsc,n_C$ \\
-% \verb"\allNsbut{i}" & $n_{j\neq i}$ & $n_1,\dotsc,[n_i],\dotsc,n_C$ \\
-% \verb"\allNsbut{j}" & $n_{k\neq j}$ & $n_1,\dotsc,[n_j],\dotsc,n_C$ \\
-% \verb"\allNsbut{\ncomponents}" & $n_{j\neq C}$ & $n_1,\dotsc,n_{C-1}$ \\
-% \verb"\allNsbut[k]{i}" & $n_{k\neq i}$ & $n_1,\dotsc,[n_i],\dotsc,n_C$ \\
-% \verb"\allXs" & $\vec{x}$ & $x_1,\dotsc,x_{C}$ \\
-% \verb"\allXsbut{1}" & $x_{j\neq 1,C}$ & $x_2,\dotsc,x_{C-1}$ \\
-% \verb"\allXsbut{i}" & $x_{j\neq i,C}$ & $x_1,\dotsc,[x_i],\dotsc,x_{C-1}$ \\
-% \verb"\allXsbut{j}" & $x_{k\neq j,C}$ & $x_1,\dotsc,[x_j],\dotsc,x_{C-1}$ \\
-% \verb"\allXsbut{\ncomponents-1}" & $x_{j\neq C-1,C}$ & $x_1,\dotsc,x_{C-2}$ \\
-% \verb"\allXsbut[k]{\ncomponents-1}" & $x_{k\neq C-1,C}$ & $x_1,\dotsc,x_{C-2}$ \\
+% \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 $\Gt(T,P,n,x_1,\dotsc,x_{C-1})$ rather
-% than in a subscript, but it looks silly if we don't handle this
-% case this way.}
-% & $x_{j\neq C}$ & $x_1,\dotsc,x_{C-1}$ \\
+% 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}
-% \newcommand*{\dbar}{{\mkern5mu\mathchar'26\mkern-10mu d}}\relax
+% \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 not very stable: changing
+% 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 Specific Textbooks}
+% \subsubsection{Options for Particular Textbooks}
% There are several options that load package options and/or redefine
% particular commands to match the notation in a particular textbook. So far
% the following textbooks are supported:
@@ -1363,22 +1585,24 @@
% \item[Bejan] Notation used by Bejan, \emph{Advanced Engineering
% Thermodynamics}, Third Edition. Wiley: Hoboken, 2006. Loads non-default
% package options \verb"EUFGHAN", \verb"intensive-lowercase", and
-% \verb"delta". Also swaps the definitions of \verb"\@specific" and
-% \verb"\@intensive" and redefines \cs{cV}, \cs{cVs}, \cs{cVt},
+% \verb"delta". Also swaps the notation for specific and
+% intensive properties and redefines \cs{cV}, \cs{cVs}, \cs{cVt},
% \cs{expansivitysymbol}, and \cs{ncomponents} to match his notation.
% \item[CBK] Notation used by \c Cengel, Boles, and Kano\u glu,
% \emph{Thermodynamics: An Engineering Approach}, Ninth Edition.
% McGraw Hill: Singapore, 2020. Loads the non-default package options
% \verb"EUAGHAN" and \verb"intensive-lowercase"; also redefines
% partial molar, specific, and molar properties' notation to fit theirs,
-% and redefines \cs{pressure@symbol}, \cs{Deltarxn},
+% and redefines the internal symbol for pressure, \cs{Deltarxn},
% \cs{compressibilitysymbol}, and \cs{expansivitysymbol} to fit their
-% usage. Their prodigal symbols for specific and total volume are not
+% usage. Their prodigal symbols for specific and total volume, which appear
+% to be from the font ITC Benguiat Gothic Standard Book Oblique, are not
% supported.
% \item[ElliottLira] Notation used by Elliott and Lira, \emph{Introductory
% Chemical Engineering Thermodynamics}, Second Edition. Prentice Hall:
% Upper Saddle River, 2012. Loads the default package options and
-% redefines \cs{allcomponents} and \cs{Deltarxn} to fit their notation.
+% redefines \cs{IG}, \cs{IGM}, \cs{allcomponents}, and \cs{Deltarxn} to fit
+% their notation.
% \item[Koretsky] Notation used by Koretsky, \emph{Engineering and Chemical
% Thermodynamics}, Second Edition, Wiley: New Caledonia, 2013.
% Loads the non-default package options \verb"EUAGHAn", \verb"brackets",
@@ -1396,15 +1620,15 @@
% \verb"EUFGHAn", \verb"intensive-lowercase", and \verb"delta"; removes the
% left parenthesis in partial derivatives and redefines \cs{IGM}, \cs{IG},
% \cs{expansitivitysymbol}, \cs{allcomponents}, \cs{allbut}, \cs{Ft},
-% \cs{Helmholtz@symbol}, \cs{@intensive}, \cs{@specific}, \cs{fmix},
-% \cs{phimix}, and \cs{pressure@symbol} to fit their somewhat ill-advised
-% notation. Also resets \cs{partialmolar} to match their use.
+% \cs{fmix}, and \cs{phimix}, as well as symbols for the Helmholtz free
+% energy and pressure, intensive and specific property notation, and
+% partial molar notation to fit their somewhat ill-advised notation.
% \item[Prausnitz] Notation used by Prausnitz, Lichtenthaler, and de Azevedo,
% \emph{Molecular Thermodynamics of Fluid-Phase Equilibria}, Third Edition,
% Pearson, 1998. Loads the non-default package option
% \verb"intensive-lowercase" and redefines \cs{fmix}, \cs{phimix},
-% \cs{fpure}, \cs{phipure}, \cs{residual}, \cs{allcomponents}, and
-% \cs{allbut} to fit their notation.
+% \cs{fpure}, \cs{phipure}, \cs{Henryrat}, \cs{residual},
+% \cs{allcomponents}, and \cs{allbut} to fit their notation.
% \item[Sandler] Notation used by Sandler, \emph{Chemical, Biochemical, and
% Engineering Thermodynamics}, Fifth Edition. Wiley: Hoboken, 2017.
% Loads non-default package options \verb"EUAGHaN" and
@@ -1430,28 +1654,42 @@
% \cs{Henrymol}, \cs{gammarat}, and \cs{gammamol} to fit their style.
% \item[Thompson] Notation used by Thompson, \emph{A Unified Introduction to
% Chemical Engineering Thermodynamics}, Stillwater Press: Orono, 2000.
-% Loads the non-default package options \verb"EUAGHAn" and \verb"delta";
-% also redefines \cs{excess}, \cs{residual}, \cs{allcomponents},
-% \cs{ncomponents}, \cs{IS}, \cs{IG}, \cs{IGM}, \cs{fpure}, \cs{phipure},
-% \cs{mix}, \cs{Deltamix}, \cs{Deltarxn}, \cs{@intensive}, and \cs{allbut}
-% to match his notation. Note that he uses $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.
+% Loads the non-default package options |EUAGHAn| and |delta|;
+% also redefines \cs{excess}, \cs{residual}, \cs{Henryrat}, \cs{Henrymol},
+% \cs{allcomponents}, \cs{ncomponents}, \cs{IS}, \cs{IG}, \cs{IGM},
+% \cs{fpure}, \cs{phipure}, \cs{mix}, \cs{Deltamix}, \cs{Deltarxn}, and
+% \cs{allbut} to match his notation, plus adjustments to intensive (molar)
+% properties. 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.
+%^^X \end{documentation}
%
+% \setcounter{IndexColumns}{2}
% \StopEventually{\PrintChanges\PrintIndex}
%
% ^^A--------------------------------------------------------------------------
% \iffalse
%<*package>
+%<@@=thermodynamics>
% \fi
%
+%^^X\begin{implementation}
% \section{Implementation}
-% This package requires the \verb"amstext" package, as \cs{text} is used to
+% 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.
@@ -1469,47 +1707,57 @@
% 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 \verb"lmodern"),
-% Palatino (through \verb"pxfonts" or \verb"newpxmath"),
-% Times (through \verb"txfonts", \verb"mathptmx", or \verb"newtxmath"),
-% Utopia (through \verb"mathdesign"),
-% Bitstream Charter (through \verb"mathdesign"), and
-% Garamond (through \verb"mathdesign").
-% Definitions of \cs{dbar} (with \cs{newcommand*} or \cs{providecommand*})
+% 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}{%
- \providecommand*{\dbar}{{\mkern5mu\mathchar'26\mkern-10mu d}}%
+ \ProvideDocumentCommand{\dbar}{}
+ {\mkern5mu\mathchar'26\mkern-10mu d}
}{}
\@ifpackageloaded{newpxmath}{%
- \providecommand*{\dbar}{{\mkern5mu\mathchar'26\mkern-10mu d}}%
+ \ProvideDocumentCommand{\dbar}{}
+ {\mkern5mu\mathchar'26\mkern-10mu d}
}{}
\@ifpackageloaded{txfonts}{%
- \providecommand*{\dbar}{{\mkern5mu\mathchar'26\mkern-11mu d}}%
+ \ProvideDocumentCommand{\dbar}{}
+ {\mkern5mu\mathchar'26\mkern-11mu d}
}{}
\@ifpackageloaded{mathptmx}{%
- \providecommand*{\dbar}{{\mkern5mu\mathchar'26\mkern-10mu d}}%
+ \ProvideDocumentCommand{\dbar}{}
+ {\mkern5mu\mathchar'26\mkern-10mu d}
}{}
\@ifpackageloaded{newtxmath}{%
- \providecommand*{\dbar}{{\mkern5mu\mathchar'26\mkern-12mu d}}%
+ \ProvideDocumentCommand{\dbar}{}
+ {\mkern5mu\mathchar'26\mkern-11mu d}
}{}
\@ifpackageloaded{mathdesign}{%
- \def\@charter{mdbch}%
- \def\@utopia{mdput}%
- \def\@garamond{mdugm}%
- \ifx\MD@default@family\@utopia
- \providecommand*{\dbar}{{\mkern8mu\mathchar'26\mkern-20mu d}}%
- \fi
- \ifx\MD@default@family\@charter
- \providecommand*{\dbar}{{\mkern5mu\mathchar'26\mkern-15mu d}}%
- \fi
- \ifx\MD@default@family\@garamond
- \providecommand*{\dbar}{{\mkern5mu\mathchar'26\mkern-17mu d}}%
- \fi
+ \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
- \providecommand*{\dbar}{{\mkern3mu\mathchar'26\mkern-12mu d}}
+ \ProvideDocumentCommand{\dbar}{}
+ {\mkern3mu\mathchar'26\mkern-12mu d}
}
% \end{macrocode}
% \end{macro}
@@ -1521,30 +1769,16 @@
% their own, but rather accessed through the macros \cs{Ut}, \cs{Um}, and
% \cs{Us} (using the internal energy as an example).
%
-% \begin{macro}{\totalenergy@symbol}
-% \begin{macro}{\internalenergy@symbol}
-% \begin{macro}{\Helmholtz@symbol}
-% \begin{macro}{\Gibbs@symbol}
-% \begin{macro}{\Landau@symbol}
-% \begin{macro}{\enthalpy@symbol}
-% \begin{macro}{\entropy@symbol}
-% \begin{macro}{\area@symbol}
-% \begin{macro}{\volume@symbol}
-% \begin{macro}{\mole@symbol}
-% \begin{macro}{\heat@symbol}
-% \begin{macro}{\work@symbol}
-% \begin{macro}{\temperature@symbol}
-% \begin{macro}{\pressure@symbol}
% 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 these macros inside
-% \cs{makeatletter}\dots\cs{makeatother}. For example,
+% redefine the internal token lists inside
+% \cs{ExplSyntaxOn}\dots\cs{ExplSyntaxOff}. For example,
% \begin{verbatim}
-% \makeatletter
-% \renewcommand*{\Helmholtz@symbol}{H}
-% \renewcommand*{\enthalpy@symbol}{h}
-% \makeatother
+% \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.
@@ -1553,208 +1787,236 @@
% 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}
-\newcommand*{\totalenergy@symbol}{E}
-\newcommand*{\internalenergy@symbol}{U}
-\newcommand*{\Helmholtz@symbol}{A}
-\newcommand*{\Gibbs@symbol}{G}
-\newcommand*{\Landau@symbol}{\Omega}
-\newcommand*{\enthalpy@symbol}{H}
-\newcommand*{\entropy@symbol}{S}
-\newcommand*{\area@symbol}{a}
-\newcommand*{\volume@symbol}{V}
-\newcommand*{\mole@symbol}{n}
-\newcommand*{\heat@symbol}{Q}
-\newcommand*{\work@symbol}{W}
-\newcommand*{\temperature@symbol}{T}
-\newcommand*{\pressure@symbol}{P}
+\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
+\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}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\thermo@underline}
-% \begin{macro}{\thermo@overline}
-% We then define two macros and several lengths that we shall use when
+% 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 would work better as kern 0.1*width, symbol, kern 0.2*width
+%^^A TODO these might work better as kern 0.1*width, symbol, kern 0.2*width
% \begin{macrocode}
-\newcommand*{\thermo@underline}[1]{%
- \mkern1mu\underline{\mkern-1mu #1\mkern-4mu}\mkern4mu%
-}
-\newcommand*{\thermo@overline}[1]{%
- \mkern2mu\overline{\mkern-2mu #1\mkern-1mu}\mkern1mu%
-}
+\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}
-% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\PartialOpen}
-% \begin{macro}{\PartialClose}
-% \begin{macro}{\PartialEmptyClose}
+% \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 \verb"parentheses", meaning that \verb"\[ \Partial{f}{x}{y} \]" renders as
+% 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 \verb"bar"
-% option to the document class or inside the \verb"thermobar" environment.
+% 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}
-\newcommand*{\PartialOpen}{(}
-\newcommand*{\PartialClose}{)}
-\newcommand*{\PartialEmptyClose}{)}
+\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}
-% \end{macro}
-% \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}{\renewcommand*{\mole@symbol}{N}}%
+\DeclareOption{EUAGHaN}{\tl_gset:Nn \g_@@_mole_symbol N}%
\DeclareOption{EUHAGan}{\ExecuteOptions{EUAGHan}}
\DeclareOption{EUHAGaN}{\ExecuteOptions{EUAGHaN}}
-\DeclareOption{EUFGHAn}{% this is my favorite set of symbols
- \renewcommand*{\Helmholtz@symbol}{F}%
- \renewcommand*{\area@symbol}{A}%
-}
-\DeclareOption{EUFGHAN}{% this is my second favorite set of symbols
- \renewcommand*{\Helmholtz@symbol}{F}%
- \renewcommand*{\area@symbol}{A}%
- \renewcommand*{\mole@symbol}{N}%
-}
-\DeclareOption{EEFGHAn}{% this treats all energy the same way(?)
- \renewcommand*{\internalenergy@symbol}{E}%
- \renewcommand*{\Helmholtz@symbol}{F}%
- \renewcommand*{\area@symbol}{A}%
-}
-\DeclareOption{EEFGHAN}{% this treats all energy the same way(?)
- \renewcommand*{\internalenergy@symbol}{E}%
- \renewcommand*{\Helmholtz@symbol}{F}%
- \renewcommand*{\area@symbol}{A}%
- \renewcommand*{\mole@symbol}{N}%
+\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}{%
- \renewcommand*{\internalenergy@symbol}{E}%
- \renewcommand*{\Helmholtz@symbol}{F}
+ \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}{%
- \renewcommand*{\internalenergy@symbol}{E}%
- \renewcommand*{\Helmholtz@symbol}{F}
- \renewcommand*{\mole@symbol}{N}%
+ \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}{%
- \renewcommand*{\internalenergy@symbol}{E}%
+ \tl_gset:Nn \g_@@_total_energy_symbol {\mathcal{E}}
+ \tl_gset:Nn \g_@@_internal_energy_symbol E
}
\DeclareOption{EEAGHaN}{%
- \renewcommand*{\internalenergy@symbol}{E}%
- \renewcommand*{\mole@symbol}{N}%
+ \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}{% Helmholtz free energy and area look the same here
- \renewcommand*{\area@symbol}{A}%
+\DeclareOption{EUAGHAn}{%
+ \tl_gset:Nn \g_@@_area_symbol {\mathcal{A}}
}
-\DeclareOption{EUAGHAN}{% Helmholtz free energy and area look the same here
- \renewcommand*{\area@symbol}{A}%
- \renewcommand*{\mole@symbol}{N}%
+\DeclareOption{EUAGHAN}{%
+ \tl_gset:Nn \g_@@_area_symbol {\mathcal{A}}
+ \tl_gset:Nn \g_@@_mole_symbol N
}
\DeclareOption{EUFGHan}{%
- \renewcommand*{\Helmholtz@symbol}{F}%
+ \tl_gset:Nn \g_@@_Helmholtz_symbol F
}
\DeclareOption{EUFGHaN}{%
- \renewcommand*{\Helmholtz@symbol}{F}%
- \renewcommand*{\mole@symbol}{N}%
+ \tl_gset:Nn \g_@@_Helmholtz_symbol F
+ \tl_gset:Nn \g_@@_mole_symbol N
}
% \end{macrocode}
-% The \verb"delta" option redefines \cs{dbar} to produce the symbol $\delta$.
+% 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}{\let\dbar\delta}
+\DeclareOption{delta}{ \cs_set_eq:NN \dbar \delta }
% \end{macrocode}
%
-% \begin{macro}{\@extensive}
-% \begin{macro}{\@intensive}
-% \begin{macro}{\@specific}
% Next, we define options for the set of notation. The default is
-% \verb"intensive-plain", which produces things like $V$ for molar volume,
+% |intensive-plain|, which produces things like $V$ for molar volume,
% $\Vt$ for total volume, and $\hat V$ for specific volume.
-% These are defined via the internal macros \verb"\@extensive",
-% \verb"\@intensive", and \verb"\@specific".
-% \begin{macrocode}
-\let\@extensive\relax
-\let\@intensive\relax
-\let\@specific\hat
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
+% The symbols themselves are produced via internal (non-user-facing) macros.
% \begin{macrocode}
-\DeclareOption{extensive-plain}{%
- \let\@extensive\relax
- \let\@intensive\thermo@underline
+\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}}
}
-\DeclareOption{intensive-plain}{% the default
- \let\@extensive\thermo@underline
- \let\@intensive\relax
+\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: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!
- \let\@extensive\MakeUppercase
- \let\@intensive\MakeLowercase
- \def\@specific#1{\MakeLowercase{\hat #1}}
- \AtEndOfPackage{
- \renewcommand*{\partialmolar}[1]{%
- \gdef\pm@symbol{\MakeLowercase #1}\generic@pm}
- \renewcommand*{\heatcapacitysymbol}{c}
- }
+ \@@_set_intensive_lowercase
+ \AtEndOfPackage{
+ \@@_set_lowercase_pms
+ \RenewDocumentCommand{\heatcapacitysymbol}{}{c}
+ }
}
\DeclareOption{extensive-superscript}{%
- \gdef\@extensive#1{{#1}^t}%
- \let\@intensive\relax%
- \AtEndOfPackage{%
- \renewcommand*{\URt}{\internalenergy@symbol^{\residual,t}}
- \renewcommand*{\HRt}{\enthalpy@symbol^{\residual,t}}
- \renewcommand*{\FRt}{\Helmholtz@symbol^{\residual,t}}
- \renewcommand*{\GRt}{\Gibbs@symbol^{\residual,t}}
- \renewcommand*{\VRt}{\volume@symbol^{\residual,t}}
- \renewcommand*{\SRt}{\entropy@symbol^{\residual,t}}
- \renewcommand*{\UEt}{\internalenergy@symbol^{\excess,t}}
- \renewcommand*{\HEt}{\enthalpy@symbol^{\excess,t}}
- \renewcommand*{\FEt}{\Helmholtz@symbol^{\excess,t}}
- \renewcommand*{\GEt}{\Gibbs@symbol^{\excess,t}}
- \renewcommand*{\VEt}{\volume@symbol^{\excess,t}}
- \renewcommand*{\SEt}{\entropy@symbol^{\excess,t}}
- }
+ \@@_set_extensive_superscripts
+ \AtEndOfPackage{%
+ \RenewDocumentCommand{\URt}{}{\g_@@_internal_energy_symbol
+ \c_math_superscript_token{\residual,t}}
+ \RenewDocumentCommand{\HRt}{}{\g_@@_enthalpy_symbol
+ \c_math_superscript_token{\residual,t}}
+ \RenewDocumentCommand{\FRt}{}{\g_@@_Helmoholtz_symbol
+ \c_math_superscript_token{\residual,t}}
+ \RenewDocumentCommand{\GRt}{}{\g_@@_Gibbs_symbol
+ \c_math_superscript_token{\residual,t}}
+ \RenewDocumentCommand{\VRt}{}{\g_@@_volume_symbol
+ \c_math_superscript_token{\residual,t}}
+ \RenewDocumentCommand{\SRt}{}{\g_@@_entropy_symbol
+ \c_math_superscript_token{\residual,t}}
+ \RenewDocumentCommand{\UEt}{}{\g_@@_internal_energy_symbol
+ \c_math_superscript_token{\excess,t}}
+ \RenewDocumentCommand{\HEt}{}{\g_@@_enthalpy_symbol
+ \c_math_superscript_token{\excess,t}}
+ \RenewDocumentCommand{\FEt}{}{\g_@@_Helmoholtz_symbol
+ \c_math_superscript_token{\excess,t}}
+ \RenewDocumentCommand{\GEt}{}{\g_@@_Gibbs_symbol
+ \c_math_superscript_token{\excess,t}}
+ \RenewDocumentCommand{\VEt}{}{\g_@@_volume_symbol
+ \c_math_superscript_token{\excess,t}}
+ \RenewDocumentCommand{\SEt}{}{\g_@@_entropy_symbol
+ \c_math_superscript_token{\excess,t}}
+ }
}
% \end{macrocode}
%
% The next two options choose whether variables held constant are subscripted
-% (the default) or placed next to the function. The \verb"nosubscripts"
-% option currently requires that the variable being changed is the first one
-% in the argument list. The difference is
-% \[ \left(\frac{\partial U}{\partial S}\right)_V \quad\text{versus}\quad
-% \left(\frac{\partial U(S,V)}{\partial S}\right) \]
+% (the default) or placed next to the function. The difference is
+%%^^A \[ \left(\frac{\partial U}{\partial S}\right)_V \quad\text{versus}\quad
+%%^^A \left(\frac{\partial U(S,V)}{\partial S}\right) \]
+% \[ \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}
-\newif\if@subscripted
-\@subscriptedtrue
-\DeclareOption{subscripts}{\@subscriptedtrue}
-\DeclareOption{nosubscripts}{\@subscriptedfalse}
+\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,
@@ -1762,42 +2024,38 @@
% \begin{macrocode}
\DeclareOption{parentheses}{}
\DeclareOption{brackets}{%
- \renewcommand*{\PartialOpen}{[}%
- \renewcommand*{\PartialClose}{]}%
- \renewcommand*{\PartialEmptyClose}{]}%
+ \tl_set:Nn \l_@@_PartialOpen_tl {[}
+ \tl_set:Nn \l_@@_PartialClose_tl {]}
+ \tl_set:Nn \l_@@_PartialEmptyClose_tl {]}
}
\DeclareOption{braces}{%
- \renewcommand*{\PartialOpen}{\{}%
- \renewcommand*{\PartialClose}{\}}%
- \renewcommand*{\PartialEmptyClose}{\}}%
+ \tl_set:Nn \l_@@_PartialOpen_t1 {\{}
+ \tl_set:Nn \l_@@_PartialClose_t1 {\}}
+ \tl_set:Nn \l_@@_PartialEmptyClose_tl {\}}
}
\DeclareOption{bar}{%
- \renewcommand*{\PartialOpen}{.}%
- \renewcommand*{\PartialClose}{\rvert}%
- \renewcommand*{\PartialEmptyClose}{.}%
+ \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
- \renewcommand*{\PartialOpen}{.}%
- \renewcommand*{\PartialClose}{.}%
- \renewcommand*{\PartialEmptyClose}{.}%
- \ExecuteOptions{nosubscripts}%
+ \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.
+% and related macros. The command is expandable so we can perform comparisons
+% to user-entered values.
% \begin{macrocode}
-\newcommand*{\ncomponents}{C}
+\NewExpandableDocumentCommand \ncomponents {} {C}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\allNs}
-% \begin{macro}{\allNsbut}
-% \begin{macro}{\allMs}
-% \begin{macro}{\allmus}
-% \begin{macro}{\allMsbut}
-% \begin{macro}{\allmusbut}
+% \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
@@ -1811,25 +2069,15 @@
% masses: \cs{allmus} and \cs{allmusbut} and \cs{allMs} and \cs{allMsbut},
% respectively.
% \begin{macrocode}
-\newcommand*{\allNs}{\allcomponents{\Nt}}
-\newcommand*{\allXs}{\allcomponents{x}}
-\newcommand*{\allYs}{\allcomponents{y}}
-\newcommand*{\allmus}{\allcomponents{\mu}}
-\newcommand*{\allMs}{\allcomponents{m}}
-\newcommand*{\allWs}{\allcomponents{w}}%
+\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}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \begin{macro}{\allXs}
-% \begin{macro}{\allYs}
-% \begin{macro}{\allWs}
-% \begin{macro}{\allWsbut}
-% \begin{macro}{\allXsbut}
-% \begin{macro}{\allYsbut}
+% \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
@@ -1842,98 +2090,89 @@
% \[ \Partial{G}{T}{P,\allXs} = -S \qquad
% \Partial{G}{x_i}{T,P,x_{j\neq i,C}} \neq \Gpm{i}. \]
% \begin{macrocode}
-\newcommand*{\allNsbut}[2][j]{\allbut[#1]{#2}{\Nt}}
-\newcommand*{\allXsbut}[2][j]{\allbutlastand[#1]{#2}{x}}
-\newcommand*{\allYsbut}[2][j]{\allbutlastand[#1]{#2}{y}}
-\newcommand*{\allmusbut}[2][j]{\allbut[#1]{#2}{\mu}}
-\newcommand*{\allMsbut}[2][j]{\allbut[#1]{#2}{m}}
-\newcommand*{\allWsbut}[2][j]{\allbutlastand[#1]{#2}{w}}%
+\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}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \begin{macro}{\allbutlastand}
-% \begin{macro}{\allbut}
-% \begin{macro}{\allcomponents}
+% \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}
-% \newcommand*{\allZsbut}[2][j]{\allbutlastand[#1]{#2}{z}}
+% \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}
-% \newcommand*{\allCs}{\allcomponents{C}}
+% \NewDocumentCommand{\allCs}{O{}}{\allcomponents{C}}
%\end{verbatim}
% \begin{macrocode}
-\newcommand*{\allcomponents}[1]{\vec{#1}}
-\newcommand*{\allbut}[3][j]{%
- \def\tmp@arg{#2}%
- \def\tmp@@arg{#1}%
- \ifx\tmp@arg\tmp@@arg
- {#3}_{k\neq #2}%
- \else
- {#3}_{#1\neq #2}%
- \fi
-}
-\newcommand*{\allbutlastand}[3][j]{%
- \edef\tmp@arg{#1}%
- \edef\tmp@@arg{#2}%
- \ifx\tmp@@arg\ncomponents
- {#3}_{#1 \neq #2}%
- \else
- \ifx\tmp@arg\tmp@@arg
- {#3}_{k \neq #2,\ncomponents}%
- \else
- {#3}_{#1 \neq #2,\ncomponents}%
- \fi
- \fi
+\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}
-% \end{macro}
-% \end{macro}
%
% We then define two package options that change how to render \cs{allNs} and
-% friends.
+% 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}{%
- \renewcommand*{\allcomponents}[1]{{#1}_1,\dots,{#1}_{\ncomponents}}
- \renewcommand*{\allbut}[3][j]{%
- \def\@one{1}%
- \edef\tmp@arg{#2}%
- \ifx\tmp@arg\@one
- {#3}_2,\dots,{#3}_{\ncomponents}%
- \else
- \ifx\tmp@arg\ncomponents
- {#3}_1,\dots,{#3}_{\ncomponents-1}%
- \else
- {#3}_1,\dots,[{#3}_{#2}],\dots,{#3}_{\ncomponents}%
- \fi
- \fi
+\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} }
+ }
}
- \renewcommand*{\allbutlastand}[3][j]{%
- \def\@one{1}%
- \edef\tmp@arg{#2}%
- \edef\@ncminusone{\ncomponents-1}%
- \ifx\tmp@arg\@one
- {#3}_2,\dots,{#3}_{\ncomponents-1}%
- \else
- \ifx\tmp@arg\@ncminusone
- {#3}_1,\dots,{#3}_{\ncomponents-2}%
- \else
- \ifx\tmp@arg\ncomponents
- {#3}_1,\dots,{#3}_{\ncomponents-1}%
- \else
- {#3}_1,\dots,[{#3}_{#2}],\dots,{#3}_{\ncomponents}%
- \fi
- \fi
- \fi
+ \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}
@@ -1941,223 +2180,288 @@
% \begin{macrocode}
\DeclareOption{Bejan}{
\ExecuteOptions{EUFGHAN,intensive-lowercase,delta}
- \let\@specific\MakeLowercase
- \def\@intensive#1{\MakeLowercase{\bar #1}}
- \AtEndOfPackage{
- \DeclareSubscrSymbol{cV}{\bar\heatcapacitysymbol}{v}
- \DeclareSubscrSymbol{cVs}{\heatcapacitysymbol}{v}
- \DeclareSubscrSymbol{cVt}{\Nt\heatcapacitysymbol}{v}
- \renewcommand*{\expansivitysymbol}{\beta}
- \renewcommand*{\ncomponents}{n}
- }
+ \cs_set:Nn \@@_specific:n {\text_lowercase:n {#1}}
+ \cs_set:Nn \@@_intensive:n {\bar{\text_lowercase:n {#1}}}
+ \tl_gset:Nn \g_@@_volume_symbol v
}
\DeclareOption{CBK}{
\ExecuteOptions{EUAGHAN,intensive-lowercase}
\AtEndOfPackage{
- \let\thermo@overline\widetilde
- \let\@specific\MakeLowercase
- \renewcommand*{\@intensive}[1]{\MakeLowercase{\bar{#1}}}
- \renewcommand*{\pressure@symbol}{p}
- \renewcommand*{\Deltarxn}[1]{#1_R}
- \renewcommand*{\compressibilitysymbol}{\beta}
- \renewcommand*{\expansivitysymbol}{\alpha}
+ \cs_set:Nn \@@_overline: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_@@_pressure_symbol p
+ \RenewDocumentCommand{\Deltarxn}{m}{{#1}\c_math_subscript_token R}
+ \RenewDocumentCommand{\compressibilitysymbol}{}{\beta}
+ \RenewDocumentCommand{\expansivitysymbol}{}{\alpha}
}
}
\DeclareOption{ElliottLira}{
\AtEndOfPackage{
- \renewcommand*{\allcomponents}[1]{#1}
- \renewcommand*{\Deltarxn}[1]{\Delta #1}
+ \RenewDocumentCommand{\allcomponents}{O{} m}{#2}
+ \RenewDocumentCommand{\Deltarxn}{m}{\Delta #1}
+ \RenewDocumentCommand{\IG}{}{{\text{ig}}}
+ \RenewDocumentCommand{\IGM}{}{{\text{ig}}}
+ \RenewDocumentCommand{\IS}{}{{\text{is}}}
}
}
\DeclareOption{Koretsky}{
\ExecuteOptions{EUAGHAn,brackets,intensive-lowercase,delta}
\AtEndOfPackage{
- \renewcommand*{\partialmolar}[1]{\gdef\pm@symbol{#1}\generic@pm}
- \renewcommand*{\expansivitysymbol}{\beta}
- \renewcommand*{\IS}{{\text{ideal}}}
- \renewcommand*{\residual}{{\text{dep}}}
- \renewcommand*{\IG}{{\text{ideal}}}
- \renewcommand*{\IGM}{{\text{ideal}}}
- \renewcommand*{\Deltafus}[1]{\Delta{#1}_\fusion}
- \renewcommand*{\Deltasub}[1]{\Delta{#1}_\sublimation}
- \renewcommand*{\Deltavap}[1]{\Delta{#1}_\vaporization}
- \renewcommand*{\Henryrat}{{\mathcal{H}}}
- \renewcommand*{\gammarat}{\gamma^\text{Henry's}}
- \let\phipure\varphi
- \renewcommand*{\phimix}{\hat\varphi}
- \renewcommand*{\phisat}{\varphi^\sat}
- \let\Delta@fus@sym\relax
- \DeclareSubscrSymbol{@Deltafus}{\Delta@fus@sym}{\fusion}
- \renewcommand*{\Deltafus}[1]{\def\Delta@fus@sym{\Delta #1}\@Deltafus}
- \let\Delta@vap@sym\relax
- \DeclareSubscrSymbol{@Deltavap}{\Delta@vap@sym}{\vaporization}
- \renewcommand*{\Deltasub}[1]{\def\Delta@sub@sym{\Delta #1}\@Deltasub}
- \let\Delta@sub@sym\relax
- \DeclareSubscrSymbol{@Deltasub}{\Delta@sub@sym}{\sublimation}
- \renewcommand*{\Deltasub}[1]{\def\Delta@sub@sym{\Delta #1}\@Deltasub}
+ %^^A Undo part of intensive-lowercase
+ \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}}}
+ \RenewDocumentCommand{\IGM}{}{{\text{ideal}}}
+ \RenewDocumentCommand{\Henryrat}{}{{\mathcal{H}}}
+ \RenewDocumentCommand{\gammarat}{}
+ {\gamma\c_math_superscript_token\text{Henry's}}
+ \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}
+ %^^A Undo part of intensive-lowercase
+ \RenewDocumentCommand{\Deltasub}{m}{
+ \cs_set:Npn \Delta_sub_sym {} { \Delta #1 }
+ \Delta_sub
+ }
}
}
\DeclareOption{MSBB}{
\ExecuteOptions{EUFGHAn,intensive-lowercase,delta}
\AtEndOfPackage{
- \renewcommand*{\IGM}{\ast}
- \renewcommand*{\IG}{\ast}
- \renewcommand*{\expansivitysymbol}{\beta}
- \renewcommand*{\allcomponents}[1]{#1}
- \renewcommand*{\allbut}[3][j]{%
- \def\tmp@arg{#2}%
- \def\tmp@@arg{#1}%
- \ifx\tmp@arg\tmp@@arg
- {#3}_{k}%
- \else
- {#3}_{#1}%
- \fi
+ \RenewDocumentCommand{\IGM}{}{\ast}
+ \RenewDocumentCommand{\IG}{}{\ast}
+ \RenewDocumentCommand{\expansivitysymbol}{}{\beta}
+ \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}
+ \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
+ \RenewDocumentCommand{\partialmolar}{m}
+ {
+ \tl_set:Nn \l_@@_pm_symbol_tl {#1}
+ \@@_generic_pm:
}
- \let\Helmholtz@symbol\psi
- \renewcommand*{\Ft}{\Psi}
- \def\@intensive#1{\MakeLowercase{\thermo@overline #1}}
- \let\@specific\MakeLowercase
- \renewcommand*{\partialmolar}[1]{\gdef\pm@symbol{#1}\generic@pm}
- \renewcommand*{\fmix}{\bar f}
- \renewcommand*{\phimix}{\bar\phi}
- \renewcommand*{\pressure@symbol}{p}
}
}
\DeclareOption{Prausnitz}{
\ExecuteOptions{intensive-lowercase}
\AtEndOfPackage{
- \renewcommand*{\fmix}{f}
- \let\phimix\phi
- \renewcommand*{\fsat}{\fpure^\sat}
- \DeclareSubscrSymbol{fpure}{f}{{\text{pure}}}
- \DeclareSubscrSymbol{phipure}{\phi}{{\text{pure}}}
- \renewcommand*{\residual}{{{\mathcal{R}}}}
- \renewcommand*{\allcomponents}[1]{{#1}_i}
- \renewcommand*{\allbut}[3][j]{%
- \def\tmp@arg{#2}%
- \def\tmp@@arg{#1}%
- \ifx\tmp@arg\tmp@@arg
- {#3}_{k}%
- \else
- {#3}_{#1}%
- \fi
+ \RenewDocumentCommand{\fmix}{}{f}
+ \RenewDocumentCommand{\phimix}{}{\phi}
+ \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}
+ \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} }
}
+ \RenewSubscriptedSymbol{\fpure}{f}{{\text{pure}}}
+ \RenewSubscriptedSymbol{\phipure}{\phi}{{\text{pure}}}
}
}
\DeclareOption{Sandler}{
\ExecuteOptions{EUAGHaN,extensive-plain}
\AtEndOfPackage{
- \renewcommand*{\sat}{{\text{vap}}}
- \renewcommand*{\excess}{{\text{{ex}}}}
- \renewcommand*{\residual}{{\text{r}}}
- \renewcommand*{\ncomponents}{\mathcal{C}}
- \renewcommand*{\fmix}{\bar f}
- \renewcommand*{\fstd}{\bar f^\circ}
- \renewcommand*{\phimix}{\bar\phi}
- \renewcommand*{\allcomponents}[1]{\thermo@underline{#1}}
- \renewcommand*{\IG}{{\text{IG}}}
- \renewcommand*{\IGM}{{\text{IGM}}}
- \renewcommand*{\IS}{{\text{IM}}}
- \renewcommand*{\Deltamix}[1]{\Delta_\mixing #1}
- \renewcommand*{\Deltarxn}[1]{\Delta_\reaction #1}
- \renewcommand*{\Deltasub}[1]{\Delta_\sublimation #1}
- \renewcommand*{\Deltafus}[1]{\Delta_\fusion #1}
- \renewcommand*{\Deltavap}[1]{\Delta_\vaporization #1}
- \renewcommand*{\Henryrat}{H}
- \DeclareSubscrSymbol{cV}{\heatcapacitysymbol}{\volume@symbol}
- \DeclareSubscrSymbol{cP}{\heatcapacitysymbol}{\pressure@symbol}
- \DeclareSubscrSymbol{cVt}{\Nt\heatcapacitysymbol}{\volume@symbol}
- \DeclareSubscrSymbol{cPt}{\Nt\heatcapacitysymbol}{\pressure@symbol}
+ \RenewDocumentCommand{\sat}{}{{\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{\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}
}
}
\DeclareOption{SVNAS}{
\ExecuteOptions{extensive-superscript}
\AtEndOfPackage{
- \renewcommand*{\allcomponents}[1]{#1}
- \renewcommand*{\allbut}[3][j]{%
- \def\tmp@arg{#2}%
- \def\tmp@@arg{#1}%
- \ifx\tmp@arg\tmp@@arg
- {#3}_{k}%
- \else
- {#3}_{#1}%
- \fi
+ \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} }
}
- \renewcommand*{\IG}{{ig}}
- \renewcommand*{\IGM}{{ig}}
- \renewcommand*{\IS}{{id}}
- \renewcommand*{\expansivitysymbol}{\beta}
- \renewcommand*{\Deltarxn}[1]{\Delta #1}
- \DeclareSubscrSymbol{cVt}{\Nt\heatcapacitysymbol}{\volume@symbol}
- \DeclareSubscrSymbol{cPt}{\Nt\heatcapacitysymbol}{\pressure@symbol}
+ \RenewDocumentCommand{\IG}{}{{ig}}
+ \RenewDocumentCommand{\IGM}{}{{ig}}
+ \RenewDocumentCommand{\IS}{}{{id}}
+ \RenewDocumentCommand{\expansivitysymbol}{}{\beta}
+ \RenewDocumentCommand{\Deltarxn}{m}{\Delta #1}
+ \RenewSubscriptedSymbol{\cVt}
+ {\Nt\heatcapacitysymbol}{\g_@@_volume_symbol}
+ \RenewSubscriptedSymbol{\cPt}
+ {\Nt\heatcapacitysymbol}{\g_@@_pressure_symbol}
}
}
\DeclareOption{TesterModell}{
\ExecuteOptions{EUAGHaN,delta}
\AtEndOfPackage{
- \renewcommand*{\ncomponents}{n}
- \renewcommand*{\allcomponents}[1]{{#1}_i}
- \renewcommand*{\allbut}[3][j]{%
- \def\tmp@arg{#2}%
- \def\tmp@@arg{#1}%
- \ifx\tmp@arg\tmp@@arg
- {#3}_k\relax[#2]
- \else
- {#3}_{#1}\relax[#2]
- \fi
+ \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] }
}
- \renewcommand*{\allbutlastand}[3][j]{%
- \edef\tmp@arg{#1}%
- \edef\tmp@@arg{#2}%
- \ifx\tmp@@arg\ncomponents
- {#3}_{#1}\relax[#2]%
- \else
- \ifx\tmp@arg\tmp@@arg
- {#3}\relax[#2,\ncomponents]%
- \else
- {#3}\relax[#2,\ncomponents]%
- \fi
- \fi
+ \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] }
+ }
}
- \renewcommand*{\IG}{{ig}}
-% Tester & Modell never use "igm" anywhere, and I only found ig once
- \renewcommand*{\IGM}{{igm}}
- \renewcommand*{\IS}{{ID}}
- \renewcommand*{\excess}{{EX}}%
- \renewcommand*{\reaction}{{rx}}
- \renewcommand*{\Henryrat}{f^{\ast\ast}}
- \renewcommand*{\Henrymol}{f^\ast}
- \renewcommand*{\gammarat}{\gamma^{\ast\ast}}
- \renewcommand*{\gammamol}{\gamma^\ast}
+ \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}
+ \RenewDocumentCommand{\gammarat}{}
+ {\gamma\c_math_superscript_token{\ast\ast}}
+ \RenewDocumentCommand{\gammamol}{}
+ {\gamma\c_math_superscript_token\ast}
+ \RenewExpandableDocumentCommand{\JTsymbol}{}{\alpha}
+ \RenewSubscriptedSymbol{\muJT}{\JTsymbol}{H}
}
}
\DeclareOption{Thompson}{
\ExecuteOptions{EUAGHAn,delta}
- \AtEndOfPackage{
- \renewcommand*{\excess}{{EX}}
- \renewcommand*{\residual}{{R}}
- \renewcommand*{\allcomponents}[1]{{#1}_j}
- \renewcommand*{\ncomponents}{c}
- \renewcommand*{\IS}{{IS}}
- \renewcommand*{\IG}{{IG}}
- \let\IGM\IG
- \def\@fpure_#1{f_{#1}\@ifnextchar^{}{^\bullet}}
- \renewcommand*{\fpure}{\@ifnextchar_{\@fpure}{f}}
- \def\@phi@pure_#1{\phi_{#1}\@ifnextchar^{}{^\bullet}}
- \renewcommand*{\phipure}{\@ifnextchar_{\@phi@pure}{\phi}}
- \renewcommand*{\mixing}{{MIX}}
- \renewcommand*{\Deltamix}[1]{\Delta_\mixing #1}
- \renewcommand*{\Deltarxn}[1]{\Delta #1}
- \def\@@intensive_#1{_{#1}\@ifnextchar^{}{^\bullet}}
- \newcommand*{\@intensive}[1]{#1\@ifnextchar_{\@@intensive}{}}
- \renewcommand*{\allbut}[3][j]{%
- \def\tmp@arg{#2}%
- \def\tmp@@arg{#1}%
- \ifx\tmp@arg\tmp@@arg
- {#3}_{k}\neq{#3}_{#2}%
- \else
- {#3}_{#1}\neq{#3}_{#2}%
- \fi
+ \AtEndOfPackage
+ {
+ \RenewDocumentCommand{\excess}{}{{EX}}
+ \RenewDocumentCommand{\residual}{}{{R}}
+ %^^A He uses k_H for both types of Henry's constant, but I changed
+ %^^A the rational basis one just so there is SOME difference
+ \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{\mixing}{}{{MIX}}
+ \RenewDocumentCommand{\Deltamix}{m}
+ {\Delta\c_math_subscript_token\mixing #1}
+ \RenewDocumentCommand{\Deltarxn}{m}{\Delta #1}
+ \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}
+ }
}
}
}
@@ -2167,6 +2471,50 @@
\ExecuteOptions{EUAGHan,subscripts,parentheses,intensive-plain,moles-index}
\ProcessOptions
% \end{macrocode}
+% 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 |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.
@@ -2177,423 +2525,710 @@
% 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
+% We thus set \verb"operator_width" to be \emph{just} greater than the width of
% an equals sign.
-%^^A 3/1/2022: changed adjust@width to 2pt (up from 1pt)
-%^^A 4/21/2022: changed adjust@width to 0.1\operator@width (from 2pt)
% \begin{macrocode}
-\newlength{\Partial@const@width}
-\newlength{\operator@width}
-\settowidth{\operator@width}{=}
-\newlength{\adjust@width}
-\setlength{\adjust@width}{0.1\operator@width}
-\addtolength{\operator@width}{\adjust@width}
+\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*}
% \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
+% \cs{l_@@_Partial_const_dim} from $-0.15$ to $-0.20$}
% \begin{macrocode}
-\def\Partial@start{\left\PartialOpen}
-\def\Partial@end{\right\PartialClose}
-\def\Partial@empty@end{\right\PartialEmptyClose}
-\def\Partial{\@ifstar\Partial@star\Partial@nostar}
-%^^A Several ifs to use later (breaks it if these definitions are inside)
-\newif\iftwo@has@Nt
-\two@has@Ntfalse
-\newif\iftwo@has@xory
-\two@has@xoryfalse
-\newif\ifthree@has@Nt
-\three@has@Ntfalse
-\newif\ifthree@has@xory
-\three@has@xoryfalse
-\AtEndOfPackage{%
- \edef\thermo@Nt{\Nt}%
- \edef\thermo@x{x}%
- \edef\thermo@y{y}%
-}
-\def\thermo@parse@two#1\relax{%
- \@tfor\@i:=#1\do{%
- \edef\@@i{\@i}%
- \ifx\@@i\thermo@Nt
- \two@has@Nttrue
- \@break@tfor
- \fi
- \ifx\@@i\thermo@x
- \two@has@xorytrue
- \@break@tfor
- \fi
- \ifx\@@i\thermo@y
- \two@has@xorytrue
- \@break@tfor
- \fi
+\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
+ }
+ }
}
-}
-\newcommand*{\Partial@nostar}[3]{%
- \def\tmp@arg{#3}%
- \if@subscripted
- % Handles situation of empty variables held constant
- \ifx\tmp@arg\@empty
- \ensuremath{\Partial@start\frac{\partial #1}
- {\partial #2}\Partial@empty@end}%
- \else
- \ensuremath{\Partial@start\frac{\partial #1}
- {\partial #2}\Partial@end_{#3}}%
- \fi
- \else
- % If not subscripted, we put the arguments (if any) in the derivative
- \ifx\tmp@arg\@empty
- \ensuremath{\Partial@start\frac{\partial #1}
- {\partial #2}\Partial@empty@end}%
- \else
- % Check for whether #3 contains \allNsbut{i}/etc. and #2 is \Nt_i/etc.
- \thermo@parse@two#2\relax
- \iftwo@has@Nt
- \renewcommand*{\allbut}[3][j]{\allcomponents{##3}}%
- \ensuremath{\Partial@start\frac{\partial #1(#3)}
- {\partial #2}\Partial@end}%
- \else
- \iftwo@has@xory
- \renewcommand*{\allbutlastand}[3][j]{\allbut{\ncomponents}{##3}}%
- \ensuremath{\Partial@start\frac{\partial #1(#3)}
- {\partial #2}\Partial@end}%
- \else
- \ensuremath{\Partial@start\frac{\partial #1(#2,#3)}
- {\partial #2}\Partial@end}%
- \fi
- \fi
- \fi
- \fi
-}
-\newcommand*{\Partial@star}[3]{%
- \settowidth{\Partial@const@width}{\ensuremath{#3}}%
- \addtolength{\Partial@const@width}{-0.15\Partial@const@width}%
- \Partial@nostar{#1}{#2}{#3}%
- \if@subscripted
- \ifdim\operator@width<\Partial@const@width
- \kern -\operator@width
- \else
- \kern -\Partial@const@width
- \fi
- \fi
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\PartialBigg}
-% \begin{macro}{\PartialBigg*}
-% The \cs{PartialBigg} macro (and its starred form) replace the \cs{left}
-% and \cs{right} commands in \cs{Partial} with \verb"amsmath"'s \cs{Biggl}
-% and \cs{Biggr} variants. The starred form is inherited from \cs{Partial}
+% 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}
-\def\PartialBigg{%
- \def\Partial@start{\Biggl\PartialOpen}%
- \def\Partial@end{\Biggr\PartialClose}%
- \def\Partial@empty@end{\Biggr\PartialClose}%
- \Partial%
-}
+\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}
-% \end{macro}
% \begin{macro}{\Partialbigg}
-% \begin{macro}{\Partialbigg*}
% The \cs{Partialbigg} macro does the same thing as \cs{PartialBigg}, except
-% using \verb"amsmath"'s \cs{biggl}/\cs{biggr} variants.
+% using \pkg{amsmath}'s \tn{biggl}/\tn{biggr} variants.
% \begin{macrocode}
-\def\Partialbigg{%
- \def\Partial@start{\biggl\PartialOpen}%
- \def\Partial@end{\biggr\PartialClose}%
- \def\Partial@empty@end{\biggr\PartialClose}%
- \Partial%
-}
+\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}
-% \end{macro}
%
% \begin{macro}{\PartialSecond}
-% \begin{macro}{\PartialSecond*}
% The second partial derivatives are defined similarly to \cs{Partial}.
% \begin{macrocode}
-\def\PartialSecond{\@ifstar\PartialSecond@star\PartialSecond@nostar}
-\newcommand*{\PartialSecond@nostar}[3]{%
- \def\tmp@arg{#3}%
- \if@subscripted
- % Handles situation of empty variables held constant
- \ifx\tmp@arg\@empty
- \ensuremath{\Partial@start\frac{\partial^2 #1}
- {\partial #2^2}\Partial@empty@end}%
- \else
- \ensuremath{\Partial@start\frac{\partial^2 #1}
- {\partial #2^2}\Partial@end_{#3}}%
- \fi
- \else
- \ifx\tmp@arg\@empty
- \ensuremath{\Partial@start\frac{\partial^2 #1}
- {\partial #2^2}\Partial@empty@end}%
- \else
- % Check for whether #3 contains \allNsbut{i}/etc. and #2 is \Nt_i/etc.
- \thermo@parse@two#2\relax
- \iftwo@has@Nt
- \renewcommand*{\allbut}[3][j]{\allcomponents{##3}}%
- \ensuremath{\Partial@start\frac{\partial^2 #1(#3)}
- {\partial #2^2}\Partial@end}%
- \else
- \iftwo@has@xory
- \renewcommand*{\allbutlastand}[3][j]{\allbut{\ncomponents}{##3}}%
- \ensuremath{\Partial@start\frac{\partial^2 #1(#3)}
- {\partial #2^2}\Partial@end}%
- \else
- \ensuremath{\Partial@start\frac{\partial^2 #1(#2,#3)}
- {\partial {#2}^2}\Partial@end}%
- \fi
- \fi
- \fi
- \fi
-}
-\newcommand*{\PartialSecond@star}[3]{%
- \settowidth{\Partial@const@width}{\ensuremath{#3}}%
- \addtolength{\Partial@const@width}{-0.15\Partial@const@width}%
- \PartialSecond@nostar{#1}{#2}{#3}%
- \if@subscripted
- \ifdim\operator@width<\Partial@const@width
- \kern -\operator@width
- \else
- \kern -\Partial@const@width
- \fi
- \fi
+\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}
-% \end{macro}
% \begin{macro}{\PartialSecondBigg}
-% \begin{macro}{\PartialSecondBigg*}
% The \cs{PartialSecondBigg} macro and its starred variant replace \cs{left}
-% and \cs{right} with \verb"amsmath"'s \cs{Biggl} and \cs{Biggr}.
+% and \tn{right} with \pkg{amsmath}'s \cs[module=amsmath]{Biggl} and
+% \cs[module=amsmath]{Biggr}.
% \begin{macrocode}
-\def\PartialSecondBigg{%
- \def\Partial@start{\expandafter\Biggl\PartialOpen}%
- \def\Partial@end{\expandafter\Biggr\PartialClose}%
- \PartialSecond%
+\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}
-% \end{macro}
% \begin{macro}{\PartialSecondbigg}
-% \begin{macro}{\PartialSecondbigg*}
-% The \cs{PartialSecondbigg} macro and its starred variant replace \cs{left}
-% and \cs{right} with \verb"amsmath"'s \cs{biggl} and \cs{biggr}.
+% The \cs{PartialSecondbigg} macro and its starred variant replace \tn{left}
+% and \tn{right} with \pkg{amsmath}'s \cs[module=amsmath]{biggl} and
+% \cs[module=amsmath]{biggr}.
% \begin{macrocode}
-\def\PartialSecondbigg{%
- \def\Partial@start{\expandafter\biggl\PartialOpen}%
- \def\Partial@end{\expandafter\biggr\PartialClose}%
- \PartialSecond%
+\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}
-% \end{macro}
%
% \begin{macro}{\PartialMixSecond}
-% \begin{macro}{\PartialMixSecond*}
% The macro \cs{PartialMixSecond} takes an extra argument, but is otherwise
% the same as its same-variable cousin.
% \begin{macrocode}
-\def\PartialMixSecond{\@ifstar\PartialMixSecond@star\PartialMixSecond@nostar}
-\newcommand*{\PartialMixSecond@nostar}[4]{%
- \def\tmp@arg{#4}%
- \if@subscripted
- % Handles situation of empty variables held constant
- \ifx\tmp@arg\@empty
- \ensuremath{\Partial@start\frac{\partial^2 #1}
- {\partial #2\partial#3}\Partial@empty@end}%
- \else
- \ensuremath{\Partial@start\frac{\partial^2 #1}
- {\partial #2\partial#3}\Partial@end_{#4}}%
- \fi
- \else
- \ifx\tmp@arg\@empty
- \ensuremath{\Partial@start\frac{\partial^2 #1(#2,#3)}
- {\partial #2\partial#3}\Partial@empty@end}%
- \else
- % This time, we check whether #2 OR #3 are \Nt_i/etc.
- \thermo@parse@two#3\relax
- \iftwo@has@Nt\three@has@Nttrue\fi
- \iftwo@has@xory\three@has@xorytrue\fi
- \two@has@Ntfalse
- \two@has@xoryfalse
- \thermo@parse@two#2\relax
- \iftwo@has@Nt
- \renewcommand*{\allbut}[3][j]{\allcomponents{##3}}%
- \ensuremath{\Partial@start\frac{\partial^2 #1(#3,#4)}
- {\partial #2\partial#3}\Partial@end}%
- \else
- \iftwo@has@xory
- \renewcommand*{\allbutlastand}[3][j]{\allbut{\ncomponents}{##3}}%
- \ensuremath{\Partial@start\frac{\partial^2 #1(#3,#4)}
- {\partial #2\partial#3}\Partial@end}%
- \else
- \ifthree@has@Nt
- \renewcommand*{\allbut}[3][j]{\allcomponents{##3}}%
- \ensuremath{\Partial@start\frac{\partial^2 #1(#2,#4)}
- {\partial #2\partial#3}\Partial@end}%
- \else
- \ifthree@has@xory
- \PackageWarning{thermodynamics}{GOT HERE}
- %\renewcommand*{\allbutlastand}[3][j]{\allbut{\ncomponents}{##3}}%
- \renewcommand*{\allbutlastand}[3][j]{SCREW YOU}%
- \ensuremath{\Partial@start\frac{\partial^2 #1(#2,#4)}
- {\partial #2\partial#3}\Partial@end}%
- \else
- \ensuremath{\Partial@start\frac{\partial^2 #1(#2,#3,#4)}
- {\partial #2\partial#3}\Partial@end}%
- \fi
- \fi
- \fi
- \fi
- \fi
- \fi
-}
-\newcommand*{\PartialMixSecond@star}[4]{%
- \settowidth{\Partial@const@width}{\ensuremath{#4}}%
- \addtolength{\Partial@const@width}{-0.25\Partial@const@width}%
- \PartialMixSecond@nostar{#1}{#2}{#3}{#4}%
- \if@subscripted
- \ifdim\operator@width<\Partial@const@width
- \kern -\operator@width
- \else
- \kern -\Partial@const@width
- \fi
- \fi
+\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}
-% \end{macro}
-% \begin{macro}{\PartialMixSecondBigg}
-% \begin{macro}{\PartialMixSecondBigg*}
-% \begin{macro}{\PartialMixSecondbigg}
-% \begin{macro}{\PartialMixSecondbigg*}
-% The macro \cs{PartialMixSecondBigg} and its starred form are analogous to
-% \cs{PartialBigg} and \cs{PartialSecondBigg}. \cs{PartialMixSecondbigg} and
-% its starred form are similarly analogous to \cs{Partialbigg} and
-% \cs{PartialSecondbigg}.
-% \begin{macrocode}
-\def\PartialMixSecondBigg{%
- \def\Partial@start{\expandafter\Biggl\PartialOpen}%
- \def\Partial@end{\expandafter\Biggr\PartialClose}%
- \PartialMixSecond%
-}
-\def\PartialMixSecondbigg{%
- \def\Partial@start{\expandafter\biggl\PartialOpen}%
- \def\Partial@end{\expandafter\biggr\PartialClose}%
- \PartialMixSecond%
-}
-% \end{macrocode}
-% If the user does not load the \verb"amsmath" package, we will not have access
-% to \cs{Biggl}, \cs{Biggr}, \cs{biggl}, and \cs{biggr}, so we revert them back
+% \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[module=amsmath]{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}%
- \let\PartialBigg\Partial
- \let\Partialbigg\Partial
- \let\PartialSecondBigg\PartialSecond
- \let\PartialSecondbigg\PartialSecond
- \let\PartialMixSecondBigg\PartialMixSecond
- \let\PartialMixSecondbigg\PartialMixSecond
+ {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}
-% \begin{environment}{thermobrackets}
-% \begin{environment}{thermobraces}
-% \begin{environment}{thermobar}
-% \begin{environment}{thermoplain}
-% We define seven environments that \emph{locally} override the delimiters on
-% partial derivatives generated with \cs{Partial} and friends and/or the
-% subscript notation for partial derivatives.
-% \begin{macrocode}
-\newenvironment*{thermoparentheses}{
- \renewcommand*{\PartialOpen}{(}%
- \renewcommand*{\PartialClose}{)}%
- \renewcommand*{\PartialEmptyClose}{)}%
+% 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 {)}
}{}
-\newenvironment*{thermobrackets}{%
- \renewcommand*{\PartialOpen}{[}%
- \renewcommand*{\PartialClose}{]}%
- \renewcommand*{\PartialEmptyClose}{]}%
+% \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 {]}
}{}
-\newenvironment*{thermobraces}{%
- \renewcommand*{\PartialOpen}{\{}%
- \renewcommand*{\PartialClose}{\}}%
- \renewcommand*{\PartialEmptyClose}{\}}%
+% \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 {\}}
}{}
-\newenvironment*{thermobar}{%
- \renewcommand*{\PartialOpen}{.}%
- \renewcommand*{\PartialClose}{\rvert}%
- \renewcommand*{\PartialEmptyClose}{.}%
+% \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 {.}
}{}
-\newenvironment*{thermoplain}{%
- \renewcommand*{\PartialOpen}{.}%
- \renewcommand*{\PartialClose}{.}%
- \renewcommand*{\PartialEmptyClose}{.}%
- \@subscriptedfalse
+% \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
}{}
-\newenvironment*{thermoNOsubscripts}{\@subscriptedfalse}{}
-\newenvironment*{thermosubscripts}{\@subscriptedtrue}{}
% \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}{\DeclareSubscrSymbol}
-% First, we define a (messy!)\ command that serves to create ``subscripted''
+% \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}
+\cs_new:Npn \@@_check_definable:nN #1#2
+{
+ \bool_set_true:N \l_@@_arg_legal_bool
+ \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?}
+ }
+}
+\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,##1} }
+
+ \cs_new:cpn {\cs_to_str:N #1_three:n} ##1
+ { \c_math_subscript_token{#3,##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,##1} }
+
+ \cs_set:cpn {\cs_to_str:N #1_three:n} ##1
+ { \c_math_subscript_token{#3,##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.}
% \begin{macrocode}
-\newcommand*{\DeclareSubscrSymbol}[3]{%
- \expandafter\def\csname #1\endcsname{%
- \@ifnextchar^{\csname @#1\endcsname}
- {\@ifnextchar_{\csname @@#1\endcsname}{{#2}_{#3}}}
+\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_one:n} }
+ { \c_math_subscript_token{#3} }
+ }
+
+ \cs_new:cpn {\cs_to_str:N #1_two:n} ##1
+ { {#2}\c_math_superscript_token{#3,##1} }
+
+ \cs_new:cpn {\cs_to_str:N #1_three:n} ##1
+ { {#2}\c_math_superscript_token{#3,##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} }
}
- \expandafter\def\csname @#1\endcsname ##1##2{%
- {#2}^{##2}\@ifnextchar_{\csname @@@#1\endcsname}{_{#3}}%
+
+ \cs_set:cpn {\cs_to_str:N #1_two:n} ##1
+ { {#2}\c_math_superscript_token{#3,##1} }
+
+ \cs_set:cpn {\cs_to_str:N #1_three:n} ##1
+ { \c_math_superscript_token{#3,##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} }
+ }
}
- \expandafter\def\csname @@#1\endcsname ##1##2{{#2}_{#3,##2}}
- \expandafter\def\csname @@@#1\endcsname ##1##2{_{#3,##2}}
}
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\heatcapacitysymbol}
-% \begin{macro}{\compressibilitysymbol}
-% \begin{macro}{\expansivitysymbol}
+% \begin{macro}{\heatcapacitysymbol,\compressibilitysymbol,\expansivitysymbol}
% Now we define symbols for the heat capacities, compressibilities, and
% so forth.
% \begin{macrocode}
-\newcommand*{\heatcapacitysymbol}{C}
-\newcommand*{\compressibilitysymbol}{\kappa}
-\newcommand*{\expansivitysymbol}{\alpha}
+\NewExpandableDocumentCommand{\heatcapacitysymbol}{}{C}
+\NewExpandableDocumentCommand{\compressibilitysymbol}{}{\kappa}
+\NewExpandableDocumentCommand{\expansivitysymbol}{}{\alpha}
+\NewExpandableDocumentCommand{\JTsymbol}{}{\mu}
% \end{macrocode}
% \end{macro}
-% \end{macro}
-% \end{macro}
-% \begin{macro}{\cV}
-% \begin{macro}{\cP}
+% \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
@@ -2601,150 +3236,121 @@
% ${C_V}_i$ or some other unintended symbol. Superscripts are also handled
% appropriately and can be in either order.
% \begin{macrocode}
-\DeclareSubscrSymbol{cV}{\@intensive\heatcapacitysymbol}{\volume@symbol}
-\DeclareSubscrSymbol{cP}{\@intensive\heatcapacitysymbol}{\pressure@symbol}
+\NewSubscriptedSymbol{\cV}{\@@_intensive:n \heatcapacitysymbol}
+ {\g_@@_volume_symbol}
+\NewSubscriptedSymbol{\cP}{\@@_intensive:n \heatcapacitysymbol}
+ {\g_@@_pressure_symbol}
% \end{macrocode}
% \end{macro}
-% \end{macro}
-% \begin{macro}{\cVt}
-% \begin{macro}{\cPt}
+% \begin{macro}{\cVt,\cPt}
% We also introduce \emph{extensive} (rather than molar) heat capacity macros.
% \begin{macrocode}
-\DeclareSubscrSymbol{cVt}{\@extensive\heatcapacitysymbol}{\volume@symbol}
-\DeclareSubscrSymbol{cPt}{\@extensive\heatcapacitysymbol}{\pressure@symbol}
+\NewSubscriptedSymbol{\cVt}{\@@_extensive:n \heatcapacitysymbol}
+ {\g_@@_volume_symbol}
+\NewSubscriptedSymbol{\cPt}{\@@_extensive:n \heatcapacitysymbol}
+ {\g_@@_pressure_symbol}
% \end{macrocode}
% \end{macro}
-% \end{macro}
-% \begin{macro}{\cPs}
-% \begin{macro}{\cVs}
+% \begin{macro}{\cVs,\cPs}
% \cs{cPs} and \cs{cVs} are the specific heat capacities.
% \begin{macrocode}
-\DeclareSubscrSymbol{cVs}{\@specific\heatcapacitysymbol}{\volume@symbol}
-\DeclareSubscrSymbol{cPs}{\@specific\heatcapacitysymbol}{\pressure@symbol}
+\NewSubscriptedSymbol{\cVs}{\@@_specific:n \heatcapacitysymbol}
+ {\g_@@_volume_symbol}
+\NewSubscriptedSymbol{\cPs}{\@@_specific:n \heatcapacitysymbol}
+ {\g_@@_pressure_symbol}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\kappaT}
-% \begin{macro}{\kappaS}
+% \begin{macro}{\kappaT,\kappaS}
% The isothermal and adiabatic compressibilities are defined similarly, but
% those do not have extensive versions for obvious reasons.
% \begin{macrocode}
-\DeclareSubscrSymbol{kappaT}{\compressibilitysymbol}{\temperature@symbol}
-\DeclareSubscrSymbol{kappaS}{\compressibilitysymbol}{\entropy@symbol}
+\NewSubscriptedSymbol{\kappaT}{\compressibilitysymbol}
+ {\g_@@_temperature_symbol}
+\NewSubscriptedSymbol{\kappaS}{\compressibilitysymbol}
+ {\g_@@_entropy_symbol}
% \end{macrocode}
% \end{macro}
-% \end{macro}
-% \begin{macro}{\alphaP}
-% \begin{macro}{\alphaS}
+% \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}
-\DeclareSubscrSymbol{alphaP}{\expansivitysymbol}{\pressure@symbol}
-\DeclareSubscrSymbol{alphaS}{\expansivitysymbol}{\entropy@symbol}
+\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}{JT}
+% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\Psat}
-% \begin{macro}{\Pvap}
+% \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.
-% \begin{macro}{\phisat}
-% \begin{macro}{\fsat}
-% \begin{macro}{\sat}
% 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}
-\newcommand*{\sat}{{\text{sat}}}
-\newcommand*{\Psat}{P^\sat}
-\let\Pvap\Psat
-\newcommand*{\phisat}{\phi^\sat}
-\newcommand*{\fsat}{f^\sat}
+\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}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \begin{macro}{std}
-% \begin{macro}{Pstd}
-% \begin{macro}{fstd}
+% \begin{macro}{\std,\Pstd,\fstd}
% The \cs{std} macro denotes standard properties. \cs{Pstd} and \cs{fstd} are
% defined for convenience and for consistency across textbooks.
% \begin{macrocode}
-\let\std\circ
-\newcommand*{\Pstd}{P^\std}
-\newcommand*{\fstd}{f^\std}
+\NewDocumentCommand{\std}{}{\circ}
+\NewDocumentCommand{\Pstd}{}{P\c_math_superscript_token \std}
+\NewDocumentCommand{\fstd}{}{f\c_math_superscript_token \std}
% \end{macrocode}
% \end{macro}
-% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\Deltamix}
-% \begin{macro}{\mixing}
-% Mixing properties, such as $\Delta G_\text{mix}$, should be accessed using
+% \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 \verb"Thompson" package option, for example,
-% and as $\Delta_\text{mix}G$ using the \verb"Sandler" package option.
+% as $\Delta_{MIX}G$ using the |Thompson| package option, for example,
+% and as $\Delta_\text{mix}\Gt$ using the |Sandler| package option.
% \begin{macrocode}
-\newcommand*{\mixing}{{\text{mix}}}
-\newcommand*{\Deltamix}[1]{\Delta{#1}_\mixing}
+\NewDocumentCommand{\mixing}{}{{\text{mix}}}
+\NewDocumentCommand{\Deltamix}{m}
+ {\Delta{#1}\c_math_subscript_token\mixing}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\Deltafus}
-% \begin{macro}{\fusion}
-% \begin{macro}{\Deltavap}
-% \begin{macro}{\vaporization}
-% \begin{macro}{\Deltasub}
-% \begin{macro}{\sublimation}
-% \begin{macro}{\Deltarxn}
-% \begin{macro}{\reaction}
+% \pagebreak[2]%
+% \begin{macro}{\Deltafus,\fusion,\Deltavap,\vaporization}
+% \begin{macro}{\Deltasub,\sublimation,\Deltarxn,\reaction}
% Similar entities for property changes on fusion, reaction, sublimation, and
-% vaporization are defined. The heat of reaction is handled differently if
-% \cs{cP} is its argument: one must typeset $\Delta C_{P,\text{rxn}}$ and
-% $\Delta C_{P,\text{rxn}}^\circ$ rather than
-% $\Delta{C_P}_\text{rxn}$ and $\Delta{C_P}^\circ_\text{rxn}$.
-% \begin{macrocode}
-\newcommand*{\fusion}{{\text{fus}}}
-\newcommand*{\reaction}{{\text{rxn}}}
-\newcommand*{\sublimation}{{\text{sub}}}
-\newcommand*{\vaporization}{{\text{vap}}}
-\newcommand*{\formation}{f}
-\newcommand*{\Deltafus}[1]{\Delta{#1}^\fusion}
-\newcommand*{\Deltasub}[1]{\Delta{#1}^\sublimation}
-\newcommand*{\Deltavap}[1]{\Delta{#1}^\vaporization}
-% TODO It would be nice not to have to handle \cP in a special way....
-\let\Delta@rxn@sym\relax
-\DeclareSubscrSymbol{@DeltarxncP}{\Delta@rxn@sym}{\pressure@symbol,\reaction}
-\DeclareSubscrSymbol{@Deltarxn}{\Delta@rxn@sym}{\reaction}
-\newcommand*{\Deltarxn}[1]{%
- \def\tmp@arg{#1}%
- \def\tmp@@arg{\cP}%
- \ifx\tmp@arg\tmp@@arg\relax
- \def\@command{\def\Delta@rxn@sym{\Delta\@intensive\heatcapacitysymbol}%
- \@DeltarxncP}
- \else
- \def\@command{\def\Delta@rxn@sym{\Delta{#1}}\@Deltarxn}
- \fi
- \@command
-}
-\let\Delta@f@sym\relax
-\DeclareSubscrSymbol{@Deltaf}{\Delta@f@sym}{f}
-\newcommand*{\Deltaf}[1]{\def\Delta@f@sym{\Delta{#1}}\@Deltaf}
+% vaporization are defined.
+% \begin{macrocode}
+\NewDocumentCommand{\fusion}{}{{\text{fus}}}
+\NewDocumentCommand{\reaction}{}{{\text{rxn}}}
+\NewDocumentCommand{\sublimation}{}{{\text{sub}}}
+\NewDocumentCommand{\vaporization}{}{{\text{vap}}}
+\NewDocumentCommand{\formation}{}{f}
+\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}
+ {\Delta #1\c_math_subscript_token\reaction}
+\tl_new:N \l_@@_Deltaf_sym_tl
+\NewSubscriptedSymbol{\@@_Deltaf}{\l_@@_Deltaf_sym_tl}{f}
+\NewDocumentCommand{\Deltaf}{m}
+{ \tl_set:Nn \l_@@_Deltaf_sym_tl {\Delta #1}
+ \@@_Deltaf
+}
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
%
% \begin{macro}{\fmix}
% The \cs{fmix} command is intended to describe fugacities in mixtures.
@@ -2753,14 +3359,14 @@
% just $f_i$, and this command creates a consistent way to change between
% such options.
% \begin{macrocode}
-\newcommand*{\fmix}{\hat{f}}
+\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 the mixture.
% \begin{macrocode}
-\newcommand*{\phimix}{\hat\phi}
+\NewDocumentCommand{\phimix}{}{\hat\phi}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\fpure}
@@ -2771,16 +3377,16 @@
% creates a consistent way to change between the these options. A similar
% command for $\phi$ is given, \cs{phipure}, for fugacity coefficients.
% \begin{macrocode}
-\newcommand*{\fpure}{f}
-\let\phipure\phi
+\NewDocumentCommand{\fpure}{}{f}
+\NewDocumentCommand{\phipure}{}{\phi}
% \end{macrocode}
% \end{macro}
%
% \subsection{Partial Molar Quantities}
% \begin{macro}{\partialmolar}
-% Partial molar quantities appear as $\thermooverline{G_i}$ or,
-% for residual properties, $\thermooverline{G_i^R}$, rather than something like
-% $\thermooverline{G}_i$ or $\thermooverline{G}_i^R$, which looks better but
+% Partial molar quantities with superscripts appear as $\Gpm[\IG]{i}$ or
+% $\GRpm{i}$, 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}";
@@ -2789,439 +3395,295 @@
% The macro \cs{partialmolar} can be used to create an arbitrary partial
% molar symbol.
% \begin{macrocode}
-\let\pm@symbol\relax
-\newcommand*{\partialmolar}[1]{\gdef\pm@symbol{#1}\generic@pm}
-% if nextchar is _
-\def\generic@pm{\@ifnextchar_\@generic@pm\@@generic@pm}
-% then store the argument
-\def\@generic@pm#1#2{%
- \gdef\pm@arg{#2}%
- % if nextchar after argument is ^
- \@ifnextchar^\@@@generic@pm\@@@@generic@pm
-}
-% then print it this way
-\def\@@@generic@pm#1#2{\thermo@overline{\pm@symbol^{#2}_{\pm@arg}}}
-% else do it this way
-\def\@@@@generic@pm{\thermo@overline{\pm@symbol_{\pm@arg}}}
-% else, check whether there is also a ^ coming, otherwise assume
-% it's [] or {}
-\def\@@generic@pm{\@ifnextchar^\@@@@@generic@pm\@pm@bracket@check}
-\def\@@@@@generic@pm#1#2#3#4{\thermo@overline{\pm@symbol^{#2}_{#4}}}
-\def\@pm@bracket@check{\@ifnextchar[\@pm@bracket@yes\@pm@bracket@no}
-\def\@pm@bracket@yes[#1]#2{\thermo@overline{\pm@symbol^{#1}_{#2}}}
-\def\@pm@bracket@no#1{\thermo@overline{\pm@symbol_{#1}}}
+\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
+{
+ \@@_overline:n {\l_@@_pm_symbol_tl\c_math_subscript_token{#1}}
+}
+\cs_new:Npn \@@_pm_case_two [#1]#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
+{
+ \@@_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
+{
+ \@@_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
+{
+ \@@_overline:n {\l_@@_pm_symbol_tl
+ \c_math_subscript_token{\l_@@_pm_arg_tl}}
+}
% \end{macrocode}
% \end{macro}
%
% \subsection{Symbol Definitions}
% These macros define the user interface to the symbols for energy, volume,
-% and so forth. We define the ``extra'' symbols \cs{Bt} and \cs{Mt} to
-% represent arbitrary properties.
-% \begin{macro}{\Nt}
-% \begin{macro}{\Et}
-% \begin{macro}{\Ut}
-% \begin{macro}{\Ft}
-% \begin{macro}{\Gt}
-% \begin{macro}{\Ht}
-% \begin{macro}{\Lt}
-% \begin{macro}{\At}
-% \begin{macro}{\St}
-% \begin{macro}{\Vt}
-% \begin{macro}{\Qt}
-% \begin{macro}{\Wt}
-% \begin{macro}{\Mt}
-% \begin{macro}{\Bt}
-% \penalty-600%
-% First, the extensive properties.
-% \begin{macrocode}
-\newcommand*{\Nt}{\mole@symbol}
-\newcommand*{\Et}{\@extensive\totalenergy@symbol}
-\newcommand*{\Ut}{\@extensive\internalenergy@symbol}
-\newcommand*{\Ft}{\@extensive\Helmholtz@symbol}
-\newcommand*{\Gt}{\@extensive\Gibbs@symbol}
-\newcommand*{\Ht}{\@extensive\enthalpy@symbol}
-\newcommand*{\Lt}{\@extensive\Landau@symbol}
-\newcommand*{\At}{\@extensive\area@symbol}
-\newcommand*{\St}{\@extensive\entropy@symbol}
-\newcommand*{\Vt}{\@extensive\volume@symbol}
-\newcommand*{\Qt}{\@extensive\heat@symbol}
-\newcommand*{\Wt}{\@extensive\work@symbol}
-\newcommand*{\Mt}{\@extensive M}
-\newcommand*{\Bt}{\@extensive B}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
+% and so forth. There are five commands that define thermodynamic properties.
%
-% \begin{macro}{\Em}
-% \begin{macro}{\Um}
-% \begin{macro}{\Fm}
-% \begin{macro}{\Gm}
-% \begin{macro}{\Hm}
-% \begin{macro}{\Lm}
-% \begin{macro}{\Am}
-% \begin{macro}{\Sm}
-% \begin{macro}{\Vm}
-% \begin{macro}{\Qm}
-%^^A \penalty-600%
-% Then the molar properties.
-% \begin{macrocode}
-\newcommand*{\Em}{\@intensive\totalenergy@symbol}
-\newcommand*{\Um}{\@intensive\internalenergy@symbol}
-\newcommand*{\Fm}{\@intensive\Helmholtz@symbol}
-\newcommand*{\Gm}{\@intensive\Gibbs@symbol}
-\newcommand*{\Hm}{\@intensive\enthalpy@symbol}
-\newcommand*{\Lm}{\@intensive\Landau@symbol}
-\newcommand*{\Am}{\@intensive\area@symbol}
-\newcommand*{\Sm}{\@intensive\entropy@symbol}
-\newcommand*{\Vm}{\@intensive\volume@symbol}
-\newcommand*{\Qm}{\@intensive\heat@symbol}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
+% \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}{\Wm}
-% \begin{macro}{\Mm}
-% \begin{macro}{\Bm}
-% More molar properties.
+%
+% \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}
-\newcommand*{\Wm}{\@intensive\work@symbol}
-\newcommand*{\Mm}{\@intensive M}
-\newcommand*{\Bm}{\@intensive B}
+\NewDocumentCommand{\NewThermodynamicProperty}{m m}
+{
+ \NewExtensiveProperty{#1}{#2}
+ \NewPartialMolarProperty{#1}{#2}
+ \NewResidualProperty{#1}{#2}
+ \NewExcessProperty{#1}{#2}
+}
+\NewDocumentCommand{\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}}
+}
+\NewDocumentCommand{\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}
+
+ %^^A TODO: make super- or subscripted partial molar quantities work
+ % Excess partial molar property
+ \exp_after:wN \NewDocumentCommand \exp_after:wN
+ {\cs:w #1Epm\cs_end:}{}{\partialmolar{#2}
+ \c_math_superscript_token\excess}
+}
+\NewDocumentCommand{\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}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\Es}
-% \begin{macro}{\Us}
-% \begin{macro}{\Fs}
-% \begin{macro}{\Gs}
-% \begin{macro}{\Hs}
-% \begin{macro}{\Ls}
-% \begin{macro}{\As}
-% \begin{macro}{\Ss}
-% \begin{macro}{\Vs}
-% \begin{macro}{\Qs}
-% \begin{macro}{\Ws}
-% \begin{macro}{\Ms}
-% \begin{macro}{\Bs}
+% \begin{macro}{\Nt,\Et,\Em,\Es,\Epm}
% \penalty-600%
-% Now the specific (per unit mass) properties.
-% \begin{macrocode}
-\newcommand*{\Us}{\@specific\internalenergy@symbol}
-\newcommand*{\Es}{\@specific\totalenergy@symbol}
-\newcommand*{\Fs}{\@specific\Helmholtz@symbol}
-\newcommand*{\Gs}{\@specific\Gibbs@symbol}
-\newcommand*{\Hs}{\@specific\enthalpy@symbol}
-\newcommand*{\Ls}{\@specific\Landau@symbol}
-\newcommand*{\As}{\@specific\area@symbol}
-\newcommand*{\Ss}{\@specific\entropy@symbol}
-\newcommand*{\Vs}{\@specific\volume@symbol}
-\newcommand*{\Qs}{\@specific\heat@symbol}
-\newcommand*{\Ws}{\@specific\work@symbol}
-\newcommand*{\Ms}{\@specific M}
-\newcommand*{\Bs}{\@specific B}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\Epm}
-% \begin{macro}{\Upm}
-% \begin{macro}{\Hpm}
-% \begin{macro}{\Fpm}
-% \begin{macro}{\Gpm}
-% \begin{macro}{\Apm}
-% \begin{macro}{\Spm}
-% \begin{macro}{\Vpm}
-% \begin{macro}{\Lpm}
-% \begin{macro}{\Mpm}
-% \begin{macro}{\Bpm}
-% Now the partial molar properties.
-% \begin{macrocode}
-\newcommand*{\Epm}{\partialmolar{\totalenergy@symbol}}
-\newcommand*{\Upm}{\partialmolar{\internalenergy@symbol}}
-\newcommand*{\Hpm}{\partialmolar{\enthalpy@symbol}}
-\newcommand*{\Fpm}{\partialmolar{\Helmholtz@symbol}}
-\newcommand*{\Gpm}{\partialmolar{\Gibbs@symbol}}
-\newcommand*{\Apm}{\partialmolar{\area@symbol}}
-\newcommand*{\Spm}{\partialmolar{\entropy@symbol}}
-\newcommand*{\Vpm}{\partialmolar{\volume@symbol}}
-\newcommand*{\Lpm}{\partialmolar{\Omega}}
-\newcommand*{\Mpm}{\partialmolar{M}}
-\newcommand*{\Bpm}{\partialmolar{B}}
+% 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}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\cPpm}
-% \begin{macro}{\cVpm}
+% \begin{macro}{\cVpm,\cPpm}
% Partial molar heat capacities are \emph{hard}, but the following
% implementation seems to work flawlessly\dots so far.
% \begin{macrocode}
-\newcommand*{\cPpm}{%
- \def\@@@generic@pm##1##2{%
- \thermo@overline{\pm@symbol^{##2}_{\pressure@symbol,\pm@arg}}}%
- \def\@@@@generic@pm{\thermo@overline{\pm@symbol_{\pressure@symbol,\pm@arg}}}%
- \def\@@@@@generic@pm##1##2##3##4{%
- \thermo@overline{\pm@symbol^{##2}_{\pressure@symbol,##4}}}%
- \def\@pm@bracket@yes[##1]##2{%
- \thermo@overline{\pm@symbol^{##1}_{\pressure@symbol,##2}}}%
- \def\@pm@bracket@no##1{\thermo@overline{\pm@symbol_{\pressure@symbol,##1}}}%
- \partialmolar{\heatcapacitysymbol}%
-}
-\newcommand*{\cVpm}{%
- \def\@@@generic@pm##1##2{%
- \thermo@overline{\pm@symbol^{##2}_{\volume@symbol,\pm@arg}}}%
- \def\@@@@generic@pm{\thermo@overline{\pm@symbol_{\volume@symbol,\pm@arg}}}%
- \def\@@@@@generic@pm##1##2##3##4{%
- \thermo@overline{\pm@symbol^{##2}_{\volume@symbol,##4}}}%
- \def\@pm@bracket@yes[##1]##2{%
- \thermo@overline{\pm@symbol^{##1}_{\volume@symbol,##2}}}%
- \def\@pm@bracket@no##1{\thermo@overline{\pm@symbol_{\volume@symbol,##1}}}%
- \partialmolar{\heatcapacitysymbol}%
+\NewDocumentCommand{\cPpm}{}
+{
+ \cs_set:Npn \@@_pm_case_one ##1
+ {
+ \@@_overline:n {\l_@@_pm_symbol_tl\c_math_subscript_token
+ {\g_@@_pressure_symbol,##1}}
+ }
+ \cs_set:Npn \@@_pm_case_two [##1]##2
+ {
+ \@@_overline:n {\l_@@_pm_symbol_tl\c_math_superscript_token{##1}
+ \c_math_subscript_token{\g_@@_pressure_symbol,##2}}
+ }
+ \cs_set:Npn \@@_pm_case_three_part_two ##1
+ {
+ \@@_overline:n {\l_@@_pm_symbol_tl
+ \c_math_superscript_token{\l_@@_pm_arg_tl}
+ \c_math_subscript_token{\g_@@_pressure_symbol,##1}}
+ }
+ \cs_set:Npn \@@_pm_case_four ##1
+ {
+ \@@_overline:n {\l_@@_pm_symbol_tl
+ \c_math_superscript_token{##1}\c_math_subscript_token
+ {\g_@@_pressure_symbol,\l_@@_pm_arg_tl}}
+ }
+ \cs_set:Npn \@@_pm_case_five
+ {
+ \@@_overline:n {\l_@@_pm_symbol_tl\c_math_subscript_token
+ {\g_@@_pressure_symbol,\l_@@_pm_arg_tl}}
+ }
+ \partialmolar{\heatcapacitysymbol}
+}
+\NewDocumentCommand{\cVpm}{}
+{
+ \cs_set:Npn \@@_pm_case_one ##1
+ {
+ \@@_overline:n {\l_@@_pm_symbol_tl\c_math_subscript_token
+ {\g_@@_volume_symbol,##1}}
+ }
+ \cs_set:Npn \@@_pm_case_two [##1]##2
+ {
+ \@@_overline:n {\l_@@_pm_symbol_tl
+ \c_math_superscript_token{##1}\c_math_subscript_token
+ {\g_@@_volume_symbol,##2}}
+ }
+ \cs_set:Npn \@@_pm_case_three_part_two ##1
+ {
+ \@@_overline:n {\l_@@_pm_symbol_tl
+ \c_math_superscript_token{\l_@@_pm_arg_tl}
+ \c_math_subscript_token{\g_@@_volume_symbol,##1}}
+ }
+ \cs_set:Npn \@@_pm_case_four ##1
+ {
+ \@@_overline:n {\l_@@_pm_symbol_tl
+ \c_math_superscript_token{##1}
+ \c_math_subscript_token
+ {\g_@@_volume_symbol,\l_@@_pm_arg_tl}}
+ }
+ \cs_set:Npn \@@_pm_case_five
+ {
+ \@@_overline:n {\l_@@_pm_symbol_tl\c_math_subscript_token
+ {\g_@@_volume_symbol,\l_@@_pm_arg_tl}}
+ }
+ \partialmolar{\heatcapacitysymbol}
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \subsection{Residual and Excess Properties}
-% \begin{macro}{\residual}
-% \begin{macro}{\excess}
-% Macros are defined for residual properties (departure from non-ideal gases)
+% \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}
-\newcommand*{\residual}{R}
-\newcommand*{\excess}{E}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\UR}
-% \begin{macro}{\HR}
-% \begin{macro}{\FR}
-% \begin{macro}{\GR}
-% \begin{macro}{\VR}
-% \begin{macro}{\SR}
-% The ordinary residual properties are molar.
-% \begin{macrocode}
-\newcommand*{\UR}{\Um^\residual}
-\newcommand*{\HR}{\Hm^\residual}
-\newcommand*{\FR}{\Fm^\residual}
-\newcommand*{\GR}{\Gm^\residual}
-\newcommand*{\VR}{\Vm^\residual}
-\newcommand*{\SR}{\Sm^\residual}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \pagebreak[3]%
-% \begin{macro}{\URt}
-% \begin{macro}{\HRt}
-% \begin{macro}{\FRt}
-% \begin{macro}{\GRt}
-% \begin{macro}{\VRt}
-% \begin{macro}{\SRt}
-% We define similar macros for the extensive residual properties. These are
-% appended by a \verb"t" (for ``total'').
-% \begin{macrocode}
-\newcommand*{\URt}{\Ut^\residual}
-\newcommand*{\HRt}{\Ht^\residual}
-\newcommand*{\FRt}{\Ft^\residual}
-\newcommand*{\GRt}{\Gt^\residual}
-\newcommand*{\VRt}{\Vt^\residual}
-\newcommand*{\SRt}{\St^\residual}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\URs}
-% \begin{macro}{\HRs}
-% \begin{macro}{\FRs}
-% \begin{macro}{\GRs}
-% \begin{macro}{\VRs}
-% \begin{macro}{\SRs}
-% Similar macros are declared for the specific residual properties.
-% These are appended by an \verb"s".
-% \begin{macrocode}
-\newcommand*{\URs}{\Us^\residual}
-\newcommand*{\HRs}{\Hs^\residual}
-\newcommand*{\FRs}{\Fs^\residual}
-\newcommand*{\GRs}{\Gs^\residual}
-\newcommand*{\VRs}{\Vs^\residual}
-\newcommand*{\SRs}{\Ss^\residual}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \penalty-500
-% \begin{macro}{\URpm}
-% \begin{macro}{\HRpm}
-% \begin{macro}{\FRpm}
-% \begin{macro}{\GRpm}
-% \begin{macro}{\VRpm}
-% \begin{macro}{\SRpm}
-% Now for the partial molar residual properties.
-% These are appended by \verb"pm".
-% \begin{macrocode}
-\newcommand*{\URpm}{\partialmolar{\internalenergy@symbol^\residual}}
-\newcommand*{\HRpm}{\partialmolar{\enthalpy@symbol^\residual}}
-\newcommand*{\FRpm}{\partialmolar{\Helmholtz@symbol^\residual}}
-\newcommand*{\GRpm}{\partialmolar{\Gibbs@symbol^\residual}}
-\newcommand*{\VRpm}{\partialmolar{\volume@symbol^\residual}}
-\newcommand*{\SRpm}{\partialmolar{\entropy@symbol^\residual}}
+\NewDocumentCommand{\residual}{}{R}
+\NewDocumentCommand{\excess}{}{E}
% \end{macrocode}
% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\UE}
-% \begin{macro}{\HE}
-% \begin{macro}{\FE}
-% \begin{macro}{\GE}
-% \begin{macro}{\VE}
-% \begin{macro}{\SE}
-% Now for the excess molar properties.
-% \begin{macrocode}
-\newcommand*{\UE}{\Um^\excess}
-\newcommand*{\FE}{\Fm^\excess}
-\newcommand*{\HE}{\Hm^\excess}
-\newcommand*{\GE}{\Gm^\excess}
-\newcommand*{\SE}{\Sm^\excess}
-\newcommand*{\VE}{\Vm^\excess}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\UEt}
-% \begin{macro}{\HEt}
-% \begin{macro}{\FEt}
-% \begin{macro}{\GEt}
-% \begin{macro}{\VEt}
-% \begin{macro}{\SEt}
-% Similarly, the extensive excess properties.
-% \begin{macrocode}
-\newcommand*{\UEt}{\Ut^\excess}
-\newcommand*{\FEt}{\Ft^\excess}
-\newcommand*{\HEt}{\Ht^\excess}
-\newcommand*{\GEt}{\Gt^\excess}
-\newcommand*{\SEt}{\St^\excess}
-\newcommand*{\VEt}{\Vt^\excess}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\UEs}
-% \begin{macro}{\HEs}
-% \begin{macro}{\FEs}
-% \begin{macro}{\GEs}
-% \begin{macro}{\VEs}
-% \begin{macro}{\SEs}
-% Now for the specific excess properties.
-% \begin{macrocode}
-\newcommand*{\UEs}{\Us^\excess}
-\newcommand*{\FEs}{\Fs^\excess}
-\newcommand*{\HEs}{\Hs^\excess}
-\newcommand*{\GEs}{\Gs^\excess}
-\newcommand*{\SEs}{\Ss^\excess}
-\newcommand*{\VEs}{\Vs^\excess}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \pagebreak[3]%
-% \begin{macro}{\UEpm}
-% \begin{macro}{\HEpm}
-% \begin{macro}{\FEpm}
-% \begin{macro}{\GEpm}
-% \begin{macro}{\VEpm}
-% \begin{macro}{\SEpm}
-% Finally, the excess partial molar quantities.
-% \begin{macrocode}
-\newcommand*{\UEpm}{\partialmolar{\internalenergy@symbol^\excess}}
-\newcommand*{\HEpm}{\partialmolar{\enthalpy@symbol^\excess}}
-\newcommand*{\FEpm}{\partialmolar{\Helmholtz@symbol^\excess}}
-\newcommand*{\GEpm}{\partialmolar{\Gibbs@symbol^\excess}}
-\newcommand*{\VEpm}{\partialmolar{\volume@symbol^\excess}}
-\newcommand*{\SEpm}{\partialmolar{\entropy@symbol^\excess}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\prodall}
-% \begin{macro}{\sumall}
-% \begin{macro}{\sumallbutlast}
+% \pagebreak[1]%
+% \begin{macro}{\prodall,\sumall,\summallbutlast}
% The \cs{sumall} command and its cousin, \cs{sumallbutlast}, simplify the
% typesetting of commonly-used sums; the command \cs{prodall} does the same
% thing for products, viz.,
@@ -3235,102 +3697,194 @@
% K = \exp\left(\frac{-\Delta G_\text{rxn}^\circ}{RT}\right)
% = \prod_{i=1}^C a_i^{\nu_i} \]
% \begin{macrocode}
-\newcommand*{\sumall}{\@ifnextchar_\@sumall\@@sumall}
-\def\@sumall#1#2{\sum_{#2=1}^{\ncomponents}}
-\def\@@sumall#1{\sum_{#1=1}^{\ncomponents}}
-\newcommand*{\sumallbutlast}{\@ifnextchar_\@sumallbutlast\@@sumallbutlast}
-\def\@sumallbutlast#1#2{\sum_{#2=1}^{\ncomponents-1}}
-\def\@@sumallbutlast#1{\sum_{#1=1}^{\ncomponents-1}}
-\newcommand*{\prodall}{\@ifnextchar_\@prodall\@@prodall}
-\def\@prodall#1#2{\prod_{#2=1}^{\ncomponents}}
-\def\@@prodall#1{\prod_{#1=1}^{\ncomponents}}
+\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}
-% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\IG}
-% \begin{macro}{\IGM}
-% \begin{macro}{\IS}
+% \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'' rather than ``IS''
-% for example.
+% make clean transitions between textbooks---some use ``IM'' or ``ID'' rather
+% than ``IS,'' for example.
% \begin{macrocode}
-\newcommand*{\IG}{{\text{IG}}}
-\newcommand*{\IGM}{{\text{IGM}}}
-\newcommand*{\IS}{{\text{IS}}}
+\NewDocumentCommand{\IG}{}{{\text{IG}}}
+\NewDocumentCommand{\IGM}{}{{\text{IGM}}}
+\NewDocumentCommand{\IS}{}{{\text{IS}}}
% \end{macrocode}
% \end{macro}
-% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\Henryrat}
-% \begin{macro}{\Henrymol}
+% \begin{macro}{\Henryrat,\Henrymol}
% 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}
-\newcommand*{\Henryrat}{h}
-\newcommand*{\Henrymol}{{\mathcal{H}}}
+\NewDocumentCommand{\Henryrat}{}{h}
+\NewDocumentCommand{\Henrymol}{}{\mathcal{H}}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
-% \begin{macro}{\gammarat}
-% \begin{macro}{\gammamol}
+% \begin{macro}{\gammarat,\gammamol}
% The ordinary activity coefficient is universally denoted $\gamma$, so I
-% have not defined a special macro for that. However, 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$.
+% have not defined a special macro for that. 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 (based on the \textsf{amsthm}
-% package).
-%^^A Code for \square ripped off from amsthm.sty with tweaks
+% it ``fakes it'' with the definition below.
+%^^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}
\AtBeginDocument{%
\providecommand*{\square}{%
\text{\leavevmode
- \hbox to.77778em{%
+ \hbox to.65em{%
\hfil\vrule
- \vbox to.6em{\hrule width.6em\vfil\hrule}%
+ \vbox to.53em{\hrule width.45em\vfil\hrule}%
\vrule\hfil}%
}%
}%
}
-\newcommand*{\gammarat}{\gamma^\ast}
-\newcommand*{\gammamol}{\gamma^\square}
+\NewDocumentCommand{\gammarat}{}{\gamma\c_math_superscript_token\ast}
+\NewDocumentCommand{\gammamol}{}{\gamma\c_math_superscript_token\square}
% \end{macrocode}
% \end{macro}
-% \end{macro}
+% \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 Jacobian, viz.,
-% \begin{verbatim}
-% \[ \Jacobian{K}{L}{X}{Y} =
-% \begin{vmatrix}
-% \displaystyle \Partial{K}{X}{Y} & \displaystyle \Partial{K}{Y}{X}
-% \\[2ex]
-% \displaystyle \Partial{L}{X}{Y} & \displaystyle \Partial{L}{Y}{X}
-% \end{vmatrix}
-% \]
-%\end{verbatim}
-% produces
-% \[ \left(\frac{\partial(K,L)}{\partial(X,Y)}\right) =
-% \begin{vmatrix}
-% \displaystyle \left(\frac{\partial K}{\partial X}\right)_Y
-% & \displaystyle \left(\frac{\partial K}{\partial Y}\right)_X \\[2ex]
-% \displaystyle \left(\frac{\partial L}{\partial X}\right)_Y
-% & \displaystyle \left(\frac{\partial L}{\partial Y}\right)_X
-% \end{vmatrix}
-% \]
-% This macro is defined purely for convenience.
+% The \cs{Jacobian} command typesets the Leibnitz notation for the Jacobian
+% determinant.
+% \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}
-\newcommand*{\Jacobian}[4]{\frac{\partial{(#1,#2)}}{\partial{(#3,#4)}}}%
+\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>
@@ -3342,6 +3896,7 @@
\author{Karl D. Hammond}
\date{}
\begin{document}
+\NewThermodynamicProperty{B}{B}
\maketitle\noindent
The combined laws:
\begin{align*}
@@ -3377,6 +3932,33 @@ Some Maxwell reciprocity relations:
= -\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}
@@ -3449,7 +4031,7 @@ Fugacity and related properties:
\\
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)
+ \exp\left(\frac{1}{RT} \int_{\Pstd}^P \Vm_i(T,p)\,dp\right)
\approx x_i \gamma_i
\\
\begin{split}
@@ -3458,9 +4040,9 @@ Fugacity and related properties:
= 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)
+ \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)
+ \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*}
@@ -3518,6 +4100,19 @@ Excess and Residual (Departure) Properties:
\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
diff --git a/macros/latex/contrib/thermodynamics/thermodynamics.ins b/macros/latex/contrib/thermodynamics/thermodynamics.ins
index 2e5ae9524f..f2f2b95f40 100644
--- a/macros/latex/contrib/thermodynamics/thermodynamics.ins
+++ b/macros/latex/contrib/thermodynamics/thermodynamics.ins
@@ -1,4 +1,4 @@
-%% File: thermodynamics.ins Copyright (C) 2021 Karl D. Hammond
+%% File: thermodynamics.ins Copyright (C) 2022-2023 Karl D. Hammond
%%
%% Karl D. Hammond,
%% Department of Chemical Engineering
@@ -14,14 +14,15 @@
%% 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 and thermodynamics.pdf.
+%% and the derived files thermodynamics.sty, thermodynamics.pdf,
+%% thermodynamics-examples.tex, and thermodynamics-examples.pdf.
%% \fi
-\input{docstrip}
+\input{l3docstrip}
\keepsilent
\usedir{tex/latex/thermodynamics}
@@ -29,13 +30,13 @@
This is a generated file.
-Copyright (C) 2017-2018 by Karl D. Hammond
+Copyright (C) 2022-2023 by Karl D. Hammond
Karl D. Hammond,
Department of Chemical Engineering
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.
diff --git a/macros/latex/contrib/thermodynamics/thermodynamics.pdf b/macros/latex/contrib/thermodynamics/thermodynamics.pdf
index 28957964eb..e4106e74cd 100644
--- a/macros/latex/contrib/thermodynamics/thermodynamics.pdf
+++ b/macros/latex/contrib/thermodynamics/thermodynamics.pdf
Binary files differ