diff options
author | Karl Berry <karl@freefriends.org> | 2023-09-09 20:08:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-09-09 20:08:48 +0000 |
commit | bde13253b2a25dcf8697842b3b76e7e6f2520aa2 (patch) | |
tree | a7a31004dbb7492a1469734ed51cfd4fe200c67a /Master/texmf-dist/tex/latex/musicography | |
parent | f587780334435f61739861314435fa1cf4f7be6c (diff) |
musicography (9sep23)
git-svn-id: svn://tug.org/texlive/trunk@68220 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/musicography')
-rw-r--r-- | Master/texmf-dist/tex/latex/musicography/musicography.sty | 325 |
1 files changed, 264 insertions, 61 deletions
diff --git a/Master/texmf-dist/tex/latex/musicography/musicography.sty b/Master/texmf-dist/tex/latex/musicography/musicography.sty index 0e36b46a89f..b9d9d10c11b 100644 --- a/Master/texmf-dist/tex/latex/musicography/musicography.sty +++ b/Master/texmf-dist/tex/latex/musicography/musicography.sty @@ -1,8 +1,8 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{musicography}[2020/01/29 +\ProvidesPackage{musicography}[2023/09/08 Symbols for music writing with pdflatex] -% Copyright 2020 Andrew A. Cashner, andrewacashner@gmail.com +% Copyright 2023 Andrew A. Cashner, andrewacashner@gmail.com % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -19,6 +19,29 @@ % and the documentation file musicography.tex. % CHANGE LOG +% 2023-09-08 - Improved time signatures, figured bass, documentation +% + Documentation reorganized, clarified, corrected +% + Customizable font commands used throughout: +% \musAccidentalFont, \musNumFont, \musFigSize, and +% \musFigFont +% + \musStack now takes an optional last argument to specify +% alignment +% + \musMeter now takes an optional font argument, and has a +% smaller vertical gap between numerals. It is now scaled +% to fit within the line. +% + Spacing commands in \musSymbolMeter are simplified +% + \meterThreeTwo now uses \musMeter for the numbers, shifted +% slightly to align with the meter symbol +% + \meterCZ now pulls in a cursive Z symbol from the EB +% Garamond font (installed by default in TeXLive) +% + \musFig now includes configurable \musFigSize and +% \musFigFont switches, and a first optional argument with +% alignment specifier +% + New commands for scale degress (\musDegree) and pitches with +% Helmholtz octave (\musPitch) +% + For testing or extension, add command to display a list of +% symbols by number in a given font +% % 2020-01-29 - Reduced stack gap for \musFig % 2019-11-24 - Fix problem with \MeterCThreeTwo where numerals were being % printed next to each other instead of stacked. @@ -39,13 +62,17 @@ % 2017-08-29 First version on CTAN % 2017-04-12 Created +% FONT SIZES + +% Package option 'bigger' +% +% The package uses three sizes of music fonts; the 'bigger' option increases +% all three. \newif\ifLargeFont \LargeFontfalse \DeclareOption{bigger}{\LargeFonttrue} \ProcessOptions\relax -\RequirePackage{xparse} - \ifLargeFont \newfont{\musFont}{musix13} \newfont{\musFontBig}{musix16} @@ -56,10 +83,7 @@ \newfont{\musFontLarge}{musix16} \fi -% Font for numbers in \musStack -% Could redefine to use lining figures, math mode, sans-serif, etc. -% Example for ebgaramond: \renewcommand{\musNumFont}[1]{\liningnums{#1}} -\NewDocumentCommand{\musNumFont}{}{} +% BASIC COMMANDS % Print a music symbol from the \musFont, specifying space before, after, and % baseline adjustment @@ -72,11 +96,18 @@ \mbox{#1\kern#2\raisebox{#3}{#5}\kern#4}% } -% Accidentals +% ACCIDENTALS + +% Larger relative font for accidentals (can be modified) +\NewDocumentCommand{\musAccidentalFont}{}{\musFontLarge} + +% Any accidental % #1 symbol command for accidental \NewDocumentCommand{\musAccidental}{ m }{% - \musSymbol[\musFontLarge]{0.1em}{0.5ex}{-0.1pt}{#1}% + \musSymbol[\musAccidentalFont]{0.1em}{0.5ex}{-0.1pt}{#1}% } + +% Specific accidentals \NewDocumentCommand{\musFlat} {}{\musAccidental{\symbol{90}}} \NewDocumentCommand{\musDoubleFlat} {}{\musAccidental{\symbol{91}}} \NewDocumentCommand{\musSharp} {}{\musAccidental{\symbol{92}}} @@ -84,6 +115,7 @@ \NewDocumentCommand{\musNatural} {}{\musAccidental{\symbol{94}}} % Shorthand accidental commands +% % These commands are defined differently in the semantic-markup package, % so LaTeX will use musicography commands instead \@ifpackageloaded{semantic-markup}{% @@ -95,7 +127,20 @@ \NewDocumentCommand{\sh}{}{\musSharp} \NewDocumentCommand{\na}{}{\musNatural} } -% Print a composite music symbol of a notehead plus stem + +% MUSIC NOTES + +% Just the stem +\NewDocumentCommand{\musStem}{}{% + \musSymbol{0.955em}{0.55ex}{0pt}{\symbol{16}}% +} + +% Just the (augmentation) dot +\NewDocumentCommand{\musDot}{}{% + \musSymbol{-0.2em}{-0.5ex}{0.7em}{\symbol{24}}% +} + +% Notehead plus stem (composite music symbol) % #1 Symbol musSymbol command for notehead \NewDocumentCommand{\musStemmedNote}{ m }{% \musSymbol{0.05em}{0.5ex}{0.2em}{#1\musStem}% @@ -109,20 +154,15 @@ \musSymbol{0pt}{0pt}{0.9em}{#2}% } -% Note plus dot +% Dotted note % #1 \musSymbol command for note to be dotted \NewDocumentCommand{\musDottedNote}{ m }{#1\musDot} -\NewDocumentCommand{\musStem}{}{% - \musSymbol{0.955em}{0.55ex}{0pt}{\symbol{16}}% -} -\NewDocumentCommand{\musSegno}{}{% - \musSymbol{0.55em}{-0.4ex}{1.5em}{\symbol{86}}% -} -\NewDocumentCommand{\musDot}{}{% - \musSymbol{-0.2em}{-0.5ex}{0.7em}{\symbol{24}}% -} +% Notes of different rhythmic values +\NewDocumentCommand{\musBreve}{}{% + \musSymbol{0.05em}{0.5ex}{1.35em}{\symbol{32}}% +} \NewDocumentCommand{\musWhole}{}{% \musSymbol{0.05em}{0.5ex}{1.35em}{\symbol{9}}% } @@ -145,6 +185,7 @@ \musFlaggedNote{\symbol{7}}{\symbol{43}}% } +% Dotted rhythmic values \NewDocumentCommand{\musWholeDotted}{}{% \musDottedNote{\musWhole}% } @@ -167,76 +208,238 @@ \musDottedNote{\musSixtyFourth}% } +% Aliases for older note names +\NewDocumentCommand{\musSemibreve} {}{\musWhole} +\NewDocumentCommand{\musMinim} {}{\musHalf} +\NewDocumentCommand{\musSemiminim} {}{\musQuarter} +\NewDocumentCommand{\musCorchea} {}{\musEighth} +\NewDocumentCommand{\musFusa} {}{\musEighth} +\NewDocumentCommand{\musSemibreveDotted} {}{\musWholeDotted} +\NewDocumentCommand{\musMinimDotted} {}{\musHalfDotted} +\NewDocumentCommand{\musSeminiminimDotted} {}{\musQuarterDotted} +\NewDocumentCommand{\musCorcheaDotted} {}{\musEighthDotted} +\NewDocumentCommand{\musFusaDotted} {}{\musEighthDotted} + + +% STACKED NUMERALS (for figured bass, time signatures) + +\RequirePackage{stackengine} + +% Only a minimal vertical gap between stacked elements +\setstackgap{S}{1pt} + +% Specify the font for numbers in \musStack. For time signatures I think bold +% numbers look better in most fonts, but you could redefine it, for example, +% to use lining figures, math mode, sans-serif, etc. +% +% Example: To get lining figures when using the ebgaramond package: +% \renewcommand{\musNumFont}{\liningnums} +% +% The command is employed in a way that both font switches and commands with +% arguments will work (e.g., {\bfseries\liningnums}), but take care when +% combining multiple elements. +\NewDocumentCommand{\musNumFont}{}{\bfseries} % Command to stack numerals for metrical symbols or figured bass % Takes any number of space-separated arguments and stacks them vertically -\RequirePackage{stackengine} -\NewDocumentCommand{\musStack}{ O{\musNumFont} m }{% - {#1\Shortstack[l]{#2}}% +% +% #1 (optional) Font command (\musNumFont by default) +% #2 Series of space-separated arguments to be stacked, e.g., {\fl6 5} +% #3 (optional) Alignment specifier for \Shortstack (l, c, or r); default is c +% for centering +\NewDocumentCommand{\musStack}{ O{\musNumFont} m O{c} }{% + {#1{\Shortstack[#3]{#2}}}% } -% Meter symbols -% #1 symbol code for meter sign -\NewDocumentCommand{\musSymbolMeter}{ m }{% - \raisebox{0.58ex}[8pt][2pt]{% - {\kern-1pt\musFontBig\raisebox{0.3ex}{#1}\kern0.3em}% - }% -} -% Meter that combines \meterC with numerals (e.g., C3 C3/2) -\NewDocumentCommand{\meterCplus}{ m }{\meterC{}\kern-0.7pt#1} +% METER and TIME SIGNATURES + +\RequirePackage{graphicx} % for resizebox % Numeric meter signatures (e.g., 3/4) +% #1 (optional) font command (\musNumFont by default) % #1 number on top % #2 number on bottom -\NewDocumentCommand{\musMeter}{ m m }{% - \musStack{#1 #2}\kern0.05em -} -% Same command used for figured bass -\NewDocumentCommand{\musFigFont}{}{% - \scriptsize - \let\musFontLarge\musFontBig -} -\NewDocumentCommand{\musFig}{ m }{% - \setstackgap{S}{1pt}% - \musStack[\musFigFont]{#1}% +% +% In a pinch you can issue a font command directly in the optional first +% argument, but it would be better to redefine \musNumFont. +% +% These are now scaled to the current line height and centered. +\NewDocumentCommand{\musMeter}{ O{\musNumFont} m m }{% + \resizebox{!}{\ht\strutbox}{% + \musStack[#1]{#2 #3}% + }\kern0.05em } -\NewDocumentCommand{\noFig}{ O{5} }{% - \hphantom{#1}% + +% Meter symbols +% #1 symbol code for meter sign +\NewDocumentCommand{\musSymbolMeter}{ m }{% + \smash{\kern-1pt\musFontBig\raisebox{1.1ex}{#1}\kern0.3em}% } +% Meter symbol plus numerals +\NewDocumentCommand{\meterPlus}{ m m }{#1\kern-0.7pt#2} + +% Meter signatures with a C or cut C symbol +% Just the symbols \NewDocumentCommand{\meterC}{}{% \musSymbolMeter{\symbol{83}}% } \NewDocumentCommand{\meterCutC}{}{% \musSymbolMeter{\symbol{82}}% } + % Ternary meters used in 16th--18th c. music +% Just the numbers: 3 +\NewDocumentCommand{\meterThree}{}{% + {\musNumFont{3}}% +} + +% 3/2 +\NewDocumentCommand{\meterThreeTwo}{}{% + \raisebox{-0.26ex}{\musMeter{3}{2}}% +} + +% Combining symbols and numbers +% Meter that combines \meterC with numerals (e.g., C3 C3/2) +\NewDocumentCommand{\meterCplus}{ m }{\meterPlus{\meterC}{#1}} + +% Meter that combines \meterCutC with numerals (e.g., C3 C3/2) +\NewDocumentCommand{\meterCutCplus}{ m }{\meterPlus{\meterCutC}{#1}} + +% Proportions of cut C +\NewDocumentCommand{\meterCutCThree}{}{% + \meterCutCplus{\meterThree}% +} +\NewDocumentCommand{\meterCutCThreeTwo}{}{% + \meterCutCplus{\meterThreeTwo}% +} + +% Proportions of C \NewDocumentCommand{\meterCThree}{}{% - \meterCplus{\musNumFont{3}}% + \meterCplus{\meterThree}% } \NewDocumentCommand{\meterCThreeTwo}{}{% - \meterCplus{{\footnotesize\stackanchor[1pt]{3}{2}}}% + \meterCplus{\meterThreeTwo}% +} + +% CZ meter: Ternary meter used in 17th-century Spanish music +% +% A cursive Z to match the C meter symbol, as notated in Spanish manuscripts +% +% Pull in symbol from EB Garamond font; could be redefined +\NewDocumentCommand{\meterZfont}{}{% + \fontfamily{EBGaramond-LF}\selectfont +} + +% The symbol +\NewDocumentCommand{\meterZsymbol}{}{% + {\meterZfont\Large\itshape z}% } -% Ternary meter used in 17th-century Spanish music + +% CZ meter \NewDocumentCommand{\meterCZ}{}{% - \meterCplus{Z}% + \meterCplus{\meterZsymbol}% } + % Perfect meter in medieval music \NewDocumentCommand{\meterO}{}{% $\bigcirc$ } -% Aliases for older note names -\NewDocumentCommand{\musSemibreve} {}{\musWhole} -\NewDocumentCommand{\musMinim} {}{\musHalf} -\NewDocumentCommand{\musSemiminim} {}{\musQuarter} -\NewDocumentCommand{\musCorchea} {}{\musEighth} -\NewDocumentCommand{\musFusa} {}{\musEighth} -\NewDocumentCommand{\musSemibreveDotted} {}{\musWholeDotted} -\NewDocumentCommand{\musMinimDotted} {}{\musHalfDotted} -\NewDocumentCommand{\musSeminiminimDotted} {}{\musQuarterDotted} -\NewDocumentCommand{\musCorcheaDotted} {}{\musEighthDotted} -\NewDocumentCommand{\musFusaDotted} {}{\musEighthDotted} +% FIGURED BASS + +% Definable font command to be used with figured bass; consider matching +% \musNumFont (e.g., with lining numerals) +\NewDocumentCommand{\musFigFont}{}{} + +% Size adjustment for figured bass: smaller font for numerals, reduce sizes of +% music symbols (\tiny might make it fit better within the line height) +\NewDocumentCommand{\musFigSize}{}{% + \scriptsize + \RenewDocumentCommand{\musAccidentalFont}{}{\musFont}% +} + +% Figured bass is typeset a \musStack using \musFigFont, right-aligned to +% allow for accidentals preceding numerals +% #1 (optional) Alignment specifier: l, c, r (default: r) +% #2 space-delimited list of arguments to stack, in top-down order +% +% Example: \musFig{\fl6 4} or \musFig{\sh5 4 2} +% +% Note that the command applies first \musFigSize, then \musFigFont inside the +% stack. +\NewDocumentCommand{\musFig}{ O{r} m }{% + {\musFigSize\musStack[\musFigFont]{#2}[#1]}% +} + +% Placeholder for no figure, to maintain alignment +% #1 (optional) width of blank space (Default: numeral 5) +% +% Example: \musFig{6 4}--\musFig{5 \noFig} +\NewDocumentCommand{\noFig}{ O{5} }{% + \hphantom{#1}% +} + +% MISCELLANEOUS SYMBOLS and NOTATIONS + +% Segno (repeat marker) +\NewDocumentCommand{\musSegno}{}{% + \musSymbol{0.55em}{-0.4ex}{1.5em}{\symbol{86}}% +} + +% Scale degrees +% #1 Numeral (offset from tonic) +\NewDocumentCommand{\musDegree}{ m }{$\hat{#1}$} + +% Pitch with Helmholtz octave number (e.g., A4 = A440Hz) +% #1 Pitch-class name (A-G) +% #2 Octave number +\NewDocumentCommand{\musPitch}{ m m }{#1\textsubscript{#2}} + +% Recommended: Use my 'octave' package for more options, including +% traditional, non-Helmholtz notation + +% AUXILIARY COMMANDS + +% Print a list of symbols for documentation, debugging, or extension +% E.g., \symbolList{\musFont}{256} to see all useable symbols in MusiXTeX font + +\RequirePackage{setspace} % for symbol list spacing + +\ExplSyntaxOn +% Single entry in the symbol list: Number + corresponding symbol +% #1 font command +% #2 symbol number +\cs_new:Nn \aac_symbolEntry:nn +{ + \makebox[4em]{#2\quad{#1\symbol{#2}}}\ % +} + +% Loop through all the symbols in given font up to given max +% #1 font command +% #2 max symbol number +\cs_new:Nn \aac_symbolLoop:nn +{ + \int_step_inline:nnn {0} {#2 - 1} + { + \aac_symbolEntry:nn {#1} {##1} + } +} + + +% The whole symbol list up to a given max, typeset in a big double-spaced +% block +% #1 font command +% #2 max symbol number +\NewDocumentCommand{\symbolList}{ m m }{\par + \begin{doublespace} + \noindent\aac_symbolLoop:nn {#1} {#2} + \end{doublespace} +} +\ExplSyntaxOff + +% Print a list of symbols in the MusiXTeX font +\NewDocumentCommand{\musixSymbolList}{}{\symbolList{\musFont}{128}} \endinput |