summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/contrib/recorder-fingering/README.md2
-rw-r--r--macros/latex/contrib/recorder-fingering/recorder-fingering.bib25
-rw-r--r--macros/latex/contrib/recorder-fingering/recorder-fingering.pdfbin95784 -> 108036 bytes
-rw-r--r--macros/latex/contrib/recorder-fingering/recorder-fingering.sty136
-rw-r--r--macros/latex/contrib/recorder-fingering/recorder-fingering.tex132
-rw-r--r--macros/latex/contrib/tensor/README.md (renamed from macros/latex/contrib/tensor/README)17
-rw-r--r--macros/latex/contrib/tensor/tensor-doc.pdfbin0 -> 414742 bytes
-rw-r--r--macros/latex/contrib/tensor/tensor.dtx359
-rw-r--r--macros/latex/contrib/tensor/tensor.ins58
-rw-r--r--macros/latex/contrib/tensor/tensor.pdfbin109791 -> 0 bytes
-rw-r--r--macros/latex/contrib/tensor/tensor.sty167
11 files changed, 554 insertions, 342 deletions
diff --git a/macros/latex/contrib/recorder-fingering/README.md b/macros/latex/contrib/recorder-fingering/README.md
index 1218ea95ef..bc23d7006f 100644
--- a/macros/latex/contrib/recorder-fingering/README.md
+++ b/macros/latex/contrib/recorder-fingering/README.md
@@ -1,6 +1,6 @@
# recorder-fingering
-Version 1.2 July 15, 2023
+Version 1.3 July 17, 2023
The `recorder-fingering` package provides support for generating fingering diagrams for baroque fingering recorders and the tin whistle. Standard fingerings are provided for recorders in both C and F, and the tin whistle in D, along with methods to create and display alternate fingerings for trills, etc.
diff --git a/macros/latex/contrib/recorder-fingering/recorder-fingering.bib b/macros/latex/contrib/recorder-fingering/recorder-fingering.bib
new file mode 100644
index 0000000000..53226bc94b
--- /dev/null
+++ b/macros/latex/contrib/recorder-fingering/recorder-fingering.bib
@@ -0,0 +1,25 @@
+
+@online{GreyLarsenWhistleFingerings,
+ title = {Resources for Tin Whistle and Irish Flute Players},
+ author = {Grey Larsen},
+ lastchecked = {2023-07-17},
+ month = {7},
+ url = {https://greylarsen.com/resources/resources-for-tin-whistle-and-irish-flute-players/},
+ year = {2023}}
+
+@online{BlockisRecorderFingerings,
+ author = {Übergabe, Blocki },
+ title = {Blockis recorder fingerings},
+ lastchecked = {2023-07-17},
+ month = {7},
+ url = {https://blockfloetengriffe.de/en/},
+ year = {2023}}
+
+@book{Wollitz1981,
+ address = {New York},
+ author = {Wollitz, Kenneth},
+ publisher = {Alfred A. Knopf},
+ title = {The Recorder Book},
+ year = {1981}}
+
+
diff --git a/macros/latex/contrib/recorder-fingering/recorder-fingering.pdf b/macros/latex/contrib/recorder-fingering/recorder-fingering.pdf
index 304f16d21a..c365b23947 100644
--- a/macros/latex/contrib/recorder-fingering/recorder-fingering.pdf
+++ b/macros/latex/contrib/recorder-fingering/recorder-fingering.pdf
Binary files differ
diff --git a/macros/latex/contrib/recorder-fingering/recorder-fingering.sty b/macros/latex/contrib/recorder-fingering/recorder-fingering.sty
index 728713545a..7827d48a64 100644
--- a/macros/latex/contrib/recorder-fingering/recorder-fingering.sty
+++ b/macros/latex/contrib/recorder-fingering/recorder-fingering.sty
@@ -26,9 +26,9 @@
%
% recorder-fingering.tex, recorder-fingering.pdf
%
-% Version 1.2 2023/07/15
+% Version 1.3 2023/07/17
\NeedsTeXFormat{LaTeX2e}[2022/11/01]
-\ProvidesPackage{recorder-fingering}[2023/07/15 v1.2 Recorder fingering diagrams]
+\ProvidesPackage{recorder-fingering}[2023/07/17 v1.3 Recorder fingering diagrams]
\RequirePackage{tikz}
\usetikzlibrary{calc}
\RequirePackage{graphicx}
@@ -78,6 +78,14 @@ nodes={anchor=center}
\prop_new:N \l_fingering_C_prop
\prop_new:N \l_fingering_D_prop
+% Set up property lists for trills
+\prop_new:N \l_fingering_trill_F_prop
+\prop_new:N \l_fingering_trill_C_prop
+\prop_new:N \l_fingering_trill_D_prop
+
+% Temporary property list for adding trills
+\prop_new:N \l_fingering_trills_prop
+
% Set up sharp/flat conversion list
\prop_new:N \l_fingering_F_sharp_flat_prop
\prop_new:N \l_fingering_C_sharp_flat_prop
@@ -371,8 +379,9 @@ nodes={anchor=center}
\NewDocumentCommand{\Alto}{O{}m}{
\group_begin:
\keys_set:nn {fingering} {#1}
- \prop_get:NnN \l_fingering_F_prop {#2} \l_tmpa_tl
- \fingering_generate_recorder_fingering:V \l_tmpa_tl
+ \prop_get:NnNTF \l_fingering_F_prop {#2} \l_tmpa_tl
+ {\fingering_generate_recorder_fingering:V \l_tmpa_tl}
+ {\msg_error:nn {recorder-fingering} {key-not-found}}
\group_end:
}
\cs_set_eq:NN \Sopranino \Alto
@@ -381,8 +390,9 @@ nodes={anchor=center}
\NewDocumentCommand{\Soprano}{O{}m}{
\group_begin:
\keys_set:nn {fingering} {#1}
- \prop_get:NnN \l_fingering_C_prop {#2} \l_tmpa_tl
- \fingering_generate_recorder_fingering:V \l_tmpa_tl
+ \prop_get:NnNTF \l_fingering_C_prop {#2} \l_tmpa_tl
+ {\fingering_generate_recorder_fingering:V \l_tmpa_tl}
+ {\msg_error:nn {recorder-fingering} {key-not-found}}
\group_end:
}
\cs_set_eq:NN \Tenor \Soprano
@@ -390,18 +400,48 @@ nodes={anchor=center}
\NewDocumentCommand{\Whistle}{O{}m}{
\group_begin:
\keys_set:nn {fingering} {#1}
- \prop_get:NnN \l_fingering_D_prop {#2} \l_tmpa_tl
- \fingering_generate_whistle_fingering:V \l_tmpa_tl
+ \prop_get:NnNTF \l_fingering_D_prop {#2} \l_tmpa_tl
+ {\fingering_generate_whistle_fingering:V \l_tmpa_tl}
+ {\msg_error:nn {recorder-fingering} {key-not-found}}
\group_end:
}
+% Trill version of the commands; this allows you to store trill holes
+% with a key name, so that the trill doesn’t have to be specified manually
+\NewDocumentCommand{\Ftrill}{m}{
+ \prop_get:NnNTF \l_fingering_trill_F_prop {#1} \l_tmpa_tl
+ {\group_begin:
+ \keys_set:nx {fingering} {trill={\l_tmpa_tl}}
+ \prop_get:NnN \l_fingering_F_prop {#1} \l_tmpb_tl
+ \fingering_generate_recorder_fingering:V \l_tmpb_tl
+ \group_end:}
+ {\msg_error:nn {recorder-fingering} {key-not-found}}
+}
+\NewDocumentCommand{\Ctrill}{m}{
+ \prop_get:NnNTF \l_fingering_trill_C_prop {#1} \l_tmpa_tl
+ {\group_begin:
+ \keys_set:nx {fingering} {trill={\l_tmpa_tl}}
+ \prop_get:NnN \l_fingering_C_prop {#1} \l_tmpb_tl
+ \fingering_generate_recorder_fingering:V \l_tmpb_tl
+ \group_end:}
+ {\msg_error:nn {recorder-fingering} {key-not-found}}
+}
+\NewDocumentCommand{\Dtrill}{m}{
+ \prop_get:NnNTF \l_fingering_trill_D_prop {#1} \l_tmpa_tl
+ {\group_begin:
+ \keys_set:nx {fingering} {trill={\l_tmpa_tl}}
+ \prop_get:NnN \l_fingering_D_prop {#1} \l_tmpb_tl
+ \fingering_generate_recorder_fingering:V \l_tmpb_tl
+ \group_end:}
+ {\msg_error:nn {recorder-fingering} {key-not-found}}
+}
% Now commands to add new fingerings:
% First, a note = { } version for multiple fingerings
% This command will override existing fingerings
\NewDocumentCommand{\AddFingerings}{mm}{
\str_case:nnTF {#1}{
- {F} {\prop_put_from_keyval:Nn \l_fingering_F_prop {#2}}
+ {F}{\prop_put_from_keyval:Nn \l_fingering_F_prop {#2}}
{C}{\prop_put_from_keyval:Nn \l_fingering_C_prop {#2}}
{D}{\prop_put_from_keyval:Nn \l_fingering_D_prop {#2}}
}
@@ -409,6 +449,52 @@ nodes={anchor=center}
{\msg_error:nn { recorder-fingering }{ wrong-instrument}}
}
+% Add trills version of the above command
+% Syntax is key = {{hole-list},{trill-list}}
+%
+% \AddTrills{C}{C#D={{1,1,1,0,1,1,1,0},{4,5}}}
+
+\NewDocumentCommand{\AddTrills}{mm}{
+ \prop_set_from_keyval:Nn \l_fingering_trills_prop {#2}
+ \str_case:nnTF {#1}{
+ {F}{\prop_map_function:NN \l_fingering_trills_prop \fingering_F_trill_copy:nn}
+ {C}{\prop_map_function:NN \l_fingering_trills_prop \fingering_C_trill_copy:nn}
+ {D}{\prop_map_function:NN \l_fingering_trills_prop \fingering_D_trill_copy:nn}
+ }
+ {}
+ {\msg_error:nn { recorder-fingering }{ wrong-instrument}}
+}
+
+% Trill copy functions
+\cs_new_protected:Nn \fingering_F_trill_copy:nn {
+ \clist_set:Nn \l_tmpa_clist {#2}
+ \clist_pop:NNTF \l_tmpa_clist \l_tmpa_tl
+ {\prop_put:Nnx \l_fingering_F_prop {#1}{\l_tmpa_tl}}
+ {\show\notfound}
+ \clist_pop:NNTF \l_tmpa_clist \l_tmpa_tl
+ {\prop_put:Nnx \l_fingering_trill_F_prop {#1}{\l_tmpa_tl}}
+ {\show\notfound}
+}
+
+\cs_new_protected:Nn \fingering_C_trill_copy:nn {
+ \clist_set:Nn \l_tmpa_clist {#2}
+ \clist_pop:NNTF \l_tmpa_clist \l_tmpa_tl
+ {\prop_put:Nnx \l_fingering_C_prop {#1}{\l_tmpa_tl}}
+ {\show\notfound}
+ \clist_pop:NNTF \l_tmpa_clist \l_tmpa_tl
+ {\prop_put:Nnx \l_fingering_trill_C_prop {#1}{\l_tmpa_tl}}
+ {\show\notfound}}
+
+\cs_new_protected:Nn \fingering_D_trill_copy:nn {
+ \clist_set:Nn \l_tmpa_clist {#2}
+ \clist_pop:NNTF \l_tmpa_clist \l_tmpa_tl
+ {\prop_put:Nnx \l_fingering_D_prop {#1}{\l_tmpa_tl}}
+ {\show\notfound}
+ \clist_pop:NNTF \l_tmpa_clist \l_tmpa_tl
+ {\prop_put:Nnx \l_fingering_trill_D_prop {#1}{\l_tmpa_tl}}
+ {\show\notfound}
+}
+
% Second individual fingerings for alto and soprano
% These commands will throw an error if the note is already defined
\NewDocumentCommand{\NewFfingering}{smm}{
@@ -434,6 +520,38 @@ nodes={anchor=center}
{\msg_error:nn { recorder-fingering } { key-exists }}
{\prop_put:Nnn \l_fingering_D_prop {#2} {#3}}
}}
+
+% Macros to add trill fingerings. This stores the trill keys as well so that they
+% can be automatically displayed
+
+\NewDocumentCommand{\NewFtrill}{smmm}{
+ \IfBooleanTF{#1}
+ {\prop_put:Nnn \l_fingering_F_prop {#2} {#3}
+ \prop_put:Nnn \l_fingering_trill_F_prop {#2} {#4}}
+ {\prop_get:NnNTF \l_fingering_F_prop {#2} \l_tmpa_tl
+ {\msg_error:nn { recorder-fingering } { key-exists }}
+ {\prop_put:Nnn \l_fingering_F_prop {#2} {#3}
+ \prop_put:Nnn \l_fingering_trill_F_prop {#2} {#4}}}
+}
+\NewDocumentCommand{\NewCtrill}{smmm}{
+ \IfBooleanTF{#1}
+ {\prop_put:Nnn \l_fingering_C_prop {#2} {#3}
+ \prop_put:Nnn \l_fingering_trill_C_prop {#2} {#4}}
+ {\prop_get:NnNTF \l_fingering_C_prop {#2} \l_tmpa_tl
+ {\msg_error:nn { recorder-fingering } { key-exists }}
+ {\prop_put:Nnn \l_fingering_C_prop {#2} {#3}
+ \prop_put:Nnn \l_fingering_trill_C_prop {#2} {#4}}}
+}
+\NewDocumentCommand{\NewDtrill}{smmm}{
+ \IfBooleanTF{#1}
+ {\prop_put:Nnn \l_fingering_D_prop {#2} {#3}
+ \prop_put:Nnn \l_fingering_trill_D_prop {#2} {#4}}
+ {\prop_get:NnNTF \l_fingering_D_prop {#2} \l_tmpa_tl
+ {\msg_error:nn { recorder-fingering } { key-exists }}
+ {\prop_put:Nnn \l_fingering_D_prop {#2} {#3}
+ \prop_put:Nnn \l_fingering_trill_D_prop {#2} {#4}}}
+}
+
% macros to copy fingerings (for now internal only)
\cs_new_protected:Nn \fingering_add_F_fingering:nn {\prop_put:Nnn \l_fingering_F_prop {#1} {#2}}
diff --git a/macros/latex/contrib/recorder-fingering/recorder-fingering.tex b/macros/latex/contrib/recorder-fingering/recorder-fingering.tex
index 486d6b0f81..99d0f4d89f 100644
--- a/macros/latex/contrib/recorder-fingering/recorder-fingering.tex
+++ b/macros/latex/contrib/recorder-fingering/recorder-fingering.tex
@@ -1,6 +1,6 @@
% !TEX TS-program = LuaLaTeXmk
-\documentclass[11pt]{article}
+\documentclass[11pt]{article}
\usepackage{calc}
\usepackage{fontspec}
\usepackage[lmargin=.75in,rmargin=.75in,tmargin=1in,bmargin=1in]{geometry}
@@ -12,19 +12,26 @@
\usepackage{url}
\usepackage[sf,small]{titlesec}
\usepackage[section]{placeins}
-\usepackage[colorlinks=true]{hyperref}
\setmonofont{Inconsolatazi4}
\usepackage{recorder-fingering}
\usepackage{parskip}
\usepackage{musixtex}
\input musixlyr
+% musixtex and biblatex clash
+\let\mxaddspace\addspace
+\let\addspace\relax
+\AtBeginEnvironment{music}{\let\addspace\mxaddspace}
+\usepackage[style=authoryear]{biblatex}
+\addbibresource{recorder-fingering.bib}
\usetikzlibrary{tikzmark}
\usetikzlibrary{positioning}
+\usepackage[colorlinks=true,citecolor=black]{hyperref}
+
\NewDocumentCommand{\addf}{m}{\tikz[remember picture]{\node[overlay,above=of pic cs:#1]{\Soprano{#1}};}}
\DefineShortVerb{\|}
\title{The \texttt{recorder-fingering} package}
\author{Alan Munn\\amunn@msu.edu}
-\date{Version 1.2\\July 15, 2023}
+\date{Version 1.3\\July 17, 2023}
\lstset{%
basicstyle=\ttfamily\small,
@@ -56,7 +63,7 @@ The |recorder-fingering| package provides support for generating fingering diagr
\section{Display commands}
-This package provides five recorder commands (|\Sopranino|, |\Soprano|, |\Alto|, |\Tenor|, and |\Bass|) and one tin whistle command (|\Whistle|).\footnote{Because \pkg{musixtex} defines commands \pkg{\bs alto} and \pkg{\bs bass} the fingering display commands are capitalized.} which will produce a fingering diagram for any note in the playable range of that recorder. At present, there are no differences between the three F recorders (sopranino, alto, and bass) and the two C recorders (soprano and tenor), so the different command names are simply there for convenience.
+This package provides five recorder commands (|\Sopranino|, |\Soprano|, |\Alto|, |\Tenor|, and |\Bass|) and one tin whistle command (|\Whistle|).\footnote{Because \pkg{musixtex} defines commands \pkg{\bs alto} and \pkg{\bs bass} the fingering display commands are capitalized.} which will produce a fingering diagram for any note in the playable range of that recorder. Additionally, a set of trill fingering commands are provided to make producing trill fingerings simpler. At present, there are no differences between the three F recorders (sopranino, alto, and bass) and the two C recorders (soprano and tenor), so the different command names are simply there for convenience. A set of dedicated trill fingering display commands is also provided. These are described in section \ref{trill-fingerings}.
\begin{table}[htpb]
@@ -68,6 +75,7 @@ This package provides five recorder commands (|\Sopranino|, |\Soprano|, |\Alto|,
\bs Alto [<parameters>]\{<note>\} & Display a fingering diagram for note in F\\
\bs Tenor [<parameters>]\{<note>\} & Display a fingering diagram for note in C\\
\bs Bass [<parameters>]\{<note>\} & Display a fingering diagram for note in F\\
+\bs Whistle [<parameters>]\{<note>\} & Display a tin whistle diagram (in D) \\
\bottomrule
\end{tabularx}
\caption{Display commands}
@@ -98,7 +106,7 @@ trill = \{<list of holes>\} & add a trill marker at each hole position in the li
\caption{Display options}
\end{table}
-The |width| parameter sets the width of the diagram; it defaults to |20pt| for the default thumb offset diagrams. If you set |thumboffset=false| you will probably want to choose a smaller value e.g. |10pt|. Since the tin whistle has no thumb position, its default is set to |7pt|.
+The |width| parameter sets the width of the diagram; it defaults to |20pt| for the default thumb offset diagrams. If you set |thumboffset=false| you will probably want to choose a smaller value e.g. |10pt|. Since the tin whistle has no thumb position, I recommend setting the |width| parameter for tin whistle diagrams to |7pt|.
The |trill| parameter sets an arrow pointing to a hole (numbered 1-7 from the top hole). This parameter is only in effect when using the display commands. It will place an arrow on the side specified by |trilldir| at a single hole or comma separated list of holes. e.g. |trill=3| sets an arrow at hole 3, |trill={6,7}| sets arrows at holes 6 and 7.
@@ -123,7 +131,7 @@ e.g. |\fingeringSetup{width=12pt,thumboffset=false}| makes all diagrams use an i
There are four commands to add new fingerings to the predefined list, or in fact, to change the existing defaults.
\subsection{Note names}
Although the basic predefined fingerings use the note naming schema outlined in section \ref{Notes}, the note names themselves are arbitrary. This allows you to add trill fingerings or alternate fingerings with meaningful names, e.g. |ftrill| or |altF| are possible names for new fingerings.
-\subsection{Fingering vectors}
+\subsection{Fingering vectors\label{fingering-vectors}}
Fingerings are specified using an 8 (and possibly 9) element comma separated list (7 for the tin whistle\footnote{Since I don’t play the tin whistle, I don’t know if there are any esoteric fingerings similar to those in the recorder that use the knee to close the bell hole. But in case they do exist, it’s possible to specify a 7th hole for D fingerings.}). For the recorders, each position in the list denotes a hole starting from the thumb (position 0) to the bell (position 8). For the tin whistle, each position in the list denotes a hole. Each hole position is indicated by a hole state according to the following scheme:
\begin{table}[htpb]
@@ -159,40 +167,108 @@ The fourth command is designed to enter a set of new fingerings at once. It will
\caption{Commands for adding new fingerings}
\end{table}
-\subsection{New fingering examples}
-\NewFfingering{BbAtrill}{0,1,1,1,1,1,0,0}
-\AddFingerings{C}{
- EFtrill = {0,1,1,1,1,1,0,0},
- altd = {0,1,1,1,1,1,2,2}
-}
+\section{Trill fingerings}
+Because trill fingerings are likely to be displayed with, rather than without, their trill annotations, a separate set of trill fingering macros is provided so that trill fingerings can be stored along with their trill annotations and produced without needing to add the trill annotation manually.
+
+\begin{table}[htpb]
+\centering
+\begin{tabularx}{.8\textwidth}{X}
+\toprule
+\texttt{\bs NewFtrill\{<notename>\}\{<fingering vector>\}\{<trill vector>\}} \\\rule{3em}{0pt}Add a new trill and fingering to the F recorder set\\
+\texttt{\bs NewCtrill\{<notename>\}\{<fingering vector>\}\{<trill vector>\}} \\\rule{3em}{0pt} Add a new trill and fingering to the C recorder set\\
+\texttt{\bs NewDtrill\{<notename>\}\{<fingering vector>\}\{<trill vector>\}} \\\rule{3em}{0pt} Add a new trill and fingering to the tin whistle set\\
+\texttt{\bs AddTrills\{<key>\}\{<note = \{\{<fingering vector>\}\},\{<trill vector>\}\}>\}} \\\rule{3em}{0pt} Add a set of new trills to the F, C or D instrument set\\
+\bottomrule
+\end{tabularx}
+\caption{Commands for adding new trill fingerings}
+\end{table}
+
+The three commands |\NewFtrill|, |\NewCtrill|, and |\NewDtrill| take two arguments: a fingering vector, and a trill vector. The fingering vector is the same as described in section \ref{fingering-vectors}. The trill vector indicates which holes will be annotated with trill arrows when displayed using one of the dedicated trill display macros.
+
+The fourth command takes two arguments: a key (F,C, or D) and a key value set of ordered pairs of vectors, a fingering vector and a trill vector.
+
+\subsection{Displaying trill fingerings\label{trill-fingerings}}
+Fingerings that are created using the trill fingering macros can be displayed along with their associated trill annotations using the commands |\Ftrill|, |\Ctrill|, and |\Dtrill|.
+
+\begin{table}[htpb]
+\centering
+\begin{tabularx}{.8\textwidth}{t{r}X}
+\toprule
+\bs Ftrill [<parameters>]\{<note>\} & Display a trill diagram for note in F\\
+\bs Ctrill [<parameters>]\{<note>\} & Display a trill diagram for note in C\\
+\bs Dtrill [<parameters>]\{<note>\} & Display a tin whistle trill diagram (in D) \\
+\bottomrule
+\end{tabularx}
+\caption{Trill display commands}
+\end{table}
+
+Note that the package does not come with any pre-coded trill fingerings, so these commands will not work unless you have added trill fingerings yourself.
+
+\clearpage
+\section{New fingering examples}
+Here are some examples of how to add new fingerings and trills.
+
\AddFingerings{F}{
- agtrill = {0,0,1,1,1,1,0,0}}
+altD = {1,0,1,1,1,1,0,0},
+altE = {1,0,1,1,0,0,0,0},
+altAb = {t,1,1,1,1,1,1,0}
+}
+\AddTrills{F}{
+BbA = {{0,1,1,1,1,1,0,0},{5}},
+C#D ={{1,1,1,0,1,1,1,0},{4,5}}
+}
+\NewCfingering{alte}{t,1,1,1,1,0,2,2}
+\NewCtrill{ef#}{t,1,1,1,0,1,0,0}{4}
+\NewCtrill{gab}{t,1,1,0,1,0,2,0}{6}
+
\begin{lstlisting}
-\NewFfingering{BbAtrill}{0,1,1,1,1,1,0,0}
-\Alto[trill=5]{BbAtrill}
+\AddFingerings{F}{
+altD = {1,0,1,1,1,1,0,0},
+altE = {1,0,1,1,0,0,0,0},
+altAb = {t,1,1,1,1,1,1,0}
+}
+\Alto{altD}\quad
+\Alto{altE}\quad
+\Alto{altAb}
\end{lstlisting}
-\Alto[trill=5]{BbAtrill}
+
+\Alto{altD}\quad
+\Alto{altE}\quad
+\Alto{altAb}
\begin{lstlisting}
-\AddFingerings{C}{
- EFtrill = {0,1,1,1,1,1,0,0},
- altd = {0,1,1,1,1,1,2,2}
-\AddFingerings{F}{
- agtrill = {0,0,1,1,1,1,0,0}
+\AddTrills{F}{
+BbA = {{0,1,1,1,1,1,0,0},{5}},
+C#D ={{1,1,1,0,1,1,1,0},{4,5}}
}
-\Soprano{EFtrill}
-\Soprano{altd}\hfil
-\Alto{agtrill}\hfil
+\Ftrill{BbA}\quad
+\Ftrill{C#D}\quad
\end{lstlisting}
-\Soprano{EFtrill}\hfil
-\Soprano{altd}\hfil
-\Alto{agtrill}
+\Ftrill{BbA}\quad
+\Ftrill{C#D}\quad
+
+\begin{lstlisting}
+\NewCfingering{alte}{t,1,1,1,1,0,2,2}
+\NewCtrill{ef#}{t,1,1,1,0,1,0,0}{4}
+\NewCtrill{gab}{t,1,1,0,1,0,2,0}{6}
+\Soprano{alte}\quad
+\Ctrill{ef#}\quad
+\Ctrill{gab}
+\end{lstlisting}
+\Soprano{alte}\quad
+\Ctrill{ef#}\quad
+\Ctrill{gab}
+\clearpage
\section{Version History}
-Version 0.5 of this package (the initial version) was in response to a \href{https://tex.stackexchange.com/q/674847/2693}{TeX.se question} and used a substantially different set of user commands. The current version (1.0) is more flexible and has a more useable user interface. Version 1.1 added support for trill annotation, and added a separation between the left and right hand holes. Version 1.2 added support for the tin whistle. Bug reports and feature requests are welcome at the \href{https://github.com/amunn/recorder-fingering/issues}{GitHub bug tracker}.
+Version 0.5 of this package (the initial version) was in response to a \href{https://tex.stackexchange.com/q/674847/2693}{TeX.se question} and used a substantially different set of user commands. The current version (1.x) is more flexible and has a more useable user interface. Version 1.1 added support for trill annotation, and added a separation between the left and right hand holes. Version 1.2 added support for the tin whistle. Version 1.3 added dedicated trill fingering commands. Bug reports and feature requests are welcome at the \href{https://github.com/amunn/recorder-fingering/issues}{GitHub bug tracker}.
\section{Acknowledgements}
This is my first attempt to write a package using |expl3|. Thanks to Jonathan P. Spratte for suggesting how to split fingering vectors and the various LaTeX development team members (David Carlisle, Ulrike Fischer, Phelype Olenik and Joseph Wright) who have answered random |expl3| questions in the TeX.se chat. Thanks to Bob Tennent, whose suggestions resulted in version 1.1. Thanks also to all the TeX.se users who have both asked and answered questions on the site. Your questions encourage new packages like this one and your answers help make the code better. Thanks to Charles-Albert Lehalle for the suggestion to add the tin whistle.
+\section{Sources}
+The core fingerings for recorders are taken from \textcite{Wollitz1981}. The core fingerings for the tin whistle are taken from \textcite{GreyLarsenWhistleFingerings}. The sample recorder trill fingerings are from \textcite{BlockisRecorderFingerings}.
+
+\printbibliography[heading=none]
\clearpage
\section{Samples} The charts below shows all of the defaults fingerings for the C recorders and the tin whistle.\footnote{Since the top row of the table represents the input name, \pkg{b} and \pkg{\#} are used instead the proper symbols \flat\ and \sharp.}
diff --git a/macros/latex/contrib/tensor/README b/macros/latex/contrib/tensor/README.md
index 69bb4f27ad..368b8681ce 100644
--- a/macros/latex/contrib/tensor/README
+++ b/macros/latex/contrib/tensor/README.md
@@ -1,11 +1,13 @@
--------------------------------------------------------
- | tensor: a package to typeset objects with mixed |
- | upper, lower and preposed indices |
+ | tensor: a package for typesetting objects with |
+ | mixed upper, lower and preposed indices |
| (including nuclides) |
| |
- | Philip G. Ratcliffe - version 2.1 (2004/12/20) |
+ | Philip G. Ratcliffe - version 2.2 (2023/07/18) |
--------------------------------------------------------
+* LaTeX tensor.ins to produce tensor.sty
+
* Copy tensor.sty to one of your TeX input directories.
* LaTeX tensor.dtx for usage instructions and documentation.
@@ -28,9 +30,12 @@ Piff). A new text-mode command, \nuclide, to typeset nuclides is also defined.
Change history:
-v2.1 corrected problem with 'color' package, added dotting capability, added
-starred form of \indices, minor spacing and LaTeX code improvements.
+v2.2 corrected problem with the 'underscore' package, added vertical alignment
+capability and independent mass/atomic-no. font control.
+
+v2.1 corrected problem with the 'color' package, added dotting capability,
+added starred form of \indices, minor spacing and LaTeX code improvements.
v2.0 first official release of extended version.
-v1.0 last official release of original version.
+v1.0 last official release of original version.
diff --git a/macros/latex/contrib/tensor/tensor-doc.pdf b/macros/latex/contrib/tensor/tensor-doc.pdf
new file mode 100644
index 0000000000..5fd342e4c5
--- /dev/null
+++ b/macros/latex/contrib/tensor/tensor-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/tensor/tensor.dtx b/macros/latex/contrib/tensor/tensor.dtx
index edbf571b56..0bdad9e620 100644
--- a/macros/latex/contrib/tensor/tensor.dtx
+++ b/macros/latex/contrib/tensor/tensor.dtx
@@ -1,16 +1,24 @@
% \iffalse meta-comment
%
-% Copyright (C) 2004 by Philip G. Ratcliffe <philip.ratcliffe@uninsubria.it>
+%% File: tensor.dtx
+%%
+% Copyright (C) 2023 Philip G. Ratcliffe <philip.ratcliffe@uninsubria.it>
%
-% This file may be distributed and/or modified under the conditions of
-% the LaTeX Project Public License, either version 1.2 of this license
-% or (at your option) any later version. The latest version of this
-% license is in:
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version. The latest version
+% of this license is in the file
%
% http://www.latex-project.org/lppl.txt
%
-% and version 1.2 or later is part of all distributions of LaTeX
-% version 1999/12/01 or later.
+% This file is part of the "tensor package" (the Work in LPPL)
+% and all files in that package must be distributed together.
+%
+% The released version of this package is available from CTAN.
+%
+% This package has the LPPL maintenance status "maintained".
+%
+% The current maintainer of this package is Philip G. Ratcliffe.
%
% \fi
%
@@ -18,19 +26,21 @@
%
%<package>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%<package>\ProvidesPackage{tensor}
-%<package> [2004/12/20 v2.1 tensor indices package (PGR)]
+%<package> [2023/07/18 v2.2 tensor indices package (PGR)]
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{tensor}
-\providecommand\DescribeOther[1]{%
- \leavevmode
- \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
- \index{#1|usage}%
-}
+\NewDocElement[macrolike=false]{Argument}{argument}
+\NewDocElement[macrolike=false]{Option}{option}
+%
\CodelineIndex
\EnableCrossrefs
\RecordChanges
+\DoNotIndex{\let,\def,\gdef,\newcommand,\renewcommand}
+\DoNotIndex{\if,\else,\fi,\ifx,\fi,\iffalse,\fi,\iftrue,\fi}
+\DoNotIndex{\@empty,\expandafter,\makebox,\relax,\string,\the,\z@}
+\DoNotIndex{\MessageBreak,\on@line}
%
\begin{document}
\DocInput{tensor.dtx}
@@ -38,7 +48,7 @@
%</driver>
% \fi
%
-% \CheckSum{269}
+% \CheckSum{342}
%
% \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
@@ -59,32 +69,31 @@
%
% \changes{v1.0}{1996/06/03}{original version}
% \changes{v2.0}{2004/04/01}{extended \cs{tensor}, added \cs{indices} and
-% \cs{nuclide}, substituted \cs{DeclareRobustCommand} for \cs{newcommand} in
+% \cs{nuclide}, substituted \cs{newcommand} with \cs{DeclareRobustCommand} in
% user commands, documented and packaged}
%
% \GetFileInfo{tensor.sty}
%
% \DoNotIndex{\CodelineIndex,\EnableCrossrefs,\RecordChanges}
%
-% \title{
+% \title{%
% The \textsf{tensor}\relax
-% \thanks{
-% This file has version number \fileversion, and revision date \filedate.}
-% \thanks{
+% \,\thanks{%
% Based on and extending the original package of the same name by Mike Piff
% (1996/06/03).}
% \space
% package for \LaTeX2e
% }
-% \author{
-% Philip G. Ratcliffe\thanks{E-mail: \textsf{philip.ratcliffe@uninsubria.it}}
+% \author{%
+% Philip G. Ratcliffe\relax
+% \,\thanks{E-mail: \textsf{philip.ratcliffe@uninsubria.it}}
% \\
-% Dipartimento di Fisica e Matematica
+% Dipartimento di Scienza e Alta Tecnologia
% \\
-% Universit\`{a} degli Studi dell'Insubria---Como
+% Universit\`a degli Studi dell'Insubria---Como
% }
%
-% \date{}
+% \date{(\fileversion, last revision \filedate)}
%
% \maketitle
%
@@ -93,24 +102,24 @@
% package; it defines two commands for typesetting tensors with mixed upper and
% lower indices in which the correct horizontal spacing must be observed.
% Various forms of alignment are available and spaces may be replaced by dots
-% or other symbols. Correct preposing of indices is now made possible while
+% or other symbols. Consistent preposing of indices is now made possible while
% backwards compatibility is maintained. A special-purpose command to typeset
% nuclides is also defined.
% \end{abstract}
%
% \section{Introduction}
%
-% The use of tensors with mixed upper and lower indices, in which the relative
-% horizontal positions and spacing are significant, is common in both
-% physics and mathematics; for example,
+% It is common in both physics and mathematics to use tensors with mixed upper
+% and lower indices in which the relative horizontal positions and spacing are
+% significant, for example
% \begin{displaymath}
% \Gamma\indices{^\mu_{\nu\rho}},\quad R\indices{^\mu_\nu^\rho_\sigma}
% \quad\mathrm{or}\quad
% \epsilon\indices{^\mu^\nu^\rho_\sigma}.
% \end{displaymath}
-% The commands defined in this package automatically maintain the correct
-% horizontal positioning. Another common need addressed by this
-% package is the preposing of upper and lower indices, as in
+% The macros defined in this package automatically maintain consistent
+% horizontal positioning. Another common need addressed is the
+% preposing of upper and lower indices, as in
% \begin{displaymath}
% \tensor
% [_{\rm H}]
@@ -121,18 +130,20 @@
% \end{displaymath}
% Note the correct spacing of the pre-index H in the above example. It should
% also be noted that constant vertical positioning is maintained for lone
-% indices; consider the following (examine carefully the last lower index $o$):
+% indices; consider the following (examine carefully the last lower index $o$
+% on the right):
% \begin{displaymath}
% {\rm M}\indices*{^o_o} \vert \tensor[_o]{{\rm M}}{}
% \quad\mbox{\emph{cf.}}\quad
% {\rm M}^o_o \vert _o{\rm M},
% \end{displaymath}
-% where the former group was typeset using \cs{indices} but the latter not.
+% where the former group was typeset using \cs{indices}, the latter using `|_|'
+% and `|^|'.
%
% \section{Usage}
%
% Two robust math-mode commands, \cs{tensor} and \cs{indices}, are defined (the
-% first of which remains backward compatible with Mike Piff's original
+% first of which remains backwards compatible with Mike Piff's original
% definition). A new, robust text- and math-mode command, \cs{nuclide}, is also
% defined specifically for typesetting nuclides, as in the above example.
%
@@ -141,36 +152,39 @@
% \DescribeMacro{\indices}
% To produce a mathematical expression (typically a tensor) with mixed upper
% and lower indices, simply enter
-% \meta{object}|\indices{|\relax
-% |^|\meta{sup$_{\,1}$}|_|\meta{sub$_{\,1}$}\relax
-% |^|\meta{sup$_{\,2}$}|_|\meta{sub$_{\,2}$}\relax
+% \meta{object}|\indices{|%
+% |^|\meta{sup$_{\,1}$}|_|\meta{sub$_{\,1}$}%
+% |^|\meta{sup$_{\,2}$}|_|\meta{sub$_{\,2}$}%
% \dots|}|.
-% Thus, in math mode it is sufficient to type, \emph{e.g.},
+% Thus, in math mode it is sufficient to type \emph{e.g.}
% \begin{center}
% |M\indices{^a_b^{cd}_e}|\quad to obtain\quad
% $M\indices{^a_b^{cd}_e}$.
% \end{center}
%
% \DescribeMacro{\tensor}
-% This variant has been retained in a backward compatible form and considerably
-% extended; the syntax for the previous expression is |\tensor{M}{^a_b^{cd}_e}|
-% while the resulting output is identical. The extended form of \cs{tensor} now
-% defined has an optional argument for indices to be placed \emph{before} the
-% tensor, thus:
+% This variant has been retained in a completely backwards compatible form
+% while also being considerably extended; the syntax for the previous
+% expression is |\tensor{M}{^a_b^{cd}_e}|, for which the resulting output is
+% identical. The extended form of \cs{tensor} defined here has an optional
+% argument for indices to be placed \emph{before} the tensor, thus:
% \begin{center}
-% |\tensor[^a_b^c_d]{M}{^a_b^c_d}|\quad produces\quad
-% $\tensor[^a_b^c_d]{M}{^a_b^c_d}$
+% |\tensor[^a_b^c_d]{M}{^e_f^g_h}|\quad produces\quad
+% $\tensor[^a_b^c_d]{M}{^e_f^g_h}$.
% \end{center}
% A fairly robust (if somewhat crude) attempt is made to ensure the correct
% spacing and skew of the preposed indices with respect to the tensor object
% itself.
%
+% Note that also \cs{sb} and \cs{sp} may be used in place of `|_|' and `|^|'
+% respectively for both the above macros.
+%
% \DescribeMacro{\indices*}
% \DescribeMacro{\tensor*}
-% The two commands have starred forms, which collapse the spacing (\emph{i.e.},
+% These two macros have starred forms, which collapse the spacing (\emph{i.e.}
% return to standard form). While \cs{indices*} is clearly redundant (and is
% included merely for symmetry), \cs{tensor*} also \emph{right} justifies the
-% \emph{pre}-index strings, so that, \emph{e.g.}, nuclides may be typeset as
+% \emph{pre}-index strings, so that \emph{e.g.} nuclides may be typeset as
% follows (though see below for a purpose-built command):
% \begin{center}
% |\tensor*[^{14}_6]{\mathrm{C}}{}|\quad produces\quad
@@ -187,8 +201,8 @@
% \end{center}
% The output appears identical to that of |\sideset{_*^*}{_*^*}{\prod}|.
%
-% \DescribeOther{* argument}
-% The \cs{indices*} and \cs{tensor*} forms \emph{only}, allow a |*| to also be
+% \DescribeArgument{*}
+% The \cs{indices*} and \cs{tensor*} forms \emph{alone}, allow a |*| to also be
% placed as the first entry in either index-list argument, causing alignment
% (\emph{left} justification) of the successive pairs of upper and lower
% indices. A warning is issued if a |*| appears in an argument string of either
@@ -216,10 +230,11 @@
% after which,\hspace*{\stretch{2}}
% \\
% |\tensor{M}{^a_b^c_d}|
-% \\[2ex]
-% produces\hspace{\stretch{2}}
+% \\[1ex]
+% produces\hspace*{\stretch{2}}\null
+% \\
% $\renewcommand\indexmarker{\cdot}\tensor{M}{^a_b^c_d}$\quad instead of\quad
-% $\tensor{M}{^a_b^c_d}$ \hspace*{3.5em}\hspace*{\stretch{2}}
+% $\tensor{M}{^a_b^c_d}$\,.
% \end{center}
%
% \DescribeMacro{\nuclide}
@@ -236,51 +251,125 @@
% is a little more space (|1mu|) between the numbers and the chemical symbol
% than appears in the example constructed manually with \cs{tensor*}.
%
-% All the above-defined commands may be used recursively, \emph{i.e.}, a
+% All the above-defined commands may be used recursively, \emph{i.e.} a
% \cs{tensor} may occur as an index to another \cs{tensor} and should behave
-% according to the current superscript--subscript level. Where useful, user
-% commands are defined as `robust'; thus, they may appear as arguments to
-% \cs{caption}, \cs{section} \emph{etc}.
+% according to the current superscript--subscript level. The user commands are
+% defined here as `robust'; they may thus appear as so-called moving arguments,
+% \emph{i.e.} to \cs{caption}, \cs{section} \emph{etc}.
%
% \DescribeMacro{\nuclideFont}
-% By default, the font for \cs{nuclide} is \cs{mathrm}, but \cs{nuclideFont}
-% may be reset with \cs{renewcommand} to \cs{mathsf}, \cs{mathbf}, \cs{mathtt}
-% \emph{etc}., or simply \cs{relax} (this last has the chemical symbol font
-% default to \cs{mathit} for correct spacing).
+% \DescribeMacro{\massnumFont}
+% By default, the fonts used in \cs{nuclide} for the chemical symbol, mass and
+% atomic numbers are \cs{mathrm}; \emph{i}.\emph{e}., \cs{nuclideFont} (for the
+% chemical symbol) is initially defined as \cs{mathrm} and \cs{massnumFont}
+% (for the mass/atomic numbers) as \cs{nuclideFont} (for backwards
+% compatibility). This then now allows for independent font variation of the
+% chemical symbol and mass/atomic numbers. Both macros may be reset with
+% \cs{renewcommand} to \cs{mathsf}, \cs{mathbf}, \cs{mathtt} \emph{etc}., or
+% simply \cs{relax} (this last for \cs{nuclideFont} has the chemical symbol
+% font default to \cs{mathit} for correct spacing, while for \cs{massnumFont}
+% the mass and atomic numbers revert to standard math font).
+%
+% \subsection{Package options}
+%
+% As of v2.2, the package includes four options relating to the vertical
+% alignment of indices. \LaTeX's behaviour in this regard is not always optimal
+% or what the user may desire. Consider the following output (constructed using
+% `|_|' and `|^|'.):
+% \begin{displaymath}
+% \epsilon\indices{^\mu_\rho^\nu_{\tilde\lambda}} \;
+% g\indices{^\mu^\nu} \,.
+% \end{displaymath}
+% While the indices within each single mathematical object are mutually
+% vertically aligned correctly, between separate objects they may not be. This
+% is because \LaTeX\ sets the baseline according to the height and depth of the
+% given indices on a per-object basis. To obviate such behaviour, this package
+% takes the simplest route of using \cs{smash} to hide the height and depth of
+% each superscript and subscript string so that they are always set with the
+% same baselines. This naturally leads to a somewhat cramped form (superscripts
+% are set a little too low and subscripts high) and so a specially defined
+% \cs{strut} is included, which slightly raises superscripts and lowers
+% subscripts; by default, this is only implemented in displayed math, as the
+% impact on inline text may be too disruptive.
+%
+% \DescribeOption{align}
+% \DescribeOption{text}
+% \DescribeOption{nosmash}
+% \DescribeOption{nostrut}
+% The options thus introduced are |align|, |text|, |nosmash| and |nostrut|. The
+% first implements both \cs{smash} and a \cs{strut} as outlined above, with
+% |text| extending the implementation of the \cs{strut} to inline text, while
+% |nosmash| and |nostrut| cancel the single effects (using both entirely
+% negates |align|). Option ordering is irrelevant and the last three are
+% inoperative without the first.
+%
+% The desired effects are implemented via two internal commands, which may also
+% be redefined by the user.
+% \DescribeMacro{\tensorSmash}
+% The first, \cs{tensorSmash}, is set equal to \cs{smash}, which then takes each
+% index string as an argument.
+% \DescribeMacro{\tensorStrut}
+% The second, \cs{tensorStrut}, is set equal to the height of `|l|' and depth
+% of `|j|' in the relevant font, (by default though only inside displayed math
+% environments) and is appended to each \cs{smash}'ed index string.
%
% \subsection{Caveats}
%
-% Grouping of multi-token indices should be performed as normal (\emph{i.e.},
+% Grouping of multi-token indices should be performed as normal (\emph{i.e.}
% via enclosure within a brace pair |{|\,|}|). Moreover, owing to the method by
% which index strings are parsed, any index constructs such as |\mathrm{H}|
% must also be entirely enclosed in braces, thus: |\indices{_{\mathrm{H}}^x}|.
%
-% Spacing is not guaranteed to always appear absolutely perfect, especially
-% between \emph{pre}-pended indices and the tensor object itself. Please also
-% recall, however, that screen viewing often distorts small spaces owing to
-% resolution effects.
+% Spacing is not guaranteed to always appear optimal, especially when between
+% \emph{pre}-pended indices and the tensor object itself. Recall too that
+% screen viewing often distorts small spaces owing to resolution effects.
%
% \subsection{External package requirements}
%
-% No external packages are required.
+% No external packages are required or called.
%
% \subsection{Package conflicts}
%
-% There are no known conflicts with any standard \LaTeX2e\ packages (a problem
-% with the |color| package in the first version has now been corrected).
-% However, there is obvious incompatibility with the similar |tensind| package.
+% There are few conflicts with standard \LaTeX2e\ packages; a problem with the
+% |color| package in the first version has now been corrected, as too a
+% recently flagged problem with the |underscore| package.
+%
+% However, the macros defined here fail as arguments of \cs{bm} from the |bm|
+% package (due to parsing conflicts) or, consequently, of macros defined by the
+% \cs{maybebm} package. A work around for, say, a chapter or section header is
+% \begin{center}
+% |{\let\nuclideFont\maybebm \nuclide[4][2]{\textup{He}}}|,
+% \end{center}
+% which should render \nuclide[\mathbf4][\mathbf2]{\textbf{He}} in the header,
+% but \nuclide[4][2]{\textup{He}} in the contents listing.
%
% \StopEventually{\PrintChanges\PrintIndex}
%
% \section{Implementation}
%
+% \subsection{User options}
+%
+% First, the package options with their related \cs{if}\dots\ conditionals are
+% defined and processed.
+% \begin{macrocode}
+\newif\iftnsr@Aln
+\DeclareOption{align}{\tnsr@Alntrue}
+\newif\iftnsr@Txt
+\DeclareOption{text}{\tnsr@Txttrue}
+\newif\iftnsr@Sma \tnsr@Smatrue
+\DeclareOption{nosmash}{\tnsr@Smafalse}
+\newif\iftnsr@Str \tnsr@Strtrue
+\DeclareOption{nostrut}{\tnsr@Strfalse}
+\ProcessOptions
+% \end{macrocode}
+%
% \subsection{User commands}
%
-% The |tensor| package now defines three basic user commands:
+% The |tensor| package defines three basic user commands:
% \begin{macro}{\tensor}
% The first takes three possible arguments (an optional index string to be
% \emph{preposed}, the tensor object, the index string) and also has a starred
-% form, which suppresses spacing (it is backward compatible with Mike Piff's
+% form, which suppresses spacing (it is backwards compatible with Mike Piff's
% original version).
% \begin{macrocode}
\DeclareRobustCommand\tensor{%
@@ -290,10 +379,10 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}{\indices}
-% The second command is a ``lightweight'' form, which is placed immediately
+% The second is a `\emph{lightweight}' form, which is placed immediately
% \emph{following} the tensor object, takes just one argument (the index
-% string) and also has a starred form (this command was \emph{not} present in
-% the original package).
+% string) and also has a starred form (this form was \emph{not} however present
+% in the original package).
% \changes{v2.1}{2004/12/20}{added starred form, for symmetry with
% \cs{tensor*}}
% \begin{macrocode}
@@ -307,7 +396,7 @@
% \begin{macro}{\nuclide}
% This additional new command takes one direct argument (an optional mass
% number) and two indirect arguments (an optional atomic number, the chemical
-% symbol---these last two are handled by auxiliary macros). Since usage is
+% symbol---these last two are handled by an auxiliary macro). Since usage is
% common in text, math mode is ensured.
% \begin{macrocode}
\DeclareRobustCommand\nuclide[1][]{%
@@ -318,14 +407,18 @@
% \end{macro}
%
% \begin{macro}{\nuclideFont}
-% This sets the font for \cs{nuclide} (the default is \cs{mathrm}); it may be
-% redefined as, \emph{e.g.}, \cs{mathsf}, \cs{mathbf}, \cs{mathtt}, \cs{mathit}
-% \emph{etc}., or even simply \cs{relax} (this last has the chemical symbol
-% font default to \cs{mathit} for correct spacing).
+% \begin{macro}{\massnumFont}
+% These set the fonts for \cs{nuclide}; the defaults are \cs{mathrm} for both
+% \cs{nuclideFont} and \cs{massnumFont}. They may be redefined as \emph{e.g.}
+% \changes{v2.2}{2023/07/18}{added independent mass/atomic-no.\ font control}
+% \cs{mathsf}, \cs{mathbf}, \cs{mathtt}, \cs{mathit} \emph{etc}., or even
+% simply \cs{relax} or \cs{renewcommand}\cs{nuclideFont}|{}|.
% \begin{macrocode}
\newcommand\nuclideFont{\mathrm}
+\newcommand\massnumFont{\nuclideFont}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \subsection{Internal token registers}
%
@@ -365,15 +458,18 @@
% \subsection{Internal macros}
%
% \begin{macro}{\tnsr@Prp}
+% \begin{macro}{\tnsr@Wrn}
% Here we simply reset token registers and the warning macro before commencing.
% \begin{macrocode}
+\newcommand\tnsr@Wrn{}
\newcommand\tnsr@Prp{%
\tnsr@Sps{}%
\tnsr@Sbs{}%
- \let\tnsr@Wrn\relax
+ \def\tnsr@Wrn{}
}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\ndcs@Aux}
% This (lightweight) auxiliary macro for \cs{indices} takes one argument (an
@@ -381,7 +477,8 @@
% warnings.
% \begin{macrocode}
\newcommand\ndcs@Aux[1]{%
- \def\tnsr@Obj{}
+ \tnsr@Erx
+ \def\tnsr@Obj{}%
\tnsr@Set{#1}%
\tnsr@Fin
\tnsr@Wrn
@@ -395,6 +492,7 @@
% passes everything via \cs{mathpalette} to \cs{tnsr@Plt}.
% \begin{macrocode}
\newcommand\tnsr@Aux[3][]{%
+ \tnsr@Erx
\mathpalette{\tnsr@Plt{#1}{#3}}{#2}%
\tnsr@Wrn
}
@@ -407,9 +505,9 @@
% \cs{tnsr@Set} separately for both pre- and post-index strings.
% \begin{macrocode}
\newcommand\tnsr@Plt[4]{%
- \def\tnsr@Obj{#3#4}
- \def\reserved@a{#1}%
- \ifx\reserved@a\@empty\else
+ \def\tnsr@Obj{#3#4}%
+ \def\tnsr@Tmp{#1}%
+ \ifx\tnsr@Tmp\@empty\else
\tnsr@Set{#1}%
\hphantom{{}\tnsr@Fin}%
\tnsr@Sps\expandafter{%
@@ -438,7 +536,7 @@
% \begin{macro}{\tnsr@Krn}
% This has one argument (a processed index string) and inserts the necessary
% offsets.
-% \changes{v2.1}{2004/12/20}{altered spacing slightly}
+% \changes{v2.1}{2004/12/20}{slightly altered spacing}
% \begin{macrocode}
\newcommand\tnsr@Krn[1]{%
\settowidth\@tempdima{$\m@th\tnsr@Obj^{#1}\mkern-1mu$}%
@@ -453,17 +551,19 @@
% \begin{macro}{\tnsr@Pro}
% This is the index-string processing macro, it takes one argument (an index
% string):
+% \changes{v2.2}{2023/07/18}{substituted \cs{ifx} with \cs{if} to avoid
+% \textsf{underscore} package conflict}
% \begin{macrocode}
\newcommand\tnsr@Pro[1]{%
\ifx#1\tnsr@Err
\let\tnsr@Nxt\relax
\else
- \ifx#1*
+ \if#1*
\iftnsr@Spc
\gdef\tnsr@Wrn{%
\PackageWarning{tensor}{%
- `*' not allowed in argument here, I am ignoring it,%
- \MessageBreak remove it or use `\string\tensor*',%
+ '*' not allowed in argument here; I shall ignore it.%
+ \MessageBreak Either remove it or use '\string\tensor*'%
}%
}%
\else
@@ -471,10 +571,10 @@
\fi
\let\tnsr@Nxt\tnsr@Pro
\else
- \ifx#1^
+ \if#1^
\def\tnsr@Nxt{\tnsr@Add{\tnsr@Sps}{\tnsr@Sbs}{\tnsr@Spe}}%
\else
- \ifx#1_
+ \if#1_
\def\tnsr@Nxt{\tnsr@Add{\tnsr@Sbs}{\tnsr@Sps}{\tnsr@Sbe}}%
\else
\tnsr@Err
@@ -497,7 +597,7 @@
%
% \begin{macro}{\tnsr@Swb}
% Here we flip the state of \cs{tnsr@Swx} to \cs{tnsr@Swa} then calculate and
-% insert the necessary padding for index alignment.
+% insert the necessary padding for horizontal index alignment.
% \begin{macrocode}
\newcommand\tnsr@Swb{%
\let\tnsr@Swx\tnsr@Swa
@@ -509,13 +609,13 @@
\tnsr@Sbs\expandafter\expandafter\expandafter{%
\expandafter\the\expandafter\tnsr@Sbs
\expandafter\kern\the\@tempdima
- }
+ }%
\else
\@tempdima=-\@tempdima
\tnsr@Sps\expandafter\expandafter\expandafter{%
\expandafter\the\expandafter\tnsr@Sps
\expandafter\kern\the\@tempdima
- }
+ }%
\fi
\fi
}
@@ -529,8 +629,7 @@
% index token to the upper or lower string and (if spacing is \emph{on}) a
% place-holder (\cs{tnsr@Hph}) of the same size to the lower or upper string,
% respectively. It also calls \cs{tnsr@Swx} to flip state (if activated). The
-% use of \cs{leavevmode} is necessary to avoid conflict with the |color|
-% package.
+% use of \cs{leavevmode} avoids conflict with the |color| package.
% \changes{v2.1}{2004/12/20}{added \cs{leavevmode}, to avoid \textsf{color}
% package conflict}
% \begin{macrocode}
@@ -575,20 +674,59 @@
%
% \begin{macro}{\tnsr@Fin}
% Finally, we put the index strings into place:
+% \changes{v2.2}{2023/07/18}{added vertical alignment capability}
% \begin{macrocode}
-\newcommand\tnsr@Fin{^{\the\tnsr@Sps}_{\the\tnsr@Sbs}}
+\newcommand\tnsr@Fin{%
+ ^{\tensorSmash{\the\tnsr@Sps}\tnsr@Str}%
+ _{\tensorSmash{\the\tnsr@Sbs}\tnsr@Str}%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\tensorSmash}
+% Initialise \cs{tensorSmash} as \cs{relax} and then conditionally set it equal
+% to \cs{smash} (it is user redefinable).
+% \begin{macrocode}
+\let\tensorSmash\relax
+\iftnsr@Aln
+ \iftnsr@Sma
+ \let\tensorSmash\smash
+ \fi
+\fi
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\tensorStrut}
+% \begin{macro}{\tnsr@Str}
+% Initialise \cs{tensorStrut} as \cs{relax} and then conditionally set it to
+% the height and depth of `|jl|'. By default, it is only applied to displayed
+% math environments (passed on via \cs{tnsr@Str}, which is \cs{def}'ed as
+% \cs{tensorStrut} to be user redefinable), but always (\emph{i.e.} extended to
+% inline text) if the package option |text| is present.
+% \begin{macrocode}
+\newcommand\tensorStrut{}
+\let\tnsr@Str\relax
+\iftnsr@Aln
+ \iftnsr@Str
+ \renewcommand\tensorStrut{\vphantom{jl}}
+ \iftnsr@Txt
+ \def\tnsr@Str{\tensorStrut}
+ \else
+ \everydisplay\expandafter{\the\everydisplay\let\tnsr@Str\tensorStrut}
+ \fi
+ \fi
+\fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}{\ncld@Aux}
-% This auxiliary macro takes two arguments (an optional atomic number, a
-% chemical symbol). The mass number is passed via \cs{ncld@Mno}. Math mode is
-% ensured since usage is common in text. The spacing is increased by |1mu| for
-% better appearance.
+% This auxiliary macro takes two arguments (an optional atomic number and the
+% chemical symbol). The mass number is passed on via \cs{ncld@Mno}. Math mode
+% is ensured since usage is common in text. The spacing is increased by |1mu|
+% for better appearance.
% \begin{macrocode}
\newcommand\ncld@Aux[2][]{%
\ensuremath{%
- \tensor*[^{\nuclideFont{\the\ncld@Mno}}_{\nuclideFont{#1}}]%
+ \tensor*[^{\massnumFont{\the\ncld@Mno}}_{\massnumFont{#1}}]%
{\mkern1mu{\mathit{\nuclideFont{#2}}{}}}{}%
}%
}
@@ -596,13 +734,18 @@
% \end{macro}
%
% \begin{macro}{\tnsr@Err}
-% This is invoked in the only error situation considered.
+% This is invoked in the only error situations considered.
% \begin{macrocode}
-\newcommand\tnsr@Err{%
- \PackageError{tensor}{%
- Sub/Superscript items out of order\on@line,
- \MessageBreak some index tokens may now have been lost%
- }{An index string has an extra or missing `^' or `_' token.}%
+\newcommand\tnsr@Err{}
+\newcommand\tnsr@Erx{%
+ \def\tnsr@Err{%
+ \global\let\tnsr@Err\relax
+ \PackageError{tensor}{%
+ Misordered sub/superscript items\on@line;
+ \MessageBreak index tokens may have been lost.
+ \MessageBreak Press <return> and I shall try to continue%
+ }{Index string probably has extra/missing '^' or '_'.}%
+ }%
}
% \end{macrocode}
% \end{macro}
@@ -611,4 +754,4 @@
%
\endinput
%%
-%% End of file `tensor.dtx'.
+%% End of file 'tensor.dtx'.
diff --git a/macros/latex/contrib/tensor/tensor.ins b/macros/latex/contrib/tensor/tensor.ins
index 91b1922fd2..d11490262c 100644
--- a/macros/latex/contrib/tensor/tensor.ins
+++ b/macros/latex/contrib/tensor/tensor.ins
@@ -1,38 +1,50 @@
-%%
-%% Copyright (C) 2004 by Philip G. Ratcliffe <philip.ratcliffe@uninsubria.it>
-%%
-%% This file may be distributed and/or modified under the conditions of
-%% the LaTeX Project Public License, either version 1.2 of this license
-%% or (at your option) any later version. The latest version of this
-%% license is in:
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% and version 1.2 or later is part of all distributions of LaTeX
-%% version 1999/12/01 or later.
-%%
+\iffalse meta-comment
+
+File: tensor.ins
+
+Copyright (C) 2023 Philip G. Ratcliffe <philip.ratcliffe@uninsubria.it>
+
+It may be distributed and/or modified under the conditions of the
+LaTeX Project Public License (LPPL), either version 1.3c of this
+license or (at your option) any later version. The latest version
+of this license is in the file
+
+ http://www.latex-project.org/lppl.txt
+
+This file is part of the "tensor package" (the Work in LPPL)
+and all files in that package must be distributed together.
+
+The released version of this package is available from CTAN.
+
+\fi
+
\input docstrip
+
\keepsilent
+
\usedir{tex/latex/tensor}
+
\preamble
-Copyright (C) 2004 by Philip G. Ratcliffe <philip.ratcliffe@uninsubria.it>
+Copyright (C) 2023 Philip G. Ratcliffe <philip.ratcliffe@uninsubria.it>
-This file may be distributed and/or modified under the conditions of
-the LaTeX Project Public License, either version 1.2 of this license
-or (at your option) any later version. The latest version of this
-license is in:
+It may be distributed and/or modified under the conditions of the
+LaTeX Project Public License (LPPL), either version 1.3c of this
+license or (at your option) any later version. The latest version
+of this license is in the file
http://www.latex-project.org/lppl.txt
-and version 1.2 or later is part of all distributions of LaTeX
-version 1999/12/01 or later.
+This file is part of the "tensor package" (the Work in LPPL)
+and all files in that package must be distributed together.
+
+The released version of this package is available from CTAN.
\endpreamble
\generateFile{tensor.sty}{n}{\from{tensor.dtx}{package}}
-\ifToplevel{
+\ifToplevel{%
\Msg{*************************************************************}
\Msg{*}
\Msg{* To finish the installation, move the following file into a}
@@ -45,7 +57,7 @@ version 1999/12/01 or later.
\Msg{* \space\space makeindex -s gind.ist tensor}
\Msg{* To produce a history of changes, run makeindex like this:}
\Msg{* \space\space makeindex -s gglo.ist -o tensor.gls tensor.glo}
-\Msg{* Finally, run `tensor.dtx' through LaTeX again.}
+\Msg{* Finally, run 'tensor.dtx' through LaTeX again.}
\Msg{*}
\Msg{* Happy LaTeXing}
\Msg{*************************************************************}
@@ -53,4 +65,4 @@ version 1999/12/01 or later.
\endbatchfile
%%
-%% End of file `tensor.ins'.
+%% End of file 'tensor.ins'.
diff --git a/macros/latex/contrib/tensor/tensor.pdf b/macros/latex/contrib/tensor/tensor.pdf
deleted file mode 100644
index c764ff4b5c..0000000000
--- a/macros/latex/contrib/tensor/tensor.pdf
+++ /dev/null
Binary files differ
diff --git a/macros/latex/contrib/tensor/tensor.sty b/macros/latex/contrib/tensor/tensor.sty
deleted file mode 100644
index 92c31410fb..0000000000
--- a/macros/latex/contrib/tensor/tensor.sty
+++ /dev/null
@@ -1,167 +0,0 @@
-%%
-%% This is file `tensor.sty',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% tensor.dtx (with options: `package')
-%%
-%% Copyright (C) 2004 by Philip G. Ratcliffe <philip.ratcliffe@uninsubria.it>
-%%
-%% This file may be distributed and/or modified under the conditions of
-%% the LaTeX Project Public License, either version 1.2 of this license
-%% or (at your option) any later version. The latest version of this
-%% license is in:
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% and version 1.2 or later is part of all distributions of LaTeX
-%% version 1999/12/01 or later.
-%%
-\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesPackage{tensor}
- [2004/12/20 v2.1 tensor indices package (PGR)]
-\DeclareRobustCommand\tensor{%
- \tnsr@Prp
- \@ifstar{\tnsr@Spcfalse\tnsr@Aux}{\tnsr@Spctrue\tnsr@Aux}%
-}
-\DeclareRobustCommand\indices{%
- \tnsr@Prp
- \@ifstar{\tnsr@Spcfalse\ndcs@Aux}{\tnsr@Spctrue\ndcs@Aux}%
-}
-\DeclareRobustCommand\nuclide[1][]{%
- \ncld@Mno{#1}%
- \ncld@Aux
-}
-\newcommand\nuclideFont{\mathrm}
-\newtoks\tnsr@Sps
-\newtoks\tnsr@Sbs
-\newtoks\tnsr@Spe
-\newtoks\tnsr@Sbe
-\newtoks\ncld@Mno
-\newif\iftnsr@Spc
-\newcommand\tnsr@Prp{%
- \tnsr@Sps{}%
- \tnsr@Sbs{}%
- \let\tnsr@Wrn\relax
-}
-\newcommand\ndcs@Aux[1]{%
- \def\tnsr@Obj{}
- \tnsr@Set{#1}%
- \tnsr@Fin
- \tnsr@Wrn
-}
-\newcommand\tnsr@Aux[3][]{%
- \mathpalette{\tnsr@Plt{#1}{#3}}{#2}%
- \tnsr@Wrn
-}
-\newcommand\tnsr@Plt[4]{%
- \def\tnsr@Obj{#3#4}
- \def\reserved@a{#1}%
- \ifx\reserved@a\@empty\else
- \tnsr@Set{#1}%
- \hphantom{{}\tnsr@Fin}%
- \tnsr@Sps\expandafter{%
- \expandafter\tnsr@Krn\expandafter{\the\tnsr@Sps}%
- }%
- \tnsr@Sbs\expandafter{%
- \expandafter\tnsr@Krn\expandafter{\the\tnsr@Sbs}%
- }%
- \fi
- \tnsr@Set{#2}%
- #4\tnsr@Fin
-}
-\newcommand\tnsr@Set[1]{%
- \let\tnsr@Swx\relax
- \tnsr@Pro#1\tnsr@Err
-}
-\newcommand\tnsr@Krn[1]{%
- \settowidth\@tempdima{$\m@th\tnsr@Obj^{#1}\mkern-1mu$}%
- \kern-\@tempdima
- #1
- \settowidth\@tempdima{$\m@th\tnsr@Obj$}%
- \kern\@tempdima
-}
-\newcommand\tnsr@Pro[1]{%
- \ifx#1\tnsr@Err
- \let\tnsr@Nxt\relax
- \else
- \ifx#1*
- \iftnsr@Spc
- \gdef\tnsr@Wrn{%
- \PackageWarning{tensor}{%
- `*' not allowed in argument here, I am ignoring it,%
- \MessageBreak remove it or use `\string\tensor*',%
- }%
- }%
- \else
- \let\tnsr@Swx\tnsr@Swa
- \fi
- \let\tnsr@Nxt\tnsr@Pro
- \else
- \ifx#1^
- \def\tnsr@Nxt{\tnsr@Add{\tnsr@Sps}{\tnsr@Sbs}{\tnsr@Spe}}%
- \else
- \ifx#1_
- \def\tnsr@Nxt{\tnsr@Add{\tnsr@Sbs}{\tnsr@Sps}{\tnsr@Sbe}}%
- \else
- \tnsr@Err
- \let\tnsr@Nxt\tnsr@Pro
- \fi
- \fi
- \fi
- \fi
- \tnsr@Nxt
-}
-\newcommand\tnsr@Swa{\let\tnsr@Swx\tnsr@Swb}
-\newcommand\tnsr@Swb{%
- \let\tnsr@Swx\tnsr@Swa
- \settowidth\@tempdima{$\m@th\tnsr@Obj{}^{\the\tnsr@Spe}$}%
- \settowidth\@tempdimb{$\m@th\tnsr@Obj{}_{\the\tnsr@Sbe}$}%
- \addtolength\@tempdima{-\@tempdimb}%
- \ifdim\@tempdima=\z@\else
- \ifdim\@tempdima>\z@
- \tnsr@Sbs\expandafter\expandafter\expandafter{%
- \expandafter\the\expandafter\tnsr@Sbs
- \expandafter\kern\the\@tempdima
- }
- \else
- \@tempdima=-\@tempdima
- \tnsr@Sps\expandafter\expandafter\expandafter{%
- \expandafter\the\expandafter\tnsr@Sps
- \expandafter\kern\the\@tempdima
- }
- \fi
- \fi
-}
-\newcommand\tnsr@Add[4]{%
- #1\expandafter{\the#1\leavevmode{#4}}%
- \iftnsr@Spc
- #2\expandafter{\the#2\tnsr@Hph{#4}}%
- \fi
- #3{\leavevmode{#4}}%
- \tnsr@Swx
- \tnsr@Pro
-}
-\newcommand\tnsr@Hph{\expandafter\mathpalette\expandafter\tnsr@Mph}
-\newcommand\tnsr@Mph[2]{%
- \settowidth\@tempdima{$\m@th#1{#2}$}%
- \makebox[\@tempdima][c]{$\m@th#1\indexmarker$}%
-}
-\newcommand\indexmarker{}
-\newcommand\tnsr@Fin{^{\the\tnsr@Sps}_{\the\tnsr@Sbs}}
-\newcommand\ncld@Aux[2][]{%
- \ensuremath{%
- \tensor*[^{\nuclideFont{\the\ncld@Mno}}_{\nuclideFont{#1}}]%
- {\mkern1mu{\mathit{\nuclideFont{#2}}{}}}{}%
- }%
-}
-\newcommand\tnsr@Err{%
- \PackageError{tensor}{%
- Sub/Superscript items out of order\on@line,
- \MessageBreak some index tokens may now have been lost%
- }{An index string has an extra or missing `^' or `_' token.}%
-}
-\endinput
-%%
-%% End of file `tensor.sty'.