texlive[45084] Master/texmf-dist: phfqit (20aug17)

commits+karl at tug.org commits+karl at tug.org
Mon Aug 21 00:13:28 CEST 2017


Revision: 45084
          http://tug.org/svn/texlive?view=revision&revision=45084
Author:   karl
Date:     2017-08-21 00:13:28 +0200 (Mon, 21 Aug 2017)
Log Message:
-----------
phfqit (20aug17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/phfqit/README.md
    trunk/Master/texmf-dist/doc/latex/phfqit/phfqit.pdf
    trunk/Master/texmf-dist/doc/latex/phfqit/pkg.mk
    trunk/Master/texmf-dist/source/latex/phfqit/phfqit.dtx
    trunk/Master/texmf-dist/source/latex/phfqit/phfqit.ins
    trunk/Master/texmf-dist/tex/latex/phfqit/phfqit.sty

Modified: trunk/Master/texmf-dist/doc/latex/phfqit/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/phfqit/README.md	2017-08-20 22:13:12 UTC (rev 45083)
+++ trunk/Master/texmf-dist/doc/latex/phfqit/README.md	2017-08-20 22:13:28 UTC (rev 45084)
@@ -17,3 +17,10 @@
 Run 'make sty' to generate the style file and 'make pdf' to generate the package
 documentation. Run 'make' or 'make help' for more info.
 
+
+# Author and License
+
+(C) 2016 Philippe Faist, philippe.faist at bluewin.ch
+
+License: [LaTeX project public license](http://www.ctan.org/license/lppl1.3),
+version 1.3 or above

Modified: trunk/Master/texmf-dist/doc/latex/phfqit/phfqit.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/phfqit/pkg.mk
===================================================================
--- trunk/Master/texmf-dist/doc/latex/phfqit/pkg.mk	2017-08-20 22:13:12 UTC (rev 45083)
+++ trunk/Master/texmf-dist/doc/latex/phfqit/pkg.mk	2017-08-20 22:13:28 UTC (rev 45084)
@@ -155,12 +155,13 @@
 
 dist: $(PKGZIP)
 
-$(PKGZIP): $(PKGTDSZIP)
+# feedback from CTAN upload manager: prefer not to provide tds.zip in CTAN upload
+$(PKGZIP):  #$(PKGTDSZIP)
 	rm -rf $(DISTTMPDIR)
 	mkdir -p $(DISTTMPDIR)/$(PKG)
-	cp $(PKGTDSZIP) $(DISTTMPDIR)
+#	 cp $(PKGTDSZIP) $(DISTTMPDIR)
 	cp $(PKGDTX) $(PKGINS) $(PKGPDF) $(PKGREADME) Makefile pkg.mk $(DIST_ADDITIONAL_FILES) $(DISTTMPDIR)/$(PKG)
-	cd $(DISTTMPDIR) && zip -r $(CURDIR)/$(PKGZIP) $(PKGTDSZIP) $(PKG)
+	cd $(DISTTMPDIR) && zip -r $(CURDIR)/$(PKGZIP) $(PKG) #$(PKGTDSZIP)
 	rm -rf $(DISTTMPDIR)
 
 cleandist:

Modified: trunk/Master/texmf-dist/source/latex/phfqit/phfqit.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/phfqit/phfqit.dtx	2017-08-20 22:13:12 UTC (rev 45083)
+++ trunk/Master/texmf-dist/source/latex/phfqit/phfqit.dtx	2017-08-20 22:13:28 UTC (rev 45084)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2016 by Philippe Faist <philippe.faist at bluewin.ch>
+% Copyright (C) 2016 by Philippe Faist, philippe.faist at bluewin.ch
 % -------------------------------------------------------
 % 
 % This file may be distributed and/or modified under the
@@ -22,7 +22,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
 %<package>\ProvidesPackage{phfqit}
 %<*package>
-    [2016/08/15 v1.0 phfqit package]
+    [2017/08/16 v2.0 phfqit package]
 %</package>
 %
 %<*driver>
@@ -67,7 +67,7 @@
 %
 % \GetFileInfo{phfqit.dtx}
 %
-% \DoNotIndex{\newcommand,\newenvironment,\def,\gdef,\edef,\xdef,\if,\else,\fi,\ifx}
+% \DoNotIndex{\newcommand,\newenvironment,\let,\def,\gdef,\edef,\xdef,\if,\else,\fi,\ifx,\cslet,\csdef,\begingroup,\endgroup,\expandafter,\csname,\endcsname,\appto,\hspace,\mathrm,\notblank,\the,\RequirePackage}
 % 
 % \title{\phfqitltxPkgTitle{phfqit}}
 % \author{Philippe Faist\quad\email{philippe.faist at bluewin.ch}}
@@ -106,14 +106,30 @@
 %
 % \section{Basic Usage}
 %
-% This package is straightforward to use.  There are no package options.
+% \label{sec:pkg-options}
+%
+% This package is straightforward to use:
 % \begin{verbatim}
 % \usepackage{phfqit}
 % \end{verbatim}
 %
-% [TODO: In the future, use package options to control which definitions we
-% want?]
+% A single package option controls which entropy measures are defined for you.
 %
+% \begin{pkgoptions}
+% \item[qitobjdef=\meta{\phfverb{stdset} $\mid$ \phfverb{none}}] Load
+%   the predefined set of ``qit objects, '' i.e., entropy measures.  The entropy
+%   measures documented below (and specified as such) will be loaded unless you
+%   set \pkgoptionfmt{qitobjdef=none}.
+% \item[newReIm=\metatruefalsearg] Do not override \LaTeX{}'s default
+%   {\makeatletter $\phfqit at Re$ and $\phfqit at Im$} symbols by $\Re$ and $\Im$.
+%   See \autoref{sec:description-newReIm}.
+% \end{pkgoptions}
+% 
+% \changed[v2.0-pkg-opt-qitobjdef]{v2.0}{2017/08/16}{Added the
+% \phfverb{qitobjdef} package option}
+% \changed[v2.0-pkg-opt-newReIm]{v2.0}{2017/08/16}{Added the \phfverb{newReIm}
+% package option}
+%
 % \subsection{Semantic vs. Syntactic Notation}
 %
 % The macros in this package are meant to represent a \emph{mathematical
@@ -161,6 +177,7 @@
 % \end{center}
 %
 %
+%
 % \section{General Symbols (and Math Operators)}
 % \label{sec:symbols}
 %
@@ -187,15 +204,16 @@
 % \autoref{topic:size-specification-backtick}.
 %
 % \begingroup\catcode`\^=12\relax
-% \DescribeMacro{\ee^X}\endgroup
-% A macro for the exponential.  Type the \LaTeX{} code as if |\ee| were just the symbol,
-% i.e.\@ as |\ee^{<ARGUMENT>}|.  The ideas is that this macro may be redefined to change
-% the appearance of the $e$ symbol, or even to change the notation to |\exp{<ARGUMENT>}|
-% if needed for inline math.
+% \DescribeMacro{\ee^X}\endgroup A macro for the exponential.  Type the \LaTeX{}
+% code as if |\ee| were just the symbol, i.e.\@ as |\ee^{<ARGUMENT>}|.  The
+% ideas is that this macro may be redefined to change the appearance of the $e$
+% symbol, or even to change the notation to |\exp{<ARGUMENT>}| if needed for
+% inline math.
 %
 %
 % \subsection{Math/Linear Algebra Operators}
 % \label{sec:math-operators}
+% \label{sec:description-newReIm}
 %
 % \needspace{6\baselineskip}
 % \DescribeMacro{\tr} \DescribeMacro{\supp} \DescribeMacro{\rank}
@@ -208,12 +226,12 @@
 % \DescribeMacro{\Re} \DescribeMacro{\Im} Also, redefine |\Re| and |\Im| (real
 % and imaginary parts of a complex number), to the more readable $\Re(z)$ and
 % $\Im(z)$.  (The original symbols were {\makeatletter $\phfqit at Re(z)$ and
-% $\phfqit at Im(z)$}.)
+% $\phfqit at Im(z)$}.)  Keep the old definitions using the package option
+% \pkgoptionfmt{newReIm=false}.
 %
 % \subsection{Poly symbol}
 %
 % \DescribeMacro{\poly} Can be typeset in $\poly(n)$ time.
-% \iffalse meta-comment \changedreftext{v1.0-added-poly-command} \fi
 % 
 %
 % \subsection{Bits and Bit Strings}
@@ -323,37 +341,52 @@
 %
 %
 %
-% \section{Entropy Measures}
+% \section{Entropy Measures and Other ``Qit Objects''}
 %
-% \subsection{Entropy, Conditional Entropy}
-% \label{sec:entropy-measures}
-%
-% The entropy measures (except for |\Hfunc|) all share the same syntax.  This
-% syntax is only described for the min-entropy |\Hmin|, but the other entropy
-% measures enjoy the same features.
-%
-% The name of the macros are chosen such that they identify the \emph{abstract
-% entropy measure}, and not necessarily the way one uses to write it down in a
-% specific context.  For example, for the ``old'' max-entropy
+% A ``Qit Object'' is any form of quantity which has several parameters and/or
+% arguments which are put together in some notation.  The idea is to use
+% \LaTeX{} macros to represent an actual quantity and not just some set of
+% notational symbols.  For example, for the ``old'' max-entropy
 % $H_\mathrm{max,old}(X)_\rho = \log\rank\rho$, you should use |\Hzero|
 % independently of whether it should be denoted by $H_0$, $H_\mathrm{max}$ or
 % $H_\mathrm{max,old}$.  This allows you to change the notation by redefining
 % the command |\Hzero|, while making sure that the correct quantity is
 % addressed.  (You might have both ``old''-style and ``new''-style max-entropy
-% in the same paper.)  The macros |\Hmin|, |\Hzero|, |\Hmaxf| and |\HH| may be
-% redefined to change the subscript by using the following code (change
+% in the same paper.  Their meaning should never change, even if you change your
+% mind on the notation.)  The macros |\Hmin|, |\Hzero|, |\Hmaxf| and |\HH| may
+% be redefined to change the subscript by using the following code (change
 % ``|\mathrm{max},0|'' to your favorite subscript text):
 % \begin{verbatim}
-% \makeatletter
-% \renewcommand\Hzero{\@HHbase{\HHSym}{\mathrm{max},0}}
-% \makeatother
+% \renewcommand{\Hzero}{\Hbase{\HSym}{\mathrm{max},0}}
 % \end{verbatim}
 %
+% The \pkgname{phfqit} package provides a basic infrastructure allowing to
+% define such ``Qit Object'' implementations.  This package provides the
+% following Qit Objects: entropy measures (|\Hbase|), an entropy function
+% (|\Hfnbase|), relative entropy measures (|\Dbase|), as well as coherent
+% relative entropy measures (|\DCohbase|).  The more specific commands |\Hmin|,
+% |\Hzero|, etc.\@ are then defined based on these ``base commands.''
+%
+% You may also define your own Qit Object implementations. See
+% \autoref{sec:QitObjectImpl} for documentation on that.
+%
+% The actual entropy measure definitions |\Hmin|, |\Hmaxf|, etc., can be
+% disabled by specifying the package option \pkgoptionfmt{qitobjdef=none}.
+%
+%
+% \subsection{Entropy, Conditional Entropy}
+% \label{sec:entropy-measures}
+%
+% These entropy measures all share the same syntax.  This syntax is only
+% described for the min-entropy |\Hmin|, but the other entropy measures enjoy
+% the same features.
+%
 % These commands are robust, meaning they can be used for example in figure
 % captions and section headings.
 %
 % \DescribeMacro{\Hmin} Min-entropy.  The general syntax is
-% |\Hmin|\hspace{0pt}\oarg{state}\hspace{0pt}\oarg{epsilon}\hspace{0pt}\relax
+% |\Hmin|\hspace{0pt}\meta{size-spec}\relax
+% \hspace{0pt}\oarg{state}\hspace{0pt}\oarg{epsilon}\hspace{0pt}\relax
 % \marg{target system}\hspace{0pt}\oarg{conditioning system}.  For example:
 % \begin{center}
 %   \begin{tabular}{lc}
@@ -360,8 +393,12 @@
 %       |\Hmin{X}|   & $\Hmin{X}$ \\
 %       |\Hmin[\rho]{X}|   & $\Hmin[\rho]{X}$ \\
 %       |\Hmin[\rho][\epsilon]{X}[Y]|   & $\Hmin[\rho][\epsilon]{X}[Y]$ \\
-%       \verb+\Hmin[\rho|\rho][\epsilon]{X}[Y]+   & $\Hmin[\rho\mid\rho][\epsilon]{X}[Y]$ \\
-%       |\Hmin[][\epsilon]{X}[Y]|   & $\Hmin[][\epsilon]{X}[Y]$ \\
+%       \verb+\Hmin[\rho|\rho][\epsilon]{X}[Y]+
+%                      & $\Hmin[\rho\mid\rho][\epsilon]{X}[Y]$ \\
+%       |\Hmin[][\epsilon]{X}[Y]|   & $\Hmin[][\epsilon]{X}[Y]$ \\[1ex]
+%       |\Hmin`\Big[\rho]{X}[Y]| & $\Hmin`\Big[\rho][\epsilon]{X}[Y]$ \\[0.5ex]
+%       |\Hmin`*[\rho]{\bigoplus_i X_i}[Y]| &
+%         $\displaystyle\Hmin`*[\rho][\epsilon]{\bigoplus_i X_i}[Y]$
 %   \end{tabular}
 % \end{center}
 %
@@ -378,25 +415,88 @@
 % arguments as for |\Hmin|.  For example, |\Hmaxf[][\epsilon]{X}[Y]| gives
 % $\Hmaxf[][\epsilon]{X}[Y]$.
 %
-% \DescribeMacro{\Hfunc} The entropy, written as a mathematical function.  It is
-% useful to write, e.g., $\Hfunc(p_1\rho_1 + p_2\rho_2)$ (code:
-% |\Hfunc(p_1\rho_1 + p_2\rho_2)|).  Sizing specifications also work, e.g.\@
-% |\Hfunc`\big(x)| or |\Hfunc`*(x)|.  However there is neither support for an
-% epsilon-like superscript nor for a conditioning system.
+% The commands |\Hmin|, |\HH|, |\Hzero|, and |\Hmaxf| are defined only if the
+% package option \pkgoptionfmt{qitobjdef=stdset} is set (which is the default).
 %
-% \DescribeMacro{\HHSym} You may redefine this macro if you want to change the
+% \DescribeMacro{\HSym} You may redefine this macro if you want to change the
 % ``$H$'' symbol of all entropy measures.
-% \begingroup \def\HHSym{\spadesuit} For example, with
-% |\renewcommand\HHSym{\spadesuit}|, |\Hmin{A}[B]| would give $\Hmin{A}[B]$.
+% \begingroup \def\HSym{\spadesuit} For example, with
+% |\renewcommand\HSym{\spadesuit}|, |\Hmin{A}[B]| would give $\Hmin{A}[B]$.
 % \endgroup
 %
-% \subsection{Relative Entropy Measures}
+% \paragraph{Appearance and alternative notation.}
+% You may change the notation of any of the above entropy measures by redefining
+% the corresponding commands as follows:
+% \begin{verbatim}
+% \renewcommand{\Hzero}{\Hbase{\HSym}{\mathrm{max}}}
+% \end{verbatim}
+% \begingroup\renewcommand{\Hzero}{\Hbase{\HSym}{\mathrm{max}}}
+% Then, |\Hzero[\rho]{A}[B]| would produce: $\Hzero[\rho]{A}[B]$.\endgroup
+%
+% \paragraph{Base entropy measure macro.}
+% \DescribeMacro{\Hbase} Base macro entropy for an entropy measure.  The general
+% syntax is:
+% |\Hbase|\hspace{0pt}\marg{H-symbol}\hspace{0pt}\marg{subscript}\relax
+% \hspace{0pt}\oarg{state}\hspace{0pt}\oarg{epsilon}\hspace{0pt}\relax
+% \marg{target system}\hspace{0pt}\oarg{conditioning system}
+%
+% Using this macro it is easy to define custom special-purpose entropy measures,
+% for instance:
+% \begin{verbatim}
+% \newcommand\Hxyz{\Hbase{\tilde\HSym}{\mathrm{xyz}}}
+% \end{verbatim}
+% \begingroup\newcommand\Hxyz{\Hbase{\tilde\HSym}{\mathrm{xyz}}}
+% The above code defines the command |\Hxyz[\rho][\epsilon]{A}[B]| $\to$
+% \fbox{$\Hxyz[\rho][\epsilon]{A}[B]$}. \endgroup
+%
+% See also the implementation documentation below for more specific information
+% on how to customize parts of the rendering, for instance.
+% 
+% \subsection{Entropy Function}
+% \label{sec:entropy-function}
+%
+% \DescribeMacro{\Hfn} The entropy, written as a mathematical function.  It is
+% useful to write, e.g., $\Hfunc(p_1\rho_1 + p_2\rho_2)$ as \relax
+% |\Hfunc(p_1\rho_1 + p_2\rho_2)|.  Sizing specifications also work, e.g.\@
+% |\Hfunc`\big(x)| or |\Hfunc`*(x)|.
+%
+% Usage is: |\Hfn|\hspace{0pt}\meta{size-spec}\hspace{0pt}|(|\meta{argument}|)|
+%
+% This macro doesn't allow for any subscript, any epsilon-like superscript nor
+% for any conditioning system.  Define your own macro on top of |\Hfnbase| if
+% you need that.
+%
+% Note that the \meta{argument} may contain matching parentheses, e.g.,
+% |\Hfn`\Big( g(x) + h(y) )| $\to$ \fbox{$\Hfn`\Big(g(x)+h(y))$}.
+%
+% \DescribeMacro{\Hfunc}
+% The alias |\Hfunc| is provided for backwards compatibility; same as |\Hfn|.
+%
+% The commands |\Hfn| and |\Hfunc| are defined only if the package option
+% \pkgoptionfmt{qitobjdef=stdset} is set (which is the default).
+%
+% \DescribeMacro{\Hfnbase} There is also a base macro for this kind of Qit
+% Object, |\Hfnbase|.  It allows you to specify an arbitrary symbol to use for
+% ``$H$'', as well as custom subscripts and superscripts.  The syntax is:
+%
+% |\Hfnbase|\marg{H-symbol}\hspace{0pt}\marg{sub}\hspace{0pt}\relax
+% \marg{sup}\hspace{0pt}\relax
+% \meta{size-spec}\hspace{0pt}|(|\meta{argument}|)|.
+%
+%
+% \subsection{Relative Entropy}
 % \label{sec:relative-entropies}
 %
 % Relative entropies also have a corresponding set of commands.
 %
+% The syntax varies from command to command, but all relative entropies accept
+% the final arguments \meta{size-spec}\marg{state}\marg{relative-to-state}.  The
+% size-spec is as always given using the backtick syntax described in
+% \autoref{topic:size-specification-backtick}.
+%
 % \DescribeMacro{\DD}
-% Generic relative entropy.  The syntax of this command is either of the following:\\
+% Generic relative entropy.  The syntax of this command is either of the following:
+% \par
 % |\DD|\hspace{0pt}\meta{size-spec}\hspace{0pt}\marg{state}\hspace{0pt}\marg{relative-to state},\\
 % |\DD_|\marg{subscript}\hspace{0pt}\meta{size-spec}\hspace{0pt}\marg{state}\hspace{0pt}\marg{relative-to state},\\
 % |\DD_|\marg{subscript}|^|\marg{superscript}\hspace{0pt}\meta{size-spec}\relax
@@ -406,15 +506,15 @@
 % In all cases, the argument is typeset as:
 % $\bigl(\meta{state}\big\Vert\meta{relative-to state}\bigr)$.  The size of the
 % delimiters can be set with a size specification using the standard backtick
-% syntax, as for the other entropies and as described in
-% \autoref{topic:size-specification-backtick}.
+% syntax as described in \autoref{topic:size-specification-backtick} (as for the
+% other entropy measures).
 % 
 % Examples:
 % \begin{center}
 %   \begin{tabular}{lc}
-%       |\DD{\rho}{\sigma}|  & $\DD{\rho}{\sigma}$ \\
-%       |\DD*{\rho}{\sigma}|  & $\DD*{\rho}{\sigma}$ \\
-%       |\DD`\big{\rho}{\sigma}|  & $\DD`\big{\rho}{\sigma}$ \\
+%       |\DD{\rho}{\sigma}|  & $\DD{\rho}{\sigma}$ \\[1ex]
+%       |\DD`*{M_1^\dagger M_1}{\sigma}|  & $\DD`*{M_1^\dagger M_1}{\sigma}$ \\[1ex]
+%       |\DD`\Big{\rho}{\sigma}|  & $\DD`\Big{\rho}{\sigma}$ \\
 %   \end{tabular}
 % \end{center}
 %
@@ -437,9 +537,6 @@
 % $\Dmax[\epsilon]{\rho}{\sigma}$ and |\Dmax[\epsilon]`\big{\rho}{\sigma}| gives
 % $\Dmax[\epsilon]`\big{\rho}{\sigma}$.
 % 
-% The size-spec is as always given using the backtick syntax described in
-% \autoref{topic:size-specification-backtick}.
-%
 % \DescribeMacro{\Dminz} The ``old'' min-relative entropy, based on the
 % R\'enyi-zero relative entropy.  The syntax is the same as for
 % |\Dmax|.
@@ -457,48 +554,289 @@
 % in, and it is not a zero-error quantity which is smoothed with the purified
 % distance.)
 %
-% \DescribeMacro{\DDSym} The symbol to use to denote a relative entropy.  You
-% may redefine this command to change the symbol.  (This works like |\HHSym|
+% The commands |\DD|, |\Dmax|, |\Dminz|, |\Dminf|, |\Dr| and |\DHyp| are defined
+% only if the package option \pkgoptionfmt{qitobjdef=stdset} is set (which is
+% the default).
+%
+% \DescribeMacro{\DSym} The symbol to use to denote a relative entropy.  You
+% may redefine this command to change the symbol.  (This works like |\HSym|
 % above.)
 %
+% \paragraph{Appearance and alternative notation}
+% You may change the notation of any of the above relative entropy measures by
+% redefining the corresponding commands as follows:
+% \begin{verbatim}
+% \renewcommand{\Dminz}[1][]{\Dbase{\DSym}_{\mathrm{MIN}}^{#1}}
+% \end{verbatim}
+% \begingroup\renewcommand{\Dminz}[1][]{\Dbase{\DSym}_{\mathrm{MIN}}^{#1}}
+% The above command produces: |\Dminz[\epsilon]{\rho}{\sigma}| $\to$
+% \fbox{$\Dminz[\epsilon]{\rho}{\sigma}$}.\endgroup
+% 
 %
+% \paragraph{Base relative entropy command}
+% As for the $H$-type entropy measures, there is a ``base relative entropy
+% command'' |\Dbase|.  Its syntax is:
+% \par |\Dbase|\marg{D-symbol}\hspace{0pt}\relax
+% [|_|\marg{subscript}][|^|\marg{superscript}]\hspace{0pt}\meta{size-spec}\relax
+% \hspace{0pt}\marg{state}\hspace{0pt}\marg{relative-to state}
+%
+% Example: |\Dbase{\hat\DSym}_{0}^{\eta'}`\Big{\rho}{\sigma}| $\to$
+% \fbox{$\Dbase{\hat\DSym}_{0}^{\eta'}`\Big{\rho}{\sigma}$}
+%
+% The ``|_|\marg{subscript}'' and ``|^|\marg{superscript}'' parts are optional
+% and may be specified in any order.
+%
+% See also the implementation documentation below for more specific information
+% on how to customize parts of the rendering, for instance.
+% 
+%
 % \subsection{Coherent Relative Entropy}
 % \label{sec:coh-rel-entr}
 %
-% A macro for a new quantity, the coherent relative entropy, is also available.
+% A macro for the coherent relative entropy is also available.
 %
-% \DescribeMacro{\DCoh}
-% Typeset a coherent relative entropy.  The syntax is
-% |\DCoh|\hspace{0pt}\oarg{epsilon}\hspace{0pt}\meta{size-spec}\hspace{0pt}\marg{rho}\hspace{0pt}\relax
-% \marg{A}\hspace{0pt}\marg{B}\hspace{0pt}\marg{Gamma-1}\hspace{0pt}\marg{Gamma-2}.
+% \DescribeMacro{\DCohx} Typeset a coherent relative entropy using an
+% alternative form for the reference system.  The syntax is:
+% 
+% |\DCohx|\hspace{0pt}\oarg{epsilon}\hspace{0pt}\relax
+% \meta{size-spec}\hspace{0pt}\marg{rho}\hspace{0pt}\relax
+% \marg{X}\hspace{0pt}\marg{X'}\hspace{0pt}\relax
+% \marg{$\Gamma_X$}\hspace{0pt}\marg{$\Gamma_{X'}$}
 %
-% For example, |\DCoh[\epsilon]{\rho}{A}{B}{\Gamma_A}{\Gamma_B}| gives
-% $\DCoh[\epsilon]{\rho}{A}{B}{\Gamma_A}{\Gamma_B}$.
+% For example, |\DCohx[\epsilon]{\rho}{X}{X'}{\Gamma_X}{\Gamma_{X'}}| gives
+% $\DCohx[\epsilon]{\rho}{X}{X'}{\Gamma_X}{\Gamma_{X'}}$.
 %
-% The subscript |BA| is automatically added to the \meta{rho} argument.  If this
-% is not desired, then begin the \meta{rho} argument with a star.  For example,
-% |\DCoh{*\sigma_A\otimes\rho_B}{A}{B}{\Gamma_A}{\Gamma_B}| gives
-% $\DCoh{*\sigma_A\otimes\rho_B}{A}{B}{\Gamma_A}{\Gamma_B}$.
+% The subscript $X'R_X$ (or whatever the system names) is automatically added to
+% the \meta{rho} argument.  The `$R$' symbol is used by default for designating
+% the reference system; you may change that by redefining |\DCohxRefSystemName|
+% (see below).  If no subscript should be added to the \meta{rho} argument, then
+% begin the \meta{rho} argument with a star.  For example,
+% |\DCoh{*\sigma_R\otimes\rho_{X'}}{X}{X'}{\Gamma_X}{\Gamma_{X'}}| gives
+% $\DCoh{*\sigma_R\otimes\rho_{X'}}{X}{X'}{\Gamma_X}{\Gamma_{X'}}$.
 % 
 % The \meta{size-spec} is of course optional and follows the same syntax as
 % everywhere else (\autoref{topic:size-specification-backtick}).
 %
+% The command |\DCohx| is defined only if the package option
+% \pkgoptionfmt{qitobjdef=stdset} is set (which is the default).
+%
 % \DescribeMacro{\emptysystem} Use the |\emptysystem| macro to denote a trivial
 % system.  For example, |\DCoh{\rho}{X}{\emptysystem}{\Gamma}{1}| gives
 % $\DCoh{\rho}{X}{\emptysystem}{\Gamma}{1}$.
 % 
+% \DescribeMacro{\DCohxRefSystemName} When using |\DCohx|, the macro
+% |\DCohxRefSystemName| is invoked to produce the reference system name
+% corresponding to the input system name.  By default, this is a $R_\cdot$
+% symbol with subscript the input system name.  You may redefine this macro if
+% you prefer another reference system name:
+% \begin{verbatim}
+% \renewcommand\DCohxRefSystemName[1]{E_{#1}}
+% \end{verbatim}
+% \begin{flushleft}
+% \begingroup\renewcommand\DCohxRefSystemName[1]{E_{#1}}
+% Then: |\DCohx{\rho}{X}{X'}{\Gamma_X}{\Gamma_{X'}}| $\to$
+% $\DCohx{\rho}{X}{X'}{\Gamma_X}{\Gamma_{X'}}$
+% \endgroup
+% \end{flushleft}
+%
 % \DescribeMacro{\DCSym} The symbol to use to denote a coherent relative
 % entropy.  You may redefine this command to change the symbol.  (This works
-% like |\HHSym| and |\DDSym| above.)
+% like |\HSym| and |\DSym| above.)
+% 
+% \DescribeMacro{\DCoh}
+% Typeset a coherent relative entropy using the old notation.  The syntax is:
+% 
+% |\DCoh|\hspace{0pt}\oarg{epsilon}\hspace{0pt}\relax
+% \meta{size-spec}\hspace{0pt}\marg{rho}\hspace{0pt}\relax
+% \marg{R}\hspace{0pt}\marg{X'}\hspace{0pt}\relax
+% \marg{$\Gamma_R$}\hspace{0pt}\marg{$\Gamma_{X'}$}
 %
+% For example, |\DCoh[\epsilon]{\rho}{R}{X'}{\Gamma_R}{\Gamma_{X'}}| gives
+% $\DCoh[\epsilon]{\rho}{R}{X'}{\Gamma_R}{\Gamma_{X'}}$.
 %
+% The subscript $X'R$ (or whatever the system names) is automatically added to
+% the \meta{rho} argument.  If this is not desired, then begin the \meta{rho}
+% argument with a star.  For example,
+% |\DCoh{*\sigma_R\otimes\rho_{X'}}{R}{X'}{\Gamma_R}{\Gamma_{X'}}| gives
+% $\DCoh{*\sigma_R\otimes\rho_{X'}}{R}{X'}{\Gamma_R}{\Gamma_{X'}}$.
+% 
+% The \meta{size-spec} is of course optional and follows the same syntax as
+% everywhere else (\autoref{topic:size-specification-backtick}).
 %
+% The command |\DCoh| is defined only if the package option
+% \pkgoptionfmt{qitobjdef=stdset} is set (which is the default).
 %
 %
+% \paragraph{Appearance and alternative notation}
+% You may change the notation of any of the above relative entropy measures by
+% redefining the corresponding commands as follows:
+% \begin{verbatim}
+% \renewcommand{\DCoh}{\DCohbase{\tilde\DSym}}
+% \end{verbatim}
+% \begingroup\renewcommand{\DCoh}{\DCohbase{\tilde\DSym}}
+% Then: |\DCoh[\epsilon]{\rho}{R}{X'}{\Gamma_R}{\Gamma_{X'}}| $\to$
+% \fbox{$\DCoh[\epsilon]{\rho}{R}{X'}{\Gamma_R}{\Gamma_{X'}}$}.\endgroup
+% 
 %
+% \paragraph{Base relative entropy command}
+% As for the other entropy measures, there is a ``base coherent relative entropy
+% command'' |\DCohbase|.  Its syntax is:
+% \par |\DCohbase|\marg{D-symbol}\hspace{0pt}\relax
+% \hspace{0pt}\oarg{epsilon}\hspace{0pt}\relax
+% \meta{size-spec}\hspace{0pt}\marg{rho}\hspace{0pt}\relax
+% \marg{R}\hspace{0pt}\marg{X'}\hspace{0pt}\relax
+% \marg{$\Gamma_R$}\hspace{0pt}\marg{$\Gamma_{X'}$}
 %
+% See also the implementation documentation below for more specific information
+% on how to customize parts of the rendering, for instance.
+% 
 %
 %
+% \subsection{Custom Qit Objects}
+% \label{sec:QitObjectImpl}
+%
+% \changedreftext{v2.0-qit-objects}
+%
+% You can create your own Qit Object Implementation as follows.  You need two
+% components: a \emph{Parse} macro and a \emph{Render} macro.
+%
+% The \emph{Parse} macro is responsible for parsing input \LaTeX{} tokens as
+% necessary, and building an argument list (which will be passed on to the
+% \emph{Render} macro).
+%
+% \DescribeMacro{\qitobjAddArg} \DescribeMacro{\qitobjAddArgx} The \emph{Parse}
+% macro (or any helper macro it calls) should call |\qitobjAddArg| to add
+% arguments for the eventual call to \emph{Render}.  The |\qitobjAddArg| macro
+% does not expand its argument.  The |\qitobjAddArgx| works like
+% |\qitobjAddArg|, but it accepts a single \LaTeX{} command as its only
+% argument, expands it, and adds the contents as a single new argument for the
+% renderer.
+%
+% \DescribeMacro{\qitobjParseDone}
+% Once the parser is finished, it must call |\qitobjParseDone|.
+%
+% The \emph{Render} macro is responsible for displaying the final Qit Object.
+% It should accept mandatory arguments in the exact number as there were calls
+% to |\qitobjAddArg|/|\qitobjAddArgx|.
+%
+% \DescribeMacro{\qitobjDone} The \emph{Render} macro must call |\qitobjDone|
+% after it is finished, to do some cleaning up and to close the local \LaTeX{}
+% group generated by the Qit Ojbect infrastructure.
+%
+% \DescribeMacro{\DefineQitObject} Declare your new Qit Object using the
+% |\DefineQitObject| macro, using the syntax
+% |\DefineQitObject|\marg{name}\marg{ParseCommand}\marg{RenderCommand}.
+% This declares the command |\|\meta{name} as your Qit Object.
+%
+% You may define different Qit Objects (using different names) recycling the
+% same parsers/renderers if needed.  For instance, |\Hfnbase| uses the same
+% renderer as |\Hbase|.
+%
+% \DescribeMacro{\DefineTunedQitObject} The |\DefineTunedQitObject| macro is a
+% bit more powerful.  It allows you to specify some fixed initial arguments to
+% the parser, as well as to provide some local definitions which are in effect
+% only during parsing and rendering of the Qit Object.  This is useful if you
+% would like to declare an alternative type of Qit Object to an existing one,
+% where you just change some aspect of the behavior of the original Qit Object.
+%
+% Usage: |\DefineTunedQitObject|\hspace{0pt}\marg{name}\relax
+% \marg{parse command}\hspace{0pt}\marg{render command}\hspace{0pt}\relax
+% \marg{fixed first argument(s)}\hspace{0pt}\marg{custom definitions}\relax
+%
+% The \marg{first fixed argument(s)} must be a single argument, i.e., a single
+% \LaTeX{} group, which may contain several arguments, for instance: |{{A}{B}}|.
+%
+% For instance, |\DCohx| is defined, using the same parser and renderer as for
+% |\DCoh|, as follows:
+% \begin{verbatim}
+%\def\DCohxRefSystemName#1{R_{#1}}
+%\def\DCohxStateSubscripts#1#2{#2\DCohxRefSystemName{#1}}
+%\DefineTunedQitObject{DCohx}{\DCohbaseParse}{\DCohbaseRender}%
+%{{\DCSym}}% initial args
+%{\let\DCohbaseStateSubscripts\DCohxStateSubscripts}% local defs
+% \end{verbatim}
+% 
+%
+% \paragraph{Useful helpers}
+%
+% There are some useful helpers for both the \emph{Parse} and \emph{Render}
+% macros.  More extensive documentation is available in the ``Implementation''
+% section below.
+%
+% \DescribeMacro{\phfqit at parse@sizesarg} Parse a \meta{size-spec} optional
+% argument.
+%
+% \needspace{3\baselineskip}
+% \DescribeMacro{\phfqitParen} \DescribeMacro{\phfqitSquareBrackets}
+% \DescribeMacro{\phfqitCurlyBrackets} Produce a parenthetic expression (or
+% square or curly brackets) with the appropriate size and with the given
+% contents.
+%
+% \paragraph{Example}
+% Here is a simple example: let's build a work cost of transition Qit Object to
+% display something like ``$W(\sigma\to\rho)$.''
+%
+% The arguments to be given are: they are \meta{$\sigma$} and \meta{$\rho$}.  We
+% would also like to accept an optional size specification \meta{size-spec}. We
+% should decide on a convenient syntax to specify them.  Here, we'll settle for
+% simply |\WorkCostTransition`\Big{\rho}{\sigma}|.
+%
+% We can now write the \emph{Parse} macro.  We use the |\phfqit at parsesizearg|
+% helper, which stores the optional \meta{size-spec} into the
+% |\phfqit at val@sizearg| macro before deferring our second helper macro.  We then
+% add arguments (for an eventual call to the \emph{Render} macro) using
+% |\qitobjAddArg| (or |\qitobjAddArgx|).
+% \begin{verbatim}
+% \makeatletter
+% \newcommand\WorkCostTransitionParse{%
+%   \phfqit at parsesizearg\WorkCostTransitionParse@%
+% }
+% % Helper to parse further input arguments:
+% \newcommand\WorkCostTransitionParse@[2]{% {\rho}{\sigma}
+%   \qitobjAddArgx\phfqit at val@sizearg% size arg
+%   \qitobjAddArg{#1}% rho
+%   \qitobjAddArg{#2}% sigma
+%   \qitobjParseDone%
+% }
+% \makeatother
+% \end{verbatim}
+%
+% The render macro should simply display the quantity, with the arguments given
+% as usual mandatory arguments.  We invoke the |\phfqitParens| helper, which
+% produces the parenthesis at the correct size given the size spec tokens.
+% \begin{verbatim}
+% \newcommand\WorkCostTransitionRender[3]{% {size-spec-tokens}{\rho}{\sigma}
+%   W\phfqitParens#1{#2 \to #3}%
+%    \qitobjDone
+% }
+% \end{verbatim}
+%
+% Now declare the Qit Object:
+% \begin{verbatim}
+% \DefineQitObject{WorkCostTransition}{\WorkCostTransitionParse}{\WorkCostTransitionRender}
+% \end{verbatim}
+% \begingroup\makeatletter
+% \newcommand\WorkCostTransitionParse{\relax
+%   \phfqit at parsesizearg\WorkCostTransitionParse@}
+% \newcommand\WorkCostTransitionParse@[2]{\relax
+%   \qitobjAddArgx\phfqit at val@sizearg\relax
+%   \qitobjAddArg{#1}\relax
+%   \qitobjAddArg{#2}\relax
+%   \qitobjParseDone}
+% \newcommand\WorkCostTransitionRender[3]{W\phfqitParens#1{#2 \to #3}\qitobjDone}
+% \DefineQitObject{WorkCostTransition}{\WorkCostTransitionParse}{\WorkCostTransitionRender}
+% Then: |\WorkCostTransition`\Big{\rho}{\sigma}| $\to$
+% \fbox{$\WorkCostTransition`\Big{\rho}{\sigma}$}
+% \endgroup
+%
+% You might want to check out the implementations of |\HbaseParse| and
+% |\HbaseRender|, or |\DbaseParse| and |\DbaseRender| if you'd like to see some
+% more involved examples.
+%
+%
+%
+%
+%
 % \StopEventually{\clearpage\PrintChanges
 %     \vspace{2cm plus 2cm minus 2cm}\PrintIndex}
 %
@@ -513,7 +851,20 @@
 \RequirePackage{mathrsfs}
 \RequirePackage{mathtools}
 %    \end{macrocode}
+% 
+% Package \pkgname{xparse} is needed in order to get paren matching right for
+% |\Hfn|.
+%    \begin{macrocode}
+\RequirePackage{xparse}
+%    \end{macrocode}
 %
+% Package options are handled via \pkgname{xkeyval} \& \pkgname{kvoptions} (see
+% implementation doc for \pkgname{phfnote}).
+%    \begin{macrocode}
+\RequirePackage{xkeyval}
+\RequirePackage{kvoptions}
+%    \end{macrocode}
+% 
 % \subsection{Simple Symbols and Shorthands}
 % 
 % 
@@ -538,6 +889,8 @@
 %
 % \begin{macro}{\IdentProc}
 %   Identity process.
+%
+%   TODO: this could be implemented as a Qit Object.
 %    \begin{macrocode}
 \def\IdentProc{%
   \phfqit at parsesizearg\phfqit at IdentProc@maybeA%
@@ -566,7 +919,7 @@
 }
 \def\phfqit at IdentProc@do#1#2#3{%
   \operatorname{id}_{#1\notblank{#2}{\to #2}{}}%
-  \notblank{#3}{\expandafter\phfqit at inner@parens\phfqit at val@sizearg{#3}}{}%
+  \notblank{#3}{\expandafter\phfqitParens\phfqit at val@sizearg{#3}}{}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -610,20 +963,20 @@
 % \end{macro}
 % \end{macro}
 % 
-% \begin{macro}{\Re}
-% \begin{macro}{\Im}
-%   Also, alter the appearance of |\Re| and |\Im| to something more readable.
+% \begin{macro}{\phfqit at Realpart}
+% \begin{macro}{\phfqit at Imagpart}
+%   Provide math operators for $\Re$ and $\Im$.  The aliasing to the actual
+%   commands |\Re| and |\Im| is done later, when we process the package options.
 %    \begin{macrocode}
 \let\phfqit at Re\Re
 \DeclareMathOperator{\phfqit at Realpart}{Re}%
-\renewcommand{\Re}{\phfqit at Realpart}
 \let\phfqit at Im\Im
 \DeclareMathOperator{\phfqit at Imagpart}{Im}%
-\renewcommand{\Im}{\phfqit at Imagpart}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 %
+%
 % \subsubsection{Poly}
 %
 % \begin{macro}{\poly}
@@ -858,8 +1211,11 @@
 %
 %
 %
-% \subsection{Entropy Measures}
+% \subsection{Entropy Measures and Other Qit Objects}
 %
+% \changed[v2.0-qit-objects]{v2.0}{2017/06/17}{Introduced the Qit Objects infrastructure}
+%
+%
 % \subsubsection{Some Internal Utilities}
 %
 % \begin{macro}{\phfqit at parsesizearg}
@@ -877,191 +1233,322 @@
   \begingroup%
   \mathcode`\`="0060\relax%
   \gdef\phfqit at val@sizearg{}%
-  \@ifnextchar`{\phfqit at parsesizearg@withsize{#1}}{\endgroup#1}%
+  \def\phfqit at tmp@contwithsize{\phfqit at parsesizearg@withsize{#1}}%
+  \@ifnextchar`{\phfqit at tmp@contwithsize}{\endgroup#1}%
 }
 \def\phfqit at parsesizearg@withsize#1`#2{%
-  \def\@tmp at arg{#2}%
-  \def\@tmp at star{*}%
-  \def\@tmp at endgroupandcontinue{\endgroup#1}%
-  \ifx\@tmp at arg\@tmp at star\relax%
+  \def\phfqit at tmp@x{#2}%
+  \def\phfqit at tmp@star{*}%
+  \ifx\phfqit at tmp@x\phfqit at tmp@star%
     \gdef\phfqit at val@sizearg{*}%
-    \expandafter\@tmp at endgroupandcontinue%
+    \def\phfqit at tmp@cont{\endgroup#1}%
+    \expandafter\phfqit at tmp@cont%
   \else%
     \gdef\phfqit at val@sizearg{[#2]}%
-    \expandafter\@tmp at endgroupandcontinue%
+    \def\phfqit at tmp@cont{\endgroup#1}%
+    \expandafter\phfqit at tmp@cont%
   \fi%
 }
 %    \end{macrocode}
 % \end{macro}
-% 
 %
-% \begin{macro}{\phfqit at inner@parens}
+% \begin{macro}{\phfqitParens}
 %   Simple parenthesis-delimited expression, with
 %   |\DeclarePairedDelimiter|-compatible syntax.  For example,
-%   \par |\phfqit at inner@parens|\marg{content} \quad$\to$\quad
+%   \par |\phfqitParens|\marg{content} \quad$\to$\quad
 %   \fbox{\phfverb( \meta{content} \phfverb)}
-%   \par |\phfqit at inner@parens*|\marg{content} \quad$\to$\quad
+%   \par |\phfqitParens*|\marg{content} \quad$\to$\quad
 %   \fbox{\phfverb\left\phfverb( \meta{content} \phfverb\right\phfverb)}
-%   \par |\phfqit at inner@parens[\big]|\marg{content} \quad$\to$\quad
+%   \par |\phfqitParens[\big]|\marg{content} \quad$\to$\quad
 %   \fbox{\phfverb\bigl\phfverb( \meta{content} \phfverb\bigr\phfverb)}
 %
 %    \begin{macrocode}
-\DeclarePairedDelimiterX\phfqit at inner@parens[1]{(}{)}{#1}
+\DeclarePairedDelimiterX\phfqitParens[1]{(}{)}{#1}
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\phfqitSquareBrackets}
+%   Simple bracket-delimited expression, with
+%   |\DeclarePairedDelimiter|-compatible syntax.  For example,
+%   \par |\phfqitSquareBrackets|\marg{content} \quad$\to$\quad
+%   \fbox{\phfverb[ \meta{content} \phfverb]}
+%   \par |\phfqitSquareBrackets*|\marg{content} \quad$\to$\quad
+%   \fbox{\phfverb\left\phfverb[ \meta{content} \phfverb\right\phfverb]}
+%   \par |\phfqitSquareBrackets[\big]|\marg{content} \quad$\to$\quad
+%   \fbox{\phfverb\bigl\phfverb[ \meta{content} \phfverb\bigr\phfverb]}
 %
+%    \begin{macrocode}
+\DeclarePairedDelimiterX\phfqitSquareBrackets[1]{[}{]}{#1}
+%    \end{macrocode}
+% \end{macro}
 %
-% \subsubsection{Entropy, Conditional Entropy, and Entropy Function}
+% \begin{macro}{\phfqitCurlyBrackets}
+%   Simple bracket-delimited expression, with
+%   |\DeclarePairedDelimiter|-compatible syntax.  For example,
+%   \par |\phfqitSquareBrackets|\marg{content} \quad$\to$\quad
+%   \fbox{\phfverb\{ \meta{content} \phfverb\}}
+%   \par |\phfqitSquareBrackets*|\marg{content} \quad$\to$\quad
+%   \fbox{\phfverb\left\phfverb\{ \meta{content} \phfverb\right\phfverb\}}
+%   \par |\phfqitSquareBrackets[\big]|\marg{content} \quad$\to$\quad
+%   \fbox{\phfverb\bigl\phfverb\{ \meta{content} \phfverb\bigr\phfverb\}}
 %
-% See user documentation in \autoref{sec:entropy-measures}.
+%    \begin{macrocode}
+\DeclarePairedDelimiterX\phfqitCurlyBrackets[1]{\{}{\}}{#1}
+%    \end{macrocode}
+% \end{macro}
 %
-% \begin{macro}{\HHSym}
-%   The symbol used to designate an entropy measure (not relative).
+%
+%
+% \subsubsection{Machinery for Qit Objects}
+%
+% See also user documentation in \autoref{sec:QitObjectImpl}.
+%
+% \begin{macro}{\QitObject}
+%   The argument is the entropic quantity type or object kind (or ``entropic
+%   quantity driver''): one of |Hbase|, |Hfnbase|, |Dbase|, |DCbase|, or any
+%   other custom object.
 %    \begin{macrocode}
-\newcommand\HHSym{H}
+\newcommand\QitObject[1]{%
+  \begingroup%
+    \preto\QitObjectDone{\endgroup}%
+    \QitObjectInit%
+    \csname QitObj at reg@#1 at initdefs\endcsname%
+%%\message{DEBUG: \detokenize{\QitObject{#1}}}%
+    \def\QitObj at args{}%
+    \def\qitobjParseDone{\QitObj at proceedToRender{#1}}%
+    \def\qitobjDone{\QitObjectDone}%
+    \csname QitObj at reg@#1 at parse\endcsname%
+}
 %    \end{macrocode}
 % \end{macro}
 %
 %
-% \begingroup\makeatletter
-% \begin{macro}{\@HHbase}
-%   Base macro for entropy macros.
+% \begin{macro}{\DefineQitObject}
+% \begin{macro}{\DefineTunedQitObject}
+%   Define a new Qit Object implementation with this macro.  A Qit Object
+%   implementation is specified in its simplest form by a \emph{name}, a
+%   \emph{Parser} and a \emph{Renderer} (a single \LaTeX{} macro each).  The
+%   more advanced |\DefineTunedQitObject| allows you in addition to specify
+%   local definitions to override defaults, as well as some initial arguments to
+%   the parser.
+%    \begin{macrocode}
+\def\DefineQitObject#1#2#3{%
+  \DefineTunedQitObject{#1}{#2}{#3}{}{}%
+}%
+\def\DefineTunedQitObject#1#2#3#4#5{%
+  \csdef{#1}{\QitObject{#1}#4}%
+  \expandafter\robustify\csname #1\endcsname%
+  \cslet{QitObj at reg@#1 at parse}#2%
+  \cslet{QitObj at reg@#1 at render}#3%
+  \csdef{QitObj at reg@#1 at initdefs}{#5}%
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
 %
+%
+% Here are some callbacks meant for Qit Object implementations
+% (``types''/``drivers'').
+% 
+% \begin{macro}{\qitobjAddArg}
+% \begin{macro}{\qitobjAddArgx}
+%   These macros should only be called from within a \emph{Parse} macro of a qit
+%   object type.  Append an argument in preparation for an eventual call to the
+%   corresponding \emph{Render} macro.  |\qitobjAddArg| does not expand its
+%   contents. |\qitobjAddArgx| expects a single command name as argument; it
+%   expands the command once and stores those tokens as a single new argument.
+%    \begin{macrocode}
+\def\qitobjAddArg#1{%
+  \appto\QitObj at args{{#1}}%
+}
+\def\qitobjAddArgx#1{%
+  \expandafter\qitobjAddArg\expandafter{#1}%
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% 
+% \begin{macro}{\qitobjParseDone}
+% \begin{macro}{\qitobjDone}
+%   These macros MUST be called at the end of the respective \emph{Parse}
+%   (|\qitobjParseDone|) and \emph{Render} (|\qitobjDone|) implementations
+%   (otherwise processing doesn't proceed, \LaTeX{} groups won't be closed, and
+%   it will be a mess).
+%
+%   These macros are correctly defined in |\QitObject| actually. Here we provide
+%   empty definitions so that the \emph{Render} and \emph{Parse} user
+%   implementation macros can be called stand-alone, too.
+%    \begin{macrocode}
+\def\qitobjParseDone{}
+\def\qitobjDone{}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% 
+% \begin{macro}{\QitObjectDone}
+%   A hook which gets called after a Qit Object is displayed.  This should
+%   really stay empty on the global scope.  However you can locally append or
+%   prepend to it in tuned definitions for |\DeclareTunedQitObject| to perform
+%   additional actions at the end of the Qit Object, for instance to close an
+%   additional \LaTeX{} group.
+%    \begin{macrocode}
+\def\QitObjectDone{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\QitObjectInit}
+%   A hook which gets called before the parsing phase of a Qit Object.  This
+%   should really stay empty on the global scope.  However you can locally
+%   append or prepend to it in tuned definitions for |\DeclareTunedQitObject| to
+%   perform additional actions before parsing the Qit Object (but which have to
+%   be made within the \LaTeX{} group of the Qit Object).  You can use this to
+%   prepend code to |\QitObjectDone| so that you code gets called \emph{before}
+%   the inner \LaTeX{} group is closed.
+%    \begin{macrocode}
+\def\QitObjectInit{}
+%    \end{macrocode}
+% \end{macro}
+% 
+% An internal helper; it's useful to keep it separate for readability and for
+% debugging.
+%    \begin{macrocode}
+\def\QitObj at proceedToRender#1{%
+%%\message{DEBUG: Rendering #1|\detokenize\expandafter{\QitObj at args}|}%
+  \expandafter\def\expandafter\x\expandafter{%
+    \csname QitObj at reg@#1 at render\endcsname}%
+  \expandafter\x\QitObj at args%
+}
+%    \end{macrocode}
+% 
+%
+% \subsubsection{Qit Object Implementation: Entropy, Conditional Entropy}
+%
+% See also the user doc in \autoref{sec:entropy-measures}.
+%
+% \begin{macro}{\HbaseParse}
+%   Base parser macro for usual entropy measures; possibly conditional and/or
+%   smooth.
+%
 %   USAGE:
-%   |\@HHbase|\marg{H-symbol}\hspace{0pt}\marg{subscript}\hspace{0pt}\relax
-%   \marg{superscript}\hspace{0pt}\meta{size-spec}\hspace{0pt}\oarg{state}\hspace{0pt}\relax
-%   \oarg{epsilon}\hspace{0pt}\marg{target system}\hspace{0pt}\oarg{conditioning system}
+%   |\Hbase|\marg{H-symbol}\hspace{0pt}\relax
+%   \marg{subscript}\hspace{0pt}\relax
+%   \meta{size-spec}\hspace{0pt}\oarg{state}\relax
+%   \hspace{0pt}\oarg{epsilon}\hspace{0pt}\marg{target system}\hspace{0pt}\relax
+%   \oarg{conditioning system}
 %
 %   The argument \meta{size-spec} is optional, and is documented in
 %   \autoref{topic:size-specification-backtick}.  For example \meta{size-spec} =
 %   |`*| or |`\Big|.
 %
-%   This command is robust.
-% 
 %   Examples: 
-%   \par |\@HHbase{\hat{H}}{\mathrm{max}}[\rho][\epsilon]{E}[X']|
+%   \par |\Hbase{\hat{H}}{\mathrm{max}}[\rho][\epsilon]{E}[X']|
 %   \quad$\to$\quad
-%   \fbox{$\@HHbase{\hat{H}}{\mathrm{max}}[\rho][\epsilon]{E}[X']$}
-%   \par |\@HHbase{\hat{H}}{\mathrm{max}}`*[\rho][\epsilon]{\bigotimes_i E}[X']|
+%   \fbox{$\Hbase{\hat{H}}{\mathrm{max}}[\rho][\epsilon]{E}[X']$}
+%   \par |\Hbase{\hat{H}}{\mathrm{max}}`*[\rho][\epsilon]{\bigotimes_i E}[X']|
 %   \quad$\to$\quad
-%   \fbox{$\@HHbase{\hat{H}}{\mathrm{max}}`*[\rho][\epsilon]{\displaystyle\bigotimes_i E}[X']$}
-%   \par |\@HHbase{\hat{H}}{\mathrm{max}}`\big[\rho][\epsilon]{E}[X']|
-%   \quad$\to$\quad
-%   \fbox{$\@HHbase{\hat{H}}{\mathrm{max}}`\big[\rho][\epsilon]{E}[X']$}
+%   \fbox{$\Hbase{\hat{H}}{\mathrm{max}}`*[\rho][\epsilon]{\displaystyle\bigotimes_i E}[X']$}
+% 
+%   The |\HbaseParse| macro is responsible for parsing the arguments to
+%   |\Hbase|.  We should parse the arguments using helper macros as needed,
+%   adding rendering arguments with |\qitobjAddArg| or |\qitobjAddArgx|, and
+%   then calling |\qitobjParseDone|.  The arguments are then automatically
+%   provided as arguments to the |\HbaseRender| function.  We just have to make
+%   sure we add the correct number of arguments in the correct order.
 %   
 %    \begin{macrocode}
-\def\@HHbase#1#2{%
-  #1_{#2}%
-  \@HHbase at parsesize%
-}
-\robustify\@HHbase
+\def\HbaseParse#1#2{%
 %    \end{macrocode}
-% 
 %
-% TODO: use our generic size parser, don't duplicate code....  this is
-% historical and I don't dare change it without thorough testing:
+% The first arguments are the mandatory arguments
+% \marg{H-symbol}\hspace{0pt}\marg{subscript}.  Then defer to helper macros for
+% the rest of the parsing.
 %    \begin{macrocode}
-\def\@HHbase at parsesize{%
-  \begingroup\mathcode`\`="0060\relax%
-  \gdef\HH at tmp@sizearg{}%
-  \@ifnextchar`\@HHbase at withsize\@HHbase at endgroupandparseinner%
+  \qitobjAddArg{#1}%
+  \qitobjAddArg{#2}%
+  \phfqit at parsesizearg\HbaseParse@%
 }
-\def\@HHbase at withsize`#1{%
-  \def\@tmp at arg{#1}%
-  \def\@tmp at star{*}%
-  \ifx\@tmp at arg\@tmp at star\relax%
-    \gdef\HH at tmp@sizearg{*}%
-    \expandafter\@HHbase at endgroupandparseinner%
-  \else%
-    \gdef\HH at tmp@sizearg{[#1]}%
-    \expandafter\@HHbase at endgroupandparseinner%
-  \fi%
-}
-\def\@HHbase at endgroupandparseinner{\endgroup\@HHbase at parseinner}
-\newcommand\@HHbase at parseinner[1][]{%  arg: state
-  \def\HH at tmpstore@state{#1}%
-  \@HHbase at parseinner@%
-}
-\newcommand\@HHbase at parseinner@[2][]{% arg: epsilon and target system
-  \def\HH at tmpstore@epsilon{#1}%
-  \def\HH at tmpstore@system{#2}%
-  \@HHbase at parseinner@@%
-}
-\newcommand\@HHbase at parseinner@@[1][]{% arg: conditioning system
-  \def\HH at tmpstore@condsys{#1}%
-  \@HHbase at do@inner%
-}
-\newtoks\HH at tmp@toks
-\def\HH at addtoks#1\@HH at END@ADD at TOKS{\HH at tmp@toks=\expandafter{\the\HH at tmp@toks#1}}%
 %    \end{macrocode}
-% \end{macro}
-% \begin{macro}{\@HHbase at do@inner}
-%   Format the entropy measure.  All information is stored in macros of the form
-%   |\HH at tmpstore@<FIELD>|.  The base string (entropy symbol and subscript) have
-%   already been typeset.
+% 
+% Store the delimiter size argument which |\phfqit at parsesizearg| has stored into
+% |\phfqit at val@sizearg|, then parse an optional \oarg{state} argument.
 %    \begin{macrocode}
-\def\@HHbase at do@inner{%
+\newcommand\HbaseParse@[1][]{%
+  \qitobjAddArgx{\phfqit at val@sizearg}%
+  \qitobjAddArg{#1}%
+  \HbaseParse@@%
+}
 %    \end{macrocode}
-% Add the superscript:
+% Then parse an optional \oarg{epsilon} argument, as well as a mandatory
+% \marg{target system} argument.
 %    \begin{macrocode}
-  ^{\HH at tmpstore@epsilon}%
+\newcommand\HbaseParse@@[2][]{%
+  \qitobjAddArg{#1}%
+  \qitobjAddArg{#2}%
+  \HbaseParse@@@%
+}
 %    \end{macrocode}
-% If system is blank, we just want the symbol itself with no
-% argument. (|\notblank| is from the \pkgname{etoolbox} package.)  Otherwise, add the
-% rest:
+% Finally, parse an optional \oarg{conditioning system}.
 %    \begin{macrocode}
-  \expandafter\notblank\expandafter{\HH at tmpstore@system}{%
+\newcommand\HbaseParse@@@[1][]{%
+  \qitobjAddArg{#1}%
+  \qitobjParseDone%
+}
 %    \end{macrocode}
-% Construct the parenthetic argument to the entropy, which we will store in the
-% token register |\HH at tmp@toks|:
+% \end{macro}
+% 
+%
+% \begin{macro}{\HbaseRender}
+%   Render the entropy measure.
+%   \par |#1| = ``$H$'' symbol to use (e.g. |H|)
+%   \par |#2| = subscript (type of entropy, e.g. |\marthrm{min},0|)
+%   \par |#3| = possible size argument to expand in front of parens command (one
+%   of \emph{(empty)}, |*|, or |[\big]| using a standard sizing command)
+%   \par |#4| = the state (e.g. |\rho|), may be left empty
+%   \par |#5| = epsilon argument (superscript to entropy measure), if any, or
+%   leave argument empty
+%   \par |#6| = system to measure entropy of
+%   \par |#7| = conditioning system, if any, or else leave the argument empty
 %    \begin{macrocode}
-    \HH at tmp@toks={}%
+\def\HbaseRender#1#2#3#4#5#6#7{%
+%%\message{DEBUG: HbaseRender\detokenize{{#1}{#2}{#3}{#4}{#5}{#6}{#7}}}%
 %    \end{macrocode}
-% \ldots{} add system name:
+%
+%   Start with the entropy symbol (`H'), the subscript, and the superscript:
 %    \begin{macrocode}
-    \expandafter\HH at addtoks\HH at tmpstore@system\@HH at END@ADD at TOKS%
+  \HbaseRenderSym{#1}_{\HbaseRenderSub{#2}}^{\HbaseRenderSup{#5}}
 %    \end{macrocode}
-% \ldots{} add conditional system, if specified:
+% Render the contents of the entropy (parenthetic expression with system \&
+% conditioning system), only if the system or conditioning system or state are
+% not empty:
 %    \begin{macrocode}
-    \expandafter\notblank\expandafter{\HH at tmpstore@condsys}{%
-      \HH at addtoks\mathclose{}\,\delimsize\vert\,\mathopen{}\@HH at END@ADD at TOKS%
-      \expandafter\HH at addtoks\HH at tmpstore@condsys\@HH at END@ADD at TOKS%
-    }{}%
+  \notblank{#4#6#7}{%
+    \HbaseRenderContents{#3}{#6}{#7}%
 %    \end{macrocode}
-% The tokens are ready now. Prepare the argument to the |\phfqit at inner@parens|
-% command, and go:
+% Finally, add the state as subscript, if any:
 %    \begin{macrocode}
-    \edef\tmp at args{\expandonce{\HH at tmp@sizearg}{\the\HH at tmp@toks}}%
-    \expandafter\phfqit at inner@parens\tmp at args%
+    \HbaseRenderTail{#4}%
+  }{}%
 %    \end{macrocode}
-% Finally, add the state as subscript, if any:
+% We're done.
 %    \begin{macrocode}
-    _{\HH at tmpstore@state}% 
-    %
-  }{}%
-  %
+  \qitobjDone%
 }
 %    \end{macrocode}
 % \end{macro}
-% \endgroup
 %
-%
-%
-% Now, we have the proper entropy commands.
-%
-% \needspace{4\baselineskip}
-% \begin{macro}{\HH}
-% \begin{macro}{\Hzero}
-% \begin{macro}{\Hmin}
-% \begin{macro}{\Hmaxf}
-%   The definition of individual entropy macros just delegates to |\@HHbase|
-%   with the relevant subscript.
+% \needspace{5\baselineskip}
+% \begin{macro}{\HbaseRenderSym}
+% \begin{macro}{\HbaseRenderSub}
+% \begin{macro}{\HbaseRenderSup}
+% \begin{macro}{\HbaseRenderTail}
+%   Macros to render different parts of the entropy measure.  By default, don't
+%   do anything special to them (but this might be locally overridden in a tuned
+%   Qit Object, for instance).
 %    \begin{macrocode}
-\newcommand\HH{\@HHbase{\HHSym}{}}
-\newcommand\Hzero{\@HHbase{\HHSym}{\mathrm{max},0}}
-\newcommand\Hmin{\@HHbase{\HHSym}{\mathrm{min}}}
-\newcommand\Hmaxf{\@HHbase{\HHSym}{\mathrm{max}}}
+\def\HbaseRenderSym#1{#1}%
+\def\HbaseRenderSub#1{#1}%
+\def\HbaseRenderSup#1{#1}%
+\def\HbaseRenderTail#1{_{#1}}%
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -1068,218 +1555,441 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\Hfunc}
-%   Entropy function.  Usage: |\Hfunc(x)|, |\Hfunc`*(x)|, |\Hfunc`\big(x)|.
-%
-%   TODO: Use our generic size-specification parser! Don't duplicate code!
+% \begin{macro}{\HbaseRenderContents}
+% For the main contents rendering macro, we need to do a little more work.
+% First, declare a token register in which we will prepare the contents of the
+% parenthetic expression.
 %    \begin{macrocode}
-\DeclareRobustCommand\Hfunc{%
-  \begingroup\mathcode`\`="0060\relax%
-  \gdef\Hfunc at tmp@sizearg{}%
-  \@ifnextchar`\Hfunc at withsize\Hfunc at next%
+\newtoks\Hbase at tmp@toks
+\def\Hbase at addtoks#1\@Hbase at END@ADD at TOKS{%
+  \Hbase at tmp@toks=\expandafter{\the\Hbase at tmp@toks#1}}%
+%    \end{macrocode}
+% Now we need to define the macro which formats the contents of the entropy.
+% The arguments are |#1| = possible sizing argument, |#2| = system name, |#3| =
+% conditioning system if any.
+%    \begin{macrocode}
+\def\HbaseRenderContents#1#2#3{%
+%    \end{macrocode}
+% We need to construct the parenthetic argument to the entropy, which we will
+% store in the token register |\Hbase at tmp@toks|.  Start with system name:
+%    \begin{macrocode}
+    \Hbase at tmp@toks={#2}%
+%    \end{macrocode}
+% \ldots{} add conditional system, if specified:
+%    \begin{macrocode}
+    \notblank{#3}{%
+      \Hbase at addtoks\mathclose{}\,\delimsize\vert\,\mathopen{}%
+          #3%
+          \@Hbase at END@ADD at TOKS%
+    }{}%
+%    \end{macrocode}
+% The tokens are ready now. Prepare the argument to the command
+% |\HbaseRenderContentsInnerParens| (normally just |\phfqitParens|), and go:
+%    \begin{macrocode}
+    \edef\tmp at args{\unexpanded{#1}{\the\Hbase at tmp@toks}}%
+    \expandafter\HbaseRenderContentsInnerParens\tmp at args%
 }
-\def\Hfunc at withsize`#1{%
-  \def\@tmp at arg{#1}%
-  \def\@tmp at star{*}%
-  \ifx\@tmp at arg\@tmp at star\relax%
-    \gdef\Hfunc at tmp@sizearg{*}%
-    \endgroup%
-    \expandafter\Hfunc at inner%
-  \else%
-    \gdef\Hfunc at tmp@sizearg{[#1]}%
-    \endgroup%
-    \expandafter\Hfunc at inner%
-  \fi%
-}
-\def\Hfunc at next{\endgroup\Hfunc at inner}
-\def\Hfunc at inner(#1){%
-  \HHSym%  ({#1})%
-  \expandafter\phfqit at inner@parens\Hfunc at tmp@sizearg{#1}%
-}
 %    \end{macrocode}
 % \end{macro}
-% 
 %
-% \subsubsection{Relative Entropies}
-% 
-% User documentation in \autoref{sec:relative-entropies}
-%
-% \begin{macro}{\DDSym}
-%   Symbol to use to denote a relative entropy.
+% \begin{macro}{\X}
+%   Macro which expands to the parenthetic expression type macro we would like
+%   to use. By default, this is |\phfqitParens|.
 %    \begin{macrocode}
-\newcommand\DDSym{D}
+\def\HbaseRenderContentsInnerParens{\phfqitParens}
 %    \end{macrocode}
 % \end{macro}
-% 
-% \begin{macro}{\@DDbase at inner}
-%   Internal macro to format the inner contents of a relative entropy.
-%   \begingroup\makeatletter
-%   \par |\@DDbase at inner{\rho}{\Gamma}| \quad$\to$\quad \fbox{$\@DDbase at inner{\rho}{\Gamma}$}
-%   \endgroup
 %
-%   You can also specify the optional size specifier compatible with the
-%   |\DeclarePariedDelimiter| syntax: |\@DDbase at inner*{\rho}{\Gamma}| and
-%   |\@DDbase at inner[\big]{\rho}{\Gamma}|, for example.
 %
+% \begin{macro}{\Hbase}
+%   Finally, we declare our base entropic quantity type:
 %    \begin{macrocode}
-\DeclarePairedDelimiterX\@DDbase at inner[2]{(}{)}{%
-  #1\mathclose{}\,\delimsize\Vert\,\mathopen{}#2%
-}
+\DefineQitObject{Hbase}{\HbaseParse}{\HbaseRender}
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@DDbase}
-%   Base macro for relative entropy macros.
 %
-%   USAGE:
-%   |\@DDbase|\marg{D-symbol}\hspace{0pt}\marg{subscript}\hspace{0pt}\relax
-%   \marg{superscript}\meta{size-spec}\marg{state}\marg{relative to state}
-%   
-%   The \meta{size-spec} may be either a backtick-style specification, or a star
-%   or an optional argument (``|[\big]|'').
+% \subsubsection{Qit Object Implementation: Entropy Function}
 %
-%   \begingroup\makeatletter
-%   Examples:
-%   \par|\@DDbase{DSYMBOL}{subscript}{superscript}{\rho}{\Gamma}|  \quad$\to$\quad
-%   $\@DDbase{DSYMBOL}{subscript}{superscript}{\rho}{\Gamma}$, and similarly\\
-%   |\@DDbase{DSYMBOL}{subscript}{superscript}*{\rho}{\Gamma}|,
-%   |\@DDbase{DSYMBOL}{subscript}{superscript}[\big]{\rho}{\Gamma}|,
-%   |\@DDbase{D-symbol}{subscript}{superscript}`*{\rho}{\Gamma}|,
-%   |\@DDbase{D-symbol}{subscript}{superscript}`\big{\rho}{\Gamma}|.
-%   \endgroup
+% See also the user doc in \autoref{sec:entropy-function}.
 %
-%  This command is robust.
+% \begin{macro}{\Hfnbase}
+%   Base implementation of an entropy function.
 %
+%   Usage: |\Hfnbase{H}{1}{2}(x)| $\to$ $\Hfnbase{H}{1}{2}(x)$,
+%   |\Hfnbase{H}{1}{2}`*(x)| $\to$ $\Hfnbase{H}{1}{2}`*(x)$,
+%   |\Hfnbase{H}{1}{2}`\big(x)| $\to$ $\Hfnbase{H}{1}{2}`\big(x)$.
+%
+%   We can use the same renderer as |\Hbase|, we just need a different parser.
+%   The parser first accepts the mandatory arguments
+%   \marg{H-symbol}\hspace{0pt}\marg{subscript}\hspace{0pt}\marg{superscript}.
 %    \begin{macrocode}
-\def\@DDbase#1#2#3{%
-  #1_{#2}^{#3}%
-  \@DDbase at parsesize%
+\def\HfnbaseParse#1#2#3{%
+  \qitobjAddArg{#1}% H-sym
+  \qitobjAddArg{#2}% sub
+  \phfqit at parsesizearg{\HfnbaseParse@{#3}}%
 }
-\robustify\@DDbase
-\def\@DDbase at parsesize{%
-  \@ifnextchar`\@DDbase at withsize\@DDbase at inner%
+%    \end{macrocode}
+% 
+% Continue to parse a the argument given in parentheses.  The first mandatory
+% argument is simply the subscript passed on from the previous macro.  It might
+% be tempting to do simply |\def\HfnbaseParse@#1(#2){...}|, but this does not
+% allow for recursive use of parenthesis within the entropy argument, for
+% instance |\Hfn(g(x)+h(y))|.  Because of this, we use \pkgname{xparse}'s
+% |\NewDocumentCommand| which can handle this.
+%    \begin{macrocode}
+\NewDocumentCommand{\HfnbaseParse@}{mr()}{%
+  \qitobjAddArgx{\phfqit at val@sizearg}% size-arg
+  \qitobjAddArg{}% state
+  \qitobjAddArg{#1}% epsilon
+  \qitobjAddArg{#2}% system--main arg
+  \qitobjAddArg{}% cond system
+%%\message{DEBUG: Hfnbase args are |\detokenize\expandafter{\QitObj at args}|}%
+  \qitobjParseDone%
 }
-\def\@DDbase at withsize`#1{%
-  \def\@tmp at arg{#1}%
-  \def\@tmp at star{*}%
-  \ifx\@tmp at arg\@tmp at star\relax%
-    \def\tmp at cmd{\@DDbase at inner*}%
-    \expandafter\tmp at cmd%
-  \else%
-    \def\tmp at cmd{\@DDbase at inner[#1]}%
-    \expandafter\tmp at cmd%
-  \fi%
-}
+\DefineQitObject{Hfnbase}{\HfnbaseParse}{\HbaseRender}
 %    \end{macrocode}
 % \end{macro}
 % 
-% \begin{macro}{\DD}
-%   (Usual) quantum relative entropy.  Actually this is more versatile, because
-%   you can also specify subscript and superscript.
+%
+% \subsubsection{Qit Object Implementation: Relative Entropy}
+%
+% User documentation in \autoref{sec:relative-entropies}.
+%
+%
+% \begin{macro}{\DbaseParse}
+%   Base macro for relative entropy macros.
+%
+%   USAGE:
+%   |\Dbase|\marg{D-symbol}\hspace{0pt}\relax
+%   [|_|\meta{subscript}]\hspace{0pt}\relax
+%   [|^|\meta{superscript}]\hspace{0pt}\relax
+%   \meta{size-spec}\hspace{0pt}\marg{state}\hspace{0pt}\marg{relative to state}
+%
+%   The subscript and superscripts are optional and don't have to be specified.
+%   They may be specified in any order.  Repetitions are allowed and
+%   concatenates the arguments, e.g., |^{a}_{x}_{y}^{z}_{w}| is the same as
+%   |_{xyw}^{az}|.
+%   
+%   The \meta{size-spec} is a backtick-style specification as always.
+%
 %    \begin{macrocode}
-\DeclareRobustCommand\DD{%
-  \def\DD at tmp@sub{}%
-  \def\DD at tmp@sup{}%
-  \DD@%
+\def\DbaseParse#1{%
+  \qitobjAddArg{#1}% D-sym
+  \def\DbaseParse at val@sub{}%
+  \def\DbaseParse at val@sup{}%
+  \DbaseParse@%
 }
-\def\DD@{%
-  \@ifnextchar_\DD at parsesub\DD@@%
+\def\DbaseParse@{%
+  \@ifnextchar_{\DbaseParse at parsesub}{\DbaseParse@@}%
 }
-\def\DD@@{%
-  \@ifnextchar^\DD at parsesup\DD@@@%
+\def\DbaseParse@@{%
+  \@ifnextchar^{\DbaseParse at parsesup}{\DbaseParse@@@}%
 }
-\def\DD@@@{% sub/super-scripts have been parsed, move on to rest of command
-  \@DDbase{\DDSym}{\DD at tmp@sub}{\DD at tmp@sup}%
+\def\DbaseParse at parsesub_#1{%
+  \appto\DbaseParse at val@sub{#1}%
+  \DbaseParse@% return to maybe parsing other sub/superscripts
 }
-\def\DD at parsesub_#1{%
-  \def\DD at tmp@sub{#1}%
-  \DD@% continue parsing maybe another sub or superscript
+\def\DbaseParse at parsesup^#1{%
+  \appto\DbaseParse at val@sup{#1}%
+  \DbaseParse@% return to maybe parsing other sub/superscripts
 }
-\def\DD at parsesup^#1{%
-  \def\DD at tmp@sup{#1}%
-  \DD@% continue parsing maybe another sub or superscript
+\def\DbaseParse@@@{%
+  \qitobjAddArgx\DbaseParse at val@sub%
+  \qitobjAddArgx\DbaseParse at val@sup%
+  \phfqit at parsesizearg\DbaseParse at rest%
 }
+\def\DbaseParse at rest#1#2{%
+  \qitobjAddArgx\phfqit at val@sizearg%
+  \qitobjAddArg{#1}% rho
+  \qitobjAddArg{#2}% Gamma
+  \qitobjParseDone%
+}
 %    \end{macrocode}
 % \end{macro}
-% 
-% \begin{macro}{\Dminz}
-%   ``Old'' min-relative entropy, based on the R\'enyi-zero relative entropy.
+%
+%
+%
+%
+%
+% \begin{macro}{\DbaseRender}
+%   Macro which formats a relative entropy of the form
+%   $D_\mathrm{sub}^\mathrm{sup}(A\Vert B)$:
+%   \par |\DbaseRender{D}{\mathrm{min}}{\epsilon}{[\big]}{\rho}{\Gamma}|
+%   \quad$\to$\quad
+%   \fbox{$\DbaseRender{D}{\mathrm{min}}{\epsilon}{[\big]}{\rho}{\Gamma}$}
+%
 %    \begin{macrocode}
-\DeclareRobustCommand\Dminz[1][]{%
-  \@DDbase{\DDSym}{\mathrm{min,0}}{#1}%
+\def\DbaseRender#1#2#3#4#5#6{%
+%%\message{DEBUG: DbaseRender\detokenize{{#1}{#2}{#3}{#4}{#5}{#6}}}%
+%    \end{macrocode}
+%
+%   Start with the entropy symbol (`H'), the subscript, and the superscript:
+%    \begin{macrocode}
+  \DbaseRenderSym{#1}_{\DbaseRenderSub{#2}}^{\DbaseRenderSup{#3}}
+%    \end{macrocode}
+% Render the contents of the entropy (parenthetic expression with the (one or)
+% two states), only if the arguments are non-empty:
+%    \begin{macrocode}
+  \notblank{#5#6}{%
+    \DbaseRenderContents{#4}{#5}{#6}%
+  }{}%
+%    \end{macrocode}
+% We're done.
+%    \begin{macrocode}
+  \qitobjDone%
 }
 %    \end{macrocode}
 % \end{macro}
+%
+% \needspace{5\baselineskip}
+% \begin{macro}{\DbaseRenderSym}
+% \begin{macro}{\DbaseRenderSub}
+% \begin{macro}{\DbaseRenderSup}
+%   Macros to render different parts of the entropy measure.  By default, don't
+%   do anything special to them (but this might be locally overridden in a
+%   tuned Qit Object).
+%    \begin{macrocode}
+\def\DbaseRenderSym#1{#1}%
+\def\DbaseRenderSub#1{#1}%
+\def\DbaseRenderSup#1{#1}%
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 % 
-% \begin{macro}{\Dminf}
-%   Min-relative entropy (``new'' version).
+% \begin{macro}{\DbaseRenderContents}
+% Now we need to define the macro which formats the contents of the entropy.
+% First, define a useful token register.
 %    \begin{macrocode}
-
+\newtoks\Dbase at tmp@toks
+\def\Dbase at addtoks#1\@Dbase at END@ADD at TOKS{%
+  \Dbase at tmp@toks=\expandafter{\the\Dbase at tmp@toks#1}}%
+%    \end{macrocode}
 %
-% \Dminf{\rho}{\sigma}
-% \Dminf[\epsilon]{\rho}{\sigma}
-% \Dminf<states-spec>
-% \Dminf[\epsilon]<states-spec>
+% The arguments are |#1| = possible sizing argument, |#2| = first state, |#3| =
+% second state (or operator), if any.
+%    \begin{macrocode}
+\def\DbaseRenderContents#1#2#3{%
+%    \end{macrocode}
+% We need to construct the parenthetic argument to the relative entropy, which
+% we will store in the token register |\Dbase at tmp@toks|.  Start with system
+% name:
+%    \begin{macrocode}
+    \Dbase at tmp@toks={#2}%
+%    \end{macrocode}
+% \ldots{} add conditional system, if specified:
+%    \begin{macrocode}
+    \notblank{#3}{%
+      \Dbase at addtoks\mathclose{}\,\delimsize\Vert\,\mathopen{}%
+          #3%
+          \@Dbase at END@ADD at TOKS%
+    }{}%
+%    \end{macrocode}
+% The tokens are ready now. Prepare the argument to the command
+% |\DbaseRenderContentsInnerParens| (by default just |\phfqitParens|), and go:
+%    \begin{macrocode}
+    \edef\tmp at args{\unexpanded{#1}{\the\Dbase at tmp@toks}}%
+    \expandafter\DbaseRenderContentsInnerParens\tmp at args%
+}
+%    \end{macrocode}
+% \end{macro}
 %
-% Where <states-spec>  =  <size-spec>{\rho}{\sigma}
+% \begin{macro}{\DbaseRenderContentsInnerParens}
+%   Macro which expands to the parenthetic expression type macro we would like
+%   to use. By default, this is |\phfqitParens|.
+%    \begin{macrocode}
+\def\DbaseRenderContentsInnerParens{\phfqitParens}
+%    \end{macrocode}
+% \end{macro}
 %
-% Where optional  <size-spec>  =  "`*"  or  "`\Big"
+% \begin{macro}{\Dbase}
+%   Finally, define the |\Dbase| macro by declaring a new qit object.
+%    \begin{macrocode}
+\DefineQitObject{Dbase}{\DbaseParse}{\DbaseRender}
+%    \end{macrocode}
+% \end{macro}
 % 
-\DeclareRobustCommand\Dminf[1][]{%
-  \@DDbase{\DDSym}{\mathrm{min}}{#1}%
+%
+% \subsubsection{Qit Object Type: Coherent Relative Entropy}
+% 
+% See also user documentation in \autoref{sec:coh-rel-entr}.
+%
+% \begin{macro}{\DCohbaseParse}
+%   Base macros for coherent relative entropy-type quantities of the form
+%   ${\bar D}_{X\to X'}^{\epsilon}(\rho_{X'R}\Vert\Gamma_X,\Gamma_{X'})$.
+%
+%   USAGE:
+%   |\DCohbase|\marg{D symbol}\hspace{0pt}\relax
+%   \oarg{epsilon}\hspace{0pt}\relax
+%   \marg{state or \texttt{\textup{*}}fully-decorated-state}\hspace{0pt}\relax
+%   \marg{System In}\hspace{0pt}\relax
+%   \marg{System Out}\hspace{0pt}\relax
+%   \marg{Gamma In}\hspace{0pt}\relax
+%   \marg{Gamma Out}
+%
+%    \begin{macrocode}
+\def\DCohbaseParse#1{%
+  \qitobjAddArg{#1}% D-sym
+  \DCohbaseParse@%
 }
+\newcommand\DCohbaseParse@[1][]{%
+  \qitobjAddArg{#1}% epsilon
+  \phfqit at parsesizearg\DCohbaseParse at rest%
+}
+\def\DCohbaseParse at rest#1#2#3#4#5{%
+  % rho, X, X', \Gamma_X, \Gamma_{X'}
+  \qitobjAddArgx\phfqit at val@sizearg%
+  \DCohbaseParse at parserhosub#1\DCohbaseParse at ENDSTATE{#2}{#3}%
+  \qitobjAddArg{#2}%
+  \qitobjAddArg{#3}%
+  \qitobjAddArg{#4}%
+  \qitobjAddArg{#5}%
+  \qitobjParseDone%
+}
+\def\DCohbaseParse at parserhosub{%
+  \@ifnextchar*\DCohbaseParse at parserhosub@nosub%
+  \DCohbaseParse at parserhosub@wsub%
+}
+\def\DCohbaseParse at parserhosub@nosub*#1\DCohbaseParse at ENDSTATE#2#3{%
+  \qitobjAddArg{#1}% rho
+}
+\def\DCohbaseParse at parserhosub@wsub#1\DCohbaseParse at ENDSTATE#2#3{%
+  \qitobjAddArg{#1_{\begingroup\let\emptysystem\relax%
+      \DCohbaseStateSubscripts{#2}{#3}\endgroup}}% all this for "rho" arg
+}
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\Dmax}
-%   Max-relative entropy.
+% \begin{macro}{\DCohbaseStateSubscripts}
+%   Macro which produces the relevant subscript for the state.  By default,
+%   simply produce ``$X'R$'' (but don't produce an ``empty system''
+%   symbol). This macro may be overridden e.g. locally.
 %    \begin{macrocode}
-\DeclareRobustCommand\Dmax[1][]{%
-  \@DDbase{\DDSym}{\mathrm{max}}{#1}%
+\def\DCohbaseStateSubscripts#1#2{%
+  #2#1%
 }
 %    \end{macrocode}
 % \end{macro}
-%
-% \begin{macro}{\Dr}
-%   Rob-relative entropy.
+% 
+% \begin{macro}{\DCohbaseRender}
+%   Render the coherent relative entropy.
+%   \par |#1| = ``$D$'' symbol
+%   \par |#2| = superscript (epsilon)
+%   \par |#3| = possible size argument tokens (i.e., |[\big]|)
+%   \par |#4| = fully decorated state (i.e., with necessary subscripts as required)
+%   \par |#5| = input system name
+%   \par |#6| = output system name
+%   \par |#7| = Gamma-in
+%   \par |#8| = Gamma-out
 %    \begin{macrocode}
-\DeclareRobustCommand\Dr[1][]{%
-  \@DDbase{\DDSym}{\mathrm{r}}{#1}%
+\def\DCohbaseRender#1#2#3#4#5#6#7#8{%
+  % 
+%%\message{DEBUG: DCohbaseRender here, args are |\detokenize{{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}|.}}
+  %
+  \DCohbaseRenderSym{#1}%
+  _{\DCohbaseRenderSystems{#5}{#6}}%
+  ^{\DCohbaseRenderSup{#2}}%
+  \notblank{#4#7#8}{%
+    \DCohbaseRenderContents{#3}{#4}{#7}{#8}%
+  }{}%
+%    \end{macrocode}
+% We're done.
+%    \begin{macrocode}
+  \qitobjDone%
 }
 %    \end{macrocode}
 % \end{macro}
 %
+% \needspace{5\baselineskip}
+% \begin{macro}{\DCohbaseRenderSym}
+% \begin{macro}{\DCohbaseRenderSystems}
+% \begin{macro}{\DCohbaseRenderSup}
+%   Macros to render different parts of the entropy measure.  By default, don't
+%   do anything special to them (but this might be locally overridden in a
+%   tuned Qit Object)
+%    \begin{macrocode}
+\def\DCohbaseRenderSym#1{#1}%
+\def\DCohbaseRenderSystems#1#2{#1\to #2}%
+\def\DCohbaseRenderSup#1{#1}%
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
-% \begin{macro}{\DHyp}
-%   Hypothesis testing relative entropy.
+% \begin{macro}{\DCohbaseRenderContents}
+%   Now we define the macro which formats the contents of the entropy.
+%
+%   Define first a useful token register for rendering the contents.
 %    \begin{macrocode}
-\DeclareRobustCommand\DHyp[1][\eta]{%
-  \@DDbase{\DDSym}{\mathrm{H}}{#1}%
+\newtoks\DCohbase at tmp@toks
+\def\DCohbase at addtoks#1\@DCohbase at END@ADD at TOKS{%
+  \DCohbase at tmp@toks=\expandafter{\the\DCohbase at tmp@toks#1}}%
+%    \end{macrocode}
+%
+% The arguments are |#1| = possible sizing argument tokens, |#2| = decorated
+% state, |#3| = Gamma-X, |#4| = Gamma-{X'}.
+%    \begin{macrocode}
+\def\DCohbaseRenderContents#1#2#3#4{%
+%    \end{macrocode}
+% We need to construct the parenthetic argument to the coherent relative
+% entropy, which we will prepare in the token register |\DCohbase at tmp@toks|.
+% Start with the state:
+%    \begin{macrocode}
+    \DCohbase at tmp@toks={#2}%
+%    \end{macrocode}
+% \ldots{} add conditional system, if specified:
+%    \begin{macrocode}
+    \notblank{#3#4}{%
+      \DCohbase at addtoks\mathclose{}\,\delimsize\Vert\,\mathopen{}%
+          #3\mathclose{},\mathopen{}#4\@DCohbase at END@ADD at TOKS%
+    }{}%
+%    \end{macrocode}
+% The tokens are ready now. Prepare the argument to the command
+% |\DCohbaseRenderContentsInnerParens| (by default just |\phfqitParens|), and go:
+%    \begin{macrocode}
+    \edef\tmp at args{\unexpanded{#1}{\the\DCohbase at tmp@toks}}%
+    \expandafter\DCohbaseRenderContentsInnerParens\tmp at args%
 }
 %    \end{macrocode}
 % \end{macro}
+% 
+% \begin{macro}{\DCohbaseRenderContentsInnerParens}
+%   Macro which expands to the parenthetic expression type macro we would like
+%   to use.  By default, this is |\phfqitParens|.
+%    \begin{macrocode}
+\def\DCohbaseRenderContentsInnerParens{\phfqitParens}
+%    \end{macrocode}
+% \end{macro}
 %
+% \begin{macro}{\DCohbase}
+%   Finally, define the |\DCohbase| macro by declaring a new qit object.
+%    \begin{macrocode}
+\DefineQitObject{DCohbase}{\DCohbaseParse}{\DCohbaseRender}
+%    \end{macrocode}
+% \end{macro}
+% 
 %
-% \subsubsection{Coherent Relative Entropy}
-% 
-% See user documentation in \autoref{sec:coh-rel-entr}.
-% 
-% \begin{macro}{\DC at inner}
-%   Format the contents of the coherent relative entropy.  This is simply a
-%   |\DeclarePariedDelimiter|-style command.  The syntax is
-%   |\DC at inner|\hspace{0pt}\marg{rho}\hspace{0pt}\marg{Gamma1}\hspace{0pt}\marg{Gamma2}, and
-%   this typesets as $\bigl(\meta{rho}\big\Vert\meta{Gamma1},\meta{Gamma2}\bigr)$.
+% \subsection{Additional helpers for entropy measures}
+%
+% \begin{macro}{\HSym}
+%   Symbol to use to denote an entropy measure.
 %    \begin{macrocode}
-\DeclarePairedDelimiterX\DC at inner[3]{(}{)}{%
-  #1\mathclose{}\,\delimsize\Vert\,\mathopen{}#2\mathclose{},\mathopen{}#3%
-}
+\def\HSym{H}
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\DSym}
+%   Symbol to use to denote a relative entropy measure.
+%    \begin{macrocode}
+\newcommand\DSym{D}
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\DCSym}
-%   Symbol to use for the coherent relative entropy
+%   Symbol to use for the coherent relative entropy measure.
 %    \begin{macrocode}
-\newcommand\DCSym{\bar\DDSym}
+\newcommand\DCSym{\bar\DSym}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1291,71 +2001,185 @@
 %    \end{macrocode}
 % \end{macro}
 % 
+% \begin{macro}{\DCohxRefSystemName}
+% \begin{macro}{\DCohxStateSubscripts}
+%   Macros helpful for defining |\DCohx|.
+%    \begin{macrocode}
+\def\DCohxRefSystemName#1{R_{#1}}
+\def\DCohxStateSubscripts#1#2{#2\DCohxRefSystemName{#1}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
 %
-% \begin{macro}{\DCoh}
-%   The Coherent Relative Entropy.
 %
-%   TODO: Use our generic size parser, don't duplicate code!
+% Finally, some macros provided for backwards compatibility:
+%    \begin{macrocode}
+\let\@HHbase\Hbase
+\let\@DDbase\Dbase
+\let\HHSym\HSym
+\let\DDSym\DSym
+%    \end{macrocode}
 %
-%   First part: read the first few arguments (epsilon superscript, optional size
-%   specification).
+%
+% \subsection{Handle package options}
+%
+% \changedreftext{v2.0-pkg-opt-qitobjdef}
+% \changedreftext{v2.0-pkg-opt-newReIm}
+%
+% Initialization code for \pkgname{kvoptions} for our package options.  See
+% \autoref{sec:pkg-options}.
 %    \begin{macrocode}
-\newcommand\DCoh[1][]{%
-  \def\DC at tmp@sup{#1}%
-  %\message{*********|\detokenize{#1}|*********}%
-  \begingroup\mathcode`\`="0060\relax
-  \DC at parsesize%
+\SetupKeyvalOptions{
+   family=phfqit,
+   prefix=phfqit at opt@
 }
-\def\DC at parsesize#1{%
-  \gdef\DC at tmp@sizeargs{}%
-  \ifstrequal{#1}{`}\DC at withsize{\endgroup\DC at rest{#1}}%
-}
-\def\DC at withsize#1{%
-  %\message{*********\detokenize{#1}********}%
-  \def\@tmp at arg{#1}%
-  \def\@tmp at star{*}%
-  \ifx\@tmp at arg\@tmp at star\relax%
-    \gdef\DC at tmp@sizeargs{*}%
-    \endgroup%
-    \expandafter\DC at rest%
-  \else%
-    \gdef\DC at tmp@sizeargs{[#1]}%
-    \endgroup%
-    \expandafter\DC at rest%
-  \fi%
-}
 %    \end{macrocode}
 % 
-% Read the rest and typeset the output.  |#1|=rho, |#2|=system-in,
-% |#3|=system-out, |#4|=Gamma-in, |#5|=Gamma-out:
+% Set of predefined qit objects to load. Either |stdset| (standard set, the
+% default) or |none| (none).
 %    \begin{macrocode}
-\def\DC at rest#1#2#3#4#5{%
-  %\message{*********\detokenize{#1}|\detokenize{#2}|\detokenize{#3}%
-  %    |\detokenize{#4}|\detokenize{#5}|********}%
-  \def\DC at tmp@rho{\DC at fmtrhosub#1\DC at ENDSTATE{#2}{#3}}%
-  \DCSym_{#2\to #3}^{\DC at tmp@sup}%
-  \expandafter\DC at inner\DC at tmp@sizeargs{\DC at tmp@rho}{#4}{#5}%
-}
+\DeclareStringOption[stdset]{qitobjdef}
 %    \end{macrocode}
+%
+% Whether to override \LaTeX{}'s default {\makeatletter $\phfqit at Re$ and
+% $\phfqit at Im$} symbols by our more readable $\Re$ and $\Im$.
+%    \begin{macrocode}
+\DeclareBoolOption[true]{newReIm}
+%    \end{macrocode}
+%
 % 
-% Read the following tokens until the marker |\DC at ENDSTATE|, and format this as
-% a state with or without the automatic system subscripts (depending on if the
-% argument starts with a `|*|').
+% Process package options.
 %    \begin{macrocode}
-\def\DC at fmtrhosub{%
-  \@ifnextchar*\DC at fmtrhosub@nosub\DC at fmtrhosub@wsub%
+\ProcessKeyvalOptions*
+%    \end{macrocode}
+%
+%
+% \subsubsection{Re/Im symbols}
+%
+% \begin{macro}{\Re}
+% \begin{macro}{\Im}
+%   Provide |\Re| and |\Im| commands to override \LaTeX{}'s default if the
+%   corresponding package option is set (which is the default).
+%    \begin{macrocode}
+\ifphfqit at opt@newReIm
+  \renewcommand{\Re}{\phfqit at Realpart}
+  \renewcommand{\Im}{\phfqit at Imagpart}
+\fi
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{Standard entropy measures}
+%
+% Load the requested set of qit objects. 
+%    \begin{macrocode}
+\def\phfqit at tmp@str at none{none}
+\def\phfqit at tmp@str at stdset{stdset}
+\ifx\phfqit at opt@qitobjdef\phfqit at tmp@str at none%
+%    \end{macrocode}
+% In this case, do not load any definitions.
+%    \begin{macrocode}
+\else\ifx\phfqit at opt@qitobjdef\phfqit at tmp@str at stdset%
+%    \end{macrocode}
+% In this case, provide our standard set of ``qit objects'' (i.e., entropy
+% measures).
+% 
+% \needspace{4\baselineskip}
+% \begin{macro}{\HH}
+% \begin{macro}{\Hzero}
+% \begin{macro}{\Hmin}
+% \begin{macro}{\Hmaxf}
+%   The definition of individual entropy macros just delegates to |\Hbase|
+%   with the relevant subscript.
+%    \begin{macrocode}
+\def\HH{\Hbase{\HSym}{}}
+\def\Hzero{\Hbase{\HSym}{\mathrm{max},0}}
+\def\Hmin{\Hbase{\HSym}{\mathrm{min}}}
+\def\Hmaxf{\Hbase{\HSym}{\mathrm{max}}}
+\def\Hfn{\Hfnbase{\HSym}{}{}}
+\let\Hfunc\Hfn% backwards compatibility
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% 
+% \begin{macro}{\DD}
+%   (Usual) quantum relative entropy.  (Actually this is more versatile, because
+%   you can also specify subscript and superscript, so you can make on-the-fly
+%   custom relative entropy measures.)
+%    \begin{macrocode}
+\def\DD{\Dbase{\DSym}}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\Dminz}
+%   ``Old'' min-relative entropy, based on the R\'enyi-zero relative entropy.
+%    \begin{macrocode}
+\newcommand\Dminz[1][]{\Dbase{\DSym}_{\mathrm{min,0}}^{#1}}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\Dminf}
+%   Min-relative entropy (``new'' version).
+%    \begin{macrocode}
+\newcommand\Dminf[1][]{\Dbase{\DSym}_{\mathrm{min}}^{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Dmax}
+%   Max-relative entropy.
+%    \begin{macrocode}
+\newcommand\Dmax[1][]{\Dbase{\DSym}_{\mathrm{max}}^{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Dr}
+%   Rob-relative entropy.
+%    \begin{macrocode}
+\newcommand\Dr[1][]{\Dbase{\DSym}_{\mathrm{r}}^{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\DHyp}
+%   Hypothesis testing relative entropy.
+%    \begin{macrocode}
+\newcommand\DHyp[1][\eta]{\Dbase{\DSym}_{\mathrm{H}}^{#1}}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\DCoh}
+%   Coherent relative entropy (old style).
+%    \begin{macrocode}
+\DefineTunedQitObject{DCoh}{\DCohbaseParse}{\DCohbaseRender}{{\DCSym}}{}
+%    \end{macrocode}   
+% \end{macro}
+%
+% \begin{macro}{\DCohx}
+%   Coherent relative entropy (new style).
+%    \begin{macrocode}
+\DefineTunedQitObject{DCohx}{\DCohbaseParse}{\DCohbaseRender}%
+{{\DCSym}}{%
+  \let\DCohbaseStateSubscripts\DCohxStateSubscripts%
 }
-\def\DC at fmtrhosub@nosub*#1\DC at ENDSTATE#2#3{%
-  #1%
-}
-\def\DC at fmtrhosub@wsub#1\DC at ENDSTATE#2#3{%
-  \begingroup%
-    \let\emptysystem\relax%
-    #1_{#3#2}%
-  \endgroup%
-}
 %    \end{macrocode}
 % \end{macro}
 %
+%
+% End case |qitobjdef=stdset|.  Last case is the final |\else| branch which is an
+% error, as we have an unknown set of standard definitions to load.
+%    \begin{macrocode}
+\else
+\PackageError{phfqit}{Invalid value `\phfqit at opt@qitobjdef' specified for
+  package option `qitobjdef'.  Please specify one of `stdset' (the default) or
+  `none'}{You specified an invalid value to the `qitobjdef' package option of
+  the `phfqit' package.}
+\fi
+\fi
+%    \end{macrocode}
+%
+% 
 % \Finale
 \endinput

Modified: trunk/Master/texmf-dist/source/latex/phfqit/phfqit.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/phfqit/phfqit.ins	2017-08-20 22:13:12 UTC (rev 45083)
+++ trunk/Master/texmf-dist/source/latex/phfqit/phfqit.ins	2017-08-20 22:13:28 UTC (rev 45084)
@@ -1,5 +1,5 @@
 %%
-%% Copyright (C) 2016 by Philippe Faist <philippe.faist at bluewin.ch>
+%% Copyright (C) 2016 by Philippe Faist, philippe.faist at bluewin.ch
 %%
 %% This file may be distributed and/or modified under the conditions of
 %% the LaTeX Project Public License, either version 1.3 of this license
@@ -21,7 +21,7 @@
 
 This is a generated file.
 
-Copyright (C) 2016 by Philippe Faist <philippe.faist at bluewin.ch>
+Copyright (C) 2016 by Philippe Faist, philippe.faist at bluewin.ch
 
 This file may be distributed and/or modified under the conditions of
 the LaTeX Project Public License, either version 1.3 of this license

Modified: trunk/Master/texmf-dist/tex/latex/phfqit/phfqit.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/phfqit/phfqit.sty	2017-08-20 22:13:12 UTC (rev 45083)
+++ trunk/Master/texmf-dist/tex/latex/phfqit/phfqit.sty	2017-08-20 22:13:28 UTC (rev 45084)
@@ -8,7 +8,7 @@
 %% 
 %% This is a generated file.
 %% 
-%% Copyright (C) 2016 by Philippe Faist <philippe.faist at bluewin.ch>
+%% Copyright (C) 2016 by Philippe Faist, philippe.faist at bluewin.ch
 %% 
 %% This file may be distributed and/or modified under the conditions of
 %% the LaTeX Project Public License, either version 1.3 of this license
@@ -22,7 +22,7 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
 \ProvidesPackage{phfqit}
-    [2016/08/15 v1.0 phfqit package]
+    [2017/08/16 v2.0 phfqit package]
 \RequirePackage{calc}
 \RequirePackage{etoolbox}
 \RequirePackage{amsmath}
@@ -29,6 +29,9 @@
 \RequirePackage{dsfont}
 \RequirePackage{mathrsfs}
 \RequirePackage{mathtools}
+\RequirePackage{xparse}
+\RequirePackage{xkeyval}
+\RequirePackage{kvoptions}
 \newcommand{\Hs}{\mathscr{H}}
 \newcommand{\Ident}{\mathds{1}}
 \def\IdentProc{%
@@ -53,7 +56,7 @@
 }
 \def\phfqit at IdentProc@do#1#2#3{%
   \operatorname{id}_{#1\notblank{#2}{\to #2}{}}%
-  \notblank{#3}{\expandafter\phfqit at inner@parens\phfqit at val@sizearg{#3}}{}%
+  \notblank{#3}{\expandafter\phfqitParens\phfqit at val@sizearg{#3}}{}%
 }
 \def\ee^#1{e^{#1}} % we could imagine that in inlines, we replace this by exp()...
 \DeclareMathOperator{\tr}{tr}
@@ -64,10 +67,8 @@
 \DeclareMathOperator{\diag}{diag}
 \let\phfqit at Re\Re
 \DeclareMathOperator{\phfqit at Realpart}{Re}%
-\renewcommand{\Re}{\phfqit at Realpart}
 \let\phfqit at Im\Im
 \DeclareMathOperator{\phfqit at Imagpart}{Im}%
-\renewcommand{\Im}{\phfqit at Imagpart}
 \DeclareMathOperator{\poly}{poly}
 \newcommand\bit[1]{\texttt{#1}}
 \newcommand\bitstring[1]{\phfqit at bitstring{#1}}
@@ -138,211 +139,291 @@
   \begingroup%
   \mathcode`\`="0060\relax%
   \gdef\phfqit at val@sizearg{}%
-  \@ifnextchar`{\phfqit at parsesizearg@withsize{#1}}{\endgroup#1}%
+  \def\phfqit at tmp@contwithsize{\phfqit at parsesizearg@withsize{#1}}%
+  \@ifnextchar`{\phfqit at tmp@contwithsize}{\endgroup#1}%
 }
 \def\phfqit at parsesizearg@withsize#1`#2{%
-  \def\@tmp at arg{#2}%
-  \def\@tmp at star{*}%
-  \def\@tmp at endgroupandcontinue{\endgroup#1}%
-  \ifx\@tmp at arg\@tmp at star\relax%
+  \def\phfqit at tmp@x{#2}%
+  \def\phfqit at tmp@star{*}%
+  \ifx\phfqit at tmp@x\phfqit at tmp@star%
     \gdef\phfqit at val@sizearg{*}%
-    \expandafter\@tmp at endgroupandcontinue%
+    \def\phfqit at tmp@cont{\endgroup#1}%
+    \expandafter\phfqit at tmp@cont%
   \else%
     \gdef\phfqit at val@sizearg{[#2]}%
-    \expandafter\@tmp at endgroupandcontinue%
+    \def\phfqit at tmp@cont{\endgroup#1}%
+    \expandafter\phfqit at tmp@cont%
   \fi%
 }
-\DeclarePairedDelimiterX\phfqit at inner@parens[1]{(}{)}{#1}
-\newcommand\HHSym{H}
-\def\@HHbase#1#2{%
-  #1_{#2}%
-  \@HHbase at parsesize%
+\DeclarePairedDelimiterX\phfqitParens[1]{(}{)}{#1}
+\DeclarePairedDelimiterX\phfqitSquareBrackets[1]{[}{]}{#1}
+\DeclarePairedDelimiterX\phfqitCurlyBrackets[1]{\{}{\}}{#1}
+\newcommand\QitObject[1]{%
+  \begingroup%
+    \preto\QitObjectDone{\endgroup}%
+    \QitObjectInit%
+    \csname QitObj at reg@#1 at initdefs\endcsname%
+%%\message{DEBUG: \detokenize{\QitObject{#1}}}%
+    \def\QitObj at args{}%
+    \def\qitobjParseDone{\QitObj at proceedToRender{#1}}%
+    \def\qitobjDone{\QitObjectDone}%
+    \csname QitObj at reg@#1 at parse\endcsname%
 }
-\robustify\@HHbase
-\def\@HHbase at parsesize{%
-  \begingroup\mathcode`\`="0060\relax%
-  \gdef\HH at tmp@sizearg{}%
-  \@ifnextchar`\@HHbase at withsize\@HHbase at endgroupandparseinner%
+\def\DefineQitObject#1#2#3{%
+  \DefineTunedQitObject{#1}{#2}{#3}{}{}%
+}%
+\def\DefineTunedQitObject#1#2#3#4#5{%
+  \csdef{#1}{\QitObject{#1}#4}%
+  \expandafter\robustify\csname #1\endcsname%
+  \cslet{QitObj at reg@#1 at parse}#2%
+  \cslet{QitObj at reg@#1 at render}#3%
+  \csdef{QitObj at reg@#1 at initdefs}{#5}%
 }
-\def\@HHbase at withsize`#1{%
-  \def\@tmp at arg{#1}%
-  \def\@tmp at star{*}%
-  \ifx\@tmp at arg\@tmp at star\relax%
-    \gdef\HH at tmp@sizearg{*}%
-    \expandafter\@HHbase at endgroupandparseinner%
-  \else%
-    \gdef\HH at tmp@sizearg{[#1]}%
-    \expandafter\@HHbase at endgroupandparseinner%
-  \fi%
+\def\qitobjAddArg#1{%
+  \appto\QitObj at args{{#1}}%
 }
-\def\@HHbase at endgroupandparseinner{\endgroup\@HHbase at parseinner}
-\newcommand\@HHbase at parseinner[1][]{%  arg: state
-  \def\HH at tmpstore@state{#1}%
-  \@HHbase at parseinner@%
+\def\qitobjAddArgx#1{%
+  \expandafter\qitobjAddArg\expandafter{#1}%
 }
-\newcommand\@HHbase at parseinner@[2][]{% arg: epsilon and target system
-  \def\HH at tmpstore@epsilon{#1}%
-  \def\HH at tmpstore@system{#2}%
-  \@HHbase at parseinner@@%
+\def\qitobjParseDone{}
+\def\qitobjDone{}
+\def\QitObjectDone{}
+\def\QitObjectInit{}
+\def\QitObj at proceedToRender#1{%
+%%\message{DEBUG: Rendering #1|\detokenize\expandafter{\QitObj at args}|}%
+  \expandafter\def\expandafter\x\expandafter{%
+    \csname QitObj at reg@#1 at render\endcsname}%
+  \expandafter\x\QitObj at args%
 }
-\newcommand\@HHbase at parseinner@@[1][]{% arg: conditioning system
-  \def\HH at tmpstore@condsys{#1}%
-  \@HHbase at do@inner%
+\def\HbaseParse#1#2{%
+  \qitobjAddArg{#1}%
+  \qitobjAddArg{#2}%
+  \phfqit at parsesizearg\HbaseParse@%
 }
-\newtoks\HH at tmp@toks
-\def\HH at addtoks#1\@HH at END@ADD at TOKS{\HH at tmp@toks=\expandafter{\the\HH at tmp@toks#1}}%
-\def\@HHbase at do@inner{%
-  ^{\HH at tmpstore@epsilon}%
-  \expandafter\notblank\expandafter{\HH at tmpstore@system}{%
-    \HH at tmp@toks={}%
-    \expandafter\HH at addtoks\HH at tmpstore@system\@HH at END@ADD at TOKS%
-    \expandafter\notblank\expandafter{\HH at tmpstore@condsys}{%
-      \HH at addtoks\mathclose{}\,\delimsize\vert\,\mathopen{}\@HH at END@ADD at TOKS%
-      \expandafter\HH at addtoks\HH at tmpstore@condsys\@HH at END@ADD at TOKS%
-    }{}%
-    \edef\tmp at args{\expandonce{\HH at tmp@sizearg}{\the\HH at tmp@toks}}%
-    \expandafter\phfqit at inner@parens\tmp at args%
-    _{\HH at tmpstore@state}%
-    %
-  }{}%
-  %
+\newcommand\HbaseParse@[1][]{%
+  \qitobjAddArgx{\phfqit at val@sizearg}%
+  \qitobjAddArg{#1}%
+  \HbaseParse@@%
 }
-\newcommand\HH{\@HHbase{\HHSym}{}}
-\newcommand\Hzero{\@HHbase{\HHSym}{\mathrm{max},0}}
-\newcommand\Hmin{\@HHbase{\HHSym}{\mathrm{min}}}
-\newcommand\Hmaxf{\@HHbase{\HHSym}{\mathrm{max}}}
-\DeclareRobustCommand\Hfunc{%
-  \begingroup\mathcode`\`="0060\relax%
-  \gdef\Hfunc at tmp@sizearg{}%
-  \@ifnextchar`\Hfunc at withsize\Hfunc at next%
+\newcommand\HbaseParse@@[2][]{%
+  \qitobjAddArg{#1}%
+  \qitobjAddArg{#2}%
+  \HbaseParse@@@%
 }
-\def\Hfunc at withsize`#1{%
-  \def\@tmp at arg{#1}%
-  \def\@tmp at star{*}%
-  \ifx\@tmp at arg\@tmp at star\relax%
-    \gdef\Hfunc at tmp@sizearg{*}%
-    \endgroup%
-    \expandafter\Hfunc at inner%
-  \else%
-    \gdef\Hfunc at tmp@sizearg{[#1]}%
-    \endgroup%
-    \expandafter\Hfunc at inner%
-  \fi%
+\newcommand\HbaseParse@@@[1][]{%
+  \qitobjAddArg{#1}%
+  \qitobjParseDone%
 }
-\def\Hfunc at next{\endgroup\Hfunc at inner}
-\def\Hfunc at inner(#1){%
-  \HHSym%  ({#1})%
-  \expandafter\phfqit at inner@parens\Hfunc at tmp@sizearg{#1}%
+\def\HbaseRender#1#2#3#4#5#6#7{%
+%%\message{DEBUG: HbaseRender\detokenize{{#1}{#2}{#3}{#4}{#5}{#6}{#7}}}%
+  \HbaseRenderSym{#1}_{\HbaseRenderSub{#2}}^{\HbaseRenderSup{#5}}
+  \notblank{#4#6#7}{%
+    \HbaseRenderContents{#3}{#6}{#7}%
+    \HbaseRenderTail{#4}%
+  }{}%
+  \qitobjDone%
 }
-\newcommand\DDSym{D}
-\DeclarePairedDelimiterX\@DDbase at inner[2]{(}{)}{%
-  #1\mathclose{}\,\delimsize\Vert\,\mathopen{}#2%
+\def\HbaseRenderSym#1{#1}%
+\def\HbaseRenderSub#1{#1}%
+\def\HbaseRenderSup#1{#1}%
+\def\HbaseRenderTail#1{_{#1}}%
+\newtoks\Hbase at tmp@toks
+\def\Hbase at addtoks#1\@Hbase at END@ADD at TOKS{%
+  \Hbase at tmp@toks=\expandafter{\the\Hbase at tmp@toks#1}}%
+\def\HbaseRenderContents#1#2#3{%
+    \Hbase at tmp@toks={#2}%
+    \notblank{#3}{%
+      \Hbase at addtoks\mathclose{}\,\delimsize\vert\,\mathopen{}%
+          #3%
+          \@Hbase at END@ADD at TOKS%
+    }{}%
+    \edef\tmp at args{\unexpanded{#1}{\the\Hbase at tmp@toks}}%
+    \expandafter\HbaseRenderContentsInnerParens\tmp at args%
 }
-\def\@DDbase#1#2#3{%
-  #1_{#2}^{#3}%
-  \@DDbase at parsesize%
+\def\HbaseRenderContentsInnerParens{\phfqitParens}
+\DefineQitObject{Hbase}{\HbaseParse}{\HbaseRender}
+\def\HfnbaseParse#1#2#3{%
+  \qitobjAddArg{#1}% H-sym
+  \qitobjAddArg{#2}% sub
+  \phfqit at parsesizearg{\HfnbaseParse@{#3}}%
 }
-\robustify\@DDbase
-\def\@DDbase at parsesize{%
-  \@ifnextchar`\@DDbase at withsize\@DDbase at inner%
+\NewDocumentCommand{\HfnbaseParse@}{mr()}{%
+  \qitobjAddArgx{\phfqit at val@sizearg}% size-arg
+  \qitobjAddArg{}% state
+  \qitobjAddArg{#1}% epsilon
+  \qitobjAddArg{#2}% system--main arg
+  \qitobjAddArg{}% cond system
+%%\message{DEBUG: Hfnbase args are |\detokenize\expandafter{\QitObj at args}|}%
+  \qitobjParseDone%
 }
-\def\@DDbase at withsize`#1{%
-  \def\@tmp at arg{#1}%
-  \def\@tmp at star{*}%
-  \ifx\@tmp at arg\@tmp at star\relax%
-    \def\tmp at cmd{\@DDbase at inner*}%
-    \expandafter\tmp at cmd%
-  \else%
-    \def\tmp at cmd{\@DDbase at inner[#1]}%
-    \expandafter\tmp at cmd%
-  \fi%
+\DefineQitObject{Hfnbase}{\HfnbaseParse}{\HbaseRender}
+\def\DbaseParse#1{%
+  \qitobjAddArg{#1}% D-sym
+  \def\DbaseParse at val@sub{}%
+  \def\DbaseParse at val@sup{}%
+  \DbaseParse@%
 }
-\DeclareRobustCommand\DD{%
-  \def\DD at tmp@sub{}%
-  \def\DD at tmp@sup{}%
-  \DD@%
+\def\DbaseParse@{%
+  \@ifnextchar_{\DbaseParse at parsesub}{\DbaseParse@@}%
 }
-\def\DD@{%
-  \@ifnextchar_\DD at parsesub\DD@@%
+\def\DbaseParse@@{%
+  \@ifnextchar^{\DbaseParse at parsesup}{\DbaseParse@@@}%
 }
-\def\DD@@{%
-  \@ifnextchar^\DD at parsesup\DD@@@%
+\def\DbaseParse at parsesub_#1{%
+  \appto\DbaseParse at val@sub{#1}%
+  \DbaseParse@% return to maybe parsing other sub/superscripts
 }
-\def\DD@@@{% sub/super-scripts have been parsed, move on to rest of command
-  \@DDbase{\DDSym}{\DD at tmp@sub}{\DD at tmp@sup}%
+\def\DbaseParse at parsesup^#1{%
+  \appto\DbaseParse at val@sup{#1}%
+  \DbaseParse@% return to maybe parsing other sub/superscripts
 }
-\def\DD at parsesub_#1{%
-  \def\DD at tmp@sub{#1}%
-  \DD@% continue parsing maybe another sub or superscript
+\def\DbaseParse@@@{%
+  \qitobjAddArgx\DbaseParse at val@sub%
+  \qitobjAddArgx\DbaseParse at val@sup%
+  \phfqit at parsesizearg\DbaseParse at rest%
 }
-\def\DD at parsesup^#1{%
-  \def\DD at tmp@sup{#1}%
-  \DD@% continue parsing maybe another sub or superscript
+\def\DbaseParse at rest#1#2{%
+  \qitobjAddArgx\phfqit at val@sizearg%
+  \qitobjAddArg{#1}% rho
+  \qitobjAddArg{#2}% Gamma
+  \qitobjParseDone%
 }
-\DeclareRobustCommand\Dminz[1][]{%
-  \@DDbase{\DDSym}{\mathrm{min,0}}{#1}%
+\def\DbaseRender#1#2#3#4#5#6{%
+%%\message{DEBUG: DbaseRender\detokenize{{#1}{#2}{#3}{#4}{#5}{#6}}}%
+  \DbaseRenderSym{#1}_{\DbaseRenderSub{#2}}^{\DbaseRenderSup{#3}}
+  \notblank{#5#6}{%
+    \DbaseRenderContents{#4}{#5}{#6}%
+  }{}%
+  \qitobjDone%
 }
-
-\DeclareRobustCommand\Dminf[1][]{%
-  \@DDbase{\DDSym}{\mathrm{min}}{#1}%
+\def\DbaseRenderSym#1{#1}%
+\def\DbaseRenderSub#1{#1}%
+\def\DbaseRenderSup#1{#1}%
+\newtoks\Dbase at tmp@toks
+\def\Dbase at addtoks#1\@Dbase at END@ADD at TOKS{%
+  \Dbase at tmp@toks=\expandafter{\the\Dbase at tmp@toks#1}}%
+\def\DbaseRenderContents#1#2#3{%
+    \Dbase at tmp@toks={#2}%
+    \notblank{#3}{%
+      \Dbase at addtoks\mathclose{}\,\delimsize\Vert\,\mathopen{}%
+          #3%
+          \@Dbase at END@ADD at TOKS%
+    }{}%
+    \edef\tmp at args{\unexpanded{#1}{\the\Dbase at tmp@toks}}%
+    \expandafter\DbaseRenderContentsInnerParens\tmp at args%
 }
-\DeclareRobustCommand\Dmax[1][]{%
-  \@DDbase{\DDSym}{\mathrm{max}}{#1}%
+\def\DbaseRenderContentsInnerParens{\phfqitParens}
+\DefineQitObject{Dbase}{\DbaseParse}{\DbaseRender}
+\def\DCohbaseParse#1{%
+  \qitobjAddArg{#1}% D-sym
+  \DCohbaseParse@%
 }
-\DeclareRobustCommand\Dr[1][]{%
-  \@DDbase{\DDSym}{\mathrm{r}}{#1}%
+\newcommand\DCohbaseParse@[1][]{%
+  \qitobjAddArg{#1}% epsilon
+  \phfqit at parsesizearg\DCohbaseParse at rest%
 }
-\DeclareRobustCommand\DHyp[1][\eta]{%
-  \@DDbase{\DDSym}{\mathrm{H}}{#1}%
+\def\DCohbaseParse at rest#1#2#3#4#5{%
+  % rho, X, X', \Gamma_X, \Gamma_{X'}
+  \qitobjAddArgx\phfqit at val@sizearg%
+  \DCohbaseParse at parserhosub#1\DCohbaseParse at ENDSTATE{#2}{#3}%
+  \qitobjAddArg{#2}%
+  \qitobjAddArg{#3}%
+  \qitobjAddArg{#4}%
+  \qitobjAddArg{#5}%
+  \qitobjParseDone%
 }
-\DeclarePairedDelimiterX\DC at inner[3]{(}{)}{%
-  #1\mathclose{}\,\delimsize\Vert\,\mathopen{}#2\mathclose{},\mathopen{}#3%
+\def\DCohbaseParse at parserhosub{%
+  \@ifnextchar*\DCohbaseParse at parserhosub@nosub%
+  \DCohbaseParse at parserhosub@wsub%
 }
-\newcommand\DCSym{\bar\DDSym}
-\def\emptysystem{\ensuremath{\emptyset}}
-\newcommand\DCoh[1][]{%
-  \def\DC at tmp@sup{#1}%
-  %\message{*********|\detokenize{#1}|*********}%
-  \begingroup\mathcode`\`="0060\relax
-  \DC at parsesize%
+\def\DCohbaseParse at parserhosub@nosub*#1\DCohbaseParse at ENDSTATE#2#3{%
+  \qitobjAddArg{#1}% rho
 }
-\def\DC at parsesize#1{%
-  \gdef\DC at tmp@sizeargs{}%
-  \ifstrequal{#1}{`}\DC at withsize{\endgroup\DC at rest{#1}}%
+\def\DCohbaseParse at parserhosub@wsub#1\DCohbaseParse at ENDSTATE#2#3{%
+  \qitobjAddArg{#1_{\begingroup\let\emptysystem\relax%
+      \DCohbaseStateSubscripts{#2}{#3}\endgroup}}% all this for "rho" arg
 }
-\def\DC at withsize#1{%
-  %\message{*********\detokenize{#1}********}%
-  \def\@tmp at arg{#1}%
-  \def\@tmp at star{*}%
-  \ifx\@tmp at arg\@tmp at star\relax%
-    \gdef\DC at tmp@sizeargs{*}%
-    \endgroup%
-    \expandafter\DC at rest%
-  \else%
-    \gdef\DC at tmp@sizeargs{[#1]}%
-    \endgroup%
-    \expandafter\DC at rest%
-  \fi%
+\def\DCohbaseStateSubscripts#1#2{%
+  #2#1%
 }
-\def\DC at rest#1#2#3#4#5{%
-  %\message{*********\detokenize{#1}|\detokenize{#2}|\detokenize{#3}%
-  %    |\detokenize{#4}|\detokenize{#5}|********}%
-  \def\DC at tmp@rho{\DC at fmtrhosub#1\DC at ENDSTATE{#2}{#3}}%
-  \DCSym_{#2\to #3}^{\DC at tmp@sup}%
-  \expandafter\DC at inner\DC at tmp@sizeargs{\DC at tmp@rho}{#4}{#5}%
+\def\DCohbaseRender#1#2#3#4#5#6#7#8{%
+  %
+%%\message{DEBUG: DCohbaseRender here, args are |\detokenize{{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}|.}}
+  %
+  \DCohbaseRenderSym{#1}%
+  _{\DCohbaseRenderSystems{#5}{#6}}%
+  ^{\DCohbaseRenderSup{#2}}%
+  \notblank{#4#7#8}{%
+    \DCohbaseRenderContents{#3}{#4}{#7}{#8}%
+  }{}%
+  \qitobjDone%
 }
-\def\DC at fmtrhosub{%
-  \@ifnextchar*\DC at fmtrhosub@nosub\DC at fmtrhosub@wsub%
+\def\DCohbaseRenderSym#1{#1}%
+\def\DCohbaseRenderSystems#1#2{#1\to #2}%
+\def\DCohbaseRenderSup#1{#1}%
+\newtoks\DCohbase at tmp@toks
+\def\DCohbase at addtoks#1\@DCohbase at END@ADD at TOKS{%
+  \DCohbase at tmp@toks=\expandafter{\the\DCohbase at tmp@toks#1}}%
+\def\DCohbaseRenderContents#1#2#3#4{%
+    \DCohbase at tmp@toks={#2}%
+    \notblank{#3#4}{%
+      \DCohbase at addtoks\mathclose{}\,\delimsize\Vert\,\mathopen{}%
+          #3\mathclose{},\mathopen{}#4\@DCohbase at END@ADD at TOKS%
+    }{}%
+    \edef\tmp at args{\unexpanded{#1}{\the\DCohbase at tmp@toks}}%
+    \expandafter\DCohbaseRenderContentsInnerParens\tmp at args%
 }
-\def\DC at fmtrhosub@nosub*#1\DC at ENDSTATE#2#3{%
-  #1%
+\def\DCohbaseRenderContentsInnerParens{\phfqitParens}
+\DefineQitObject{DCohbase}{\DCohbaseParse}{\DCohbaseRender}
+\def\HSym{H}
+\newcommand\DSym{D}
+\newcommand\DCSym{\bar\DSym}
+\def\emptysystem{\ensuremath{\emptyset}}
+\def\DCohxRefSystemName#1{R_{#1}}
+\def\DCohxStateSubscripts#1#2{#2\DCohxRefSystemName{#1}}
+\let\@HHbase\Hbase
+\let\@DDbase\Dbase
+\let\HHSym\HSym
+\let\DDSym\DSym
+\SetupKeyvalOptions{
+   family=phfqit,
+   prefix=phfqit at opt@
 }
-\def\DC at fmtrhosub@wsub#1\DC at ENDSTATE#2#3{%
-  \begingroup%
-    \let\emptysystem\relax%
-    #1_{#3#2}%
-  \endgroup%
+\DeclareStringOption[stdset]{qitobjdef}
+\DeclareBoolOption[true]{newReIm}
+\ProcessKeyvalOptions*
+\ifphfqit at opt@newReIm
+  \renewcommand{\Re}{\phfqit at Realpart}
+  \renewcommand{\Im}{\phfqit at Imagpart}
+\fi
+\def\phfqit at tmp@str at none{none}
+\def\phfqit at tmp@str at stdset{stdset}
+\ifx\phfqit at opt@qitobjdef\phfqit at tmp@str at none%
+\else\ifx\phfqit at opt@qitobjdef\phfqit at tmp@str at stdset%
+\def\HH{\Hbase{\HSym}{}}
+\def\Hzero{\Hbase{\HSym}{\mathrm{max},0}}
+\def\Hmin{\Hbase{\HSym}{\mathrm{min}}}
+\def\Hmaxf{\Hbase{\HSym}{\mathrm{max}}}
+\def\Hfn{\Hfnbase{\HSym}{}{}}
+\let\Hfunc\Hfn% backwards compatibility
+\def\DD{\Dbase{\DSym}}
+\newcommand\Dminz[1][]{\Dbase{\DSym}_{\mathrm{min,0}}^{#1}}
+\newcommand\Dminf[1][]{\Dbase{\DSym}_{\mathrm{min}}^{#1}}
+\newcommand\Dmax[1][]{\Dbase{\DSym}_{\mathrm{max}}^{#1}}
+\newcommand\Dr[1][]{\Dbase{\DSym}_{\mathrm{r}}^{#1}}
+\newcommand\DHyp[1][\eta]{\Dbase{\DSym}_{\mathrm{H}}^{#1}}
+\DefineTunedQitObject{DCoh}{\DCohbaseParse}{\DCohbaseRender}{{\DCSym}}{}
+\DefineTunedQitObject{DCohx}{\DCohbaseParse}{\DCohbaseRender}%
+{{\DCSym}}{%
+  \let\DCohbaseStateSubscripts\DCohxStateSubscripts%
 }
+\else
+\PackageError{phfqit}{Invalid value `\phfqit at opt@qitobjdef' specified for
+  package option `qitobjdef'.  Please specify one of `stdset' (the default) or
+  `none'}{You specified an invalid value to the `qitobjdef' package option of
+  the `phfqit' package.}
+\fi
+\fi
 \endinput
 %%
 %% End of file `phfqit.sty'.



More information about the tex-live-commits mailing list