diff options
author | Karl Berry <karl@freefriends.org> | 2023-02-21 20:43:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-02-21 20:43:36 +0000 |
commit | 33a151c7817911e968e9d75bd32209509615c4b2 (patch) | |
tree | a3d503a904e3bbd61649b32ba7e4b282b7da7090 /Master/texmf-dist | |
parent | 592ddafc3b99e224426bfb4c1e32337a6d7f6c12 (diff) |
recorder-fingering (21feb23)
git-svn-id: svn://tug.org/texlive/trunk@66008 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/recorder-fingering/README.md | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/recorder-fingering/RecorderInCchart.png | bin | 65144 -> 0 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering-RecorderInCchart.png | bin | 0 -> 73061 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering.pdf | bin | 68489 -> 89434 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering.tex | 72 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/recorder-fingering/recorder-fingering.sty | 383 |
6 files changed, 328 insertions, 133 deletions
diff --git a/Master/texmf-dist/doc/latex/recorder-fingering/README.md b/Master/texmf-dist/doc/latex/recorder-fingering/README.md index d0d5179023b..8ac7acfac51 100644 --- a/Master/texmf-dist/doc/latex/recorder-fingering/README.md +++ b/Master/texmf-dist/doc/latex/recorder-fingering/README.md @@ -1,9 +1,9 @@ # recorder-fingering -Version 1.0 February 17, 2023 +Version 1.1b February 21, 2023 -LaTeX package for recorder fingering diagrams. Support for all standard F and C recorder fingerings, with the ability to add new fingerings as needed. +The `recorder-fingering` package provides support for generating fingering diagrams for baroque fingering recorders. Standard fingerings are provided for recorders in both C and F, along with methods to create and display alternate fingerings for trills, etc. # Sample of what you can do with it: -![Fingering chart](RecorderInCchart.png) +![Fingering chart](recorder-fingering-RecorderInCchart.png) diff --git a/Master/texmf-dist/doc/latex/recorder-fingering/RecorderInCchart.png b/Master/texmf-dist/doc/latex/recorder-fingering/RecorderInCchart.png Binary files differdeleted file mode 100644 index 2dc30ed9f31..00000000000 --- a/Master/texmf-dist/doc/latex/recorder-fingering/RecorderInCchart.png +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering-RecorderInCchart.png b/Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering-RecorderInCchart.png Binary files differnew file mode 100644 index 00000000000..f8350a15d70 --- /dev/null +++ b/Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering-RecorderInCchart.png diff --git a/Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering.pdf b/Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering.pdf Binary files differindex a513c2c860e..11762eaaf8d 100644 --- a/Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering.pdf +++ b/Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering.pdf diff --git a/Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering.tex b/Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering.tex index c2cfbe9caea..f68080b9e40 100644 --- a/Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering.tex +++ b/Master/texmf-dist/doc/latex/recorder-fingering/recorder-fingering.tex @@ -24,7 +24,7 @@ \DefineShortVerb{\|} \title{The \texttt{recorder-fingering} package} \author{Alan Munn\\amunn@msu.edu} -\date{Version 1.0\\February 17, 2023} +\date{Version 1.1b\\February 21, 2023} \lstset{% basicstyle=\ttfamily\small, @@ -39,7 +39,7 @@ } \newcommand*{\pkg}[1]{\texttt{#1}} -\newcolumntype{t}{>{\ttfamily}r} +\newcolumntype{t}[1]{>{\ttfamily}#1} \newcolumntype{T}{>{\ttfamily}c} \newcommand*{\bs}{\textbackslash} \setlength{\droptitle}{-1in} @@ -62,7 +62,7 @@ This package provides five commands (|\Sopranino|, |\Soprano|, |\Alto|, |\Tenor| \begin{table}[htpb] \centering -\begin{tabularx}{.8\textwidth}{tX} +\begin{tabularx}{.8\textwidth}{t{r}X} \toprule \bs Sopranino [<parameters>]\{<note>\} & Display a fingering diagram for note in F\\ \bs Soprano [<parameters>]\{<note>\} & Display a fingering diagram for note in C\\ @@ -77,31 +77,45 @@ This package provides five commands (|\Sopranino|, |\Soprano|, |\Alto|, |\Tenor| The notes range from C–Eb for recorders in C (|\Soprano| and |\Tenor|) or F–Ab for recorders in F (|\Sopranino| and |\Alto|). Notes are noted as C-B (first octave) c-b (second octave) and c'–eb' (third octave) with an equivalent scheme starting at F for the recorders in F. + +Enharmonic notes are available for any of the flat/sharp notes (i.e., Db and C\#, etc. are both defined by default.) \subsection{Display parameters} -Each display command allows two display parameters to be set. +Fingering diagrams are customizable either globally using |\fingeringSetup{}| or locally as an optional argument passed to any individual command. \begin{table}[htpb] \centering -\begin{tabularx}{.9\textwidth}{tX} +\begin{tabularx}{.9\textwidth}{t{l}X} \toprule thumboffset = <true/false> & Display the thumb hole offset or not (default = \pkg{true})\\ width = <length> & Width of the diagram (default = \pkg{20pt}). Height adjusts proportionally\\ +LHRHdivider = <true/false> & Display a line separating the left and right hand holes (default = \pkg{true})\\ +LHRHspace = <length> & Space between the left hand and right hand holds (default = \pkg{10pt})\\ +trilldir = <L/R/LR> & trill arrows uniformly to the Left or Right, or top 3 holes L, bottom 4 holes R\\ +Lpointer = <left trill pointer> & changes the left pointer for trills\\ +Rpointer = <right trill pointer> & changes the right pointer for trills\\ +trill = \{<list of holes>\} & add a trill marker at each hole position in the list (local use only)\\ \bottomrule \end{tabularx} -\caption{Display parameters} +\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|. +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. + +The trill arrow direction can be specified using the |trilldir| parameter. Setting it to |L| places all arrows on the left, setting it to |R| places all arrows on the right. Setting it to |LR| places arrows to the left on holes 1-3 and on the right on holes 4-7. + +The |Lpointer| and |Rpointer| parameters set the left and right trill pointers. The default values are |Lpointer={$\rightarrow$}| and |Rpointer={$\leftarrow$}|. + You can set the parameters individually for any particular display command, but most likely you'll want global settings. To set the parameters globally use the command |\fingeringSetup| e.g. |\fingeringSetup{width=12pt,thumboffset=false}| makes all diagrams use an inline thumb hole and 12pt width. \begin{table}[htpb] \centering -\begin{tabular}{TT} -\pkg{\bs Alto\{c\}} & \pkg{\bs Soprano[width=10pt,thumboffset=false]\{f\}}\\ +\begin{tabular}{TTT} +\bs Alto\{c\} & \bs Soprano[width=10pt,thumboffset=false]\{f\} & \bs Alto[trill=3]\{C\}\\ \\ -\Alto{c} & \Soprano[width=10pt,thumboffset=false]{f} +\Alto{c} & \Soprano[width=10pt,thumboffset=false]{f} & \Alto[trill=3]{C} \end{tabular} \caption{Example fingering commands} \end{table} @@ -115,7 +129,7 @@ Fingerings are specified using an 8 (and possibly 9) element comma separated lis \begin{table}[htpb] \centering -\begin{tabularx}{.8\textwidth}{tX} +\begin{tabularx}{.8\textwidth}{t{r}X} \toprule 0 & open hole\\ 1 & closed hole (positions 0-5); single closed hole (positions 6,7)\\ @@ -145,48 +159,54 @@ The third command is designed to enter a set of new fingerings at once. It will \end{table} %\clearpage \subsection{New fingering examples} -\NewFfingering{ABbtrill}{0,1,1,1,1,1,0,0} +\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} } +\AddFingerings{F}{ + agtrill = {0,0,1,1,1,1,0,0}} \begin{lstlisting} -\NewFfingering{ABbtrill}{0,1,1,1,1,1,0,0} -\Alto{ABbtrill} +\NewFfingering{BbAtrill}{0,1,1,1,1,1,0,0} +\Alto[trill=5]{BbAtrill} \end{lstlisting} -\Alto{ABbtrill} - +\Alto[trill=5]{BbAtrill} +\clearpage \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} } \Soprano{EFtrill} -\Soprano{altd} +\Soprano{altd}\hfil +\Alto{agtrill}\hfil \end{lstlisting} -\Soprano{EFtrill} -\Soprano{altd} +\Soprano{EFtrill}\hfil +\Soprano{altd}\hfil +\Alto{agtrill} \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. 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.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. 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 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. +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. \clearpage -\section{Samples} The chart below shows all of the possible fingerings. +\section{Samples} The chart below shows all of the possible fingerings.\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.} \section*{Recorder in C soprano chart} \begin{tabular}{cccccccccccc} \toprule -C & Db & D & Eb & E & F & Gb & G & Ab & A & Bb & B\\ +C & C\# & D & Eb & E & F & F\# & G & Ab & A & Bb & B\\ \midrule \Soprano{C} & -\Soprano{Db} & +\Soprano{C#} & \Soprano{D} & \Soprano{Eb} & \Soprano{E} & \Soprano{F} & -\Soprano{Gb} & +\Soprano{F#} & \Soprano{G} & \Soprano{Ab} & \Soprano{A} & @@ -198,7 +218,7 @@ C & Db & D & Eb & E & F & Gb & G & Ab & A & Bb & B\\ \bigskip \begin{tabular}{cccccccccccc} \toprule -c & db & d & eb & e & f & gb & g & ab & a & bb & b\\ +c & c\# & d & eb & e & f & f\# & g & ab & a & bb & b\\ \midrule \Soprano{c} & \Soprano{db} & @@ -223,7 +243,7 @@ Here's what the fingering diagrams look like with |thumboffset=false|: \begin{tabular}{cccc} \toprule -c' & db' & d' & eb'\\ +c' & c\#' & d' & eb'\\ \midrule \Soprano{c'} & \Soprano{db'} & diff --git a/Master/texmf-dist/tex/latex/recorder-fingering/recorder-fingering.sty b/Master/texmf-dist/tex/latex/recorder-fingering/recorder-fingering.sty index 6c5f447f72e..fa65399f261 100644 --- a/Master/texmf-dist/tex/latex/recorder-fingering/recorder-fingering.sty +++ b/Master/texmf-dist/tex/latex/recorder-fingering/recorder-fingering.sty @@ -25,12 +25,13 @@ % % recorder-fingering.tex, recorder-fingering.pdf % -% Version 1.0 2023/02/17 +% Version 1.1b 2023/02/21 \NeedsTeXFormat{LaTeX2e}[2022/11/01] -\ProvidesPackage{recorder-fingering}[2023/02/17 v1.0 Recorder fingering diagrams] +\ProvidesPackage{recorder-fingering}[2023/02/20 v1.1 Recorder fingering diagrams] \RequirePackage{tikz} \usetikzlibrary{calc} -\RequirePackage{graphicx} +\RequirePackage{graphicx} +% First set up TikZ styles for the diagrams % Split node code from % https://tex.stackexchange.com/a/657282/2693 % These styles are local to the package @@ -59,59 +60,117 @@ t/.style={node split half=0}, % thumb half hole h/.style={node split half=-90}, % finger half hole top double/.style={circle,minimum size=7pt,inner sep=0pt,draw,##1}, bottom double/.style={circle,minimum size=6pt,inner sep=0pt,draw,##1}, +nodes={anchor=center} }} -\ExplSyntaxOn - +\ExplSyntaxOn % Error messages \msg_new:nnnn {recorder-fingering}{too-few}{\\You\ haven't\ provided\ enough\ holes!}{Fingerings\ must\ specify\ all\ 8\ holes\ (thumb\ +\ all\ 7\ fingers)} \msg_new:nnnn {recorder-fingering}{key-exists}{\\This\ fingering\ is\ already\ defined!}{Use\ the\ starred\ version\ of\ the\ command\ or\ \token_to_str:N \AddFingerings\ instead\ to\ override\ existing\ fingerings.} \msg_new:nnnn {recorder-fingering}{wrong-instrument}{\\This\ command\ only\ permits\ F\ and\ C\ fingerings!}{} -\msg_new:nnnn {recorder-fingering}{deprecated}{\\This\ command\ is\ deprecated.\ Please\ use\ \token_to_str:N \alto\ or\ \token_to_str:N \soprano\ instead.}{} +\msg_new:nnnn {recorder-fingering}{deprecated}{\\This\ command\ is\ deprecated.\ Please\ use\ \token_to_str:N \Alto\ or\ \token_to_str:N \Soprano\ instead.}{} +\msg_new:nnnn {recorder-fingering}{no-hole}{\\The\ recorder\ does't\ have\ enough\ holes\ to\ trill\ here.\ Please\ use\ hole\ numbers\ between\ 1\ and\ 7!}{} +\msg_new:nnnn {recorder-fingering}{key-not-found}{\\Key\ not\ found}{} -% Command parameters -\keys_define:nn {fingering}{ - thumboffset.bool_set:N = \g_fingering_thumboffset_bool, - width.dim_set:N = \g_fingering_size_dim, - thumboffset.initial:n = {true}, - width.initial:n = {20pt} -} -\keys_define:nn {fingering / command}{ - thumboffset.bool_set:N = \g_fingering_command_thumboffset_bool, - width.dim_set:N = \l_fingering_command_size_dim, -} -\NewDocumentCommand{\fingeringSetup}{m}{ - \keys_set:nn {fingering} {#1} -} +% Set up the property lists for F and C fingerings +\prop_new:N \l_fingering_F_prop +\prop_new:N \l_fingering_C_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 + +% Set up transposition tables for later +\prop_new:N \l_fingering_C_to_F_prop +\prop_new:N \l_fingering_F_to_C_prop + +% Set up the clists for the fingering vectors themselves +\clist_new:N \l_fingering_fing_clist +\clist_new:N \l_fingering_topholes_clist + +% Set up the trill holes clist +\clist_new:N \l_fingering_trill_holes_clist + +\prop_new:N \l_fingering_pointer_prop +\prop_set_from_keyval:Nn \l_fingering_pointer_prop { + LPointer = {$\rightarrow$}, + RPointer = {$\leftarrow$} + } + + + +% Definitions of the hole positions. To be used to add trill notation. + + +\tl_const:Nn \c_fingering_thumb_tl {0.5} +\tl_const:Nn \c_fingering_one_tl {1.0} +\tl_const:Nn \c_fingering_two_tl {1.5} +\tl_const:Nn \c_fingering_three_tl {2.0} +\tl_const:Nn \c_fingering_four_tl {2.5} +\tl_const:Nn \c_fingering_five_tl {3.0} +\tl_const:Nn \c_fingering_six_seven_x_tl {0.15} +\tl_const:Nn \c_fingering_six_top_tl {3.5} +\tl_const:Nn \c_fingering_six_bot_tl {3.575} +\tl_const:Nn \c_fingering_seven__top_tl {4.0} +\tl_const:Nn \c_fingering_seven_bot_tl {4.075} +\tl_const:Nn \c_fingering_bell_tl {4.5} % Manage the thumb offset parameters -\tl_set:Nn \g_fingering_thumboffset_x {-.5} -\tl_set:Nn \g_fingering_thumboffset_y {-.25} +\tl_set:Nn \l_fingering_thumboffset_x {-.5} +\tl_set:Nn \l_fingering_thumboffset_y {-.25} \cs_new:Nn \fingering_offset_reset: -{\tl_gset:Nn \g_fingering_thumboffset_x {-.5} -\tl_gset:Nn \g_fingering_thumboffset_y {-.25} +{\tl_gset:Nn \l_fingering_thumboffset_x {-.5} +\tl_gset:Nn \l_fingering_thumboffset_y {-.25} } \cs_new:Nn \fingering_offset_zero: -{\tl_gset:Nn \g_fingering_thumboffset_x {0} -\tl_gset:Nn \g_fingering_thumboffset_y {0} +{\tl_gset:Nn \l_fingering_thumboffset_x {0} +\tl_gset:Nn \l_fingering_thumboffset_y {0} } \cs_new:Nn \fingering_set_thumboffset: { -\bool_if:nTF {\g_fingering_command_thumboffset_bool} +\bool_if:nTF {\l_fingering_thumboffset_bool} {\fingering_offset_reset:} {\fingering_offset_zero:} } -% Set up the property lists for F and C fingerings -\prop_new:N \l_fingering_F_prop -\prop_new:N \l_fingering_C_prop -% Set up transposition tables for later -\prop_new:N \l_fingering_C_to_F_prop -\prop_new:N \l_fingering_F_to_C_prop +\tl_new:N \l_fingering_top_bottom_space_tl +\tl_new:N \l_fingering_trill_offset_tl +\bool_new:N \l_fingering_trill_offset_LR_bool -% Set up the clists for the fingering vectors themselves -\clist_new:N \l_fingering_fing_clist -\clist_new:N \l_fingering_topholes_clist +% Command parameters +\keys_define:nn {fingering}{ + thumboffset.bool_set:N = \l_fingering_thumboffset_bool, + width.dim_set:N = \l_fingering_size_dim, + thumboffset.initial:n = {true}, + width.initial:n = {20pt}, + LHRHspace.tl_set:N = \l_fingering_top_bottom_space_tl, + LHRHspace.initial:n = {4pt}, + LHRHdivider.bool_set:N = \l_fingering_LHRH_divider_bool, + LHRHdivider.initial:n = {false}, + LPointer.prop_put:N = \l_fingering_pointer_prop, + RPointer.prop_put:N = \l_fingering_pointer_prop, + trill.clist_set:N = \l_fingering_trill_holes_clist, + trilldir.choice:, + trilldir / L .code:n = + {\bool_set_false:N \l_fingering_trill_offset_LR_bool + \tl_set:Nn \l_fingering_trill_offset_tl {-.5} + \prop_get:NnN \l_fingering_pointer_prop {LPointer} \l_fingering_trill_pointer_tl}, + trilldir / R .code:n = + {\bool_set_false:N \l_fingering_trill_offset_LR_bool + \tl_set:Nn \l_fingering_trill_offset_tl {.5} + \prop_get:NnN \l_fingering_pointer_prop {RPointer} \l_fingering_trill_pointer_tl}, + trilldir / LR .code:n = { + \bool_set_true:N \l_fingering_trill_offset_LR_bool }, + trilldir.initial:n = LR +} + + +\NewDocumentCommand{\fingeringSetup}{m}{ + \keys_set:nn {fingering} {#1} + \keys_set:nn {fingering} {trill={}} % trill makes no sense as a global option +} +% Set defaults +\fingeringSetup{thumboffset=true,trilldir=LR,LHRHdivider=true,LHRHspace=10pt,width=20pt} % Generic fingering generator: takes a clist, splits it between top holes and bottom holes % and produces the corresponding diagram @@ -121,36 +180,59 @@ bottom double/.style={circle,minimum size=6pt,inner sep=0pt,draw,##1}, { \clist_set:Nn \l_fingering_holes_clist {#1} \clist_clear:N \l_fingering_topholes_clist - \int_step_inline:nn { 6 } { + \int_step_inline:nn { 4 } { \clist_pop:NNF \l_fingering_holes_clist \l_tmpa_tl { \msg_error:nn { recorder-fingering } { too-few }} \clist_put_right:NV \l_fingering_topholes_clist \l_tmpa_tl } - \resizebox{\l_fingering_command_size_dim}{!}{ + \resizebox{\l_fingering_size_dim}{!}{ \begin{tikzpicture}[/fingering] -% display the topholes +% display the thumb and first three topholes \fingering_set_thumboffset: \foreach[expand~list]~\x~[count=\xi]~in~\l_fingering_topholes_clist { - \node[hole=\x]~at~(0+\g_fingering_thumboffset_x,-\xi/2+\g_fingering_thumboffset_y)~{}; + \node[hole=\x]~at~(0+\l_fingering_thumboffset_x,-\xi/2+\l_fingering_thumboffset_y)~{}; \fingering_offset_zero:} +% add the divider if selected + \bool_if:NTF \l_fingering_LHRH_divider_bool + {\draw[overlay]~($(-.5,-2.25)+(0,-\l_fingering_top_bottom_space_tl/2)$)~ + --($(.5,-2.25)+(0,-\l_fingering_top_bottom_space_tl/2)$);} + {} +% now shift the bottom holes to make a small space between LH and RH holes + \begin{scope}[yshift=-\l_fingering_top_bottom_space_tl] + \clist_pop:NN \l_fingering_holes_clist \l_tmpa_tl + \node[hole=\l_tmpa_tl]~at~(0,-\c_fingering_four_tl)~{}; + \clist_pop:NN \l_fingering_holes_clist \l_tmpa_tl + \node[hole=\l_tmpa_tl]~at~(0,-\c_fingering_five_tl)~{}; % display the bottom two paired holes \clist_pop:NN \l_fingering_holes_clist \l_tmpa_tl \int_case:nnTF {\l_tmpa_tl}{ - {0} {\node[top~double=0]~at~(.15,-7/2)~{}; - \node[bottom~double=0]~at~(-.15,-7.15/2)~{};} - {2} {\node[top~double=1,]~at~(.15,-7/2)~{}; - \node[bottom~double=1]~at~(-.15,-7.15/2)~{};} - {1} {\node[top~double=1]~at~(.15,-7/2)~{}; - \node[bottom~double=0]~at~(-.15,-7.15/2)~{};} + {0} {\node[top~double=0]~at~ + (\c_fingering_six_seven_x_tl,-\c_fingering_six_top_tl)~{}; + \node[bottom~double=0]~at~ + (-\c_fingering_six_seven_x_tl,-\c_fingering_six_bot_tl)~{};} + {2} {\node[top~double=1,]~at~ + (\c_fingering_six_seven_x_tl,-\c_fingering_six_top_tl)~{}; + \node[bottom~double=1]~at~ + (-\c_fingering_six_seven_x_tl,-\c_fingering_six_bot_tl)~{};} + {1} {\node[top~double=1]~at~ + (\c_fingering_six_seven_x_tl,-\c_fingering_six_top_tl)~{}; + \node[bottom~double=0]~at~ + (-\c_fingering_six_seven_x_tl,-\c_fingering_six_bot_tl)~{};} } {} {} \clist_pop:NN \l_fingering_holes_clist \l_tmpa_tl \int_case:nnTF {\l_tmpa_tl}{ - {0} {\node[top~double=0,]~at~(.15,-8/2)~{}; - \node[bottom~double=0]~at~(-.15,-8.15/2)~{};} - {2} {\node[top~double=1,]~at~(.15,-8/2)~{}; - \node[bottom~double=1]~at~(-.15,-8.15/2)~{};} - {1} {\node[top~double=1,]~at~(.15,-8/2)~{}; - \node[bottom~double=0]~at~(-.15,-8.15/2)~{};} + {0} {\node[top~double=0,]~at~ + (\c_fingering_six_seven_x_tl,-\c_fingering_seven__top_tl)~{}; + \node[bottom~double=0]~at~ + (-\c_fingering_six_seven_x_tl,-\c_fingering_seven_bot_tl)~{};} + {2} {\node[top~double=1,]~at~ + (\c_fingering_six_seven_x_tl,-\c_fingering_seven__top_tl)~{}; + \node[bottom~double=1]~at~ + (-\c_fingering_six_seven_x_tl,-\c_fingering_seven_bot_tl)~{};} + {1} {\node[top~double=1,]~at~ + (\c_fingering_six_seven_x_tl,-\c_fingering_seven__top_tl)~{}; + \node[bottom~double=0]~at~ + (-\c_fingering_six_seven_x_tl,-\c_fingering_seven_bot_tl)~{};} } {} {} @@ -158,36 +240,63 @@ bottom double/.style={circle,minimum size=6pt,inner sep=0pt,draw,##1}, \clist_if_empty:NTF \l_fingering_holes_clist {} {\clist_pop:NN \l_fingering_holes_clist \l_tmpa_tl - \node[hole=\l_tmpa_tl]~at~(0,-9/2)~{};} + \node[hole=\l_tmpa_tl]~at~(0,-\c_fingering_bell_tl)~{};} +% display trill arrows if present + \clist_if_empty:NTF \l_fingering_trill_holes_clist + {} + { + \clist_map_variable:NNn \l_fingering_trill_holes_clist \l_tmpa_tl + {\int_compare:nNnTF {\l_tmpa_tl} > {7} + {\msg_warning:nn { recorder-fingering } { no-hole }} + {\int_compare:nNnTF {\l_tmpa_tl} > {3} + {\tl_set:Nn \l_fingering_top_bottom_space_tl {0}} + {} + \bool_if:nTF {\l_fingering_trill_offset_LR_bool} + {\int_compare:nNnTF {\l_tmpa_tl} > {3} + {\tl_set:Nn \l_fingering_trill_offset_tl {.5} + \prop_get:NnN \l_fingering_pointer_prop {RPointer} + \l_fingering_trill_pointer_tl } + {\tl_set:Nn \l_fingering_trill_offset_tl {-.5} + \prop_get:NnN \l_fingering_pointer_prop {LPointer} + \l_fingering_trill_pointer_tl } + } + {} + \int_set:Nn \l_tmpb_int {\l_tmpa_tl+1} + \node[overlay]~at~($(\l_fingering_trill_offset_tl, + -\l_tmpb_int/2)+(0,\l_fingering_top_bottom_space_tl) + $)~{\l_fingering_trill_pointer_tl}; + } + } + } + \end{scope} \end{tikzpicture}} } + + + + % create variable version of the command \cs_generate_variant:Nn \fingering_generate_fingering:n { V } - % Main user commands and synonyms % First basic commands to display the fingering for any note -\NewDocumentCommand{\Alto}{om}{ -\IfNoValueTF{#1} - {\keys_set:nn {fingering / command} {width = \g_fingering_size_dim} - \bool_set_eq:NN {\g_fingering_command_thumboffset_bool}{\g_fingering_thumboffset_bool}} - {\bool_set_eq:NN {\g_fingering_command_thumboffset_bool}{\g_fingering_thumboffset_bool} - \keys_set:nn {fingering /command } {#1}} - \prop_get:NnN \l_fingering_F_prop {#2} \l_tmpa_tl - \fingering_generate_fingering:V \l_tmpa_tl +\NewDocumentCommand{\Alto}{O{}m}{ + \group_begin: + \keys_set:nn {fingering} {#1} + \prop_get:NnN \l_fingering_F_prop {#2} \l_tmpa_tl + \fingering_generate_fingering:V \l_tmpa_tl + \group_end: } \cs_set_eq:NN \Sopranino \Alto \cs_set_eq:NN \Bass \Alto -\NewDocumentCommand{\Soprano}{om}{ -\IfNoValueTF{#1} - {\keys_set:nn {fingering / command} {width = \g_fingering_size_dim} - \bool_set_eq:NN {\g_fingering_command_thumboffset_bool}{\g_fingering_thumboffset_bool}} - {\bool_set_eq:NN {\g_fingering_command_thumboffset_bool}{\g_fingering_thumboffset_bool} - \keys_set:nn {fingering /command } {#1}} - \prop_get:NnN \l_fingering_C_prop {#2} \l_tmpa_tl - \fingering_generate_fingering:V \l_tmpa_tl +\NewDocumentCommand{\Soprano}{O{}m}{ + \group_begin: + \keys_set:nn {fingering} {#1} + \prop_get:NnN \l_fingering_C_prop {#2} \l_tmpa_tl + \fingering_generate_fingering:V \l_tmpa_tl + \group_end: } \cs_set_eq:NN \Tenor \Soprano @@ -208,7 +317,7 @@ bottom double/.style={circle,minimum size=6pt,inner sep=0pt,draw,##1}, \NewDocumentCommand{\NewFfingering}{smm}{ \IfBooleanTF{#1} {\prop_put:Nnn \l_fingering_F_prop {#2} {#3}} - {\prop_get:NnNTF \l_fingering_F_prop {#2} \tl_tmpa_tl + {\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}} }} @@ -216,11 +325,42 @@ bottom double/.style={circle,minimum size=6pt,inner sep=0pt,draw,##1}, \NewDocumentCommand{\NewCfingering}{smm}{ \IfBooleanTF{#1} {\prop_put:Nnn \l_fingering_C_prop {#2} {#3}} - {\prop_get:NnNTF \l_fingering_C_prop {#2} \tl_tmpa_tl + {\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}} }} +% 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}} +\cs_new_protected:Nn \fingering_add_C_fingering:nn {\prop_put:Nnn \l_fingering_C_prop {#1} {#2}} +\cs_generate_variant:Nn \fingering_add_F_fingering:nn {nV} +\cs_generate_variant:Nn \fingering_add_C_fingering:nn {nV} + +% These macros take two arguments: a new key and an existing key, and create a new +% fingering in the associated property list with the new key name and the existing key +% fingering + \cs_new_protected:Nn \fingering_copy_F:nn + {\prop_get:NnN \l_fingering_F_sharp_flat_prop {#1} \l_tmpa_tl + \prop_get:NoN \l_fingering_F_prop {\l_tmpa_tl} \l_tmpb_tl + \fingering_add_F_fingering:nV {#1} {\l_tmpb_tl}} + +\cs_new_protected:Nn \fingering_copy_C:nn + {\prop_get:NnN \l_fingering_C_sharp_flat_prop {#1} \l_tmpa_tl + \prop_get:NoN \l_fingering_C_prop {\l_tmpa_tl} \l_tmpb_tl + \fingering_add_C_fingering:nV {#1} {\l_tmpb_tl}} + +\NewDocumentCommand{\debug}{O{f}m}{ + \str_case:nn {#1}{ + {f}{\prop_get:NnNTF \l_fingering_F_prop {#2} \l_tmpa_tl + {}{\msg_error:nn { recorder-fingering } { key-not-found }} + \l_tmpa_tl} + {c}{\prop_get:NnNTF \l_fingering_C_prop {#2} \l_tmpa_tl + {}{\msg_error:nn { recorder-fingering } { key-not-found }} + \l_tmpa_tl + } + } +} + % Now add all of the basic fingerings \AddFingerings{F}{ F = {1,1,1,1,1,1,2,2}, @@ -283,39 +423,44 @@ bottom double/.style={circle,minimum size=6pt,inner sep=0pt,draw,##1}, eb' = {t,0,1,1,0,1,2,0} } +% These are equivalent lists for generating the # versions +% new_key = {existing_key} +\prop_set_from_keyval:Nn \l_fingering_F_sharp_flat_prop { + F# = {Gb}, + G# = {Ab}, + A# = {Bb}, + C# = {Db}, + D# = {Eb}, + f# = {gb}, + g# = {ab}, + a# = {bb}, + c# = {db}, + d# = {eb}, + f#' = {gb'}, + g#' = {ab'} +} +\prop_set_from_keyval:Nn \l_fingering_C_sharp_flat_prop { + C# = {Db}, + D# = {Eb}, + Bb = {F}, + F# = {Gb}, + G# = {Ab}, + A# = {Bb}, + c# = {db}, + d# = {eb}, + f# = {gb}, + g# = {ab}, + a# = {bb}, + c#' = {db'}, + d#' = {eb'} +} + +% Add all the sharp fingerings. + \prop_map_function:NN \l_fingering_F_sharp_flat_prop \fingering_copy_F:nn + \prop_map_function:NN \l_fingering_C_sharp_flat_prop \fingering_copy_C:nn + % Transposition tables (may be useful; currently not used) \prop_set_from_keyval:Nn \l_fingering_F_to_C_prop { - F = {C}, - Gb = {Db}, - G = {D}, - Ab = {Eb}, - A = {E}, - Bb = {F}, - B = {Gb}, - C = {G}, - Db = {Ab}, - D = {A}, - Eb = {Bb}, - E = {B}, - f = {c}, - gb = {db}, - g = {d}, - ab = {eb}, - a = {e}, - bb = {f}, - b = {gb}, - c = {g}, - db = {ab}, - d = {a}, - eb = {bb}, - e = {b}, - f' = {c'}, - gb' = {db'}, - g' = {d'}, - ab' = {eb'} - } - -\prop_set_from_keyval:Nn \l_fingering_C_to_F_prop { C = {F}, Db = {Gb}, D = {G}, @@ -344,9 +489,39 @@ bottom double/.style={circle,minimum size=6pt,inner sep=0pt,draw,##1}, db' = {gb'}, d' = {g'}, eb' = {ab'} + } + +\prop_set_from_keyval:Nn \l_fingering_C_to_F_prop { + F = {C}, + Gb = {Db}, + G = {D}, + Ab = {Eb}, + A = {E}, + Bb = {F}, + B = {Gb}, + C = {G}, + Db = {Ab}, + D = {A}, + Eb = {Bb}, + E = {B}, + f = {c}, + gb = {db}, + g = {d}, + ab = {eb}, + a = {e}, + bb = {f}, + b = {gb}, + c = {g}, + db = {ab}, + d = {a}, + eb = {bb}, + e = {b}, + f' = {c'}, + gb' = {db'}, + g' = {d'}, + ab' = {eb'} } - % Backwards (in)compatibility with the initial version of the package \NewDocumentCommand{\fingering}{}{ |