Debian Codegraph @

texmf-dist/doc/latex/musicography/musicography.tex

raw
1 \documentclass{article}
2
3 \usepackage[T1]{fontenc}
4 \usepackage{lmodern}
5 \usepackage{geometry}
6 \usepackage{semantic-markup}
7 \usepackage[bigger]{musicography}
8 \usepackage{fancyvrb}
9 \frenchspacing
10 \setcounter{secnumdepth}{1}
11
12 \NewDocumentEnvironment{codetable}{}
13 {
14 \begin{quote}
15 \begin{tabular}{p{0.3\textwidth} p{0.4\textwidth} l}
16 }
17 {
18 \end{tabular}
19 \end{quote}
20 }
21
22 \usepackage[
23 pdftitle={The musicography Package: Symbols for Music Writing},
24 pdfauthor={Andrew A. Cashner},
25 pdfsubject={LaTeX package}, pdfkeywords={LaTeX, symbols, music, musicology, humanities}
26 ]{hyperref}
27
28 \title{The \code{musicography} Package: Symbols for Music Writing with
29 \code{pdflatex}}
30 \author{Andrew A. Cashner\thanks{%
31 \href{mailto:[email protected]}
32 {\nolinkurl{[email protected]}}%
33 }%
34 }
35 \date{September 8, 2023}
36
37 \begin{document}
38 \maketitle
39
40 Most \LaTeX{} font packages and freely available fonts only provided a limited
41 range of musical symbols.
42 The \code{lilyglyphs} package uses Lilypond's fonts, but requires
43 \code{lualatex}.
44 This package makes available the most commonly used symbols in writing about
45 music in a way that looks consistent and attractive.
46 It is especially useful for \code{pdflatex} but also works alongside Unicode
47 fonts with \code{xelatex}.
48 It includes accidentals, meters, notes of different rhythmic values, and
49 automatic formatting of figured bass.
50
51 This package builds on the approach used in the \code{harmony} package, where
52 the symbols are taken from the MusiXTeX fonts.
53 But it provides a larger range of symbols and a more flexible, user-friendly
54 interface written using the new interface introduced in \code{xparse} (now
55 built in to \LaTeX).
56 The package is meant to work hand-in-hand with my \code{semantic-markup}
57 package, and overrides some of its music-symbol commands with better
58 alternatives.
59
60 \tableofcontents
61
62 \section{Package Options}
63
64 To use the package, write \verb|\usepackage{musicography}| in your preamble.
65 If you are also using this author's \code{semantic-markup} package,
66 \code{musicography} will automatically redefine the commands for accidentals in
67 the other package.
68
69 The \code{bigger} option provides larger font sizes that match better with
70 certain fonts (tested with 12-point \code{ebgaramond}).
71
72 \section{Fonts}
73
74 The package requires the MusiX\TeX{} fonts, which are installed by default in
75 \TeX{}Live.
76 In case there is anyone else using the obscure \verb|\meterCZ| command (in
77 which case, send me a note!) it now requires the EB Garamond font, also
78 installed in \TeX{}Live.
79
80 Most of the font commands can be customized by redefining one of the following
81 commands:
82 \begin{itemize}
83 \item \verb|\musAccidentalFont|: The size of accidentals is defined as
84 larger relative to the other symbols.
85
86 \item \verb|\musNumFont|: This command is used in typesetting time
87 signatures and meters. By default such numbers are boldfaced, which
88 looks better in most fonts. Redefine this command to adjust the
89 appearance of the numbers, for example by using lining numerals.
90 Recommended with \code{ebgaramond} or \code{libertine}:
91 \begin{quote}
92 \verb|\RenewDocumentCommand{\musNumFont}{\liningnums}|
93 \end{quote}
94 The command is employed in a way that both font switches and commands
95 with arguments will work (e.g., \verb|\bfseries\liningnums|), but take
96 care when combining multiple elements.
97
98 \item \verb|\musFigSize| and \verb|\musFigFont|: These commands are used
99 in typesetting figured bass. By default \verb|\musFigSize| sets a
100 smaller size for both numerals and accidentals. The command
101 \verb|\musFigFont| is empty by default but it would be a good idea to
102 make sure the treatment of numerals matches \verb|\musNumFont| if, for
103 example, you are using lining numerals.
104 \end{itemize}
105
106
107 \section{Symbols and Commands}
108
109 \subsection{Accidentals}
110
111 \begin{codetable}
112 Flat & \verb|\musFlat| or \verb|\fl| & \musFlat\\
113 Sharp & \verb|\musSharp| or \verb|\sh| & \musSharp\\
114 Natural & \verb|\musNatural| or \verb|\na| & \musNatural\\
115 Double Flat & \verb|\musDoubleFlat| & \musDoubleFlat\\
116 Double Sharp & \verb|\musDoubleSharp| & \musDoubleSharp\\
117 \end{codetable}
118
119 \subsection{Notes of Different Rhythmic Values}
120
121 Commands are available using modern (United States) note names; in several
122 cases there are also aliases for older note names.
123
124 \begin{codetable}
125 Whole note (semibreve) & \verb|\musWhole| or \verb|\musSemibreve| &
126 \musWhole\\
127 Half note (minim) & \verb|\musHalf| or \verb|\musMinim| & \musHalf\\
128 Quarter note (semiminim) & \verb|\musQuarter| or \verb|\musSeminimin| &
129 \musQuarter\\
130 Eighth note (corchea) & \verb|\musEighth| or \verb|\musCorchea| &
131 \musEighth\\
132 Sixteenth note & \verb|\musSixteenth| & \musSixteenth\\
133 Thirty-second note & \verb|\musThirtySecond| & \musThirtySecond\\
134 Sixty-fourth note & \verb|\musSixtyFourth| & \musSixtyFourth\\
135 \end{codetable}
136
137 A dot may be added to any of the above by adding \code{Dotted} to the end of the
138 command. For example:
139
140 \begin{codetable}
141 Dotted whole note & \verb|\musWholeDotted| & \musWholeDotted\\
142 Dotted quarter note & \verb|\musQuarterDotted| & \musQuarterDotted\\
143 Dotted thirty-second note & \verb|\musThirtySecondDotted| &
144 \musThirtySecondDotted\\
145 \end{codetable}
146
147 \subsection{Other Symbols}
148
149 \begin{codetable}
150 \emph{Segno} repeat marker & \verb|\musSegno| & \musSegno \\
151 \end{codetable}
152
153 \subsection{Meter Signatures}
154
155 \begin{codetable}
156 Common duple & \verb|\meterC| & \meterC\\
157 \term{Alla breve} & \verb|\meterCutC| & \meterCutC\\
158 Ternary (16th--18th cent.) & \verb|\meterCThree| & \meterCThree\\
159 Ternary with $3:2$ proportion & \verb|\meterCThreeTwo| &
160 \meterCThreeTwo\\
161 Spanish 17th-cent. ternary & \verb|\meterCZ| & \meterCZ\\
162 Medieval \term{tempus perfectum} & \verb|\meterO| & \meterO\\
163 \end{codetable}
164
165 For other time signatures, use \verb|\musMeter{}{}|; the two arguments are the
166 numerator and denominator of the fraction, respectively.
167
168 By default this command applies the \verb|\musNumFont| command to its
169 arguments; in a pinch (such as for testing) you can supply an alternate font
170 command as an optional first argument, which will be used instead of
171 \verb|\musNumFont|.
172 In practical use it would be better and more consistent to redefine
173 \verb|\musNumFont| as described above.
174
175
176 \subsection{Figured Bass}
177
178 For figured-bass notation, use \verb|\musFig{}|.
179 The command takes a single argument which may contain as many space-separated
180 elements as you like (just like \verb|\Shortstack| from the \code{stackengine}
181 package, which it uses internally).
182
183 The elements in the argument will be stacked vertically and right-aligned (to
184 allow for accidentals preceding the numerals).
185 Multiple figures in a row should be enclosed in brackets if there are spaces
186 between them.
187
188 To align figures when there are empty slots, as in \musFig{6--5
189 \noFig[5--]\musSharp}, use \verb|\noFig[]|.
190 It will insert horizontal space the same width as its optional argument when
191 typeset; the default value is the width of the numeral 5.
192 It does this using \verb|\hphantom|, so you should supply the same text in the
193 argument as the figure with which you want to align.
194 The code for the example at the beginning of this paragraph was
195 \verb|\musFig{6--5 \noFig[5--]\musSharp}|.
196
197 You can adjust the size and font of the figures by redefining
198 \verb|\musFigSize| and \verb|\musFigFont| as described above.
199 The command applies both commands, in that order, so if you change them, make
200 sure the two work together appropriately.
201
202 {\renewcommand{\arraystretch}{2.5}
203 \small
204 \begin{codetable}
205 Two figures & \verb|\musFig{7 \sh5}|
206 & \musFig{7 \sh5}\\
207 Two figures, accidentals after & \verb|\musFig[l]{7 \sh5}|
208 & \musFig[l]{7 5\sh}\\
209 Three figures & \verb|\musFig{\fl7} 5 3}|
210 & \musFig{\fl7 5 3}\\
211 Four figures & \verb|\musFig{7 5 4 2}| &
212 \musFig{7 5 4 2}\\
213 Voice leading & \verb|\musFig{7--6 5--4 3}|
214 & \musFig{7--6 5--4 3}\\
215 Multiple figures per row
216 & \verb|\musFig{{\fl6} 5} {\noFig[\fl6] \sh}}|
217 & \musFig{{\fl6 5} {\noFig[\fl6] \sh}}\\
218 \end{codetable}}
219
220 \subsection{Scale Degrees and Octave Numbers}
221
222 \begin{codetable}
223 Scale degree & \verb|A is \musDegree{6} in C major.|
224 & A is \musDegree{6} in C major. \\
225 Pitch with octave & \verb|\musPitch{A}{4} is 440Hz.|
226 & \musPitch{A}{4} is 440Hz. \\
227 \end{codetable}
228
229 For more flexible options, including traditional, non-Helmholtz notation for
230 pitches, use my \code{octave} package.
231
232 \section{Customization}
233
234 To create aliases for these commands, such as \verb|\quaver| for British
235 usage, use \verb|\NewDocumentCommand| like this:
236 \begin{quote}
237 \verb|\NewDocumentCommand{\quaver}{}{\musEighth}|
238 \end{quote}
239 If this new LaTeX interface is unfamiliar, \verb|\newcommand| or even
240 \verb|\let| will still work.
241
242 \LaTeX{} programmers may wish to use the package's internal commands directly
243 to access more symbols from the fonts or fine-tune their appearance.
244 See \verb|\musSymbol|, \verb|\musAccidental|, and \verb|\musStack| in the code
245 listing below.
246
247 \subsubsection{MusiX\TeX{} Symbol List}
248
249 You may use \verb|\musSymbol| to pull in any of the following symbols by
250 number:
251 \musixSymbolList
252
253 \section{Changes}
254
255 \begin{itemize}
256 \item[2023-09-08] Improved customization, time signatures, figured bass,
257 and documentation
258 \begin{itemize}
259 \item Documentation reorganized, clarified, corrected
260 \item Customizable font commands used throughout:
261 \verb|\musAccidentalFont|, \verb|\musNumFont|,
262 \verb|\musFigSize|, and \verb|\musFigFont|
263 \item \verb|\musStack| now takes an optional last argument to
264 specify alignment
265 \item \verb|\musMeter| now takes an optional font argument, and
266 has a smaller vertical gap between numerals. It is now scaled
267 to fit within the line.
268 \item Spacing commands in \verb|\musSymbolMeter| are simplified
269 \item \verb|\meterThreeTwo| now uses \verb|\musMeter| for the
270 numbers, shifted slightly to align with the meter symbol
271 \item \verb|\meterCZ| now pulls in a cursive Z symbol from the EB
272 Garamond font (installed by default in TeXLive)
273 \item \verb|\musFig| now includes configurable \verb|\musFigSize|
274 and \verb|\musFigFont| switches, and a first optional argument
275 with alignment specifier
276 \item New commands for scale degress (\verb|\musDegree|) and
277 pitches with Helmholtz octave (\verb|\musPitch|)
278 \item For testing or extension, add command to display a list of
279 symbols by number in a given font
280 \end{itemize}
281 \item[2020-01-29] Reduced stack gap for \verb|\musFig|
282 \item[2019/11/24] Fix \verb|\MeterCThreeTwo| so that numbers are stacked
283 and aligned correctly
284 \item[2019/05/28] Bux fixes and new features, especially figured bass
285 \begin{itemize}
286 \item Fix issue 1 on Bitbucket, thanks to Christian Mondrup
287 \begin{itemize}
288 \item Correct mistaken notehead symbol for values less than
289 quarter note (was hollow, now filled)
290 \item Add 32nd and 64th notes, regular and dotted varieties
291 \item \verb|\musSymbol| is now typeset inside an
292 \verb|\mbox| to fix alignment problems when used in
293 tables
294 \end{itemize}
295 \item New features (some requested in issue no. 1):
296 \begin{itemize}
297 \item Add medieval perfect meter
298 \item Add aliases for \term{fusa} ($=$ corchea $=$ eighth note)
299 \item Replace musStack implementation with \code{stackengine}
300 \item Add full figured-bass support
301 \end{itemize}
302 \end{itemize}
303 \item[2018/05/21] Override semantic-markup's \verb|\fl|, \verb|\sh|,
304 \verb|\na| commands if it is loaded
305 \item[2017/10/31] Corrected glyph used for \verb|\musHalf| and documented
306 \verb|\musMeter| and \verb|\musFigures|
307 \item[2017/08/29] First version on CTAN
308 \item[2017/04/12] Created
309 \end{itemize}
310
311 \section{Code}
312
313 \VerbatimInput{musicography.sty}
314
315
316 \end{document}