diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/latex4musicians/latex4musicians.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/latex4musicians/latex4musicians.tex | 1021 |
1 files changed, 707 insertions, 314 deletions
diff --git a/Master/texmf-dist/doc/latex/latex4musicians/latex4musicians.tex b/Master/texmf-dist/doc/latex/latex4musicians/latex4musicians.tex index b408262bff9..fb2bd31925f 100644 --- a/Master/texmf-dist/doc/latex/latex4musicians/latex4musicians.tex +++ b/Master/texmf-dist/doc/latex/latex4musicians/latex4musicians.tex @@ -2,7 +2,9 @@ % % By Guido Gonzato, PhD <guido.gonzato (at) gmail.com> % -% Last updated: January 05, 2019 +% Last updated: January 19, 2019 + +% \RequirePackage[l2tabu,orthodox]{nag} % LaTeX syntax check \documentclass[a4paper,12pt]{article} \usepackage{etoolbox} % fix alltt @@ -11,21 +13,26 @@ \usepackage{wasysym} % for \twonotes \usepackage{graphicx} % include PDF files \usepackage[colorlinks,% - linkcolor=darkred,% - urlcolor=darkblue,% - filecolor=darkblue,% + linkcolor=red,% + urlcolor=blue,% + filecolor=blue,% breaklinks=true]% {hyperref} % URLs and links \urlstyle{same} % use the same font for links \usepackage{setspace} % for sources \usepackage{fancyvrb} % fancy verbatim +\usepackage{color} % for included pages +\pagecolor{white} % don't disrupt pdfpages \usepackage{pdfpages} % include external pages \usepackage[breakable]% {tcolorbox} % shaded boxes \usepackage{alltt} % for sources +\usepackage{textcomp} % for upquote +\usepackage{upquote} % fix ' in PDF output +\usepackage{boxedminipage} % for LaTeX examples \include{params} % low-level formatting stuff -\pagestyle{fancy} +\pagestyle{fancy} % fancy headers % ----- @@ -41,26 +48,24 @@ \maketitle \begin{center} - \includegraphics{shave.pdf} + \includegraphics[width=\textwidth]{jingle.pdf} \end{center} \begin{abstract} This guide shows how to create \LaTeX{} documents that include - several kinds of music elements, from very simple to highly complex. + several kinds of music elements, from very simple to quite complex. Music features may consist of music symbols, song lyrics, guitar chords diagrams, lead sheets, music excerpts, guitar tablatures, multi-page scores. - Music can be produced by \TeX{} and \LaTeX{} directly using + Music can be produced directly by \TeX{} and \LaTeX{} using packages, and also by external scorewriters. Major packages and programs are listed and briefly described, providing ready-to-use examples. \end{abstract} -\noteseparator - \tableofcontents % \listoftables % \listoffigures @@ -86,29 +91,30 @@ I'm a long-time and enthusiastic \LaTeX{} user, and I'm also an amateur musician; I play folk music on wind instruments. Years ago, I used \LaTeX{} to typeset my -\href{http://abcplus.sourceforge.net/#ABCGuide}{ABC notation -tutorial}, which I'm still maintaining. Writing that tutorial, I -included many music snippets along with the corresponding sources, and -I was very satisfied with the result. (I hope that other people are +\href{http://abcplus.sourceforge.net/#ABCGuide}{ABC notation tutorial} +that I'm still maintaining. Writing that tutorial, I included many PDF +music snippets along with the corresponding ABC sources, and I was +very satisfied with the result. (Hopefully, other people were satisfied, too.) -Since then, I've become interested in other music notation languages. -I've come across many great programs and many great packages I wasn't -aware of; I've collected many snippets and I've taken notes. I'm -really impressed; there are plenty of options for the musician who is -also a \LaTeX{} user. In fact, \TeX{} can typeset music by itself -using extensions, such as the MusiX\TeX{} family. Besides, \LaTeX{} -can easily include music produced by other programs. +Since then, I have become interested in other music notation +languages. I have come across many excellent programs and many great +packages I wasn't aware of; I have collected many music snippets and I +have taken notes. I must say that I'm impressed; there are plenty of +options for the musician who is also a \LaTeX{} user. In fact, \TeX{} +can typeset music by itself using extensions, such as the MusiX\TeX{} +family. Besides, \LaTeX{} can easily include music produced by other +scorewriters. So, to write \LaTeX{} documents that include music we have to solve two problems: how do we make the music in a suitable format? And how do we combine the music with \LaTeX? -For my own self-training, and hoping to do something useful for other -musicians, I have decided to write this manual that explains how to -solve these problems. In particular, it shows how to create documents -that include many types of music information, from very simple to -highly complex: +For my own self-training, and in the hope of doing something useful +for other musicians, I have decided to write this guide that explains +how to solve these problems in many ways. In particular, it shows how +to create documents that include many types of music information, from +very simple to quite complex: \begin{itemize} @@ -137,62 +143,87 @@ highly complex: \includegraphics{gtablature} \end{minipage} + \item \hyperref[sec:multimedia]{multimedia files}: + \begin{minipage}[c]{\linewidth} + \href{run:jingle.midi}{\fbox{play me!}} + \end{minipage} + + \item \hyperref[sec:sources]{notation sources}: + \hspace{1em} + \begin{boxedminipage}[c]{0.4\linewidth} + \begin{alltt} +\footnotesize +X: 1 +L: 1/4 +K: C +c G/G/ _AG|z !>!B!>!c z|] +\end{alltt} + \end{boxedminipage} + \end{itemize} This guide aims to provide a roundup of available options, along with ready-to-use examples. We will examine a few \TeX/\LaTeX{} packages -and several programs that produce high-quality musical output; then we -will learn how to include them in \LaTeX{} documents. +and several programs that produce high-quality music output; then we +will learn how to include the music (as PDF files, sound files, or +notation sources) in \LaTeX{} documents. % ----- \subsection{Conventions} -This document is meant to be consulted in its PDF version, rather than -printed on paper. Links are written in short form whenever possible; -for instance, links to packages are written simply as +This document is meant to be consulted in its PDF version (online, if +possible), rather than printed on paper. Hence, it uses many external +links. + +Links are written in short form whenever possible; for instance, the +\pkgname{abc} package will be referred to as \href{https://www.ctan.org/pkg/abc}{abc} instead of \url{https://www.ctan.org/pkg/abc}. Sources (\LaTeX{} or notation languages) are shown in a frame with a -cyan background; the resulting PDF output, when applicable, has a -light background. Command line sessions are shown in a frame, with -user commands emphasised in boldface. +light green background; the resulting PDF output, when applicable, has +a light gray background. Command line sessions are shown in a frame; +user commands are emphasised in boldface. All software described in this guide is -\href{https://en.wikipedia.org/wiki/Free_and_open-source_software}{free -and open source}. +\href{https://en.wikipedia.org/wiki/Free_and_open-source_software}% +{free and open source}. % ----- \subsection{Preliminaries} -To begin with, we need a working \LaTeX{} system. I recommend that you -install the latest release of \href{https://www.tug.org/texlive/}{TeX -Live}, which I used to typeset this manual and all included examples -on a GNU/Linux system (TeX Live 2018). On Debian-based GNU/Linux -systems, all you need to do is install \file{texlive-mu\-sic}; all -other needed components will be installed as dependencies. I suppose -that other distributions like \href{https://miktex.org/}{MiKTeX} or +To begin with, we need a working \LaTeX{} system. I strongly recommend +that you install the latest release of +\href{https://www.tug.org/texlive/}{TeX Live}, which I used to typeset +this manual and all included examples on a GNU/Linux system (TeX Live +2018). Please note that on Debian-based GNU/Linux systems, and maybe +other distributions, the default TeX Live packages may be older. I +suppose that other \TeX{} distributions like +\href{https://miktex.org/}{MiKTeX} or \href{http://www.tug.org/mactex/}{MacTeX} are just as good, but I have no first-hand experience with them. Secondly, we need a Bash-based command line environment; this is -provided by default in GNU/Linux and macOS systems. I recommend that -Windows users install the \href{http://www.msys2.org/}{MSYS2} +provided by default in GNU/Linux and macOS systems. Windows users +should install the excellent \href{http://www.msys2.org/}{MSYS2} platform. In most cases, typesetting is done with the common \cmd{pdflatex} -command. Some packages, however, require the \XeLaTeX{} or \LuaLaTeX{} -engines. In that case, you'll also have to install -\file{texlive-xetex} or \file{texlive-luatex}. In this manual, -\cmd{pdflatex} is the default command, unless otherwise specified. +command. Some packages, though, require the \XeLaTeX{} or \LuaLaTeX{} +engines. In this manual, \cmd{pdflatex} is the default command, unless +otherwise specified. This manual is not meant to replace the documentation of the packages -and programs that it describes. A few examples are provided to get you -started and to whet your appetite, but in many cases they don't cover -all available features. The package or program documentation is the -primary source of information. +and programs that it briefly describes. A few examples are provided to +get you started and to whet your appetite, but in most cases they +don't cover all available features. The package or program +documentation is the primary source of information you should refer +to. + +% Good luck. Some programmers write awsome programs, but clearly +% don't know how to write good, useful, concise documentation. Finally, I assume that you are reasonably familiar with \LaTeX. Should you need some information, fine manuals and tutorials are available at @@ -204,10 +235,10 @@ the \href{https://ctan.org/tex-archive/info/}{\LaTeX{} info page}. TeX Live provides a large number of packages, but in the following sections we will deal with packages that may not be included in less -recent releases. In this case, you will have to install the missing -package manually. - -The procedure is simple: +recent releases. Also, some features may be available in package +releases that are newer than those included in TeX Live. In these +cases, you will have to install the missing (or newer) package +manually. The procedure is simple: \begin{enumerate} @@ -235,7 +266,19 @@ The procedure is simple: \end{enumerate} -Package \pkgname{foo} is now accessible by \LaTeX. +Package \pkgname{foo} is now accessible. + +If you are installing a package that is newer than that in TeX Live +and want \LaTeX{} to use it, add this line to your \file{.bashrc}: + +\begin{verbatim} +export TEXINPUTS=$HOME/texmf/tex//: +\end{verbatim} +% $ + +Please note the double \cmd{/} at the end. This line makes \TeX{} +search recursively in \file{\$HOME/texmf/tex/}, then it adds the +current value of \cmd{TEXINPUTS} (if any) to the search path. % ----- @@ -277,11 +320,16 @@ Let's now include several pages: \end{verbatim} \end{source} +I suggest that you read the excellent \pkg{epslatex} guide that +explains many details on alignment, size, rotation etc.\ of included +graphics files. + In the case of short excerpts, we need some means of cropping the PDF to its actual contents (bounding box); PDF files, in fact, are usually created as whole pages. Cropping the PDF is accomplished with the free -program \href{http://pdfcrop.sourceforge.net}{pdfcrop}, a Perl script -that depends on \href{https://www.ghostscript.com}{Ghostscript} and +program \href{http://pdfcrop.sourceforge.net}{pdfcrop}, a very useful +Perl script that depends on +\href{https://www.ghostscript.com}{Ghostscript} and \href{http://pdfedit.cz/en/index.html}{PDFedit}. Given a file called \file{music.pdf}, we crop it with these commands: @@ -295,10 +343,10 @@ $ _ \end{screen} % $ -Pdfcrop doesn't work on MSYS2. However, if you install the official -release of \href{https://ghostscript.com/}{Ghostscript} for Windows, -you can use the following shell script, \cmd{pdfcrop.sh}. It only -works with single-page PDF files: +Pdfcrop doesn't work on MSYS2; moreover, MSYS2's Ghostscript package +lacks the \cmd{bbox} device. However, if you install the official +release of Ghostscript for Windows, you can use the following shell +script, \cmd{pdfcrop.sh}. It only works with single-page PDF files: \begin{source} \begin{verbatim} @@ -315,11 +363,13 @@ if [ $# -eq 0 ] ; then exit 1 fi -# GhostScript is installed in C:\Gs +# GhostScript for Windows is installed in C:\Gs GS=/c/gs/gs9.26/bin/gswin64c.exe +# GNU/Linux and others: +# GS=/usr/bin/gs INPUT=$1 PDF=$(basename $1 .pdf) -OUTPUT=$PDF-cropped.pdf +OUTPUT=$PDF-crop.pdf GSOPTS="-q -sDEVICE=bbox -dBATCH -dNOPAUSE" # find out the bounding box @@ -363,7 +413,8 @@ packages; moreover, glyphs provided by music fonts are accessible via \subsection{Using Packages} The impressive -\href{http://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf}% +\href{http://tug.ctan.org/info/symbols/% +comprehensive/symbols-a4.pdf}% {Comprehensive LaTeX Symbol List}, Section 7, lists packages that provide a handful of music symbols: \pkg{textcomp}, \pkg{mnsymbol}, \pkg{fdsymbol}, \pkg{boisik}, \pkg{wasysym}, \pkg{stix}, and @@ -389,7 +440,7 @@ number of glyphs, then \pkg{musicography} may do the job: \begin{verbatim} \documentclass{article} \usepackage{musicography} -\thispagestyle{empty} +\thispagestyle{empty} % no page number \begin{document} @@ -442,20 +493,42 @@ of symbols: \score{glyphs_ls} +This package also provides the \ltx{writechord} command to typeset +chords: + +\begin{source} +\begin{verbatim} +\documentclass[12pt]{article} +\usepackage[minimal]{leadsheets} +\useleadsheetslibraries{chords} +\thispagestyle{empty} + +\begin{document} + +Let's typeset some chords: \writechord{Bb7(#9)} \writechord{Bbb6} +\writechord{C#7(b9)} \writechord{C##13} + +\end{document} +\end{verbatim} +\end{source} + +\scoreshort{chords} + % ----- \subsubsection{Package \pkg{lilyglyphs}} -By far, the most complete source of music glyphs is the +One of the most complete sources of music glyphs is the \pkg{lilyglyphs} package. It provides all the symbols available in the -\href{http://lilypond.org/doc/v2.18/Documentation/notation/the-feta-font} -{Emmentaler} music font, which is used by the -\href{http://lilypond.org}{LilyPond} scorewriter +\href{http://lilypond.org/doc/v2.18/% +Documentation/notation/the-feta-font} {Emmentaler} music font, which +is used by the \href{http://lilypond.org}{LilyPond} scorewriter (Section~\ref{sec:lilypond}). \pkgname{Lilyglyphs} only works with \XeLaTeX{} and \LuaLaTeX, and is incompatible with \pkgname{leadsheets} and \pkgname{MusiXTeX}. Available glyphs and corresponding commands are listed in Section 3 of the package -documentation. +\href{http://mirrors.ctan.org/macros/luatex/latex/lilyglyphs/% +documentation/lilyglyphs.pdf}{documentation}. This is a very small example of what \pkgname{Lilyglyphs} provides: @@ -464,7 +537,7 @@ This is a very small example of what \pkgname{Lilyglyphs} provides: \documentclass{article} \usepackage{fontspec} \usepackage{lilyglyphs} -\thispagestyle{empty} % no page number +\thispagestyle{empty} \begin{document} @@ -496,17 +569,22 @@ character provided by locally installed fonts; these can be listed with the \cmd{fc-list} command, provided by the \href{https://www.fontconfig.org/}{Fontconfig} software. -Some fonts are especially useful for music. Specifically, -\href{https://www.smufl.org/fonts}{Bravura} is a free, +Some fonts are especially useful for music. Unicode-encoded fonts +provide \href{https://www.unicode.org/charts/PDF/U1D100.pdf}{music +symbols}, which we can find for instance in +\href{https://www.gnu.org/software/freefont/}{GNU FreeFont}. However, +a font standard for music applications called +\href{https://www.smufl.org}{SMuFL} has been developed. + +Specifically, \href{https://www.smufl.org/fonts}{Bravura} is a free, SMuFL-compliant music font that provides thousands of high-quality music glyphs. Bravura is available in OpenType format as \file{Bravura.otf} and \file{BravuraText.otf}; the first is used for drawing music symbols in scores, the second for inserting music -symbols in text. - -Each glyph is mapped to a numerical code called \emph{code point}; -a comprehensive list of glyphs and the corresponding code points is -available at \url{https://www.smufl.org/version}. +symbols in text. Each glyph is mapped to a numerical code called +\emph{code point}; a comprehensive list of glyphs and the +corresponding code points is available at +\url{https://www.smufl.org/version}. The following source shows how to use the glyphs provided by Bravura. We can define new commands for commonly used glyphs, or directly use @@ -577,7 +655,11 @@ diagrams, transposition, index generation, etc. \label{sec:pkgguitar} This is a very basic and simple to use package that provides a -\env{guitar} environment to add chords above lyrics. A minimal +\env{guitar} environment to add chords above lyrics. Customisation +options include alignment, spacing, font, and other low-level +details. + +A minimal example: \begin{source} @@ -611,8 +693,9 @@ example: \subsection{Package \pkg{gtrcrd}} -This is another basic and simple to use package, with some -customisation options. Chords overlaps need manual adjustment. +This is another basic and simple to use package. Customisation options +include chord location and name (Do-Re-Mi instead of C-D-E), font, +transposition, and spacing. Chords overlaps need manual adjustment. \begin{source} \begin{verbatim} @@ -621,8 +704,8 @@ customisation options. Chords overlaps need manual adjustment. \usepackage{gtrcrd} \setlength{\crdheight}{2ex} % reduce spacing -\def\crdfont{\footnotesize \itshape \sffamily} % chord font -\setlength{\parindent}{0pt} +\def\crdfont{\footnotesize \itshape \sffamily} % setchord font +\setlength{\parindent}{0pt} % no indentation \begin{document} @@ -652,10 +735,11 @@ customisation options. Chords overlaps need manual adjustment. \label{sec:pkgsongs} This is a very powerful package that provides many features: chords -above lyrics, guitar chords diagrams, transposition, index generation, -multiple co\-lumns, and more. It allows for the creation of complete -songbooks; its guitar chord diagrams capabilities will be explained in -Section~\ref{sec:songs_cd}. +above lyrics, guitar chords diagrams (Section~\ref{sec:songs_cd}), +transposition, index generation, multiple columns, and more. Overall, +it allows for the creation of complete songbooks. + +% \enlargethispage{\baselineskip} \begin{source} \begin{verbatim} @@ -665,9 +749,10 @@ Section~\ref{sec:songs_cd}. \begin{document} -\renewcommand{\stitlefont}{\rm\large} \renewcommand{\lyricfont}{\small} \renewcommand{\printchord}{\it\small} +\afterpreludeskip=-18pt +\beforepostludeskip=-8pt \begin{songs}{} \beginsong{Imagine}[by={John Lennon}] @@ -696,8 +781,7 @@ This package is integrated with \pkg{musixtex} (Section~\ref{sec:musixtex}), and is also capable of producing sheet music and guitar chord diagrams. Its documentation is written in German; if you can't read it don't worry, the provided examples are -easy to understand. Chords overlaps need manual adjustment. A minimal -example: +easy to understand. Chords overlaps need manual adjustment. \begin{source} \begin{verbatim} @@ -734,13 +818,12 @@ example: % ----- \subsection{Package \pkg{leadsheets}} +\label{sec:leadsheets} -This package provides many features: music symbols, chords, MuseJazz -style, a \env{song} and a \env{verse} environment, transposition, a -\cmd{leadsheet} class, and templates. Overall, this package allows for -the creation of complete songbooks. A minimal example: - -% \medskip +This package provides many features: music and symbols, chords, +MuseJazz style, a \env{song} and a \env{verse} environment, +transposition, a \cmd{leadsheet} class, and templates. Overall, this +package allows for the creation of complete songbooks. \begin{source} \begin{verbatim} @@ -753,13 +836,14 @@ the creation of complete songbooks. A minimal example: \begin{song}{title={Imagine}, music={John Lennon}} \begin{verse} - \chord{C}Imagine there's \chord{Cmaj7}no \chord{F}heaven - - \chord{C}It's easy if \chord{Cmaj7}you \chord{F}try + Intro, $\times$ 2\\ + \chord{C}~ \chord{Cmaj7}~ \chord{F}~ - \chord{C}No hell \chord{Cmaj7}below \chord{F}us - - \chord{C}Above us \chord{Cmaj7}only \chord{F}sky + % The ^ character is a shortcut for \chord + \chord{C}Imagine there's ^{Cmaj7}no ^{F}heaven \\ + ^{C}It's easy if ^{Cmaj7}you ^{F}try \\ + ^{C}No hell ^{Cmaj7}below ^{F}us \\ + ^{C}Above us ^{Cmaj7}only ^{F}sky \\ \end{verse} \end{song} @@ -775,10 +859,7 @@ the creation of complete songbooks. A minimal example: \subsection{Package \pkg{songbook}} This is another powerful package that provides support for chords, -songs, overhead transparencies, and index generation. A minimal -example: - -% \medskip +songs, overhead transparencies, and index generation. \begin{source} \begin{verbatim} @@ -796,13 +877,13 @@ example: \Ch{C}~ \Ch{Cmaj7}~ \Ch{F}~ - \Ch{C}{Imagine} there's \Ch{Cmaj7}{no} \Ch{F}heaven +\Ch{C}{Imagine} there's \Ch{Cmaj7}{no} \Ch{F}heaven - \Ch{C}{It's} easy if \Ch{Cmaj7}{you} \Ch{F}{try} +\Ch{C}{It's} easy if \Ch{Cmaj7}{you} \Ch{F}{try} - \Ch{C}No hell \Ch{Cmaj7}{below} \Ch{F}us +\Ch{C}No hell \Ch{Cmaj7}{below} \Ch{F}us - \Ch{C}{Above} us \Ch{Cmaj7}{only} \Ch{F}{sky} +\Ch{C}{Above} us \Ch{Cmaj7}{only} \Ch{F}{sky} \end{document} \end{verbatim} @@ -855,10 +936,6 @@ chords''. The resulting song is: \scoreshort{chordii} -\bigskip - -The chord grid at the bottom is automatically added by the program. - % ----- \noteseparator @@ -870,16 +947,21 @@ The chord grid at the bottom is automatically added by the program. Guitar players may need to print \emph{guitar chords diagrams} and \emph{guitar tablatures}; both can be made with \LaTeX{} packages and -external programs. As a matter of fact, these musical features are not +external programs. As a matter of fact, these music features are not limited to the guitar; chord diagrams and tablatures apply to other stringed instruments as well. -Tablatures are a form of musical notation that is usually employed to +Tablatures are a form of music notation that is usually employed to show how a \emph{melody} should be fingered on the fretboard. Since tablatures are just a special form of music notation, we will deal with them after the section about sheet music. For the moment, let's see how to do guitar chord diagrams. +For an authoritative list of standard guitar chords diagrams, I +suggest that you visit \href{http://lilypond.org/doc/v2.18/% +Documentation/notation/predefined-fretboard-diagrams}{this useful +page}. + % ----- \subsection{Package \pkg{gchords}} @@ -986,8 +1068,9 @@ diagrams using a very simple syntax: \subsection{Package \pkg{guitarchordschemes}} -This package enables the creation of large guitar chord diagrams. The -main command is \ltx{chordscheme}, and is quite self-explanatory: +This package enables the creation of fully customisable guitar chord +diagrams and scales. The main command is \ltx{chordscheme}, and is +quite self-explanatory: \begin{source} \begin{verbatim} @@ -997,23 +1080,39 @@ main command is \ltx{chordscheme}, and is quite self-explanatory: \begin{document} +% general parameters +\setchordscheme{ + rotate=-90, + x-unit=2.5mm, % chord size, x + y-unit=3mm, % chord size, y + name-format=\bfseries, % chord name font + finger-format=\bfseries% + \footnotesize % fingering font +} + +\newsavebox{\Gstd} +\savebox{\Gstd}{ +\chordscheme[ % define the chord + name = G (Sol), % chord name + position = 1, % first fret position + finger = {2/5:2} , % fret, string, finger + finger = {3/6:3} , % fret, string, finger + finger = {3/1:4} , % fret, string, finger + ring = {2,3,4} % open strings +]} + +\newsavebox{\Gbarre} +\savebox{\Gbarre}{ \chordscheme[ -name = G (Sol), % chord name -position = 1, % first fret position -finger = {2/5:2} , % fret, string, finger -finger = {3/6:3} , % fret, string, finger -finger = {3/1:4} , % fret, string, finger -ring = {2,3,4} % open strings -] -% -\chordscheme[ -name = G (Sol) barre, -position = 3, -barre = 1/1-6, % fret, string range -finger = {2/3:2}, -finger = {3/5:3}, -finger = {3/4:4}, -] + name = G (Sol) barre, + position = 3, + barre = 1/1-6, % fret, string range + finger = {2/3:2}, + finger = {3/5:3}, + finger = {3/4:4} +]} + +\usebox{\Gstd}\usebox{\Gbarre} \end{document} \end{verbatim} @@ -1031,13 +1130,33 @@ finger = {3/4:4}, \label{sec:sheetmusic} In this section, we will learn how to produce sheet music in PDF -format for inclusion in \LaTeX{} documents. Sheet music can be -produced by \TeX{} itself, but we can use the output produced by one -of the several free and open source scorewriters. +format for inclusion in \LaTeX{} documents. Sheet music can be typeset +by \TeX{} itself, but we can also use the output produced by one of +the several free and open source scorewriters. + +In the next few sections, we will briefly examine each option. Music +notation languages will not be explained, for obvious space reasons. +Minimal sources will be listed to give minimal working examples and to +get acquainted with the notation complexity. + +% ----- + +\subsection{Which Notation Software?} + +I'm not going to suggest any particular music notation software. I do +have my personal preferences; I find some notations easier than +others; some programs have more features than others; and so on. +Nevertheless, I think that all packages and programs described in the +following sections have their advantages, and all of them can typeset +beautiful scores. Unless you need specific features, choosing a +typesetting software is mostly a matter of personal preference. Let's +put it this way: the best program is the one that lets you obtain the +results you need, with the least effort, in the least amount of time, +and the most fun. -In the next few sections, we will briefly examine each option. Musical -notation languages will not be explained; sources are listed to give -practical examples and to assess the language complexity. +All software described below is capable of typesetting complex Western +music: multiple voices and staves, symbols, dynamics, lyrics, text +annotations; sone of them can also do tablatures and more. % ----- @@ -1069,7 +1188,8 @@ related to \pkgname{MusiXTeX} are the following: \item \pkg{bizantinemusic} facilitates the writing of Byzantine music; - \item \pkg{figbas} provides mini fonts for figured bass notation; + \item \pkg{figbas} provides mini fonts for figured bass notation in + \pkgname{MusiXTeX}; \item \pkg{gregoriotex} provides engraving of Gregorian Chant (Section~\ref{sec:gregoriotex}); @@ -1090,11 +1210,58 @@ related to \pkgname{MusiXTeX} are the following: \end{itemize} +From \pkg{musixtex} home page: + +\begin{quote} + + MusiXTEX provides a set of macros, based on the earlier MusicTEX, + for typesetting music with \TeX. + +\end{quote} + \pkgname{MusiXTeX} is quite low-level, and the user must take care of such details as beam slope and note spacing; several examples are -available -\href{https://ctan.org/tex-archive/macros/musixtex/doc/examples}{here}. -\pkgname{MusiXTeX} input can also be embedded in \LaTeX{} documents: +available \href{https://ctan.org/tex-archive/macros/% +musixtex/doc/examples}{here}. Notably, it works with plain \TeX. (Ever +tried plain \TeX?) A minimal example (\file{sample-mtex.tex}): + +\begin{source} +\begin{verbatim} +% bare MusiXTeX example + +\input musixtex +\nopagenumbers + +\setstaffs1{1} % a single stave +\setclef1{\treble} % with a treble clef +\generalmeter{\meterC} % common time +\nobarnumbers % what it says +\startextract % a short music piece + % \qu = quarter note, stem up; + % \ql = quarter note, stem down; + % \Notes, \en = start and end of note line + \Notes \qu c \qu d \qu e \qu f \en + \bar + \Notes \qu g \qu{'a} \ql b \ql c \en +\endextract + +\end +\end{verbatim} +\end{source} + +We typeset the score with these commands: + +\begin{screen} +$ \textbf{tex sample-mtex.tex} +$ \textbf{dvips sample-mtex.dvi} +$ \textbf{ps2pdf sample-mtex.ps} +$ _ +\end{screen} + +\scoreshort{sample-mtex} + +\pkgname{MusiXTeX} input can also be embedded in \LaTeX{} documents +(\file{sam\-ple-m\-la\-tex.tex}): \begin{source} \begin{verbatim} @@ -1135,18 +1302,18 @@ A short music excerpt in MusiX\TeX: \end{music} -End of the excerpt. \end{document} \end{verbatim} \end{source} -\score{sample-musixtex} +\score{sample-mlatex} \bigskip -It looks a bit arcane, and I'll point you to the +Admittedly it looks a bit arcane, and I'll point you to the \href{http://mirrors.ctan.org/macros/musixtex/doc/musixdoc.pdf} -{documentation} for explanations. +{documentation} for explanations. I suggest that you learn at least +the basics of it; several useful packages are based on this syntax. \pkgname{M-Tx} employs a much simpler notation than \pkgname{MusiXTeX}. This is a standalone music sample @@ -1157,7 +1324,7 @@ It looks a bit arcane, and I'll point you to the \begin{verbatim} % music sample in M-Tx notation -Title: Music sample in M-tx +Title: \bigtype Music sample in M-tx Style: Solo Meter: C Width: 140mm @@ -1170,8 +1337,8 @@ We typeset the score with this command: \begin{screen} $ \textbf{musixtex sample-mtx.mtx} -This is musixtex.lua version 0.17a. -==> This is M-Tx 0.62 (Music from TeXt) <08 February 2016> +This is musixtex.lua version 0.21. +==> This is M-Tx 0.63a (Music from TeXt) <8 April 2018> ==>> Input from file sample-mtx.mtx ... sample-mtx.pdf generated by ps2pdf. @@ -1179,9 +1346,9 @@ $ _ \end{screen} % $ -which produces \file{sample-mtx.pdf}. In older versions of -\pkgname{M-Tx}, the command was \cmd{m-tx}, which has been retired and -replaced by \cmd{musixtex}. This is the resulting score: +\noindent which produces \file{sample-mtx.pdf}. In older versions of +\pkgname{M-Tx}, the command was \cmd{m-tx}; it has now been retired +and replaced by \cmd{musixtex}. This is the resulting score: \bigskip @@ -1208,7 +1375,7 @@ copied to the same directory as the source file; all included \pkgname{M-Tx} files must be copied there too. We already met \file{sample-mtx.mtx}; the following is another short -excerpt called \file{scale.mtx}. It produces a 30mm wide scale: +excerpt, \file{scale.mtx}. It produces a 30mm wide scale: \begin{source} \begin{verbatim} @@ -1233,10 +1400,10 @@ Finally, this is the main file \file{sample-latexmtx.ltx}: \begin{document} -This \LaTeX{} document includes music written in M-Tx. The \texttt{mus} -environment includes music inline: \begin{mus} \input{scale.tex} -\end{mus} , while the \texttt{excerpts} environment is used for longer -excerpts: +This \LaTeX{} document includes music written in M-Tx. The +\texttt{mus} environment includes music inline: +\begin{mus} \input{scale.tex} \end{mus} , while the +\texttt{excerpts} environment is used for longer excerpts: \medskip @@ -1244,10 +1411,6 @@ excerpts: \input{sample-mtx.tex} \end{excerpts} -\medskip - -End of document. - \end{document} \end{verbatim} \end{source} @@ -1273,8 +1436,8 @@ output: \bigskip Please also note that the \pkgname{M-Tx} excerpts cannot be resized as -if they were included PDF files: their geometry is set in the -\pkgname{M-Tx} source! +if they were included PDF files: their geometry, in fact, is set in +the \pkgname{M-Tx} source. % ----- @@ -1299,7 +1462,7 @@ e(ixjvIH'GhvF'E)l\'e(ghg')i(g)son.(f.) \end{alltt} \end{source} -We also need a \LaTeX{} source, \file{kyrie.tex}: +We also need an auxiliary \LaTeX{} source, \file{kyrie.tex}: \begin{source} \begin{verbatim} @@ -1338,10 +1501,10 @@ GNU GPL. From the LilyPond home page: \begin{quote} -LilyPond is a music engraving program, devoted to producing the -highest-quality sheet music possible. It brings the aesthetics of -traditionally engraved music to computer printouts. LilyPond is free -software and part of the \href{http://gnu.org/}{GNU Project}. + LilyPond is a music engraving program, devoted to producing the + highest-quality sheet music possible. It brings the aesthetics of + traditionally engraved music to computer printouts. LilyPond is free + software and part of the \href{http://gnu.org/}{GNU Project}. \end{quote} @@ -1425,14 +1588,12 @@ environment: \begin{lilypond} \score { - << - \relative c' { - \time 4/4 - \clef treble - c4 d8 e f8 g a b | c4 b8 a g8 f e d | - c8 g' e g c,8 g' e g | c,4 e c r \bar "|." - } - >> + \relative c' { + \time 4/4 + \clef treble + c4 d8 e f8 g a b | c4 b8 a g8 f e d | + c8 g' e g c,8 g' e g | c,4 e c r \bar "|." + } } % end of score \end{lilypond} @@ -1495,14 +1656,12 @@ environment: \begin{lilypond} \score { - << - \relative c' { - \time 4/4 - \clef treble - c4 d8 e f8 g a b | c4 b8 a g8 f e d | - c8 g' e g c,8 g' e g | c,4 e c r \bar "|." - } - >> + \relative c' { + \time 4/4 + \clef treble + c4 d8 e f8 g a b | c4 b8 a g8 f e d | + c8 g' e g c,8 g' e g | c,4 e c r \bar "|." + } } % end of score \end{lilypond} @@ -1551,7 +1710,7 @@ formats are available. ABC is a simple text notation, originally designed for single-voice music but currently capable of producing complex polyphonic scores. -This is our usual music sample in ABC notation: +This is our usual music sample in ABC notation (\file{sample-abc.abc}): \begin{source} \begin{verbatim} @@ -1658,7 +1817,7 @@ released under the GNU GPL. From the PMW home page: PMW uses a simple text notation for music input and produces output in PostScript. -This is our usual music sample in PMW format: +This is our usual music sample in PMW format (\file{sample-pmw.pmw}): \begin{source} \begin{verbatim} @@ -1688,8 +1847,8 @@ $ _ \subsection{Program: \href{http://www.arkkra.com/}{MUP}} -MUP is a free and multiplatform scorewriter, released under the GNU -GPL. From the MUP home page: +MUP is a free and multiplatform scorewriter, released under a free +license. From the MUP home page: \begin{quote} @@ -1699,7 +1858,7 @@ GPL. From the MUP home page: \end{quote} -This is our usual music sample in MUP format: +This is our usual music sample in MUP format (\file{sample-mup.mup}): \begin{source} \begin{verbatim} @@ -1771,7 +1930,8 @@ This package enables the inclusion of music in ABC notation in \pkgname{Abc} provides the \env{abc} environment and the \ltx{abcinput} commands. The first embeds ABC music in the source, -while the second includes an external ABC file: +while the second includes an external ABC file. This is +(\file{sample-abc.tex}): \begin{source} \begin{verbatim} @@ -1833,16 +1993,20 @@ $ _ \label{sec:tablatures} Let's go back to guitar stuff. Tablature, as already explained, is a -form of musical notation for stringed instruments; making tablatures -is basically the same process as making sheet music. +form of music notation for stringed instruments; making tablatures is +basically the same process as making sheet music. + +We can distinguish between \emph{automatic tablatures}, where fret +positions are generated by the program, and \emph{manual tablatures}, +where fret positions are specified by the user. % ----- \subsection{Program: \href{http://lilypond.org/}{LilyPond}} \label{sec:lilytab} -In addition to sheet music, LilyPond can also easily typeset guitar -tablatures. A minimal example (\file{lilytab.ly}): +In addition to sheet music, LilyPond can also easily typeset automatic +guitar tablatures. A minimal example (\file{lilytab.ly}): \begin{source} \begin{verbatim} @@ -1852,13 +2016,13 @@ tablatures. A minimal example (\file{lilytab.ly}): music = { \time 3/4 - c4 d e f g a b a b c'2 r4 + c4 d e f g a b a b c'2 r4 \bar "|." } \score { << \new Staff { \clef "G_8" \music } % sheet music - \new TabStaff { \music } % tablature + \new TabStaff { \tabFullNotation \music } % tablature >> } \end{verbatim} @@ -1879,7 +2043,7 @@ $ _ \bigskip -As you can see, the very same music line can be typeset as sheet music +As we can see, the very same music line can be typeset as sheet music and as guitar tablature. Fretboard positions are automatically generated by LilyPond. @@ -1890,9 +2054,9 @@ generated by LilyPond. \label{sec:abc2xml} This Python program converts an ABC file to a -\href{https://www.musicxml.com/}{MusicXML} file containing tablature -information; this file can then be typeset with any MusicXML-enabled -application, like MuseScore. +\href{https://www.musicxml.com/}{MusicXML} file containing automatic +tablature information; this file can then be typeset with any +MusicXML-enabled application, like MuseScore. A minimal tablature example (\file{abctab.abc}): @@ -1933,7 +2097,7 @@ $ _ \bigskip -As you can see, the very same music line can be typeset as sheet music +As we can see, the very same music line can be typeset as sheet music and as guitar tablature. Fretboard positions are automatically generated by \cmd{abc2xml.py}. @@ -1966,12 +2130,51 @@ MusicXML import filter, and it may fail on complex music. % ----- +\subsection{Package \pkg{musixtex}} + +Starting from version 1.29, \pkgname{MusiXTeX} can also make manual +tablatures for several stringed instruments. A minimal example, to be +typeset with \cmd{musixtex} (\file{sample-musixtex-tab.tex}): + +\begin{source} +\begin{verbatim} +% bare MusiXTeX example + +\input musixtex +\nopagenumbers + +This is a MusiXTeX tablature example: + +\setlines16 % six lines +\setstaffs1{1} +\setclefsymbol1{\tabclef} % and a TAB clef +\nobarnumbers +\let\extractline\leftline % left aligned + +\startextract + \Notes \tab{5}{3} \tab{4}{0} \tab{4}{2} \en + \bar + \Notes \tab{4}{3} \tab{3}{0} \tab{3}{2} \en + \bar + \Notes \tab{2}{0} \tab{3}{2} \tab{2}{0} \en + \bar + \Notes \tab{2}{1} \qp \qp \en +\endextract + +\end +\end{verbatim} +\end{source} + +\scoreshort{sample-musixtex-tab} + +% ----- + \subsection{Package \pkg{guitartabs}} This package may be missing in less recent releases of TeX Live, so you might have to install it manually. It provides a \cmd{guitartabs} -document class and a very simple syntax to denote strings, fret -positions, and note length: +document class and a very simple syntax to manually specify strings, +fret positions, and note length: \begin{source} \begin{verbatim} @@ -2018,12 +2221,6 @@ tablature, use \ltx{note} instead of \ltx{notel}. % ----- -% \subsection{Package \href{https://github.com/huljar/musixtab}{musixtab}} - -% TO BE WRITTEN - -% ----- - \subsection{Using Guitar Pro Tablatures} A \emph{de facto} standard for guitar tablatures is the @@ -2049,12 +2246,120 @@ contain the tablature. % ----- +\section{Bits and Pieces} + +\subsection{Multimedia Files} +\label{sec:multimedia} + +In addition to sheet music, our documents can also include sound +files. To be more precise, we can click on a link to an external sound +file that is referred to in the PDF document; the default player will +be run. + +This feature is made possible by the \pkg{hyperref} package, which +provides the \ltx{href} command: + +\begin{source} +\begin{verbatim} +\href{run:jingle.midi}{this midi file} +\end{verbatim} +\end{source} + +The first parameter opens the specified file with the default +multimedia player; the second parameter creates a link to click on. +For example, the above line lets the reader click on +\href{run:jingle.midi}{this midi file} and listen to it. The operating +system must know how to play the specified sound file. + +The link need not be just text; we may as well apply the link to +included graphics. + +% ----- + +\subsection{Notation Source Files} +\label{sec:sources} + +If we need to include notation source files, we could use a simple +\cmd{verbatim} environment, or \cmd{alltt} (package \pkg{alltt}) if we +also want to include \LaTeX{} commands in the source: + +\bigskip + +\noindent +{ \small +\begin{boxedminipage}[c]{0.52\linewidth} +\begin{verbatim} +\textit{\% This is a comment!} +\textbf{X:} 1 +\textbf{L:} 1/4 +\textbf{K:} C +\textit{\% These are notes:} +c G/G/ _AG|z !>!B!>!c z|] +\end{verbatim} +\end{boxedminipage} +\hspace{2em} +\begin{boxedminipage}[c]{0.4\linewidth} +\begin{alltt} +\textit{\% This is a comment!} +\textbf{X:} 1 +\textbf{L:} 1/4 +\textbf{K:} C +\textit{\% These are notes:} +c G/G/ _AG|z !>!B!>!c z|] +\end{alltt} +\end{boxedminipage} +} % \small + +\bigskip + +But if you want something fancier, like the sources included in this +document, you could also use the \pkg{tcolorbox} and define a new +environment like the following: + +\bigskip + +\begin{tcolorbox}[breakable,boxrule=0.2pt,% + left=0pt,right=0pt,colback=green!7!white,arc=2pt] +\begin{verbatim} +\newenvironment{source} +{ % beg def + \medskip + \small + \begin{margins}{-0.3cm}{-0.3cm} + \begin{spacing}{0.9} + \begin{tcolorbox}[breakable,boxrule=0.2pt,% + left=0pt,right=0pt,colback=green!7!white,arc=2pt] + \begin{alltt} +} +{ % end def + \end{alltt} + \end{tcolorbox} + \end{spacing} + \end{margins} +} +\end{verbatim} +\end{tcolorbox} + +% ----- + +\noteseparator + +% ----- + \section{Putting It All Together} We have solved the first problem; now we know how to make music files in several different ways. Now it's time to solve the second problem: how to combine music files and \LaTeX. +We have two possible approaches: keeping all music in the \LaTeX{} +source, or keeping the music in external files. Both approaches have +advantages and disadvantages. Basically, the first method is slower, +because any change in the source may require recompilation of music +excerpts. The second method requires a little more work, because we +need to maintain an additional file that takes care of music +conversion. + % ----- \subsection{Package \pkg{abc}, Revisited} @@ -2119,9 +2424,6 @@ Section~\ref{sec:abcall}. % ----- - -% ----- - \subsection{Using \cmd{make}} Another way to make a \LaTeX{} document that includes music in @@ -2204,24 +2506,30 @@ music3.pdf: music3.abc Let's see what it does. First of all, as you might have guessed the \cmd{\#} character starts a comment; the rest of the line is ignored. -The line: +This line: +\begin{source} \begin{verbatim} FIGURES = music1.pdf music2.pdf music3.pdf \end{verbatim} +\end{source} +\noindent creates a \emph{variable}, that is a ``name'' (\cmd{FIGURES}) that ``contains'' the three file names \cmd{music1.pdf music2.pdf music3.pdf}. This variable will be referred to later on. -The lines: +These lines: +\begin{source} \begin{verbatim} main.pdf: main.tex $(FIGURES) pdflatex main.tex \end{verbatim} +\end{source} % $ +\noindent declare that \cmd{main.pdf} is a \emph{target} that depends on \file{main.tex} and on the three files denoted by the \cmd{FIGURES} variable. The second line specifies the command that must be run to @@ -2232,12 +2540,15 @@ Then we have three sections, one for each music file. Each section tells \cmd{make} what to do to compose the PDF figure. For instance, the section: +\begin{source} \begin{verbatim} music1.pdf: music1.mtx musixtex music1.mtx ; pdfcrop musix1.pdf ; \ /bin/mv musix1-crop.pdf music1.pdf \end{verbatim} +\end{source} +\noindent states that \file{music1.pdf} is a target that depends on \file{music1.mtx}; the following lines specify the commands to create \file{music1.pdf}. Commands are separated by the \cmd{;} character, @@ -2252,6 +2563,7 @@ $ \textbf{make} $ _ \end{screen} +\noindent in the same directory where we saved \file{Makefile}. \cmd{make} will make the three figures first, then \file{main.pdf} that depends on them. @@ -2270,6 +2582,7 @@ compiled using \cmd{make} and a pretty long \file{Makefile}. % ----- +\newpage \section{The End} That's it, dear fellow musicians: I really hope that this guide will @@ -2278,10 +2591,21 @@ suggestions, comments, or contributions, please feel free to contact me by \href{mailto:guido.gonzato@gmail.com}{email}. I'd like to receive feedback, especially if you use this document in education. +I would like to thank all the geniuses who wrote the packages and +programs cited in this guide. Kudos and hats off, folks! + This document is copyleft \copyleft{} Guido Gonzato, PhD, and released under the \href{https://www.gnu.org/licenses/fdl.html}{GNU Free Documentation Licence}. +\medskip + +\begin{center} + \includegraphics{guidopiper.jpeg} +\end{center} + +Ciao! \texttt{=8-)} + % ----- \noteseparator @@ -2310,81 +2634,81 @@ used to make this manual, in order of appearance. typesetting music and related stuff.''\\ \url{https://www.ctan.org/topic/music}. - \item Package: musicography.\\ + \item Package: musicography, v. 2018-05.21.\\ \url{https://ctan.org/pkg/musicography} - \item Package: leadsheets.\\ + \item Package: leadsheets, v. 0.5b\\ \url{https://ctan.org/pkg/leadsheets} - \item Package: lilyglyphs.\\ + \item Package: lilyglyphs, v. 0.2.3\\ \url{https://ctan.org/pkg/lilyglyphs} - - \item Font: Bravura.\\ + + \item Font: Bravura, v.1.272\\ \url{https://www.smufl.org/fonts} - \item Package: guitar.\\ + \item Package: guitar, v. 1.6\\ \url{https://ctan.org/pkg/guitar} - \item Package: gtrcrd.\\ + \item Package: gtrcrd, v. 1.1\\ \url{https://ctan.org/pkg/gtrcrd} - \item Package: songs.\\ + \item Package: songs, v. 3.0\\ \url{https://ctan.org/pkg/songs} - \item Package: musixguit.\\ + \item Package: musixguit, v. 1.2.2\\ \url{https://ctan.org/pkg/musixguit} - \item Package: songbook.\\ + \item Package: songbook, v. 4.5\\ \url{https://ctan.org/pkg/songbook} - \item Program: Chordii.\\ + \item Program: Chordii, v. 4.3\\ \url{https://www.vromans.org/projects/Chordii} - \item Package: gchords.\\ + \item Package: gchords, v. 1.20\\ \url{https://ctan.org/pkg/gchords} - \item Package: guitarchordschemes.\\ + \item Package: guitarchordschemes, v. 0.7\\ \url{https://ctan.org/pkg/guitarchordschemes} - \item Package: guitartabs.\\ + \item Package: guitartabs, v. 2018-05-01\\ \url{https://ctan.org/pkg/guitartabs} \item Page: MusiXTeX and Related Software. \\ \url{https://icking-music-archive.org/software/htdocs/htdocs.html} - \item Package: MusiXTeX.\\ + \item Package: MusiXTeX, v. 1.29\\ \url{https://ctan.org/pkg/musixtex} - \item Package: M-Tx.\\ + \item Package: M-Tx, v. 0.63a\\ \url{https://ctan.org/pkg/m-tx} - \item Package: Gregoriotex.\\ + \item Package: Gregoriotex, v. 5.1.1\\ \url{https://ctan.org/pkg/gregoriotex}\\ \url{http://gregorio-project.github.io/gregoriotex}\\ \url{http://gregorio-project.github.io} - \item Program: LilyPond.\\ + \item Program: LilyPond, v. 1.18.2\\ \url{http://lilypond.org} - \item Package: Lyluatex.\\ + \item Package: Lyluatex, v. 1.0b\\ \url{https://ctan.org/pkg/lyluatex} - \item Programs: \cmd{abcm2ps}, \cmd{and2svg}.\\ + \item Programs: \cmd{abcm2ps} v. 8.14.2, \cmd{and2svg} v. 1.19.0\\ \url{http://moinejf.free.fr} - \item Program: PMW, Philip's Music Writer.\\ + \item Program: PMW, Philip's Music Writer, v. 4.30\\ \url{http://people.ds.cam.ac.uk/ph10/pmw.html} - \item Program: MUP.\\ + \item Program: MUP v. 6.6\\ \url{http://www.arkkra.com} - \item Program: MuseScore.\\ + \item Program: MuseScore v. 3.0\\ \url{http://musescore.org} - \item Package: Abc.\\ + \item Package: Abc v. 2.0b\\ \url{https://ctan.org/pkg/abc} - \item Program: abc2xml.ly.\\ + \item Program: abc2xml.ly v. 218\\ \url{https://wim.vree.org/svgParse/abc2xml.html} \end{itemize} @@ -2461,7 +2785,7 @@ uses \texttt{abc.sty} and defines new environments. This is a short piece, typeset by M-Tx: \begin{mtx} -Title: Music sample in M-Tx +Title: \bigtype Music sample in M-Tx Style: Solo Meter: C Width: 160mm @@ -2565,101 +2889,100 @@ and \ref{sec:pkgguitar}). The resulting PDF has its own page numbers \title{A Minimal Songbook} \author{Guido Gonzato} +\date{\today} \maketitle - \tableofcontents -\bigskip -\hrule - % ----- \section{For He's a Jolly Good Fellow} -According to the 1998 Guinness World Records, this is the second most -recognized song in the English language. +% Typically sung to congratulate somebody. + +\smallchords \def\numfrets{4} -\chords{ -\chord{t}{n,p3,p2,n,p1,n}{C} -\chord{t}{p3,p2,n,n,n,p3}{G} -\chord{t1}{n,p2,p2,p1,n,n}{F} +\begin{minipage}[c]{\linewidth} % use less space + \chords{ + \chord{t}{n,p3,p2,n,p1,n}{C} + \chord{t}{p3,p2,n,n,n,p3}{G} + \chord{t}{n,p3,p2,p3,p1,n}{C7} + \chord{t1}{n,p2,p2,p1,n,n}{F} } +\end{minipage} \medskip \includegraphics[width=\textwidth]{fellow} +\bigskip + +\begin{guitar} + +For [C]he's a jolly good fellow, +For [G]he's a jolly good [C]fellow, +For [C7]he's a jolly good [F]fellow, +Which [C]nobody [G]can [C]deny. + +\end{guitar} + % ----- \section{Happy Birthday To You} -According to the 1998 Guinness World Records, it is the most -recognized song in the English language, followed by ``For He's a -Jolly Good Fellow''. +% Sung to remind somebody they're growing old. \def\numfrets{4} -\chords{ -\chord{t1}{n,p2,p2,p1,n,n}{F} -\chord{t}{n,p3,p2,n,p1,n}{C} -\chord{t}{n,p3,p2,p3,p1,n}{C7} -\chord{t1}{n,n,p2,p2,p2,n}{B$\flat$} +\begin{minipage}[c]{\linewidth} + \chords{ + \chord{t1}{n,p2,p2,p1,n,n}{F} + \chord{t}{n,p3,p2,n,p1,n}{C} + \chord{t}{n,p3,p2,p3,p1,n}{C7} + \chord{t1}{n,n,p2,p2,p2,n}{Bb} } +\end{minipage} \medskip \includegraphics[width=\textwidth]{happyb} +\bigskip + +\begin{guitar} +Happy [F]birthday to [C]you, +Happy [C7]birthday to [F]you, +Happy birthday dear [Bb]Guido, +Happy [F]birthday [C]to [F]you! +\end{guitar} + % ----- -\section{Twinkle, Twinkle Little Star} +\section{Warm Kitty} -This is a popular English lullaby. +% No need to introduce this lullaby! \def\numfrets{4} +\begin{minipage}[c]{\linewidth} \chords{ -\chord{t}{n,p3,p2,n,p1,n}{C} -\chord{t1}{n,p2,p2,p1,n,n}{F} -\chord{t}{x,n,n,p2,p3,p1}{Dm} -\chord{t}{p3,p2,n,n,n,p3}{G} + \chord{t}{n,n,p2,p2,p2,n}{A} + \chord{t}{n,p2,p2,p1,n,n}{E} + \chord{t}{n,p2,p2,p1,p3,n}{E7} } +\end{minipage} -\includegraphics[width=\textwidth]{twinkle} +\medskip -\medskip +\includegraphics[width=\textwidth]{warm} + +\bigskip \begin{guitar} -[C]Twinkle, twinkle, [F]little [C]star, -[Dm]How I [C]wonder [G]what you [C]are! -[C]Up a[Dm]bove the [C]world so [G]high, -[C]Like a [Dm]diamond [C]in the [G]sky. -Twinkle{\ldots} - -[C]When this blazing [F]sun is [C]gone, -[Dm]When he [C]nothing [G]shines u[C]pon, -[C]Then you [Dm]show your [C]little [G]light, -[C]Twinkle, [Dm]twinkle, [C]through the night. -Twinkle{\ldots} - -[C]Then the [F]traveller in the [C]dark -[Dm]Thanks you [C]for your [G]tiny [C]spark; -[C]He could [Dm]not see [C]where to [G]go, -[C]If you [Dm]did not [C]twinkle [G]so. -Twinkle{\ldots} - -[C]In the dark blue [F]sky you [C]keep, -And [Dm]often [C]through my [G]curtains [C]peep, -[C]For you [Dm]never [C]shut your [G]eye -[C]Till the [Dm]sun is [C]in the [G]sky. -Twinkle{\ldots} - -[C]As your bright and [F]tiny [C]spark -[Dm]Lights the [C]traveller [G]in the [C]dark, -[C]Though I [Dm]know not [C]what you [G]are, -[C]Twinkle, [Dm]twinkle, [C]little [G]star. -Twinkle{\ldots} +[A]Soft kitty, [E]warm kitty +[A]Little ball of [E]fur [E7]~ +[A]Happy kitty, [E]sleepy kitty +[A]Purr, [E]purr, [A]purr \end{guitar} @@ -2667,7 +2990,11 @@ Twinkle{\ldots} \end{verbatim} \end{source} +\newpage + +\pagecolor{pdfbg} \includepdf[pages=-,pagecommand={}]{sample-songbook.pdf} +\pagecolor{white} % ----- @@ -2679,36 +3006,102 @@ files. \begin{source} \begin{verbatim} -# Makefile for songbook.tex +# Makefile for sample-songbook -FIGURES = fellow.pdf happyb.pdf twinkle.pdf +FIGURES = fellow.pdf happyb.pdf warm.pdf -songbook: songbook.tex $(FIGURES) - pdflatex songbook.tex +sample-songbook: sample-songbook.tex $(FIGURES) + pdflatex sample-songbook.tex; \ + pdflatex sample-songbook.tex; \ + pdflatex sample-songbook.tex fellow.pdf: fellow.abc abcm2ps -c -O= fellow.abc; \ - ps2pdf fellow.ps; \ - pdfcrop fellow.pdf; \ + ps2pdf fellow.ps; pdfcrop fellow.pdf; \ /bin/mv -f fellow-crop.pdf fellow.pdf happyb.pdf: happyb.abc abcm2ps -O= happyb.abc; \ - ps2pdf happyb.ps; \ - pdfcrop happyb.pdf; \ + ps2pdf happyb.ps; pdfcrop happyb.pdf; \ /bin/mv -f happyb-crop.pdf happyb.pdf -twinkle.pdf: twinkle.abc - abcm2ps -O= twinkle.abc; \ - ps2pdf twinkle.ps; \ - pdfcrop twinkle.pdf; \ - /bin/mv -f twinkle-crop.pdf twinkle.pdf +warm.pdf: warm.abc + abcm2ps -O= warm.abc; \ + ps2pdf warm.ps; pdfcrop warm.pdf; \ + /bin/mv -f warm-crop.pdf warm.pdf clean: /bin/rm -f .*~ *~ *aux *bak *lo? *to? *out *tmp *bbl *ps \end{verbatim} \end{source} +% $ + +% ----- + +\subsection{Verses and Guitar Chords Diagrams} + +Combining verses and guitar chord diagrams can be done in several +ways. I think that the following example shows two of the easiest +methods. Please refer to Section~\ref{sec:pkgguitar} and +Section~\ref{sec:gchords} for further details. + +\begin{source} +\begin{verbatim} +\documentclass{article} +\usepackage{guitar} +\usepackage{gchords} +\thispagestyle{empty} + +\newcommand{\C}{\hspace{-0.8em}\chord{t}{n,p3,p2,n,p1,n}{C}} +\newcommand{\CmajVII}{\hspace{-0.8em}\chord{t}{n,p3,p2,n,n,n}{Cmaj7}} +\newcommand{\F}{\hspace{-0.8em}\chord{t1}{n,p2,p2,p1,n,n}{F}} + +\def\chordsize{1.5mm} +\def\numfrets{3} +\def\namefont{\it} + +\begin{document} + +\noindent +We can typeset verses and guitar chord grids in a \texttt{guitar} +environment: + +\bigskip + +\begin{minipage}[c]{\linewidth} % to avoid indentation + \begin{guitar} + + \textbf{Imagine (John Lennon)} + \emph{Intro, $\times$ 2} + [\C] \hspace{2em} [\CmajVII] \hspace{2em} [\F] \hspace{2em} + [\C]Imagine there's [\CmajVII|]{no} ~ [\F]heaven + [\C]It's easy if [\CmajVII|]{you} ~ [\F]try + + \end{guitar} +\end{minipage} + +\noindent +{\ldots}and so on. But we could just use the \verb|\upchord| command, +provided by \texttt{gchords}: + +\begin{verse} + + \upchord{\C}Imagine there's \upchord{\CmajVII}no \qquad + \upchord{\F}heaven + + \upchord{\C}It's easy if \upchord{\CmajVII}you \qquad + \upchord{\F}try + +\end{verse} + +\end{document} +\end{verbatim} +\end{source} + +\score{verses-chords} + +% ----- \end{document} -% --- end of file latex4musicians.tex +%% --- end of file latex4musicians.tex |