diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/musicography |
Initial commit
Diffstat (limited to 'macros/latex/contrib/musicography')
-rw-r--r-- | macros/latex/contrib/musicography/README.md | 13 | ||||
-rw-r--r-- | macros/latex/contrib/musicography/musicography.pdf | bin | 0 -> 328394 bytes | |||
-rw-r--r-- | macros/latex/contrib/musicography/musicography.sty | 238 | ||||
-rw-r--r-- | macros/latex/contrib/musicography/musicography.tex | 228 |
4 files changed, 479 insertions, 0 deletions
diff --git a/macros/latex/contrib/musicography/README.md b/macros/latex/contrib/musicography/README.md new file mode 100644 index 0000000000..da3feec9f0 --- /dev/null +++ b/macros/latex/contrib/musicography/README.md @@ -0,0 +1,13 @@ +# The `musicography` package: Symbols for Music Writing with `pdflatex` + +This package makes available the most commonly used symbols in writing about +music in a way that can be used with `pdflatex` and looks consistent and +attractive. +It includes accidentals, meters, and notes of different rhythmic values. +The package provides a flexible, user-friendly interface written using `xparse`. + +The package requires the `musixtex` fonts. + +This material is subject to the current version of the LaTeX Project Public +License. +The author and maintainer is Andrew A. Cashner, `andrewacashner@gmail.com`. diff --git a/macros/latex/contrib/musicography/musicography.pdf b/macros/latex/contrib/musicography/musicography.pdf Binary files differnew file mode 100644 index 0000000000..3d8ab64a0b --- /dev/null +++ b/macros/latex/contrib/musicography/musicography.pdf diff --git a/macros/latex/contrib/musicography/musicography.sty b/macros/latex/contrib/musicography/musicography.sty new file mode 100644 index 0000000000..dad5ff27f4 --- /dev/null +++ b/macros/latex/contrib/musicography/musicography.sty @@ -0,0 +1,238 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{musicography}[2019/05/28 + Symbols for music writing with pdflatex] + +% Copyright 2019 Andrew A. Cashner, andrewacashner@gmail.com + +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 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.3 or later is part of all distributions +% of LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% The Current Maintainer of this work is Andrew A. Cashner. +% This work consists of the package file musicography.sty +% and the documentation file musicography.tex. + +% CHANGE LOG +% 2019-05-28 - Fix issue #1: +% + Correct notehead symbol for values < quarter note +% (was hollow, should be filled) +% + Add 32nd and 64th notes regular and dotted +% + \musSymbol now inside an \mbox to fix alignment problems +% - New features (some requested in issue #1) +% + Add medieval perfect meter +% + Add aliases for fusa (= corchea = eighth note) +% + Replace musStack implementation with stackengine: +% Now takes any number of space-separated arguments to stack +% numerals, allowing for full figured-bass notation +% 2018-05-21 Override semantic-markup's \fl, \sh, \na commands if it is loaded +% 2017-10-31 Corrected glyph for \musHalf and documented +% \musMeter and \musFigures +% 2017-08-29 First version on CTAN +% 2017-04-12 Created + +\newif\ifLargeFont +\LargeFontfalse +\DeclareOption{bigger}{\LargeFonttrue} +\ProcessOptions\relax + +\RequirePackage{xparse} + +\ifLargeFont + \newfont{\musFont}{musix13} + \newfont{\musFontBig}{musix16} + \newfont{\musFontLarge}{musix20} +\else + \newfont{\musFont}{musix11} + \newfont{\musFontBig}{musix13} + \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}{}{} + +% Print a music symbol from the \musFont, specifying space before, after, and +% baseline adjustment +% #1 optional font command (default: \musFont) +% #2 kern before +% #3 raisebox value +% #4 kern after +% #5 symbol code (e.g., \symbol{4}) +\NewDocumentCommand{\musSymbol}{ O{\musFont} m m m m }{% + \mbox{#1\kern#2\raisebox{#3}{#5}\kern#4}% +} + +% Accidentals +% #1 symbol command for accidental +\NewDocumentCommand{\musAccidental}{ m }{% + \musSymbol[\musFontLarge]{0.1em}{0.5ex}{-0.1pt}{#1}% +} +\NewDocumentCommand{\musFlat} {}{\musAccidental{\symbol{90}}} +\NewDocumentCommand{\musDoubleFlat} {}{\musAccidental{\symbol{91}}} +\NewDocumentCommand{\musSharp} {}{\musAccidental{\symbol{92}}} +\NewDocumentCommand{\musDoubleSharp}{}{\musAccidental{\symbol{93}}} +\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}{% + \RenewDocumentCommand{\fl}{}{\musFlat} + \RenewDocumentCommand{\sh}{}{\musSharp} + \RenewDocumentCommand{\na}{}{\musNatural} +}{% + \NewDocumentCommand{\fl}{}{\musFlat} + \NewDocumentCommand{\sh}{}{\musSharp} + \NewDocumentCommand{\na}{}{\musNatural} +} +% Print a composite music symbol of a notehead plus stem +% #1 Symbol musSymbol command for notehead +\NewDocumentCommand{\musStemmedNote}{ m }{% + \musSymbol{0.05em}{0.5ex}{0.2em}{#1\musStem}% +} + +% Stemmed note plus flag +% #1 symbol command for base note +% #2 symbol command for flag +\NewDocumentCommand{\musFlaggedNote}{ m m }{% + \musSymbol{0.05em}{0.5ex}{0pt}{#1\musStem}% + \musSymbol{0pt}{0pt}{0.9em}{#2}% +} + +% Note plus dot +% #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}}% +} + +\NewDocumentCommand{\musWhole}{}{% + \musSymbol{0.05em}{0.5ex}{1.35em}{\symbol{9}}% +} +\NewDocumentCommand{\musHalf}{}{% + \musStemmedNote{\symbol{8}}% +} +\NewDocumentCommand{\musQuarter}{}{% + \musStemmedNote{\symbol{7}}% +} +\NewDocumentCommand{\musEighth}{}{% + \musFlaggedNote{\symbol{7}}{\symbol{40}}% +} +\NewDocumentCommand{\musSixteenth}{}{% + \musFlaggedNote{\symbol{7}}{\symbol{41}}% +} +\NewDocumentCommand{\musThirtySecond}{}{% + \musFlaggedNote{\symbol{7}}{\symbol{42}}% +} +\NewDocumentCommand{\musSixtyFourth}{}{% + \musFlaggedNote{\symbol{7}}{\symbol{43}}% +} + +\NewDocumentCommand{\musWholeDotted}{}{% + \musDottedNote{\musWhole}% +} +\NewDocumentCommand{\musHalfDotted}{}{% + \musDottedNote{\musHalf}% +} +\NewDocumentCommand{\musQuarterDotted}{}{% + \musDottedNote{\musQuarter}% +} +\NewDocumentCommand{\musEighthDotted}{}{% + \musDottedNote{\musEighth}% +} +\NewDocumentCommand{\musSixteenthDotted}{}{% + \musDottedNote{\musSixteenth}% +} +\NewDocumentCommand{\musThirtySecondDotted}{}{% + \musDottedNote{\musThirtySecond}% +} +\NewDocumentCommand{\musSixtyFourthDotted}{}{% + \musDottedNote{\musSixtyFourth}% +} + + +% 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}}% +} + +% 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} + +% Numeric meter signatures (e.g., 3/4) +% #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 }{% + \musStack[\musFigFont]{#1}% +} +\NewDocumentCommand{\noFig}{ O{5} }{% + \hphantom{#1}% +} + +\NewDocumentCommand{\meterC}{}{% + \musSymbolMeter{\symbol{83}}% +} +\NewDocumentCommand{\meterCutC}{}{% + \musSymbolMeter{\symbol{82}}% +} +% Ternary meters used in 16th--18th c. music +\NewDocumentCommand{\meterCThree}{}{% + \meterCplus{\musNumFont{3}}% +} +\NewDocumentCommand{\meterCThreeTwo}{}{% + \meterCplus{\musStack{3}{2}}% +} +% Ternary meter used in 17th-century Spanish music +\NewDocumentCommand{\meterCZ}{}{% + \meterCplus{Z}% +} +% 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} + +\endinput diff --git a/macros/latex/contrib/musicography/musicography.tex b/macros/latex/contrib/musicography/musicography.tex new file mode 100644 index 0000000000..2b7981c188 --- /dev/null +++ b/macros/latex/contrib/musicography/musicography.tex @@ -0,0 +1,228 @@ +\documentclass{article} + +\usepackage{lmodern} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage{geometry} +\usepackage{semantic-markup} +\usepackage{musicography} +\usepackage{fancyvrb} +\frenchspacing + +\newenvironment{codetable} +{\begin{quote}\begin{tabular}{lll}} +{\end{tabular}\end{quote}} + +\usepackage[ + pdftitle={The musicography Package: Symbols for Music Writing with + pdflatex}, + pdfauthor={Andrew A. Cashner}, + pdfsubject={LaTeX package}, pdfkeywords={LaTeX, symbols, music, musicology, humanities} +]{hyperref} + +\title{The \code{musicography} Package: Symbols for Music Writing with +\code{pdflatex}} +\author{Andrew A. Cashner\thanks{% + \href{mailto:andrewacashner@gmail.com} + {\nolinkurl{andrewacashner@gmail.com}}% + }% +} +\date{May 28, 2019} + +\begin{document} +\maketitle + +Font packages for \code{pdflatex} only provided a limited range of musical +symbols. +The \code{lilyglyphs} package uses Lilypond's fonts, but requires +\code{lualatex}. +This package makes available the most commonly used symbols in writing about +music in a way that can be used with \code{pdflatex} and looks consistent and +attractive. +It includes accidentals, meters, notes of different rhythmic values, and +automatic formatting of figured bass. + +This package builds on the approach used in the \code{harmony} package, where +the symbols are taken from the MusiXTeX fonts. +But it provides a larger range of symbols and a more flexible, user-friendly +interface written using \code{xparse}. + +\tableofcontents + +\section{Package Options} + +To use the package, write \verb|\usepackage{musicography}| in your preamble. +If you are also using this author's \code{semantic-markup} package, +\code{musicography} will automatically redefine the commands for accidentals in +the other package. + +The \code{bigger} option provides larger font sizes that match better with +certain fonts. + +The package now (2019) provides full support for figured-bass notation using the +\verb|\musFig| command. + +The \verb|\musNumFont| command allows you to change the font of the numerals +used. +For example, if using the \code{ebgaramond} font package, it looks better if you +do this: +\begin{quote} + \verb|\renewcommand{\musNumFont}[1]{\liningnums{#1}}|. +\end{quote} + + +\section{Symbols and Commands} + +\subsection{Accidentals} + +\begin{codetable} + Flat & \verb|\musFlat| or \verb|\fl| & \musFlat\\ + Sharp & \verb|\musSharp| or \verb|\sh| & \musSharp\\ + Natural & \verb|\musNatural| or \verb|\na| & \musNatural\\ + Double Flat & \verb|\musDoubleFlat| & \musDoubleFlat\\ + Double Sharp & \verb|\musDoubleSharp| & \musDoubleSharp\\ +\end{codetable} + +\subsection{Notes of Different Rhythmic Values} + +Commands are available using modern (United States) note names; in several cases +there are also aliases for older note names. + +\begin{codetable} + Whole note (semibreve) & \verb|\musWhole| or \verb|\musSemibreve| & + \musWhole\\ + Half note (minim) & \verb|\musHalf| or \verb|\musMinim| & \musHalf\\ + Quarter note (semiminim) & \verb|\musQuarter| or \verb|\musSeminimin| & + \musQuarter\\ + Eighth note (corchea) & \verb|\musEighth| or \verb|\musCorchea| & + \musEighth\\ + Sixteenth note & \verb|\musSixteenth| & \musSixteenth\\ + Thirty-second note & \verb|\musThirtySecond| & \musThirtySecond\\ + Sixty-fourth note & \verb|\musSixtyFourth| & \musSixtyFourth\\ +\end{codetable} + +A dot may be added to any of the above by adding \code{Dotted} to the end of the +command. For example: + +\begin{codetable} + Dotted whole note & \verb|\musWholeDotted| & \musWholeDotted\\ + Dotted quarter note & \verb|\musQuarterDotted| & \musQuarterDotted\\ + Dotted thirty-second note & \verb|\musThirtySecondDotted| & + \musThirtySecondDotted\\ +\end{codetable} + +\subsection{Meter Signatures} + +\begin{codetable} + Common duple & \verb|\meterC| & \meterC\\ + \term{Alla breve} & \verb|\meterCutC| & \meterCutC\\ + Ternary (16th--18th cent.) & \verb|\meterCThree| & \meterCThree\\ + Ternary with $3:2$ proportion & \verb|\meterCThreeTwo| & + \meterCThreeTwo\\ + Spanish 17th-cent. ternary & \verb|\meterCZ| & \meterCZ\\ + Medieval \term{tempus perfectum} & \verb|\meterO| & \meterO\\ +\end{codetable} + +For other time signatures, use \verb|\musMeter{}{}|; the two arguments are the +numerator and denominator of the fraction, respectively. + +\subsection{Figured Bass} + +For figured-bass notation, use \verb|\musFig{}|. +The command, as of May 2019 now re-implemented using the \code{stackengine} +package, takes a single argument which may contain as many space-separated +elements as you like. +(The \verb|\musFig| command is implemented with \verb|\musStack{}|, which is +also used to for \verb|\musMeter|.) + +The elements in the argument will be stacked vertically and left-aligned. +Multiple figures in a row should be enclosed in brackets if there are spaces +between them. + +To align figures when there are empty slots, as in \musFig{6--5 +\noFig[5--]\musSharp}, use \verb|\noFig[]|. +It will insert horizontal space the +same width as its optional argument when typeset; the default value is the +width of the numeral 5. +It does this using \verb|\hphantom|, so you should supply the same text in the +argument as the figure with which you want to align. +The code for the example at the beginning of this paragraph was +\verb|\musFig{6--5 \noFig[5--]\musSharp}|. + +The font may be controlled by redefining \verb|\musFigFont{}|. +Its default value is as follows: +\begin{Verbatim} +\NewDocumentCommand{\musFigFont}{}{% + \scriptsize + \let\musFontLarge\musFontBig +} +\end{Verbatim} +This reduces the size of numbers and the music font so that they fit better with +surrounding text and so that numerals and accidentals in the figures match. + + + +{\renewcommand{\arraystretch}{2.5} +\small +\begin{codetable} + Two figures & \verb|\musFig{7 5\musSharp}| + & \musFig{7 5\musSharp}\\ + Three figures & \verb|\musFig{7\musFlat{} 5 3}| + & \musFig{7\musFlat{} 5 3}\\ + Four figures & \verb|\musFig{7 5 4 2}| & + \musFig{9 7 5 3}\\ + Voice leading & \verb|\musFig{7--6 5--4 3}| + & \musFig{7--6 5--4 3}\\ + Voice leading & \verb|\musFig{6--7 4--5 \noFig[2--]3}| + & \musFig{7--6 5--4 \noFig[2--]3}\\ + Multiple figures per row + & \verb|\musFig{{6\musFlat{} 5} {\noFig[6\musFlat] \musSharp}}| + & \musFig{{6\musFlat{} 5} {\noFig[6\musFlat] \musSharp}}\\ +\end{codetable}} + + +\subsection{Customization} + +It would be a simple matter of using \verb|\newcommand| or \verb|\let| to create +aliases for these commands, say, for British usage (such as \verb|\quaver|). + +\LaTeX{} programmers may wish to use the package's internal commands directly to +access more symbols from the fonts or fine-tune their appearance. +See \verb|\musSymbol| and \verb|\musAccidental| in the code listing below. + +\section{Changes} + +\begin{itemize} + \item[2019/05/28] Bux fixes and new features, especially figured bass + \begin{itemize} + \item Fix issue 1 on Bitbucket, thanks to Christian Mondrup + \begin{itemize} + \item Correct mistaken notehead symbol for values less than + quarter note (was hollow, now filled) + \item Add 32nd and 64th notes, regular and dotted varieties + \item \verb|\musSymbol| is now typeset inside an + \verb|\mbox| to fix alignment problems when used in + tables + \end{itemize} + \item New features (some requested in issue no. 1): + \begin{itemize} + \item Add medieval perfect meter + \item Add aliases for \term{fusa} ($=$ corchea $=$ eighth note) + \item Replace musStack implementation with \code{stackengine} + \item Add full figured-bass support + \end{itemize} + \end{itemize} + \item[2018/05/21] Override semantic-markup's \verb|\fl|, \verb|\sh|, + \verb|\na| commands if it is loaded + \item[2017/10/31] Corrected glyph used for \verb|\musHalf| and documented + \verb|\musMeter| and \verb|\musFigures| + \item[2017/08/29] First version on CTAN + \item[2017/04/12] Created +\end{itemize} + +\section{Code} + +\VerbatimInput{musicography.sty} + + +\end{document} |