diff options
author | Karl Berry <karl@freefriends.org> | 2023-11-17 22:02:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-11-17 22:02:57 +0000 |
commit | d750d4833a1999a7902080b4a55e3e89eead497d (patch) | |
tree | c5670d1d100bd424cfa1854a6713264cd21cf0ca /Master/texmf-dist/tex/latex/thermodynamics | |
parent | 6719122c781ae5bcef2f225c8f5246f31dacf704 (diff) |
thermodynamics (17nov23)
git-svn-id: svn://tug.org/texlive/trunk@68881 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/thermodynamics')
-rw-r--r-- | Master/texmf-dist/tex/latex/thermodynamics/thermodynamics.sty | 2256 |
1 files changed, 1398 insertions, 858 deletions
diff --git a/Master/texmf-dist/tex/latex/thermodynamics/thermodynamics.sty b/Master/texmf-dist/tex/latex/thermodynamics/thermodynamics.sty index 5d121549971..10036eb2021 100644 --- a/Master/texmf-dist/tex/latex/thermodynamics/thermodynamics.sty +++ b/Master/texmf-dist/tex/latex/thermodynamics/thermodynamics.sty @@ -8,7 +8,7 @@ %% %% 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 @@ -23,983 +23,1523 @@ %% and version 1.3 or later is part of all distributions of LaTeX %% version 2005/12/01 or later. \NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} \ProvidesPackage{thermodynamics} - [2022/04/29 v1.00 thermodynamics package] + [2023/11/16 v2.00 thermodynamics notation] +%%^^A = C_i \gammamol_i \Henrymol_i +\ExplSyntaxOn +\cs_generate_variant:Nn \tl_if_eq:nnTF { xxTF } \RequirePackage{amstext} \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__thermodynamics_charter_tl {mdbch} + \tl_const:Nn \c__thermodynamics_utopia_tl {mdput} + \tl_const:Nn \c__thermodynamics_garamond_tl {mdugm} + \tl_if_eq:NNT \MD@default@family \c__thermodynamics_utopia_tl + { \ProvideDocumentCommand{\dbar}{} + {\mkern5mu\mathchar'26\mkern-20mu d} + } + \tl_if_eq:NNT \MD@default@family \c__thermodynamics_charter_tl + { \ProvideDocumentCommand{\dbar}{} + {\mkern5mu\mathchar'26\mkern-15mu d} + } + \tl_if_eq:NNT \MD@default@family \c__thermodynamics_garamond_tl + { \ProvideDocumentCommand{\dbar}{} + {\mkern5mu\mathchar'26\mkern-17mu d} + } }{} % Defaults to Computer Modern - \providecommand*{\dbar}{{\mkern3mu\mathchar'26\mkern-12mu d}} -} -\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} -\newcommand*{\thermo@underline}[1]{% - \mkern1mu\underline{\mkern-1mu #1\mkern-4mu}\mkern4mu% -} -\newcommand*{\thermo@overline}[1]{% - \mkern2mu\overline{\mkern-2mu #1\mkern-1mu}\mkern1mu% -} -\newcommand*{\PartialOpen}{(} -\newcommand*{\PartialClose}{)} -\newcommand*{\PartialEmptyClose}{)} + \ProvideDocumentCommand{\dbar}{} + {\mkern3mu\mathchar'26\mkern-12mu d} +} +\tl_new:N \g__thermodynamics_total_energy_symbol +\tl_new:N \g__thermodynamics_internal_energy_symbol +\tl_new:N \g__thermodynamics_Helmholtz_symbol +\tl_new:N \g__thermodynamics_Gibbs_symbol +\tl_new:N \g__thermodynamics_Landau_symbol +\tl_new:N \g__thermodynamics_enthalpy_symbol +\tl_new:N \g__thermodynamics_entropy_symbol +\tl_new:N \g__thermodynamics_area_symbol +\tl_new:N \g__thermodynamics_volume_symbol +\tl_new:N \g__thermodynamics_mole_symbol +\tl_new:N \g__thermodynamics_heat_symbol +\tl_new:N \g__thermodynamics_work_symbol +\tl_new:N \g__thermodynamics_temperature_symbol +\tl_new:N \g__thermodynamics_pressure_symbol + +\tl_gset:Nn \g__thermodynamics_total_energy_symbol E +\tl_gset:Nn \g__thermodynamics_internal_energy_symbol U +\tl_gset:Nn \g__thermodynamics_Helmholtz_symbol A +\tl_gset:Nn \g__thermodynamics_Gibbs_symbol G +\tl_gset:Nn \g__thermodynamics_Landau_symbol \Omega +\tl_gset:Nn \g__thermodynamics_enthalpy_symbol H +\tl_gset:Nn \g__thermodynamics_entropy_symbol S +\tl_gset:Nn \g__thermodynamics_area_symbol a +\tl_gset:Nn \g__thermodynamics_volume_symbol V +\tl_gset:Nn \g__thermodynamics_mole_symbol n +\tl_gset:Nn \g__thermodynamics_heat_symbol Q +\tl_gset:Nn \g__thermodynamics_work_symbol W +\tl_gset:Nn \g__thermodynamics_temperature_symbol T +\tl_gset:Nn \g__thermodynamics_pressure_symbol P +\cs_new:Nn \__thermodynamics_underline:n +{ \mkern1mu\underline{\mkern-1mu #1\mkern-4mu}\mkern4mu } +\cs_new:Nn \__thermodynamics_overline:n +{ \mkern2mu\overline{\mkern-2mu #1\mkern-1mu}\mkern1mu } +\tl_new:N \l__thermodynamics_PartialOpen_tl +\tl_new:N \l__thermodynamics_PartialEmptyClose_tl +\tl_new:N \l__thermodynamics_PartialClose_tl + +\tl_set:Nn \l__thermodynamics_PartialOpen_tl {(} +\tl_set:Nn \l__thermodynamics_PartialClose_tl {)} +\tl_set:Nn \l__thermodynamics_PartialEmptyClose_tl {)} \DeclareOption{EUAGHan}{}% the default -\DeclareOption{EUAGHaN}{\renewcommand*{\mole@symbol}{N}}% +\DeclareOption{EUAGHaN}{\tl_gset:Nn \g__thermodynamics_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__thermodynamics_Helmholtz_symbol F + \tl_gset:Nn \g__thermodynamics_area_symbol A +} +\DeclareOption{EUFGHAN}{% + \tl_gset:Nn \g__thermodynamics_Helmholtz_symbol F + \tl_gset:Nn \g__thermodynamics_area_symbol A + \tl_gset:Nn \g__thermodynamics_mole_symbol N +} +\DeclareOption{EEFGHAn}{% + \tl_gset:Nn \g__thermodynamics_total_energy_symbol {\mathcal{E}} + \tl_gset:Nn \g__thermodynamics_internal_energy_symbol E + \tl_gset:Nn \g__thermodynamics_Helmholtz_symbol F + \tl_gset:Nn \g__thermodynamics_area_symbol A +} +\DeclareOption{EEFGHAN}{% + \tl_gset:Nn \g__thermodynamics_total_energy_symbol {\mathcal{E}} + \tl_gset:Nn \g__thermodynamics_internal_energy_symbol E + \tl_gset:Nn \g__thermodynamics_Helmholtz_symbol F + \tl_gset:Nn \g__thermodynamics_area_symbol A + \tl_gset:Nn \g__thermodynamics_mole_symbol N } \DeclareOption{EEFGHan}{% - \renewcommand*{\internalenergy@symbol}{E}% - \renewcommand*{\Helmholtz@symbol}{F} + \tl_gset:Nn \g__thermodynamics_total_energy_symbol {\mathcal{E}} + \tl_gset:Nn \g__thermodynamics_internal_energy_symbol E + \tl_gset:Nn \g__thermodynamics_Helmholtz_symbol F } \DeclareOption{EEFGHaN}{% - \renewcommand*{\internalenergy@symbol}{E}% - \renewcommand*{\Helmholtz@symbol}{F} - \renewcommand*{\mole@symbol}{N}% + \tl_gset:Nn \g__thermodynamics_total_energy_symbol {\mathcal{E}} + \tl_gset:Nn \g__thermodynamics_internal_energy_symbol E + \tl_gset:Nn \g__thermodynamics_Helmholtz_symbol F + \tl_gset:Nn \g__thermodynamics_mole_symbol N } \DeclareOption{EEAGHan}{% - \renewcommand*{\internalenergy@symbol}{E}% + \tl_gset:Nn \g__thermodynamics_total_energy_symbol {\mathcal{E}} + \tl_gset:Nn \g__thermodynamics_internal_energy_symbol E } \DeclareOption{EEAGHaN}{% - \renewcommand*{\internalenergy@symbol}{E}% - \renewcommand*{\mole@symbol}{N}% + \tl_gset:Nn \g__thermodynamics_total_energy_symbol {\mathcal{E}} + \tl_gset:Nn \g__thermodynamics_internal_energy_symbol E + \tl_gset:Nn \g__thermodynamics_mole_symbol N } -\DeclareOption{EUAGHAn}{% Helmholtz free energy and area look the same here - \renewcommand*{\area@symbol}{A}% +\DeclareOption{EUAGHAn}{% + \tl_gset:Nn \g__thermodynamics_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__thermodynamics_area_symbol {\mathcal{A}} + \tl_gset:Nn \g__thermodynamics_mole_symbol N } \DeclareOption{EUFGHan}{% - \renewcommand*{\Helmholtz@symbol}{F}% + \tl_gset:Nn \g__thermodynamics_Helmholtz_symbol F } \DeclareOption{EUFGHaN}{% - \renewcommand*{\Helmholtz@symbol}{F}% - \renewcommand*{\mole@symbol}{N}% + \tl_gset:Nn \g__thermodynamics_Helmholtz_symbol F + \tl_gset:Nn \g__thermodynamics_mole_symbol N } -\DeclareOption{delta}{\let\dbar\delta} -\let\@extensive\relax -\let\@intensive\relax -\let\@specific\hat -\DeclareOption{extensive-plain}{% - \let\@extensive\relax - \let\@intensive\thermo@underline +\DeclareOption{delta}{ \cs_set_eq:NN \dbar \delta } +\cs_new:Nn \__thermodynamics_extensive:n {#1} +\cs_new:Nn \__thermodynamics_intensive:n {#1} +\cs_new:Nn \__thermodynamics_specific:n {\hat{#1}} + +\cs_new:Npn \__thermodynamics_set_intensive_plain +{ + \cs_set:Nn \__thermodynamics_extensive:n {\__thermodynamics_underline:n{##1}} + \cs_set:Nn \__thermodynamics_intensive:n {##1} } -\DeclareOption{intensive-plain}{% the default - \let\@extensive\thermo@underline - \let\@intensive\relax +\cs_new:Npn \__thermodynamics_set_extensive_plain +{ + \cs_set:Nn \__thermodynamics_extensive:n {##1} + \cs_set:Nn \__thermodynamics_intensive:n {\__thermodynamics_underline:n{##1}} } +\cs_new:Npn \__thermodynamics_set_lowercase_pms +{ + \RenewDocumentCommand{\partialmolar}{m} + { + \tl_set:Nn \l__thermodynamics_pm_symbol_tl {\text_lowercase:n {##1}} + \__thermodynamics_generic_pm: + } +} +\cs_new:Npn \__thermodynamics_set_intensive_lowercase +{ + \cs_set:Nn \__thermodynamics_extensive:n {\text_uppercase:n {##1}} + \cs_set:Nn \__thermodynamics_intensive:n {\text_lowercase:n {##1}} + \cs_set:Nn \__thermodynamics_specific:n {\hat{\text_lowercase:n {##1}}} +} +\cs_new:Npn \__thermodynamics_set_extensive_superscripts +{ + \cs_set:Nn \__thermodynamics_extensive:n {{##1}\c_math_superscript_token t} + \cs_set:Nn \__thermodynamics_intensive:n {##1} +} +\DeclareOption{extensive-plain}{\__thermodynamics_set_extensive_plain} +\DeclareOption{intensive-plain}{\__thermodynamics_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} - } + \__thermodynamics_set_intensive_lowercase + \AtEndOfPackage{ + \__thermodynamics_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}} - } -} -\newif\if@subscripted -\@subscriptedtrue -\DeclareOption{subscripts}{\@subscriptedtrue} -\DeclareOption{nosubscripts}{\@subscriptedfalse} + \__thermodynamics_set_extensive_superscripts + \AtEndOfPackage{% + \RenewDocumentCommand{\URt}{}{\g__thermodynamics_internal_energy_symbol + \c_math_superscript_token{\residual,t}} + \RenewDocumentCommand{\HRt}{}{\g__thermodynamics_enthalpy_symbol + \c_math_superscript_token{\residual,t}} + \RenewDocumentCommand{\FRt}{}{\g__thermodynamics_Helmoholtz_symbol + \c_math_superscript_token{\residual,t}} + \RenewDocumentCommand{\GRt}{}{\g__thermodynamics_Gibbs_symbol + \c_math_superscript_token{\residual,t}} + \RenewDocumentCommand{\VRt}{}{\g__thermodynamics_volume_symbol + \c_math_superscript_token{\residual,t}} + \RenewDocumentCommand{\SRt}{}{\g__thermodynamics_entropy_symbol + \c_math_superscript_token{\residual,t}} + \RenewDocumentCommand{\UEt}{}{\g__thermodynamics_internal_energy_symbol + \c_math_superscript_token{\excess,t}} + \RenewDocumentCommand{\HEt}{}{\g__thermodynamics_enthalpy_symbol + \c_math_superscript_token{\excess,t}} + \RenewDocumentCommand{\FEt}{}{\g__thermodynamics_Helmoholtz_symbol + \c_math_superscript_token{\excess,t}} + \RenewDocumentCommand{\GEt}{}{\g__thermodynamics_Gibbs_symbol + \c_math_superscript_token{\excess,t}} + \RenewDocumentCommand{\VEt}{}{\g__thermodynamics_volume_symbol + \c_math_superscript_token{\excess,t}} + \RenewDocumentCommand{\SEt}{}{\g__thermodynamics_entropy_symbol + \c_math_superscript_token{\excess,t}} + } +} +%%^^A \[ \left(\frac{\partial U}{\partial S}\right)_V \quad\text{versus}\quad +%%^^A \left(\frac{\partial U(S,V)}{\partial S}\right) \] +\bool_new:N \l__thermodynamics_subscripted_bool +\bool_set_true:N \l__thermodynamics_subscripted_bool +\DeclareOption{subscripts}{\bool_set_true:N \l__thermodynamics_subscripted_bool} +\DeclareOption{nosubscripts}{\bool_set_false:N \l__thermodynamics_subscripted_bool} \DeclareOption{parentheses}{} \DeclareOption{brackets}{% - \renewcommand*{\PartialOpen}{[}% - \renewcommand*{\PartialClose}{]}% - \renewcommand*{\PartialEmptyClose}{]}% + \tl_set:Nn \l__thermodynamics_PartialOpen_tl {[} + \tl_set:Nn \l__thermodynamics_PartialClose_tl {]} + \tl_set:Nn \l__thermodynamics_PartialEmptyClose_tl {]} } \DeclareOption{braces}{% - \renewcommand*{\PartialOpen}{\{}% - \renewcommand*{\PartialClose}{\}}% - \renewcommand*{\PartialEmptyClose}{\}}% + \tl_set:Nn \l__thermodynamics_PartialOpen_t1 {\{} + \tl_set:Nn \l__thermodynamics_PartialClose_t1 {\}} + \tl_set:Nn \l__thermodynamics_PartialEmptyClose_tl {\}} } \DeclareOption{bar}{% - \renewcommand*{\PartialOpen}{.}% - \renewcommand*{\PartialClose}{\rvert}% - \renewcommand*{\PartialEmptyClose}{.}% + \tl_set:Nn \l__thermodynamics_PartialOpen_tl {.} + \tl_set:Nn \l__thermodynamics_PartialClose_tl {\rvert} + \tl_set:Nn \l__thermodynamics_PartialEmptyClose_tl {.} } \DeclareOption{plain-derivatives}{% This implies dU(S,V,N)/dS notation - \renewcommand*{\PartialOpen}{.}% - \renewcommand*{\PartialClose}{.}% - \renewcommand*{\PartialEmptyClose}{.}% - \ExecuteOptions{nosubscripts}% -} -\newcommand*{\ncomponents}{C} -\newcommand*{\allNs}{\allcomponents{\Nt}} -\newcommand*{\allXs}{\allcomponents{x}} -\newcommand*{\allYs}{\allcomponents{y}} -\newcommand*{\allmus}{\allcomponents{\mu}} -\newcommand*{\allMs}{\allcomponents{m}} -\newcommand*{\allWs}{\allcomponents{w}}% -\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}}% -\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 + \tl_set:Nn \l__thermodynamics_PartialOpen_tl {.} + \tl_set:Nn \l__thermodynamics_PartialClose_tl {.} + \tl_set:Nn \l__thermodynamics_PartialEmptyClose_tl {.} + \ExecuteOptions{nosubscripts} +} +\NewExpandableDocumentCommand \ncomponents {} {C} +\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}} +\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}} +\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} } + } } \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 - } - \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 +\DeclareOption{moles-range}{ \__thermodynamics_set_moles_range } +\cs_new:Npn \__thermodynamics_set_moles_range {% + \RenewDocumentCommand{\allcomponents}{O{} m} + { {##2}\c_math_subscript_token 1,\dots, + {##2}\c_math_subscript_token{\ncomponents} } + \RenewDocumentCommand{\allbut}{O{j} m m} + { \tl_if_eq:nnTF {##2} {1} + { {##3}\c_math_subscript_token 2,\dots, + {##3}\c_math_subscript_token{\ncomponents} } + { \tl_if_eq:xxTF {##2} {\ncomponents} + { {##3}\c_math_subscript_token 1,\dots, + {##3}\c_math_subscript_token{\ncomponents-1} } + { {##3}\c_math_subscript_token 1,\dots, + [{##3}\c_math_subscript_token{##2}], + \dots,{##3}\c_math_subscript_token{\ncomponents} } + } + } + \RenewDocumentCommand{\allbutlastand}{O{j} m m} + { \tl_if_eq:nnTF {##2} {1} + { {##3}\c_math_subscript_token 2,\dots, + {##3}\c_math_subscript_token{\ncomponents-1} } + { \tl_if_eq:xxTF {##2} {\ncomponents} + { {##3}\c_math_subscript_token 1,\dots, + {##3}\c_math_subscript_token{\ncomponents-1} + } + { \tl_if_eq:xxTF {##2} {\ncomponents-1} + { {##3}\c_math_subscript_token 1,\dots, + {##3}\c_math_subscript_token{\ncomponents-2} } + { + {##3}\c_math_subscript_token 1,\dots, + [{##3}\c_math_subscript_token{##2}],\dots, + {##3}\c_math_subscript_token{\ncomponents-1} + } + } + } } } \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 \__thermodynamics_specific:n {\text_lowercase:n {#1}} + \cs_set:Nn \__thermodynamics_intensive:n {\bar{\text_lowercase:n {#1}}} + \tl_gset:Nn \g__thermodynamics_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 \__thermodynamics_overline:n {\widetilde{#1}} + \cs_set:Nn \__thermodynamics_specific:n {\text_lowercase:n {#1}} + \cs_set:Nn \__thermodynamics_intensive:n {\bar{\text_lowercase:n{#1}}} + \tl_gset:Nn \g__thermodynamics_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__thermodynamics_pm_symbol_tl {#1} + \__thermodynamics_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 - } - \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} + \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__thermodynamics_Helmholtz_symbol \psi + \RenewDocumentCommand{\Ft}{}{\Psi} + \cs_set:Nn \__thermodynamics_intensive:n {\__thermodynamics_overline:n{\text_lowercase:n{#1}}} + \cs_set:Nn \__thermodynamics_specific:n {\text_lowercase:n{#1}} + \RenewDocumentCommand{\fmix}{}{\bar f} + \RenewDocumentCommand{\phimix}{}{\bar\phi} + \RenewDocumentCommand{\phimix}{}{\bar\phi} + \tl_gset:Nn \g__thermodynamics_pressure_symbol p + \RenewDocumentCommand{\partialmolar}{m} + { + \tl_set:Nn \l__thermodynamics_pm_symbol_tl {#1} + \__thermodynamics_generic_pm: + } } } \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}{\__thermodynamics_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__thermodynamics_volume_symbol} + \RenewSubscriptedSymbol{\cP} + {\heatcapacitysymbol}{\g__thermodynamics_pressure_symbol} + \RenewSubscriptedSymbol{\cVt} + {\Nt\heatcapacitysymbol}{\g__thermodynamics_volume_symbol} + \RenewSubscriptedSymbol{\cPt} + {\Nt\heatcapacitysymbol}{\g__thermodynamics_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 - } - \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{\allcomponents}{O{} m}{#2} + \RenewDocumentCommand{\allbut}{O{j} m m} + { + \tl_if_eq:nnTF {#1} {#2} + { {#3}\c_math_subscript_token k } + { {#3}\c_math_subscript_token{#1} } + } + \RenewDocumentCommand{\IG}{}{{ig}} + \RenewDocumentCommand{\IGM}{}{{ig}} + \RenewDocumentCommand{\IS}{}{{id}} + \RenewDocumentCommand{\expansivitysymbol}{}{\beta} + \RenewDocumentCommand{\Deltarxn}{m}{\Delta #1} + \RenewSubscriptedSymbol{\cVt} + {\Nt\heatcapacitysymbol}{\g__thermodynamics_volume_symbol} + \RenewSubscriptedSymbol{\cPt} + {\Nt\heatcapacitysymbol}{\g__thermodynamics_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 - } - \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 - } - \renewcommand*{\IG}{{ig}} - \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} + \RenewExpandableDocumentCommand{\ncomponents}{}{n} + \RenewDocumentCommand{\allcomponents}{O{i} m} + { + {#2}\c_math_subscript_token{#1} + } + \RenewDocumentCommand{\allbut}{O{i} m m} + { \tl_if_eq:nnTF {#1} {#2} + { {#3}\c_math_subscript_token{k}[#2] } + { {#3}\c_math_subscript_token{#1}[#2] } + } + \RenewDocumentCommand{\allbutlastand}{O{j} m m} + { \tl_if_eq:xxTF {#2} {\ncomponents} + { {#3}\c_math_subscript_token{#1}\relax[#2] } + { \tl_if_eq:nnTF {#1} {#2} + { {#3}\c_math_subscript_token{k}[#2,\ncomponents] } + { {#3}\c_math_subscript_token{#1}[#2,\ncomponents] } + } + } + \RenewDocumentCommand{\IG}{}{{o}} + \RenewDocumentCommand{\IGM}{}{{o}} + \RenewDocumentCommand{\IS}{}{{ID}} + \RenewDocumentCommand{\excess}{}{{EX}} + \RenewDocumentCommand{\reaction}{}{{rx}} + \RenewDocumentCommand{\Henryrat}{} + {f\c_math_superscript_token{\ast\ast}} + \RenewDocumentCommand{\Henrymol}{}{f\c_math_superscript_token\ast} + \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 \__thermodynamics_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 + { \__thermodynamics_fpure_one:n } + { f } + } + \cs_new:Nn \__thermodynamics_intensive_two:n + { + \c_math_subscript_token{#1} + \peek_catcode:NF \c_math_superscript_token + { + \c_math_superscript_token\bullet + } + } + \cs_set:Nn \__thermodynamics_intensive:n + { #1 + \peek_catcode_remove:NT \c_math_subscript_token + { \__thermodynamics_intensive_two:n } + } + \cs_new:Nn \__thermodynamics_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 + { + \__thermodynamics_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} + } } } } \ExecuteOptions{EUAGHan,subscripts,parentheses,intensive-plain,moles-index} \ProcessOptions -\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} -\def\Partial@start{\left\PartialOpen} -\def\Partial@end{\right\PartialClose} -\def\Partial@empty@end{\right\PartialEmptyClose} -\def\Partial{\@ifstar\Partial@star\Partial@nostar} -\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 - } -} -\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 -} -\def\PartialBigg{% - \def\Partial@start{\Biggl\PartialOpen}% - \def\Partial@end{\Biggr\PartialClose}% - \def\Partial@empty@end{\Biggr\PartialClose}% - \Partial% -} -\def\Partialbigg{% - \def\Partial@start{\biggl\PartialOpen}% - \def\Partial@end{\biggr\PartialClose}% - \def\Partial@empty@end{\biggr\PartialClose}% - \Partial% -} -\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 -} -\def\PartialSecondBigg{% - \def\Partial@start{\expandafter\Biggl\PartialOpen}% - \def\Partial@end{\expandafter\Biggr\PartialClose}% - \PartialSecond% -} -\def\PartialSecondbigg{% - \def\Partial@start{\expandafter\biggl\PartialOpen}% - \def\Partial@end{\expandafter\biggr\PartialClose}% - \PartialSecond% -} -\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 -} -\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% +\tl_const:Nn \c__thermodynamics_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__thermodynamics_in_list_clist +\clist_new:N \l__thermodynamics_sorted_list_clist +\clist_new:N \l__thermodynamics_remaining_list_clist +\cs_new:Nn \__thermodynamics_sort_clist:n +{% Sort the list in the order of \c__thermodynamics_sort_order_tl + + % Wipe out any remnants from the last sort + \clist_clear:N \l__thermodynamics_in_list_clist + \clist_clear:N \l__thermodynamics_sorted_list_clist + + % Make a copy of the list + \clist_set:Nn \l__thermodynamics_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__thermodynamics_sort_order_tl + { + \clist_if_in:NnT \l__thermodynamics_remaining_list_clist {##1} + { \clist_put_right:Nn \l__thermodynamics_in_list_clist {##1} } + + \clist_remove_all:Nn \l__thermodynamics_remaining_list_clist {##1} + } + + % Then merge the lists back together again. + \clist_if_empty:NF \l__thermodynamics_in_list_clist + { + \clist_put_right:Nn \l__thermodynamics_sorted_list_clist \l__thermodynamics_in_list_clist + } + \clist_if_empty:NF \l__thermodynamics_remaining_list_clist + { + \clist_put_right:Nn \l__thermodynamics_sorted_list_clist \l__thermodynamics_remaining_list_clist + } + \clist_use:Nn \l__thermodynamics_sorted_list_clist , +} +\dim_new:N \l__thermodynamics_Partial_const_dim +\dim_new:N \l__thermodynamics_operator_width_dim +\dim_new:N \l__thermodynamics_adjust_width_dim +\settowidth{\l__thermodynamics_operator_width_dim}{=} +\dim_set:Nn \l__thermodynamics_adjust_width_dim {0.1\l__thermodynamics_operator_width_dim} +\dim_add:Nn \l__thermodynamics_operator_width_dim \l__thermodynamics_adjust_width_dim +\tl_new:N \l__thermodynamics_Partial_start_tl +\tl_new:N \l__thermodynamics_Partial_end_tl +\tl_new:N \l__thermodynamics_Partial_empty_end_tl +\tl_new:N \l__thermodynamics_Partial_middle_tl +\tl_set:Nn \l__thermodynamics_Partial_start_tl {\left\l__thermodynamics_PartialOpen_tl} +\tl_set:Nn \l__thermodynamics_Partial_end_tl {\right\l__thermodynamics_PartialClose_tl} +\tl_set:Nn \l__thermodynamics_Partial_empty_end_tl {\right\l__thermodynamics_PartialEmptyClose_tl} +\tl_set:Nn \l__thermodynamics_Partial_middle_tl {\middle} +\cs_set_eq:NN \__thermodynamics_frac:nn \frac +\NewDocumentCommand{\Partial}{s m m m} +{ \bool_if:nTF {#1} + {% Starred form (recursive) + \settowidth{\l__thermodynamics_Partial_const_dim}{\ensuremath{#4}}% + \dim_add:Nn \l__thermodynamics_Partial_const_dim {-0.20\l__thermodynamics_Partial_const_dim}% + \Partial{#2}{#3}{#4}% + \bool_if:NT \l__thermodynamics_subscripted_bool + { \dim_compare:nNnTF \l__thermodynamics_operator_width_dim + < \l__thermodynamics_Partial_const_dim + { \kern -\l__thermodynamics_operator_width_dim } + { \kern -\l__thermodynamics_Partial_const_dim } + } + } + {% Unstarred form + \bool_if:NTF \l__thermodynamics_subscripted_bool + {% Handle case of empty variables held constant + \tl_if_eq:nnTF {#4} {} + { \l__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial #2}{\partial #3}\l__thermodynamics_Partial_empty_end_tl + } + { \l__thermodynamics_Partial_start_tl\__thermodynamics_frac:nn{\partial #2} + {\partial #3}\l__thermodynamics_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__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial #2(\__thermodynamics_sort_clist:n{#4})} + {\partial #3}\l__thermodynamics_Partial_end_tl + } + { \l__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial #2(\__thermodynamics_sort_clist:n{#3,#4})} + {\partial #3}\l__thermodynamics_Partial_end_tl + } + } + } +} +\NewDocumentCommand{\PartialBigg}{} + { \tl_set:Nn \l__thermodynamics_Partial_start_tl {\Biggl\l__thermodynamics_PartialOpen_tl} + \tl_set:Nn \l__thermodynamics_Partial_end_tl {\Biggr\l__thermodynamics_PartialClose_tl} + \tl_set:Nn \l__thermodynamics_Partial_Empty_end_tl + {\Biggr\l__thermodynamics_PartialEmptyClose_tl} + \Partial + } +\NewDocumentCommand{\Partialbigg}{} + { \tl_set:Nn \l__thermodynamics_Partial_start_tl {\biggl\l__thermodynamics_PartialOpen_tl} + \tl_set:Nn \l__thermodynamics_Partial_end_tl {\biggr\l__thermodynamics_PartialClose_tl} + \tl_set:Nn \l__thermodynamics_Partial_empty_end_tl + {\biggr\l__thermodynamics_PartialEmptyClose_tl} + \Partial + } +\NewDocumentCommand{\PartialSecond}{s m m m} +{ + \bool_if:nTF {#1} + {% Starred form + \settowidth{\l__thermodynamics_Partial_const_dim}{\ensuremath{#4}}% + \dim_add:Nn \l__thermodynamics_Partial_const_dim {-0.20\l__thermodynamics_Partial_const_dim} + \PartialSecond{#2}{#3}{#4}% + \bool_if:nT \l__thermodynamics_subscripted_bool + { \dim_compare:nNnTF {\l__thermodynamics_operator_width_dim} + < {\l__thermodynamics_Partial_const_dim} + { \kern -\l__thermodynamics_operator_width_dim } + { \kern -\l__thermodynamics_Partial_const_dim } + } + } + {% Unstarred form + \bool_if:NTF \l__thermodynamics_subscripted_bool + {% Handles case of empty variables held constant + \tl_if_eq:nnTF {#4} {} + { \l__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial\c_math_superscript_token 2 #2} + {\partial #3\c_math_superscript_token 2}\l__thermodynamics_Partial_empty_end_tl + } + { \l__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial\c_math_superscript_token 2 #2} + {\partial #3\c_math_superscript_token 2}\l__thermodynamics_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__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial\c_math_superscript_token 2 #2(#4)} + {\partial\c_math_superscript_token 2 #3}\l__thermodynamics_Partial_end_tl + } + { \l__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial\c_math_superscript_token 2 + #2(\__thermodynamics_sort_clist:n{#3,#4})} + {\partial #3\c_math_superscript_token 2}\l__thermodynamics_Partial_end_tl + } + } + } +} +\NewDocumentCommand{\PartialSecondBigg}{} +{ \tl_set:Nn \l__thermodynamics_Partial_start_tl {\biggl\l__thermodynamics_PartialOpen_tl} + \tl_set:Nn \l__thermodynamics_Partial_end_tl {\biggl\l__thermodynamics_PartialClose_tl} + \tl_set:Nn \l__thermodynamics_Partial_empty_end_tl {\biggl\l__thermodynamics_PartialClose_tl} + \PartialSecond +} +\NewDocumentCommand{\PartialSecondbigg}{} +{ \tl_set:Nn \l__thermodynamics_Partial_start_tl {\biggl\l__thermodynamics_PartialOpen_tl} + \tl_set:Nn \l__thermodynamics_Partial_end_tl {\biggl\l__thermodynamics_PartialClose_tl} + \tl_set:Nn \l__thermodynamics_Partial_empty_end_tl {\biggl\l__thermodynamics_PartialClose_tl} + \PartialSecond +} +\bool_new:N \l__thermodynamics_has_x_or_y_bool +\NewDocumentCommand{\PartialMixSecond}{s m m m m} +{ + \bool_if:nTF {#1} + {% Starred version + \settowidth{\l__thermodynamics_Partial_const_dim}{\ensuremath{#4}}% + \dim_add:Nn \l__thermodynamics_Partial_const_dim {-0.20\l__thermodynamics_Partial_const_dim} + \PartialMixSecond{#2}{#3}{#4}{#5} + \bool_if:nT \l__thermodynamics_subscripted_bool + { \dim_compare:nNnTF {\l__thermodynamics_operator_width_dim} + < {\l__thermodynamics_Partial_const_dim} + { \kern -\l__thermodynamics_operator_width_dim } + { \kern -\l__thermodynamics_Partial_const_dim } + } + } + {% Unstarred version + \bool_if:nTF \l__thermodynamics_subscripted_bool + {% subscripted version + \tl_if_eq:nnTF {#5} {} + {% Handle case of empty variables held constant + \l__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial\c_math_superscript_token 2 #2} + {\partial #3\partial #4}\l__thermodynamics_Partial_empty_end_tl + } + { \l__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial\c_math_superscript_token 2 #2} + {\partial #3\partial #4}\l__thermodynamics_Partial_end_tl + \c_math_subscript_token{#5} + } + } + {% not subscripted + \tl_if_eq:nnTF {#5} {} + {% empty argument + \l__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial\c_math_superscript_token 2 + #2(\__thermodynamics_sort_clist:n{#3,#4,#5})} + {\partial #3\partial #4}\l__thermodynamics_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__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial\c_math_superscript_token 2 + #2(\__thermodynamics_sort_clist:n{#4,#5})} + {\partial #3\partial #4}\l__thermodynamics_Partial_end_tl + } + { \tl_if_in:nnTF {#4} {\Nt} + { \RenewDocumentCommand{\allbut}{O{j} m m}{\allcomponents{##3}}% + \l__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial\c_math_superscript_token 2 + #2(\__thermodynamics_sort_clist:n{#3,#5})} + {\partial #3\partial #4}\l__thermodynamics_Partial_end_tl + } + {% Check for x, y, or w + \bool_set_false:N \l__thermodynamics_has_x_or_y_bool + \tl_if_in:nnT {#3} {x} + { \l__thermodynamics_has_x_or_y_bool } + \tl_if_in:nnT {#3} {y} + { \l__thermodynamics_has_x_or_y_bool } + \tl_if_in:nnT {#3} {w} + { \l__thermodynamics_has_x_or_y_bool } + \bool_if:NTF \l__thermodynamics_has_x_or_y_bool + { \RenewDocumentCommand{\allbutlastand}{O{j} m m} + {\allcomponents{##3}} + \l__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial\c_math_superscript_token 2 + #2(\__thermodynamics_sort_clist:n{#4,#5})} + {\partial #3\partial #4}\l__thermodynamics_Partial_end_tl + } + { + \l__thermodynamics_Partial_start_tl + \__thermodynamics_frac:nn{\partial\c_math_superscript_token 2 + #2(\__thermodynamics_sort_clist:n{#3,#4,#5})} + {\partial #3\partial #4}\l__thermodynamics_Partial_end_tl + } + } + } + } + } + } +} +\NewDocumentCommand{\PartialMixSecondBigg}{} +{ \tl_set:Nn \l__thermodynamics_Partial_start_tl {\Biggl\l__thermodynamics_PartialOpen_tl} + \tl_set:Nn \l__thermodynamics_Partial_end_tl {\Biggl\l__thermodynamics_PartialClose_tl} + \tl_set:Nn \l__thermodynamics_Partial_empty_end_tl {\Biggl\l__thermodynamics_PartialClose_tl} + \PartialMixSecond +} +\NewDocumentCommand{\PartialMixSecondbigg}{} +{ \tl_set:Nn \l__thermodynamics_Partial_start_tl {\biggl\l__thermodynamics_PartialOpen_tl} + \tl_set:Nn \l__thermodynamics_Partial_end_tl {\biggl\l__thermodynamics_PartialClose_tl} + \tl_set:Nn \l__thermodynamics_Partial_empty_end_tl {\biggl\l__thermodynamics_PartialClose_tl} + \PartialMixSecond } \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}{}{|} }% } -\newenvironment*{thermoparentheses}{ - \renewcommand*{\PartialOpen}{(}% - \renewcommand*{\PartialClose}{)}% - \renewcommand*{\PartialEmptyClose}{)}% +\NewDocumentCommand{\Partialinline}{} +{ + \cs_set:Nn \__thermodynamics_frac:nn { ##1 \l__thermodynamics_Partial_middle_tl / ##2 } + \Partial +} +\NewDocumentCommand{\PartialSecondinline}{} +{ + \cs_set:Nn \__thermodynamics_frac:nn { ##1 \l__thermodynamics_Partial_middle_tl / ##2 } + \PartialSecond +} +\NewDocumentCommand{\PartialMixSecondinline}{} +{ + \cs_set:Nn \__thermodynamics_frac:nn { ##1 \l__thermodynamics_Partial_middle_tl / ##2 } + \PartialMixSecond +} +\NewDocumentCommand{\Partialinlinetext}{} +{ \cs_set_eq:NN \l__thermodynamics_Partial_start_tl \l__thermodynamics_PartialOpen_tl + \cs_set_eq:NN \l__thermodynamics_Partial_end_tl \l__thermodynamics_PartialClose_tl + \cs_set_eq:NN \l__thermodynamics_Partial_empty_end_tl \l__thermodynamics_PartialEmptyClose_tl + \cs_set_eq:NN \l__thermodynamics_Partial_middle_tl \relax + \Partialinline +} +\NewDocumentCommand{\PartialSecondinlinetext}{} +{ \cs_set_eq:NN \l__thermodynamics_Partial_start_tl \l__thermodynamics_PartialOpen_tl + \cs_set_eq:NN \l__thermodynamics_Partial_end_tl \l__thermodynamics_PartialClose_tl + \cs_set_eq:NN \l__thermodynamics_Partial_empty_end_tl \l__thermodynamics_PartialEmptyClose_tl + \cs_set_eq:NN \l__thermodynamics_Partial_middle_tl \relax + \PartialSecondinline +} +\NewDocumentCommand{\PartialMixSecondinlinetext}{} +{ \cs_set_eq:NN \l__thermodynamics_Partial_start_tl \l__thermodynamics_PartialOpen_tl + \cs_set_eq:NN \l__thermodynamics_Partial_end_tl \l__thermodynamics_PartialClose_tl + \cs_set_eq:NN \l__thermodynamics_Partial_empty_end_tl \l__thermodynamics_PartialEmptyClose_tl + \cs_set_eq:NN \l__thermodynamics_Partial_middle_tl \relax + \PartialMixSecondinline +} +\NewDocumentEnvironment{thermoparentheses}{} +{ \cs_set:Nn \l__thermodynamics_PartialOpen_tl {(} + \cs_set:Nn \l__thermodynamics_PartialClose_tl {)} + \cs_set:Nn \l__thermodynamics_PartialEmptyClose_tl {)} }{} -\newenvironment*{thermobrackets}{% - \renewcommand*{\PartialOpen}{[}% - \renewcommand*{\PartialClose}{]}% - \renewcommand*{\PartialEmptyClose}{]}% +\NewDocumentEnvironment{thermobrackets}{} +{ \tl_set:Nn \l__thermodynamics_PartialOpen_tl {[} + \tl_set:Nn \l__thermodynamics_PartialClose_tl {]} + \tl_set:Nn \l__thermodynamics_PartialEmptyClose_tl {]} }{} -\newenvironment*{thermobraces}{% - \renewcommand*{\PartialOpen}{\{}% - \renewcommand*{\PartialClose}{\}}% - \renewcommand*{\PartialEmptyClose}{\}}% +\NewDocumentEnvironment{thermobraces}{} +{ \tl_set:Nn \l__thermodynamics_PartialOpen_tl {\{} + \tl_set:Nn \l__thermodynamics_PartialClose_tl {\}} + \tl_set:Nn \l__thermodynamics_PartialEmptyClose_tl {\}} }{} -\newenvironment*{thermobar}{% - \renewcommand*{\PartialOpen}{.}% - \renewcommand*{\PartialClose}{\rvert}% - \renewcommand*{\PartialEmptyClose}{.}% +\NewDocumentEnvironment{thermobar}{} +{ \tl_set:Nn \l__thermodynamics_PartialOpen_tl {.} + \tl_set:Nn \l__thermodynamics_PartialClose_tl {\rvert} + \tl_set:Nn \l__thermodynamics_PartialEmptyClose_tl {.} }{} -\newenvironment*{thermoplain}{% - \renewcommand*{\PartialOpen}{.}% - \renewcommand*{\PartialClose}{.}% - \renewcommand*{\PartialEmptyClose}{.}% - \@subscriptedfalse +\NewDocumentEnvironment{thermoplain}{} +{ \tl_set:Nn \l__thermodynamics_PartialOpen_tl {.} + \tl_set:Nn \l__thermodynamics_PartialClose_tl {.} + \tl_set:Nn \l__thermodynamics_PartialEmptyClose_tl {.} + \bool_set_false:N \l__thermodynamics_subscripted_bool }{} -\newenvironment*{thermoNOsubscripts}{\@subscriptedfalse}{} -\newenvironment*{thermosubscripts}{\@subscriptedtrue}{} -\newcommand*{\DeclareSubscrSymbol}[3]{% - \expandafter\def\csname #1\endcsname{% - \@ifnextchar^{\csname @#1\endcsname} - {\@ifnextchar_{\csname @@#1\endcsname}{{#2}_{#3}}} - } - \expandafter\def\csname @#1\endcsname ##1##2{% - {#2}^{##2}\@ifnextchar_{\csname @@@#1\endcsname}{_{#3}}% - } - \expandafter\def\csname @@#1\endcsname ##1##2{{#2}_{#3,##2}} - \expandafter\def\csname @@@#1\endcsname ##1##2{_{#3,##2}} -} -\newcommand*{\heatcapacitysymbol}{C} -\newcommand*{\compressibilitysymbol}{\kappa} -\newcommand*{\expansivitysymbol}{\alpha} -\DeclareSubscrSymbol{cV}{\@intensive\heatcapacitysymbol}{\volume@symbol} -\DeclareSubscrSymbol{cP}{\@intensive\heatcapacitysymbol}{\pressure@symbol} -\DeclareSubscrSymbol{cVt}{\@extensive\heatcapacitysymbol}{\volume@symbol} -\DeclareSubscrSymbol{cPt}{\@extensive\heatcapacitysymbol}{\pressure@symbol} -\DeclareSubscrSymbol{cVs}{\@specific\heatcapacitysymbol}{\volume@symbol} -\DeclareSubscrSymbol{cPs}{\@specific\heatcapacitysymbol}{\pressure@symbol} -\DeclareSubscrSymbol{kappaT}{\compressibilitysymbol}{\temperature@symbol} -\DeclareSubscrSymbol{kappaS}{\compressibilitysymbol}{\entropy@symbol} -\DeclareSubscrSymbol{alphaP}{\expansivitysymbol}{\pressure@symbol} -\DeclareSubscrSymbol{alphaS}{\expansivitysymbol}{\entropy@symbol} -\newcommand*{\sat}{{\text{sat}}} -\newcommand*{\Psat}{P^\sat} -\let\Pvap\Psat -\newcommand*{\phisat}{\phi^\sat} -\newcommand*{\fsat}{f^\sat} -\let\std\circ -\newcommand*{\Pstd}{P^\std} -\newcommand*{\fstd}{f^\std} -\newcommand*{\mixing}{{\text{mix}}} -\newcommand*{\Deltamix}[1]{\Delta{#1}_\mixing} -\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} -\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} -\newcommand*{\fmix}{\hat{f}} -\newcommand*{\phimix}{\hat\phi} -\newcommand*{\fpure}{f} -\let\phipure\phi -\let\pm@symbol\relax -\newcommand*{\partialmolar}[1]{\gdef\pm@symbol{#1}\generic@pm} -\def\generic@pm{\@ifnextchar_\@generic@pm\@@generic@pm} -\def\@generic@pm#1#2{% - \gdef\pm@arg{#2}% - % if nextchar after argument is ^ - \@ifnextchar^\@@@generic@pm\@@@@generic@pm -} -\def\@@@generic@pm#1#2{\thermo@overline{\pm@symbol^{#2}_{\pm@arg}}} -\def\@@@@generic@pm{\thermo@overline{\pm@symbol_{\pm@arg}}} -\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}}} -\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} -\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} -\newcommand*{\Wm}{\@intensive\work@symbol} -\newcommand*{\Mm}{\@intensive M} -\newcommand*{\Bm}{\@intensive B} -\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} -\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}} -\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}% -} -\newcommand*{\residual}{R} -\newcommand*{\excess}{E} -\newcommand*{\UR}{\Um^\residual} -\newcommand*{\HR}{\Hm^\residual} -\newcommand*{\FR}{\Fm^\residual} -\newcommand*{\GR}{\Gm^\residual} -\newcommand*{\VR}{\Vm^\residual} -\newcommand*{\SR}{\Sm^\residual} -\newcommand*{\URt}{\Ut^\residual} -\newcommand*{\HRt}{\Ht^\residual} -\newcommand*{\FRt}{\Ft^\residual} -\newcommand*{\GRt}{\Gt^\residual} -\newcommand*{\VRt}{\Vt^\residual} -\newcommand*{\SRt}{\St^\residual} -\newcommand*{\URs}{\Us^\residual} -\newcommand*{\HRs}{\Hs^\residual} -\newcommand*{\FRs}{\Fs^\residual} -\newcommand*{\GRs}{\Gs^\residual} -\newcommand*{\VRs}{\Vs^\residual} -\newcommand*{\SRs}{\Ss^\residual} -\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}} -\newcommand*{\UE}{\Um^\excess} -\newcommand*{\FE}{\Fm^\excess} -\newcommand*{\HE}{\Hm^\excess} -\newcommand*{\GE}{\Gm^\excess} -\newcommand*{\SE}{\Sm^\excess} -\newcommand*{\VE}{\Vm^\excess} -\newcommand*{\UEt}{\Ut^\excess} -\newcommand*{\FEt}{\Ft^\excess} -\newcommand*{\HEt}{\Ht^\excess} -\newcommand*{\GEt}{\Gt^\excess} -\newcommand*{\SEt}{\St^\excess} -\newcommand*{\VEt}{\Vt^\excess} -\newcommand*{\UEs}{\Us^\excess} -\newcommand*{\FEs}{\Fs^\excess} -\newcommand*{\HEs}{\Hs^\excess} -\newcommand*{\GEs}{\Gs^\excess} -\newcommand*{\SEs}{\Ss^\excess} -\newcommand*{\VEs}{\Vs^\excess} -\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}} -\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}} -\newcommand*{\IG}{{\text{IG}}} -\newcommand*{\IGM}{{\text{IGM}}} -\newcommand*{\IS}{{\text{IS}}} -\newcommand*{\Henryrat}{h} -\newcommand*{\Henrymol}{{\mathcal{H}}} +\NewDocumentEnvironment{thermoNOsubscripts}{} + {\bool_set_false:N \l__thermodynamics_subscripted_bool} + {} +\NewDocumentEnvironment{thermosubscripts}{} + {\bool_set_true:N \l__thermodynamics_subscripted_bool} + {} +\NewDocumentEnvironment{thermomolesrange}{} + { \__thermodynamics_set_moles_range } + {} +\NewDocumentEnvironment{thermointensiveplain}{} + { \__thermodynamics_set_intensive_plain } + {} +\NewDocumentEnvironment{thermoextensiveplain}{} + { \__thermodynamics_set_extensive_plain } + {} +\NewDocumentEnvironment{thermointensivelowercase}{} + {% { + + \__thermodynamics_set_intensive_lowercase + \__thermodynamics_set_lowercase_pms + } + {} +\NewDocumentEnvironment{thermoextensivesuperscript}{} + { + \__thermodynamics_set_extensive_superscripts + } + {} +\cs_new:Npn \__thermodynamics_check_definable:nN #1#2 +{ + \bool_set_true:N \l__thermodynamics_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} +{ + \__thermodynamics_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} +{ + \__thermodynamics_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} } + } + } + +} +\NewDocumentCommand{\NewSuperscriptedSymbol}{m m m} +{ + \__thermodynamics_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} +{ + \__thermodynamics_check_definable:nN {#1} \RenewSuperscriptedSymbol + \cs_if_exist:NF #1 + { \PackageError{thermodynamics} + {Command~'\tl_trim_spaces:o {\tl_to_str:n {#1}}'~not~defined} + {You~have~used~ + '\tl_trim_spaces:o {\tl_to_str:n {\RenewSuperscriptedSymbol}}'~ + with~a~command~that~does~not~have~a~definition} + } + \cs_set:cpn {\cs_to_str:N #1_one:n} ##1 + { + {#2}\c_math_subscript_token{##1} + \peek_catcode_remove:NTF \c_math_superscript_token + { \use:c {\cs_to_str:N #1_three:n} } + { \c_math_superscript_token{#3} } + } + + \cs_set:cpn {\cs_to_str:N #1_two:n} ##1 + { {#2}\c_math_superscript_token{#3,##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} } + } + } +} +\NewExpandableDocumentCommand{\heatcapacitysymbol}{}{C} +\NewExpandableDocumentCommand{\compressibilitysymbol}{}{\kappa} +\NewExpandableDocumentCommand{\expansivitysymbol}{}{\alpha} +\NewExpandableDocumentCommand{\JTsymbol}{}{\mu} +\NewSubscriptedSymbol{\cV}{\__thermodynamics_intensive:n \heatcapacitysymbol} + {\g__thermodynamics_volume_symbol} +\NewSubscriptedSymbol{\cP}{\__thermodynamics_intensive:n \heatcapacitysymbol} + {\g__thermodynamics_pressure_symbol} +\NewSubscriptedSymbol{\cVt}{\__thermodynamics_extensive:n \heatcapacitysymbol} + {\g__thermodynamics_volume_symbol} +\NewSubscriptedSymbol{\cPt}{\__thermodynamics_extensive:n \heatcapacitysymbol} + {\g__thermodynamics_pressure_symbol} +\NewSubscriptedSymbol{\cVs}{\__thermodynamics_specific:n \heatcapacitysymbol} + {\g__thermodynamics_volume_symbol} +\NewSubscriptedSymbol{\cPs}{\__thermodynamics_specific:n \heatcapacitysymbol} + {\g__thermodynamics_pressure_symbol} +\NewSubscriptedSymbol{\kappaT}{\compressibilitysymbol} + {\g__thermodynamics_temperature_symbol} +\NewSubscriptedSymbol{\kappaS}{\compressibilitysymbol} + {\g__thermodynamics_entropy_symbol} +\NewSubscriptedSymbol{\alphaP}{\expansivitysymbol}{\g__thermodynamics_pressure_symbol} +\NewSubscriptedSymbol{\alphaS}{\expansivitysymbol}{\g__thermodynamics_entropy_symbol} +\NewSubscriptedSymbol{\muJT}{\JTsymbol}{JT} +\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} +\NewDocumentCommand{\std}{}{\circ} +\NewDocumentCommand{\Pstd}{}{P\c_math_superscript_token \std} +\NewDocumentCommand{\fstd}{}{f\c_math_superscript_token \std} +\NewDocumentCommand{\mixing}{}{{\text{mix}}} +\NewDocumentCommand{\Deltamix}{m} + {\Delta{#1}\c_math_subscript_token\mixing} +\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__thermodynamics_Deltaf_sym_tl +\NewSubscriptedSymbol{\__thermodynamics_Deltaf}{\l__thermodynamics_Deltaf_sym_tl}{f} +\NewDocumentCommand{\Deltaf}{m} +{ \tl_set:Nn \l__thermodynamics_Deltaf_sym_tl {\Delta #1} + \__thermodynamics_Deltaf +} +\NewDocumentCommand{\fmix}{}{\hat{f}} +\NewDocumentCommand{\phimix}{}{\hat\phi} +\NewDocumentCommand{\fpure}{}{f} +\NewDocumentCommand{\phipure}{}{\phi} +\tl_new:N \l__thermodynamics_pm_symbol_tl +\tl_new:N \l__thermodynamics_pm_arg_tl +\NewDocumentCommand{\partialmolar}{m} +{ + \tl_set:Nn \l__thermodynamics_pm_symbol_tl {#1} + \__thermodynamics_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 \__thermodynamics_generic_pm: +{ + \peek_catcode_remove:NTF \c_math_subscript_token + {% case 4 or case 5 + \__thermodynamics_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} + \__thermodynamics_pm_case_three + } + {% Look for optional argument [...] + \peek_charcode:NTF [ + {% case 2: \Mpm[S]{i} + \__thermodynamics_pm_case_two + } + {% case 1: \Mpm{i} + \__thermodynamics_pm_case_one + } + } + } +} +\cs_new:Npn \__thermodynamics_pm_case_one #1 +{ + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl\c_math_subscript_token{#1}} +} +\cs_new:Npn \__thermodynamics_pm_case_two [#1]#2 +{ + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl + \c_math_superscript_token{#1}\c_math_subscript_token{#2}} +} +\cs_new:Npn \__thermodynamics_pm_case_three #1 +{ + \tl_set:Nn \l__thermodynamics_pm_arg_tl {#1} + \peek_catcode_remove:NTF \c_math_subscript_token + { \__thermodynamics_pm_case_three_part_two } + { \__thermodynamics_pm_case_three_part_two } +} +\cs_new:Npn \__thermodynamics_pm_case_three_part_two #1 +{ + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl + \c_math_superscript_token{\l__thermodynamics_pm_arg_tl} + \c_math_subscript_token{#1}} +} +\cs_new:Npn \__thermodynamics_pm_case_four_or_five #1 +{ + \tl_set:Nn \l__thermodynamics_pm_arg_tl {#1} + \peek_catcode_remove:NTF \c_math_superscript_token + { \__thermodynamics_pm_case_four } + { \__thermodynamics_pm_case_five } +} +\cs_new:Npn \__thermodynamics_pm_case_four #1 +{ + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl\c_math_superscript_token{#1} + \c_math_subscript_token{\l__thermodynamics_pm_arg_tl}} +} +\cs_new:Npn \__thermodynamics_pm_case_five +{ + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl + \c_math_subscript_token{\l__thermodynamics_pm_arg_tl}} +} +\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:}{}{\__thermodynamics_extensive:n {#2}} + % Molar property + \exp_after:wN \NewDocumentCommand \exp_after:wN + {\cs:w #1m\cs_end:}{}{\__thermodynamics_intensive:n {#2}} + % Specific property + \exp_after:wN \NewDocumentCommand \exp_after:wN + {\cs:w #1s\cs_end:}{}{\__thermodynamics_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:}{\__thermodynamics_extensive:n{#2}}{\excess} + \exp_after:wN \NewSuperscriptedSymbol \exp_after:wN + {\cs:w #1 E\cs_end:}{\__thermodynamics_intensive:n{#2}}{\excess} + \exp_after:wN \NewSuperscriptedSymbol \exp_after:wN + {\cs:w #1 Es\cs_end:}{\__thermodynamics_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:}{\__thermodynamics_extensive:n{#2}}{\residual} + \exp_after:wN \NewSuperscriptedSymbol \exp_after:wN + {\cs:w #1 R\cs_end:}{\__thermodynamics_intensive:n{#2}}{\residual} + \exp_after:wN \NewSuperscriptedSymbol \exp_after:wN + {\cs:w #1 Rs\cs_end:}{\__thermodynamics_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} +} +\NewDocumentCommand{\Nt}{}{\g__thermodynamics_mole_symbol} +\NewThermodynamicProperty{E}{\g__thermodynamics_total_energy_symbol} +\NewThermodynamicProperty{U}{\g__thermodynamics_internal_energy_symbol} +\NewThermodynamicProperty{F}{\g__thermodynamics_Helmholtz_symbol} +\NewThermodynamicProperty{G}{\g__thermodynamics_Gibbs_symbol} +\NewThermodynamicProperty{H}{\g__thermodynamics_enthalpy_symbol} +\NewThermodynamicProperty{L}{\g__thermodynamics_Landau_symbol} +\NewThermodynamicProperty{V}{\g__thermodynamics_volume_symbol} +\NewThermodynamicProperty{S}{\g__thermodynamics_entropy_symbol} +\NewExtensiveProperty{A}{\g__thermodynamics_area_symbol} +\NewPartialMolarProperty{A}{\g__thermodynamics_area_symbol} +\NewExtensiveProperty{Q}{\g__thermodynamics_heat_symbol} +\NewExtensiveProperty{W}{\g__thermodynamics_work_symbol} +\NewDocumentCommand{\cPpm}{} +{ + \cs_set:Npn \__thermodynamics_pm_case_one ##1 + { + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl\c_math_subscript_token + {\g__thermodynamics_pressure_symbol,##1}} + } + \cs_set:Npn \__thermodynamics_pm_case_two [##1]##2 + { + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl\c_math_superscript_token{##1} + \c_math_subscript_token{\g__thermodynamics_pressure_symbol,##2}} + } + \cs_set:Npn \__thermodynamics_pm_case_three_part_two ##1 + { + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl + \c_math_superscript_token{\l__thermodynamics_pm_arg_tl} + \c_math_subscript_token{\g__thermodynamics_pressure_symbol,##1}} + } + \cs_set:Npn \__thermodynamics_pm_case_four ##1 + { + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl + \c_math_superscript_token{##1}\c_math_subscript_token + {\g__thermodynamics_pressure_symbol,\l__thermodynamics_pm_arg_tl}} + } + \cs_set:Npn \__thermodynamics_pm_case_five + { + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl\c_math_subscript_token + {\g__thermodynamics_pressure_symbol,\l__thermodynamics_pm_arg_tl}} + } + \partialmolar{\heatcapacitysymbol} +} +\NewDocumentCommand{\cVpm}{} +{ + \cs_set:Npn \__thermodynamics_pm_case_one ##1 + { + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl\c_math_subscript_token + {\g__thermodynamics_volume_symbol,##1}} + } + \cs_set:Npn \__thermodynamics_pm_case_two [##1]##2 + { + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl + \c_math_superscript_token{##1}\c_math_subscript_token + {\g__thermodynamics_volume_symbol,##2}} + } + \cs_set:Npn \__thermodynamics_pm_case_three_part_two ##1 + { + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl + \c_math_superscript_token{\l__thermodynamics_pm_arg_tl} + \c_math_subscript_token{\g__thermodynamics_volume_symbol,##1}} + } + \cs_set:Npn \__thermodynamics_pm_case_four ##1 + { + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl + \c_math_superscript_token{##1} + \c_math_subscript_token + {\g__thermodynamics_volume_symbol,\l__thermodynamics_pm_arg_tl}} + } + \cs_set:Npn \__thermodynamics_pm_case_five + { + \__thermodynamics_overline:n {\l__thermodynamics_pm_symbol_tl\c_math_subscript_token + {\g__thermodynamics_volume_symbol,\l__thermodynamics_pm_arg_tl}} + } + \partialmolar{\heatcapacitysymbol} +} +\NewDocumentCommand{\residual}{}{R} +\NewDocumentCommand{\excess}{}{E} +\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} } +\NewDocumentCommand{\IG}{}{{\text{IG}}} +\NewDocumentCommand{\IGM}{}{{\text{IGM}}} +\NewDocumentCommand{\IS}{}{{\text{IS}}} +\NewDocumentCommand{\Henryrat}{}{h} +\NewDocumentCommand{\Henrymol}{}{\mathcal{H}} \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} -\newcommand*{\Jacobian}[4]{\frac{\partial{(#1,#2)}}{\partial{(#3,#4)}}}% +\NewDocumentCommand{\gammarat}{}{\gamma\c_math_superscript_token\ast} +\NewDocumentCommand{\gammamol}{}{\gamma\c_math_superscript_token\square} +\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| } +} +\NewDocumentCommand{\Jacobian}{m m} + {\__thermodynamics_frac:nn{\partial(#1)}{\partial{(#2)}}} +\NewDocumentCommand{\Jacobiandet}{O{} O{} m m} +{ + \__thermodynamics_Jacobian_set_ncomponents:nn {#3} {#4} + \begin{thermovmatrix} + \__thermodynamics_Jacobianmatrix:nnnn {#1} {#2} {#3} {#4} + \end{thermovmatrix} +} +\seq_new:N \l__thermodynamics_row_seq +\seq_new:N \l__thermodynamics_matrix_seq +\clist_new:N \l__thermodynamics_other_vars_clist +\clist_new:N \l__thermodynamics_other_vars_copy_clist +\tl_new:N \l__thermodynamics_Jacobian_x_tl +\tl_new:N \l__thermodynamics_Jacobian_n_tl +\tl_new:N \l__thermodynamics_Jacobian_temp_tl +\bool_new:N \l__thermodynamics_found_dots_bool +\cs_new:Nn \__thermodynamics_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__thermodynamics_found_dots_bool + % look for what "x" is + \tl_set:Nn \l__thermodynamics_Jacobian_x_tl {\tl_head:n {#2}} + % look for what "n" is and set \ncomponents to it + \tl_set:Nx \l__thermodynamics_Jacobian_n_tl {\tl_item:nn {#2} {-1}} + \RenewExpandableDocumentCommand{\ncomponents}{}{\l__thermodynamics_Jacobian_n_tl} + } + {% Does not have dots; proceed accordingly + \bool_set_false:N \l__thermodynamics_found_dots_bool + } +} +\cs_new_protected:Nn \__thermodynamics_Jacobianmatrix:nnnn +{ + \seq_clear:N \l__thermodynamics_matrix_seq + \clist_set:Nn \l__thermodynamics_other_vars_clist {#4} + \clist_set_eq:NN \l__thermodynamics_other_vars_copy_clist \l__thermodynamics_other_vars_clist + + \clist_map_inline:nn {#3} + { + \seq_clear:N \l__thermodynamics_row_seq + \tl_if_in:nnTF {##1} {\dots} + {% The current row has "dots" => row is \vdots && \vdots + \seq_put_right:Nn \l__thermodynamics_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__thermodynamics_row_seq \dots + } + {% Normal column + \clist_set_eq:NN \l__thermodynamics_other_vars_clist + \l__thermodynamics_other_vars_copy_clist + \clist_remove_all:Nn \l__thermodynamics_other_vars_clist {####1} + \bool_if:NTF \l__thermodynamics_found_dots_bool + { \tl_set:Nn \l__thermodynamics_Jacobian_temp_tl {\tl_item:nn {####1} {-1}} + \seq_put_right:Nx \l__thermodynamics_row_seq + { + #1\Partial{##1}{####1} + {\allbut{\l__thermodynamics_Jacobian_temp_tl}{\l__thermodynamics_Jacobian_x_tl}} + } + } + { \seq_put_right:Nx \l__thermodynamics_row_seq + { + #1\Partial{##1}{####1} + {\clist_use:Nn \l__thermodynamics_other_vars_clist ,} + } + } + } + } + \seq_put_right:Nx \l__thermodynamics_matrix_seq + { + \seq_use:Nn \l__thermodynamics_row_seq { \c_alignment_token } + } + } + } + \tl_if_empty:nTF {#2} + { + \tl_if_eq:nnTF {#1} {\displaystyle} + { \seq_use:Nn \l__thermodynamics_matrix_seq { \\[2.75ex] } } + { \seq_use:Nn \l__thermodynamics_matrix_seq { \\[1.25ex] } } + } + { + \seq_use:Nn \l__thermodynamics_matrix_seq { \\[#2] } + } +} \endinput %% %% End of file `thermodynamics.sty'. |