texlive[62739] branches/branch2021.final/Master/texmf-dist: altsubsup

commits+karl at tug.org commits+karl at tug.org
Wed Mar 16 22:00:53 CET 2022


Revision: 62739
          http://tug.org/svn/texlive?view=revision&revision=62739
Author:   karl
Date:     2022-03-16 22:00:52 +0100 (Wed, 16 Mar 2022)
Log Message:
-----------
altsubsup (16mar22) (branch)

Modified Paths:
--------------
    branches/branch2021.final/Master/texmf-dist/doc/latex/altsubsup/altsubsup.pdf
    branches/branch2021.final/Master/texmf-dist/source/latex/altsubsup/altsubsup.dtx
    branches/branch2021.final/Master/texmf-dist/tex/latex/altsubsup/altsubsup.sty

Modified: branches/branch2021.final/Master/texmf-dist/doc/latex/altsubsup/altsubsup.pdf
===================================================================
(Binary files differ)

Modified: branches/branch2021.final/Master/texmf-dist/source/latex/altsubsup/altsubsup.dtx
===================================================================
--- branches/branch2021.final/Master/texmf-dist/source/latex/altsubsup/altsubsup.dtx	2022-03-16 21:00:43 UTC (rev 62738)
+++ branches/branch2021.final/Master/texmf-dist/source/latex/altsubsup/altsubsup.dtx	2022-03-16 21:00:52 UTC (rev 62739)
@@ -25,15 +25,16 @@
 %<package> \NeedsTeXFormat{LaTeX2e}
 %<package> \ProvidesPackage{altsubsup}
 %<*package>
-[2022/01/23 v1.0 .dtx altsubsup file]
+[2022/03/15 v1.1 .dtx altsubsup file]
 %</package>
 %
 %<*driver>
 \documentclass{ltxdoc}
 \usepackage{altsubsup}
+\usepackage{spbmark}
 \usepackage[hidelinks]{hyperref}
 \usepackage{xcolor}
-\EnableCrossrefs         
+\EnableCrossrefs
 \CodelineIndex
 \RecordChanges
 % \OnlyDescription
@@ -45,7 +46,7 @@
 %</driver>
 % \fi
 %
-% \CheckSum{109}
+% \CheckSum{147}
 %
 % \CharacterTable
 % {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -64,7 +65,7 @@
 % Right brace   \}     Tilde         \~}
 %
 %
-% \changes{v1.0}{2022/01/23}{Initial version}
+% \changes{v1.0}{2022/01/23}{Initial version.}
 %
 % \GetFileInfo{altsubsup.dtx}
 %
@@ -92,84 +93,118 @@
 %     \begin{tabular}{ccc}
 %         |x_[roman]^{italic}|& $\longrightarrow$ & $x_[roman]^{italic}$ \\[6pt]
 %         |x_{italic}^[roman]|& $\longrightarrow$ & $x_{italic}^[roman]$
-%       \end{tabular}
-%     \end{center}
-%   \end{abstract}
+%     \end{tabular}
+%   \end{center}
+% \end{abstract}
 %
-%   \tableofcontents{}
-%   \clearpage
+% \tableofcontents{}
+% \clearpage
 %
-%   \section{Introduction}
+% \section{Introduction}
 %
-%   The \textsf{altsubsup} package allows to write alternate subscripts and
-%   superscripts, in math mode, with square brackets :
-%   \begin{center}
-%     |x_[my subscript]| \quad or \quad |x^[my superscript]|.
-%   \end{center}
-%   These alternate superscripts and superscripts are formatted by the commands
-%   set, respectively,  with |\SetAltSubscriptCommand| and
-%   |\SetAltSuperscriptCommand|. By default,  the |\text| command, from
-%   \textsf{amstext} (part of \textsf{amsmath}) is used. This gives:
-%   \begin{center}
-%     $x_[my subscript]$ \quad or \quad $x^[my superscript]$.
-%   \end{center}
+% The \textsf{altsubsup} package allows to write alternate subscripts and
+% superscripts, in math mode, with square brackets :
+% \begin{center}
+%   |x_[my subscript]| \quad or \quad |x^[my superscript]|.
+% \end{center}
+% These alternate superscripts and superscripts are formatted by the commands
+% set, respectively,  with |\SetAltSubscriptCommand| and
+% |\SetAltSuperscriptCommand|. By default,  the |\text| command, from
+% \textsf{amstext} (part of \textsf{amsmath}) is used. This gives:
+% \begin{center}
+%   $x_[my subscript]$ \quad or \quad $x^[my superscript]$.
+% \end{center}
 %
-%   This package redefine |_| and |^| symbols. Options allow to redefine both
-%   (by default), only subscript |_| symbol, or only superscript |^| symbol.
+% This package redefine |_| and |^| symbols. Options allow to redefine both
+% (by default), only subscript |_| symbol, or only superscript |^| symbol.
 %
-%   \section{Motivations}
+% \section{Motivations}
 %
-%   Common typographic conventions\footnotemark{} use italic (sloping) type for
-%   physical quantities or mathematical variables and roman (upright) type for
-%   words or fixed numbers. For example, heat capacity at constant pressure should
-%   be printed $C_P$, but kinetic energy $E_[k]$ (instead of $E_k$) and relative
-%   permeability $\mu_[r]$ (instead of $\mu_r$). This can be obtainted in \LaTeX{}
-%   with |E_{\mathrm{k}}| and |\mu_{\mathrm{r}}|. This package allows to write them
-%   simply |E_[k]| and |\mu_[r]|.
-%   \footnotetext{See, for example: International Organization for
-%   Standardization. (2009). \emph{Quantities and units -- Part 1: General} (ISO
-%   Standard No. 80000-1:2009).
-%   \href{https://www.iso.org/standard/30669.html}{https://www.iso.org/standard/30669.html}.}
+% Common typographic conventions\footnotemark{} use italic (sloping) type for
+% physical quantities or mathematical variables and roman (upright) type for
+% words or fixed numbers. For example, heat capacity at constant pressure should
+% be printed $C_P$, but kinetic energy $E_[k]$ (instead of $E_k$) and relative
+% permeability $\mu_[r]$ (instead of $\mu_r$). This can be obtainted in \LaTeX{}
+% with\footnotemark{} |E_{\mathrm{k}}| and |\mu_{\mathrm{r}}|. This package
+% allows to write them simply |E_[k]| and |\mu_[r]|.
+% \footnotetext{See, for example: International Organization for
+% Standardization. (2009). \emph{Quantities and units -- Part 1: General} (ISO
+% Standard No. 80000-1:2009).
+% \href{https://www.iso.org/standard/30669.html}{https://www.iso.org/standard/30669.html}.}
+% \footnotetext{Instead of \texttt{\textbackslash{}mathrm}, a best choice is
+% the \texttt{\textbackslash{}text} macro provided by \textsf{amsmath}
+% package, which, for example, handle spaces. It's the formatting macro used
+% by default by the \textsf{altsubsup} package.}
 %
-%   \section{Usage}
+% \section{User interface}
 %
-%   \DescribeMacro{\SetAltSubscriptCommand\marg{cmd}}
+% \subsection{Usage}
 %
-%   Set the command \meta{cmd} used to format square brackets subscripts
-%   |_[...]|. By default, \meta{cmd} is the |\text| command, provided by the
-%   \textsf{amstext} package (part of \textsf{amsmath} package).
+% \DescribeMacro{\SetAltSubscriptCommand\marg{cmd}}
 %
-%   \DescribeMacro{\SetAltSuperscriptCommand\marg{cmd}}
+% Set the command \meta{cmd} used to format square brackets subscripts
+% |_[...]|. By default, \meta{cmd} is the |\text| command, provided by the
+% \textsf{amstext} package (part of \textsf{amsmath} package).
 %
-%   Set the command \meta{cmd} used to format square brackets superscripts
-%   |^[...]|. By default, \meta{cmd} is the |\text| command, provided by the
-%   \textsf{amstext} package (part of \textsf{amsmath} package).
+% \DescribeMacro{\SetAltSuperscriptCommand\marg{cmd}}
 %
-%   \DescribeMacro{\SetAltSubSupCommands\marg{cmd}}
+% Set the command \meta{cmd} used to format square brackets superscripts
+% |^[...]|. By default, \meta{cmd} is the |\text| command, provided by the
+% \textsf{amstext} package (part of \textsf{amsmath} package).
 %
-%   Set both square brackets subscripts and square brackets superscripts, with the
-%   same command \meta{cmd}.
+% \DescribeMacro{\SetAltSubSupCommands\marg{cmd}}
 %
-%   \section{Options}
+% Set both square brackets subscripts and square brackets superscripts, with the
+% same command \meta{cmd}.
 %
-%   To load the package, add in your preamble:
-%   \begin{center}
-%     \begin{minipage}{0.7\linewidth}
-%       |\usepackage|\oarg{option}|{altsubsup}|
-%     \end{minipage}
-%   \end{center}
-%   Available values for \meta{option}:
-%   \begin{description}
-%    \item[|subscript|] redefine only the |_| subscript symbol.
-%    \item[|superscript|] redefine only the |^| superscript symbol.
-%    \item[|both|] redefine both |_| and |^| symbols (default).
-%   \end{description}
+% \pagebreak
+% \subsection{Options}
 %
-%   \section{Example}
+% To load the package, add in your preamble:
+% \begin{center}
+%   \begin{minipage}{0.7\linewidth}
+%     |\usepackage|\oarg{option}|{altsubsup}|
+%   \end{minipage}
+% \end{center}
+% Available values for \meta{option}:
+% \begin{description}
+%  \item[|subscript|] redefine only the |_| subscript symbol.
+%  \item[|superscript|] redefine only the |^| superscript symbol.
+%  \item[|both|] redefine both |_| and |^| symbols (default).
+%  \item[|spbmark|] use the \textsf{spbmark} package to handle bracket form of
+%  superscripts and superscripts (see below).
+% \end{description}
 %
-%   The following input:
-%   \begin{center}\begin{minipage}{0.7\linewidth}
+% \subsubsection*{\texttt{spbmark} option}
+%
+% The \textsf{spbmark} package
+% (\href{https://www.ctan.org/pkg/spbmark}{https://www.ctan.org/pkg/spbmark}),
+% by Qu Yi, allows a complete customisation of subscripts and superscripts.
+% With the |spbmark| option, the \textsf{altsubsup} package use the |\sub| and
+% |\super| macros of the \textsf{spbmark} package to handle subscripts and
+% superscripts in place of the standard |_| and |^| commands.
+%
+% Theses two macros are called with the respective |altsub| and |altsup| styles,
+% allowing simple customization (these styles are initially created empty).
+% For example, to display subscripts in blue and superscripts in red, use:
+% \begin{center}\begin{minipage}{0.7\linewidth}
 % \begin{verbatim}
+%   \defspbstyle{altsub}{cmd=\color{blue}}
+%   \defspbstyle{altsup}{cmd=\color{red}}
+% \end{verbatim}
+% \end{minipage}\end{center}
+%
+% A major limitation is that using simultaneously a subscript and a superscript gives
+% bad formatting (the \textsf{spbmark} macro for this is |\supersub|).
+% For example, |x_[sub]^[super]| gives $x\sub{\text{sub}}\super{\text{super}}$
+% instead of $x_[sub]^[super]$.
+%
+% \pagebreak
+% \section{Example}
+%
+% The following input:
+% \begin{center}\begin{minipage}{0.7\linewidth}
+% \begin{verbatim}
 % Default:
 % \begin{displaymath}
 %   x_a^b  \quad
@@ -204,10 +239,10 @@
 %   x_[brackets sub]^[brackets sup]
 % \end{displaymath}
 % \end{verbatim}
-%     \end{minipage}\end{center}
+% \end{minipage}\end{center}
 %
-%   gives:
-%   \begin{center}\begin{minipage}{0.7\linewidth}
+% gives:
+% \begin{center}\begin{minipage}{0.7\linewidth}
 % Default:
 % \begin{displaymath}
 %   x_a^b  \quad
@@ -239,43 +274,54 @@
 %   x_{braces sub}^[brackets sup]  \quad
 %   x_[brackets sub]^[brackets sup]
 % \end{displaymath}
-%     \end{minipage}\end{center}
+% \end{minipage}\end{center}
 %
-%   \section{Known issues}
+% \section{Complements}
 %
-%   The use of the prime symbol |'| can raise the \emph{Double superscript}
-%   error message. This is normally fixed (|x'^2| gives $x'^2$ correctly).
-%   If needed, enclose the expression with |{...}|. In particular, |x'^[sup]|
-%   doesn't work, and should be written: |{x'}^[sup]|.
+% \subsection{Known issue}
 %
-%   \section{Alternatives}
+% The use of the prime symbol |'| can raise the \emph{Double superscript}
+% error message. This is normally fixed (|x'^2| gives $x'^2$ correctly).
+% If needed, enclose the expression with |{...}|. In particular, |x'^[sup]|
+% doesn't work, and should be written: |{x'}^[sup]|.
 %
-%   Two other packages give similar functionalities:
-%   \begin{description}
-%    \item[the \textsf{subtext} package]
-%     (\href{https://www.ctan.org/pkg/subtext}{https://www.ctan.org/pkg/subtext}),
-%     by Palle J\o{}rgensen, formats |_[...]| subscripts with |\text| (the
-%     differences, is that the \textsf{altsubsup} package works both for
-%     subscripts and superscripts, allows to customise the commands, and
-%     redefine symbols only in math mode);
-%    \item[the \textsf{spbmark} package]
-%     (\href{https://www.ctan.org/pkg/spbmark}{https://www.ctan.org/pkg/spbmark}),
-%     by Qu Yi, allows a complete customisation of subscripts and superscripts.
-%   \end{description}
+% \subsection{Alternative}
 %
-%   \StopEventually{}
-%   \section{Implementation}
+% \begin{description}
+%  \item[the \textsf{subtext} package]
+%   (\href{https://www.ctan.org/pkg/subtext}{https://www.ctan.org/pkg/subtext}),
+%   by Palle J\o{}rgensen, formats |_[...]| subscripts with |\text| (the
+%   differences, is that the \textsf{altsubsup} package works both for
+%   subscripts and superscripts, allows to customise the commands, and
+%   redefine symbols only in math mode).
+% \end{description}
 %
-%   \subsection*{Package declaration}
+% \subsection{Changelog}
 %
+% \begin{description}
+%  \item[v1.1]
+% \begin{itemize}
+% \item Backup standard subscript |_| and superscript |^| commands to handle
+% packages that redefine |\sb| or |\sp| macros, as \textsf{spbmark}.
+% \item Add option |spbmark| to format subscripts and superscripts with the
+% \textsf{spbmark} package.
+% \end{itemize}
+%  \item[v1.0] Initial version.
+% \end{description}
+
+% \StopEventually{}
+% \section{Implementation}
+%
+% \subsection*{Package declaration}
+%
 %    \begin{macrocode}
-\ProvidesPackage{altsubsup}[2022/01/23, v1.0, Alternative and customisable
+\ProvidesPackage{altsubsup}[2022/03/15, v1.1, Alternative and customisable
 subscripts and superscripts, with  square brackets.]
 %    \end{macrocode}
 %
 % \subsection*{Flags declaration}
 %
-% Determine the commands that will be redefined.
+% \subsubsection*{Determine the commands that will be redefined}
 %
 %    \begin{macrocode}
 \newif\ifaltsbsp at subscript    \altsbsp at subscripttrue
@@ -282,20 +328,40 @@
 \newif\ifaltsbsp at superscript  \altsbsp at superscripttrue
 %    \end{macrocode}
 %
+% \subsubsection*{Use the spbmark mechanism}
+%
+%    \begin{macrocode}
+\newif\ifaltsbsp at spbmark      \altsbsp at spbmarkfalse
+%    \end{macrocode}
+%
 % \subsection*{Options declarations and processing}
 %
+% \changes{v1.1}{2022/03/15}{Add sbpmark option}
 %    \begin{macrocode}
 \DeclareOption{subscript}   {\altsbsp at subscripttrue   \altsbsp at superscriptfalse}
 \DeclareOption{superscript} {\altsbsp at subscriptfalse  \altsbsp at superscripttrue }
 \DeclareOption{both}        {\altsbsp at subscripttrue   \altsbsp at superscripttrue }
+\DeclareOption{spbmark}     {\altsbsp at spbmarktrue}
 \DeclareOption*{\PackageWarning{altsubsup}{Unknown option \CurrentOption.}}
 \ProcessOptions\relax
+\ifaltsbsp at spbmark
+  \RequirePackage{spbmark}
+\fi
 %    \end{macrocode}
 %
+% \subsection*{Backup standard superscript and subscript commands}
+%
+% \changes{v1.1}{2022/03/15}{Backup standard superscript and superscript commands}
+%
+%    \begin{macrocode}
+\AtBeginDocument{%
+  \begingroup\catcode`\_=8 \global\let\altsbsp at standardsub=_\endgroup
+  \begingroup\catcode`\^=7 \global\let\altsbsp at standardsup=^\endgroup
+%    \end{macrocode}
+%
 % \subsection*{Redefine catcodes and make symbols active in mathmode}
 %
 %    \begin{macrocode}
-\AtBeginDocument{%
   \ifaltsbsp at subscript    \catcode`\_=12 \mathcode`\_="8000 \fi%
   \ifaltsbsp at superscript  \catcode`\^=12 \mathcode`\^="8000 \fi%
 }
@@ -308,7 +374,7 @@
 \begingroup\lccode`\~=`\_\lowercase{\endgroup%
   \def~}{\@ifnextchar[% dummy bracket ]
   {\altsbsp at subwrapper}% bracket wrapper
-  {\sb}% standard form
+  {\altsbsp at standardsub}% standard form
 }%
 \fi
 %    \end{macrocode}
@@ -320,7 +386,7 @@
 \begingroup\lccode`\~=`\^\lowercase{\endgroup%
   \def~}{\@ifnextchar[% dummy bracket ]
   {\altsbsp at supwrapper}% bracket wrapper
-  {\sp}% standard form
+  {\altsbsp at standardsup}% standard form
 }%
 \fi
 %    \end{macrocode}
@@ -330,17 +396,33 @@
 % \begin{macro}{\SetAltSubscriptCommand}
 %    \begin{macrocode}
 \def\SetAltSubscriptCommand#1{\let\altsbsp at altsubcmd#1}%
-\def\altsbsp at subwrapper[#1]{\sb{\altsbsp at altsubcmd{#1}}}%
 %    \end{macrocode}
 % \end{macro}
 %
+%    \begin{macrocode}
+\ifaltsbsp at spbmark%
+  \defspbstyle{altsub}{}
+  \def\altsbsp at subwrapper[#1]{\sub[style=altsub]{\altsbsp at altsubcmd{#1}}}%
+\else
+  \def\altsbsp at subwrapper[#1]{\altsbsp at standardsub{\altsbsp at altsubcmd{#1}}}%
+\fi
+%    \end{macrocode}
+%
 % \begin{macro}{\SetAltSuperscriptCommand}
 %    \begin{macrocode}
 \def\SetAltSuperscriptCommand#1{\let\altsbsp at altsupcmd#1}%
-\def\altsbsp at supwrapper[#1]{\sp{\altsbsp at altsupcmd{#1}}}%
 %    \end{macrocode}
 % \end{macro}
 %
+%    \begin{macrocode}
+\ifaltsbsp at spbmark%
+  \defspbstyle{altsup}{}
+  \def\altsbsp at supwrapper[#1]{\super[style=altsup]{\altsbsp at altsupcmd{#1}}}%
+\else
+  \def\altsbsp at supwrapper[#1]{\altsbsp at standardsup{\altsbsp at altsupcmd{#1}}}%
+\fi
+%    \end{macrocode}
+%
 % \begin{macro}{\SetAltSubSupCommands}
 %    \begin{macrocode}
 \newcommand{\SetAltSubSupCommands}[1]{%

Modified: branches/branch2021.final/Master/texmf-dist/tex/latex/altsubsup/altsubsup.sty
===================================================================
--- branches/branch2021.final/Master/texmf-dist/tex/latex/altsubsup/altsubsup.sty	2022-03-16 21:00:43 UTC (rev 62738)
+++ branches/branch2021.final/Master/texmf-dist/tex/latex/altsubsup/altsubsup.sty	2022-03-16 21:00:52 UTC (rev 62739)
@@ -22,17 +22,25 @@
 %% 
  \NeedsTeXFormat{LaTeX2e}
  \ProvidesPackage{altsubsup}
-[2022/01/23 v1.0 .dtx altsubsup file]
-\ProvidesPackage{altsubsup}[2022/01/23, v1.0, Alternative and customisable
+[2022/03/15 v1.1 .dtx altsubsup file]
+
+\ProvidesPackage{altsubsup}[2022/03/15, v1.1, Alternative and customisable
 subscripts and superscripts, with  square brackets.]
 \newif\ifaltsbsp at subscript    \altsbsp at subscripttrue
 \newif\ifaltsbsp at superscript  \altsbsp at superscripttrue
+\newif\ifaltsbsp at spbmark      \altsbsp at spbmarkfalse
 \DeclareOption{subscript}   {\altsbsp at subscripttrue   \altsbsp at superscriptfalse}
 \DeclareOption{superscript} {\altsbsp at subscriptfalse  \altsbsp at superscripttrue }
 \DeclareOption{both}        {\altsbsp at subscripttrue   \altsbsp at superscripttrue }
+\DeclareOption{spbmark}     {\altsbsp at spbmarktrue}
 \DeclareOption*{\PackageWarning{altsubsup}{Unknown option \CurrentOption.}}
 \ProcessOptions\relax
+\ifaltsbsp at spbmark
+  \RequirePackage{spbmark}
+\fi
 \AtBeginDocument{%
+  \begingroup\catcode`\_=8 \global\let\altsbsp at standardsub=_\endgroup
+  \begingroup\catcode`\^=7 \global\let\altsbsp at standardsup=^\endgroup
   \ifaltsbsp at subscript    \catcode`\_=12 \mathcode`\_="8000 \fi%
   \ifaltsbsp at superscript  \catcode`\^=12 \mathcode`\^="8000 \fi%
 }
@@ -40,7 +48,7 @@
 \begingroup\lccode`\~=`\_\lowercase{\endgroup%
   \def~}{\@ifnextchar[% dummy bracket ]
   {\altsbsp at subwrapper}% bracket wrapper
-  {\sb}% standard form
+  {\altsbsp at standardsub}% standard form
 }%
 \fi
 \ifaltsbsp at superscript%
@@ -47,13 +55,23 @@
 \begingroup\lccode`\~=`\^\lowercase{\endgroup%
   \def~}{\@ifnextchar[% dummy bracket ]
   {\altsbsp at supwrapper}% bracket wrapper
-  {\sp}% standard form
+  {\altsbsp at standardsup}% standard form
 }%
 \fi
 \def\SetAltSubscriptCommand#1{\let\altsbsp at altsubcmd#1}%
-\def\altsbsp at subwrapper[#1]{\sb{\altsbsp at altsubcmd{#1}}}%
+\ifaltsbsp at spbmark%
+  \defspbstyle{altsub}{}
+  \def\altsbsp at subwrapper[#1]{\sub[style=altsub]{\altsbsp at altsubcmd{#1}}}%
+\else
+  \def\altsbsp at subwrapper[#1]{\altsbsp at standardsub{\altsbsp at altsubcmd{#1}}}%
+\fi
 \def\SetAltSuperscriptCommand#1{\let\altsbsp at altsupcmd#1}%
-\def\altsbsp at supwrapper[#1]{\sp{\altsbsp at altsupcmd{#1}}}%
+\ifaltsbsp at spbmark%
+  \defspbstyle{altsup}{}
+  \def\altsbsp at supwrapper[#1]{\super[style=altsup]{\altsbsp at altsupcmd{#1}}}%
+\else
+  \def\altsbsp at supwrapper[#1]{\altsbsp at standardsup{\altsbsp at altsupcmd{#1}}}%
+\fi
 \newcommand{\SetAltSubSupCommands}[1]{%
   \SetAltSubscriptCommand{#1}%
   \SetAltSuperscriptCommand{#1}%



More information about the tex-live-commits mailing list.