The Songs Package

This webpage documents the Songs LaTeX Package. For an overview of the software and for download information, see the Songs Package Homepage.

This webpage was generated semi-automatically from the official documentation (available online in pdf form). This web version omits the package implementation details and associated commentary. For full documentation including implementation commentary, please consult the songs.pdf file.


The songs package produces songbooks that contain lyrics and chords (but not full sheet music). It allows lyric books, chord books, overhead slides, and digital projector slides to all be maintained and generated from a single LaTeX source document. Automatic transposition, guitar tablature diagrams, handouts, and a variety of specialized song indexes are supported.

1 Introduction

The songs LaTeX package produces books of songs that contain lyrics and (optionally) chords. A single source document yields a lyric book for singers, a chord book for musicians, and overhead or digital projector slides for corporate singing.

The software is especially well suited for churches and religious fellowships desiring to create their own books of worship songs. Rather than purchasing a fixed hymnal of songs, the songs package allows worship coordinators to maintain a constantly evolving repertoire of music to which they can add and remove songs over time. As the book content changes, the indexes, spacing, and other formatting details automatically adjust to stay consistent. Songs can also be quickly selected and arranged for specific events or services through the use of scripture indexes, automatic transposition, and handout and slide set creation features.

2 Terms of Use

The songs package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. A copy of the license can be found in section 14.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License in section 14 for details. A copy of the license can also be obtained by writing to the Free Software Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301, USA.

This software is copyright © 2017 Kevin W. Hamlen. For contact information or the latest version, see the project webpage at:

3 Sample Document

For those who would like to start making song books quickly, the following is a sample document that yields a simple song book with one song. Starting from this template, you can begin to add songs and customizations to create a larger book. Instructions for compiling this sample song book follow the listing.




\songsection{Worship Songs}

\beginsong{Doxology}[by={Louis Bourgeois and Thomas Ken},
                     sr={Revelation 5:13},
                     cr={Public domain.}]
\[G]Praise God, \[D]from \[Em]Whom \[Bm]all \[Em]bless\[D]ings \[G]flow;
\[G]Praise Him, all \[D]crea\[Em]tures \[C]here \[G]be\[D]low;
\[Em]Praise \[D]Him \[G]a\[D]bove, \[G]ye \[C]heav'n\[D]ly \[Em]host;
\[G]Praise Fa\[Em]ther, \[D]Son, \[Am]and \[G/B G/C]Ho\[D]ly \[G]Ghost.


To compile this book, run LaTeX (pdflatex is recommended):

pdflatex mybook.tex

(where mybook.tex is the name of the source document above). The final document is named mybook.pdf if you use pdflatex or mybook.dvi if you use regular latex.

Note that compiling a document that includes indexes requires extra steps. See section 10.3 for details.

4 Initialization and Options

Each LaTeX document that uses the songs package should contain a line like the following near the top of the document:


Supported <options> include the following:


Output Type.  The songs package can produce four kinds of books: lyric books, chord books, books of overhead slides, and raw text output. You can specify which kind of book is to be produced by specifying one of lyric, chorded, slides, or rawtext as an option. The slides and chorded options can be used together to create chorded slides. If no output options are specified, chorded is the default.

Lyric books omit all chords, whereas chord books include chords and additional information for musicians (specified using \musicnote). Books of overhead slides typeset one song per page in a large font, centered.

Raw text output yields an ascii text file named <jobname>.txt (where <jobname> is the root filename) containing lyrics without chords. This can be useful for importing song books into another program, such as a spell-checker.


Chords can be turned on or off in the middle of the document by using the \chordson or \chordsoff macros.


Slides mode can be activated in the middle of the document by using the \slides macro. For best results, this should typically only be done in the document preamble or at the beginning of a fresh page.


Measure Bars.  The songs package includes a facility for placing measure bars in chord books (see section 5.7). To omit these measure bars, use the nomeasures option; to display them, use the showmeasures option (the default). Measure bars can also be turned on or off in the middle of the document by using the \measureson or \measuresoff macros.


Transposition.  The transposecapos option changes the effect of the \capo macro. Normally, using \capo{<n>} within a song environment produces a textual note in chord books that suggests the use of a guitar capo on fret <n>. However, when the transposecapos option is active, these textual notes are omitted and instead the effect of \capo{<n>} is the same as for \transpose{<n>}. That is, chords between the \capo macro and the end of the song are automatically transposed up by <n> half-steps. This can be useful for adapting a chord book for guitarists to one that can be used by pianists, who don't have the luxury of capos. See section 5.8 and section 7 for more information on the \capo and \transpose macros.


Indexes.  The noindexes option suppresses the typesetting of any in-document indexes. Display of indexes can also be turned on or off using the \indexeson and \indexesoff macros.


PDF bookmark entries and hyperlinks can be suppressed with the nopdfindex option. For finer control of PDF indexes, see section 11.6.


Scripture Quotations.  The noscripture option omits scripture quotations (see section 8.2) from the output. You can also turn scripture quotations on or off in the middle of the document by using \scriptureon or \scriptureoff, respectively.


Shaded Boxes.  The noshading option causes all shaded boxes, such as those that surround song numbers and textual notes, to be omitted. You might want to use this option if printing such shaded boxes causes problems for your printer or uses too much ink.


Partial Song Sets.  Often it is useful to be able to extract a subset of songs from the master document—e.g. to create a handout or set of overhead slides for a specific worship service. To do this, you can type \includeonlysongs{<songlist>} in the document preamble (i.e., before the \begin{document} line), where <songlist> is a comma-separated list of the song numbers to include. For example,


creates a document consisting only of songs 37, 50, and 2, in that order.

Partial books generated with \includeonlysongs omit all scripture quotations (section 8.2), and ignore uses of \nextcol, \brk, \sclearpage, and \scleardpage between songs unless they are followed by a star (e.g., \nextcol*). To force a column- or page-break at a specific point in a partial book, add the word nextcol, brk, sclearpage, or scleardpage at the corresponding point in the <songlist>.

The \includeonlysongs macro only reorders songs within each songs environment (see section 5), not between different songs environments. It also cannot be used in conjunction with the rawtext option.

5 Songs

5.1 Beginning a Song


Song Sets.  Songs are contained within songs environments. Each songs environment begins and ends with:


<indexes> is a comma-separated list of index <id>'s (see section 10.1)—one identifier for each index that is to include songs in this song set. Between the \begin{songs} and \end{songs} lines of a song section only songs (see below) or inter-song environments (see section 8) may appear. No text in a songs environment may appear outside of these environments.


Songs.  A song begins and ends with:


Songs should appear only within songs environments (see above) unless you are supplying your own page-builder (see section 11.5).

In the \beginsong line, <titles> is one or more song titles separated by \\. If multiple titles are provided, the first is typeset normally atop the song and the rest are each typeset in parentheses on separate lines.

The [<otherinfo>] part is an optional comma-separated list of key-value pairs (keyvals) of the form <key>=<value>. The possible keys and their values are:

by={<authors>}authors, composers, and other contributors
cr={<copyright>}copyright information
li={<license>}licensing information
sr={<refs>}related scripture references
index={<lyrics>}an extra index entry for a line of lyrics
ititle={<title>}an extra index entry for a hidden title

For example, a song that begins and ends with

\beginsong{Title1 \\ Title2}[by={Joe Smith}, sr={Job 3},
  cr={\copyright~2017 XYZ.}, li={Used with permission.}]

looks like

document fragment

The four keyvals used in the above example are described in detail in the remainder of this section; the final two are documented in section 10.2. You can also create your own keyvals (see section 11.8).


Song Authors.  The by={<authors>} keyval lists one or more authors, composers, translators, etc. An entry is added to each author index associated with the current songs environment for each contributor listed. Contributors are expected to be separated by commas, semicolons, or the word and. For example:

by={Fred Smith, John Doe, and Billy Bob}

Words separated by a macro-space (\␣) or tie (~) instead of a regular space are treated as single words by the indexer. For example, The␣Vienna␣Boys’␣Choir is indexed as "Choir, The Vienna Boys' " but The␣Vienna\␣Boys’\␣Choir is indexed as "Vienna Boys' Choir, The".


Copyright Info.  The cr={<copyright>} keyval specifies the copyright-holder of the song, if any. For example:

cr={\copyright~2000 ABC Songs, Inc.}

Copyright information is typeset in fine print at the bottom of the song.


Licensing Info.  Licensing information is provided by li={<license>}, where <license> is any text. Licensing information is displayed in fine print under the song just after the copyright information (if any). Alternatively, writing \setlicense{<license>} anywhere between the \beginsong and \endsong lines is equivalent to using li={<license>} in the \beginsong line.

When many songs in a book are covered by a common license, it is usually convenient to create a macro to abbreviate the licensing information. For example, if your organization has a music license from Christian Copyright Licensing International with license number 1234567, you might define a macro like

\newcommand{\CCLI}{(CCLI \#1234567)}

Then you could write li=\CCLI in the \beginsong line of each song covered by CCLI.


Scripture References.  The songs package has extensive support for scripture citations and indexes of scripture citations. To cite scripture references for the song, use the keyval sr={<refs>}, where <refs> is a list of scripture references. Index entries are added to all scripture indexes associated with the current songs environment for each such reference. The songidx index generation script (see section 10.3) expects <refs> to be a list of references in which semicolons are used to separate references to different books, and commas are used to separate references to to different chapters and verses within the same book. For example, one valid scripture citation is

sr={John 3:16,17, 4:1-5; Jude 3}

The full formal syntax of a valid <refs> argument is given by the following syntax rules:

<refs><nothing> | <ref>;<ref>;...;<ref>
<ref><many-chptr-book><chapters> | <one-chptr-book><verses>
<many-chptr-book>Genesis | Exodus | Leviticus | Numbers | ...
<one-chptr-book>Obadiah | Philemon | 2 John | 3 John | Jude
<chref><chapter> | <chapter>-<chapter> | <chapter>:<verses> |
<vref><verse> | <verse>-<verse>

In those syntax rules, <chapter> and <verse> stand for arabic numbers denoting a valid chapter number for the given book, and a valid verse number for the given chapter, respectively. Note that when referencing a book that has only one chapter, one should list only its verses after the book name (rather than 1:<verses>).

5.2 Verses and Choruses


Starting A Verse Or Chorus.  Between the \beginsong and \endsong lines of a song can appear any number of verses and choruses. A verse begins and ends with:


and a chorus begins and ends with:


Verses are numbered (unless \noversenumbers has been used to suppress verse numbering) whereas choruses have a vertical line placed to their left.

To create an unnumbered verse, begin the verse with \beginverse* instead. This can be used for things that aren't really verses but should be typeset like a verse (e.g. intros, endings, and the like). A verse that starts with \beginverse* should still end with \endverse (not \endverse*).

Within a verse or chorus you should enter one line of text for each line of lyrics. Each line of the source document produces a separate line in the resulting document (like LaTeX's \obeylines macro). Lines that are too long to fit are wrapped with hanging indentation of width \parindent.

5.3 Chords


Between the \beginverse and \endverse lines, or between the \beginchorus and \endchorus lines, chords can be produced using the macro \[<chordname>]. Chords only appear in chord books; they are omitted from lyric books. The <chordname> may consist of arbitrary text. To produce sharp and flat symbols, use # and & respectively.

Any text that immediately follows the \[] macro with no intervening whitespace is assumed to be the word or syllable that is to be sung as the chord is struck, and is therefore typeset directly under the chord. For example:

\[E&]peace and \[Am]joy            produces            document fragment

If whitespace (a space or <return>) immediately follows, then the chord name be typeset without any lyric text below it, indicating that the chord is to be struck between any surrounding words. For example:

\[E&]peace and \[Am] joy            produces            document fragment

If the lyric text that immediately follows the chord contains another chord, and if the width of the chord name exceeds the width of the lyric text, then hyphenation is added automatically. For example:

\[F#sus4]e\[A]ternal            produces            document fragment

Sequences of chords that sit above a single word can be written back-to-back with no intervening space, or as a single chord:

\[A]\[B]\[Em]joy            produces            document fragment

\[A B Em]joy            produces            document fragment

The only difference between the two examples above is that the chords in the first example can later be replayed separately (see section 5.4) whereas the chords in the second example can only be replayed as a group.

You can explicitly dictate how much of the text following a chord macro is to appear under the chord name by using braces. To exclude text that would normally be drawn under the chord, use a pair of braces that includes the chord macro. For example:

{\[G A]e}ternal            produces            document fragment

(Without the braces, the syllables "ternal" would not be pushed out away from the chord.) This might be used to indicate that the chord transition occurs on the first syllable rather than as the second syllable is sung.

Contrastingly, braces that do not include the chord itself can be used to include text under a chord that would otherwise be excluded. For example:

\[Gmaj7sus4]{th’ eternal}            produces            document fragment

Without the braces, the word "eternal" would be pushed out away from the chord so that the chord would appear only over the partial word "th' ".


Chords Without Lyrics.  Sometimes you may want to write a line of chords with no lyrics in it at all, such as for an instrumental intro or solo. To make the chords in such a line sit on the baseline instead of raised above it, use the \nolyrics macro. For example:

{\nolyrics Intro: \[G] \[A] \[D]}            produces            document fragment

Note the enclosing braces that determine how long the effect should last. Multiple lines can be included in the braces. Instrumental solos should typically not appear in lyric books, so such lines should usually also be surrounded by \ifchorded and \fi (see section 11.4).


Symbols Under Chords.  If you are typesetting songs in a language whose alphabet contains symbols that LaTeX treats as punctuation, you can use the \DeclareLyricChar macro to instruct the songs package to treat the symbol as non-chord-ending, so that it is included under chords by default just like an alphabetic character.


Here, <token> must be a single TeX macro control sequence, active character, letter (something TeX assigns catcode 11), or punctuation symbol (something TeX assigns catcode 12). For example, by default,

\[Fmaj7]s\dag range            produces            document fragment

because \dag is not recognized as an alphabetic symbol; but if you first type,


then instead you will get:

\[Fmaj7]s\dag range            produces            document fragment


Likewise, you can type


to reverse the above effect and force a token to be lyric-ending. Such tokens are pushed out away from long chord names so that they never fall under a chord, and hyphenation is added to the resulting gap.


To declare a token to be lyric-ending but without the added hyphenation, use \DeclareNoHyphen{<token>} instead. Such tokens are pushed out away from long chord names so that they never fall under the chord, but hyphenation is not added to the resulting gap.


Extending Chords Over Adjacent Words.  The \MultiwordChords macro forces multiple words to be squeezed under one chord by default. Normally a long chord atop a short lyric pushes subsequent lyrics away to make room for the chord:

\[Gmaj7sus4]my life            produces            document fragment

But if you first type \MultiwordChords, then instead you get the more compact:

\[Gmaj7sus4]my life            produces            document fragment

Authors should exercise caution when using \MultiwordChords because including many words under a single chord can often produce output that is ambiguous or misleading to musicians. For example,

\[F G Am]me free            produces            document fragment

This might be misleading to musicians if all three chords are intended to be played while singing the word "me." Liberal use of braces is therefore required to make \MultiwordChords produce good results, which is why it isn't the default.


Accidentals Outside Chords.  Sharp and flat symbols can be produced with # and & when they appear in chord macros, but if you wish to produce those symbols in other parts of the document, you must use the \shrp and \flt macros. For example, to define a macro that produces a C# chord, use:


5.4 Replaying Chords and Choruses


Many songs consist of multiple verses that use the same chords. The songs package simplifies this common case by providing a means to replay the chord sequence of a previous verse without having to retype all the chords. To replay a chord from a previous verse, type a hat symbol (^) anywhere you would otherwise use a chord macro (\[]). For example,

\[G]This is the \[C]first \[G]verse.
The ^second verse ^ has the same ^chords.


document fragment

document fragment

Normal chords can appear amidst replayed chords without disrupting the sequence of chords being replayed. Thus, a third verse could say,

The ^third verse ^has a \[Cm]new ^chord.

to produce

document fragment

Replaying can be used in combination with automatic transposition to produce modulated verses. See section 7 for an example.


By default, chords are replayed from the current song's first verse, but you can replay the chords of a different verse or chorus by saying \memorize at the beginning of any verse or chorus whose chords you want to later replay. Subsequent verses or choruses that use ^ replay chords from the most recently memorized verse or chorus.

Selective Memorization.  It is also possible to inject unmemorized chords into a memorized verse so that they are not later replayed. To suppress memorization of a chord, begin the chord's name with a hat symbol. For example,

The \[G]third \[C]chord will \[^Cm]not be re\[G]played.
When ^replaying, the ^unmemorized chord is ^skipped.


document fragment

This is useful when the first verse of a song has something unique, like an intro that won't be repeated in subsequent verses, but has other chords that you wish to replay.

Memorizing Multiple Chord Sequences.  By default, the songs package only memorizes one sequence of chords at a time and ^ replays chords from that most recently memorized sequence. However, you can memorize and replay multiple independent sequences using the macros described in the following paragraphs.


Memorized or replayed chord sequences are stored in chord-replay registers. To declare a new chord-replay register, type


where <regname> is any unique alphabetic name.

Once you've declared a register, you can memorize into that register by providing the <regname> as an optional argument to \memorize:


Memorizing into a non-empty register replaces the contents of that register with the new chord sequence.


To replay chords from a particular register, type


Subsequent uses of ^ reproduce chords from the sequence stored in register <regname>.

Register contents are global, so you can memorize a chord sequence from one song and replay it in others. You can also use \replay multiple times in the same verse or chorus to replay a sequence more than once.


Replaying Choruses.  When making overhead slides, it is often convenient to repeat the song's chorus after the first verse on each page, so that the projector-operator need not flip back to the first slide each time the chorus is to be sung. You can say \repchoruses to automate this process. This causes the first chorus in each subsequent song to be automatically repeated after the first verse on each subsequent page of the song (unless that verse is already immediately followed by a chorus). If the first chorus is part of a set of two or more consecutive choruses, then the whole set of choruses is repeated. (A set of choruses is assumed to consist of things like pre-choruses that should always be repeated along with the chorus.) Choruses are not automatically inserted immediately after unnumbered verses (i.e., verses that begin with \beginverse*). Unnumbered verses are assumed to be bridges or endings that aren't followed by a chorus.


Writing \norepchoruses turns off chorus repetition for subsequent songs.

If you need finer control over where replayed choruses appear, use the conditional macros covered in section 11.4 instead of \repchoruses. For example, to manually insert a chorus into only slide books at a particular point (without affecting other versions of your book), you could write:


and copy and paste the desired chorus into the middle.

5.5 Line and Column Breaks


Line Breaking.  To cause a long line of lyrics to be broken in a particular place, put the \brk macro at that point in the line. This does not affect lines short enough to fit without breaking. For example,

This is a \brk short line.
But this is a particularly long line of lyrics \brk that will need to be wrapped.


document fragment

Column Breaks Within Songs.  To suggest a column break within a verse or chorus too long to fit in a single column, use \brk on a line by itself. If there are no \brk lines in a long verse, it is broken somewhere that a line does not wrap. (A wrapped line is never divided by a column break.) If there are no \brk lines in a long chorus, it overflows the column, yielding an overfull vbox warning.


Column Breaks Between Songs.  To force a column break between songs, use \nextcol, \brk, \sclearpage, or \scleardpage between songs. The \nextcol macro ends the column by leaving blank space at the bottom. The \brk macro ends the current column in lyric books by stretching the preceeding text so that the column ends flush with the bottom of the page. (In non-lyric books \brk is identical to \nextcol.) The \sclearpage macro is like \nextcol except that it shifts to the next blank page if the current page is nonempty. The \scleardpage macro is like \sclearpage except that it shifts to the next blank even-numbered page in two-sided documents. Column breaks usually need to be in different places in different book types. To achieve this, use a conditional block from section 11.4. For example,


forces a column break only in lyric books but does not affect chord books or books of overhead slides.

When a partial list of songs is being extracted with \includeonlysongs, \brk, \nextcol, \clearpage, and \cleardpage macros between songs must be followed by a star to have any effect. To force a column-break at a specific point in a partial book, add the word nextcol, brk, clearpage, or cleardpage at the corresponding point in the argument to \includeonlysongs.

5.6 Echoes and Repeats


Echo Parts.  To typeset an echo part, use \echo{<lyrics and chords>}. Echo parts are parenthesized and italicized. For example,

Alle\[G]luia! \echo{Alle\[A]luia!}            produces            document fragment


Repeated Lines.  To indicate that a line should be sung multiple times by all singers, put \rep{<n>} at the end of the line. For example,

Alleluia! \rep{4}            produces            document fragment


To indicate exactly where repeated parts begin and end, use \lrep and \rrep to create begin- and end-repeat signs. For example,

\lrep \[G]Alleluia!\rrep \rep{4}            produces            document fragment

5.7 Measure Bars


Measure bars can be added to chord books in order to help musicians keep time when playing unfamiliar songs. To insert a measure bar, type either \measurebar or type the vertical pipe symbol ("|"). For example,

Alle|\[G]luia            produces            document fragment

In order for measure bars to be displayed, the showmeasures option must be enabled. Measure bars are only displayed by default in chord books.


The first measure bar in a song has meter numbers placed above it to indicate the time signature of the piece. By default, these numbers are 4/4, denoting four quarter notes per measure. To change the default, type \meter{<n>}{<d>} somewhere after the \beginsong line of the song but before the first measure bar, to declare a time signature of <n> <d>th notes per measure.


You can also change meters mid-song either by using \meter in the middle of the song or by typing \mbar{<n>}{<d>} to produce a measure bar with a time signature of <n>/<d>. For example,

Sing to the heavens, ye \mbar{4}{4}saints of |old!


document fragment

5.8 Textual Notes


Aside from verses and choruses, songs can also contain textual notes that provide instructions to singers and musicians. To create a textual note that is displayed in both lyric books and chord books, use:


To create a textual note that is displayed only in chord books, use:


Both of these create a shaded box containing <text>. For example,

\textnote{Sing as a two-part round.}


document fragment

Textual notes can be placed anywhere within a song, either within verses and choruses or between them.


Guitar Capos.  One special kind of textual note suggests to guitarists a fret on which they should put their capos. Macro \capo{<n>} should be used for this purpose. It normally has the same effect as \musicnote{capo <n>}; however, if the transposecapos option is active then it instead has the effect of \transpose{<n>}. See section 7 for more information on automatic chord transposition.

5.9 Chords in Ligatures

This subsection covers an advanced topic and can probably be skipped by those creating song books for non-professional use.

The \[ macro is the normal means by which chords should be inserted into a song; however, a special case occurs when a chord falls within a ligature. Ligatures are combinations of letters or symbols that TeX normally typesets as a single font character so as to produce cleaner-looking output. The only ligatures in English are: ff, fi, fl, ffi, and ffl. Other languages have additional ligatures like æ and œ. Notice that in each of these cases, the letters are "squished" together to form a single composite symbol.


When a chord macro falls inside a ligature, LaTeX fails to compact the ligature into a single font character even in non-chorded versions of the book. To avoid this minor typographical error, use the \ch macro to typeset the chord:


where <chord> is the chord text, <pre> is the text to appear before the hyphen if the ligature is broken by auto-hyphenation, <post> is the text to appear after the hyphen if the ligature is broken by auto-hyphenation, and <full> is the full ligature if it is not broken by hyphenation. For example, to correctly typeset \[Gsus4]dif\[G]ficult, in which the G chord falls in the middle of the "ffi" ligature, one should use:

di\ch{G}{f}{fi}{ffi}cult            produces            document fragment

This causes the "ffi" ligature to appear intact yet still correctly places the G chord over the second f. To use the \ch macro with a replayed chord name (see section 5.4), use ^ as the <chord>.


The \mch macro is exactly like the \ch macro except that it also places a measure bar into the ligature along with the chord. For example,

di\mch{G}{f}{fi}{ffi}cult            produces            document fragment

places both a measure bar and a G chord after the first "f" in "difficult", yet correctly produces an unbroken "ffi" ligature in copies of the book in which measure bars are not displayed.

In the unusual case that a meter change is required within a ligature, this can be achieved with a construction like:

\meter{6}{8}di\mch{G}{f}{fi}{ffi}cult            produces            document fragment

The \meter macro sets the new time signature, which appears above the next measure bar—in this case the measure bar produced by the \mch macro.

Chords and measure bars produced with ^ or | are safe to use in ligatures. Thus, dif|^ficult requires no special treatment; it leaves the "ffi" ligature intact when measure bars are not being displayed.

6 Guitar Tablatures


Guitar tablature diagrams can be created by using the construct


where the <fret> and <fingering> parts are both optional (and you may omit any colon that borders an omitted argument).

<chord> is a chord name to be placed above the diagram.

<fret> is an optional digit from 2 to 9 placed to the left of the diagram.

<strings> should be a series of symbols, one for each string of the guitar from lowest pitch to highest. Each symbol should be one of: X if that string is not to be played, 0 (zero or the letter O) if that string is to be played open, or one of 1 through 9 if that string is to be played on the given numbered fret.

<fingering> is an optional series of digits, one for each string of the guitar from lowest pitch to highest. Each digit should be one of: 0 if no fingering information is to be displayed for that string (e.g., if the string is not being played or is being played open), or one of 1 through 4 to indicate that the given numbered finger is to be used to hold down that string.

Here are some examples to illustrate:

\gtab{A}{X02220:001230}            produces            document fragment

\gtab{C#sus4}{4:XX3341}            produces            document fragment

\gtab{B&}{X13331}            produces            document fragment


By default, tablature diagrams always consist of at least 4 fret rows (more if the <strings> argument contains a number larger than 4). To change the minimum number of fret rows, change the value of \minfrets. For example, typing


causes tablature diagrams to have only as many rows are required to accommodate the largest digit appearing in the <strings> argument.

7 Automatic Transposition


You can automatically transpose some or all of the chords in a song up by <n> half-steps by adding the line


somewhere between the song's \beginsong line and the first chord to be transposed. For example, if a song's first chord is \[D], and the line \transpose{2} appears before it, then the chord appears as an E in the resulting document. Specifying a negative number for <n> transposes subsequent chords down instead of up.

The \transpose macro affects all chords appearing after it until the \endsong line. If two \transpose macros appear in the same song, their effects are cumulative.

When the transposecapos option is active, the \capo macro acts like \transpose. See section 5.8 for more information.


Enharmonics.  When using \transpose to automatically transpose the chords of a song, the songs package code chooses between enharmonically equivalent names for "black key" notes based on the first chord of the song. For example, if \transpose{1} is used, and if the first chord of the song is an E, then all A chords that appear in the song are transcribed as Bb chords rather than A# chords, since the key of F-major (E transposed up by one half-step) has a flatted key signature. Usually this guess produces correct results, but if not, you can use either \preferflats or \prefersharps after the \transpose line to force all transcription to use flatted names or sharped names respectively, when resolving enharmonic equivalents.

Modulated Verses.  Automatic transposition can be used in conjunction with chord-replaying (see section 5.3) to produce modulated verses. For example,

\[F#]This is a \[B/F#]memorized \[F#]verse. \[E&7]
^This verse is ^modulated up two ^half-steps.


document fragment


Both Keys.  By default, when chords are automatically transposed using \transpose, only the transposed chords are printed. However, in some cases you may wish to print the old chords and the transposed chords together so that musicians playing transposing and non-transposing instruments can play from the same piece of music. This can be achieved by redefining the \trchordformat macro, which receives two arguments—the original chord name and the transposed chord name, respectively. For example, to print the old chord above the new chord above each lyric, define


Changing Note Names.  In many countries it is common to use the solfedge names for the notes of the scale (LA, SI, DO, RE, MI, FA, SOL) instead of the alphabetic names (A, B, C, D, E, F, G). By default, the transposition logic only understands alphabetic names, but you can tell it to look for solfedge names by typing \solfedge. To return to alphabetic names, type \alphascale.


You can use other note names as well. To define your own note names, type


where each of <nameA> through <nameG> must consist entirely of a sequence of one or more uppercase letters. For example, some solfedge musicians use TI instead of SI for the second note of the scale. To automatically transpose such music, use:


The songs package can also automatically convert one set of note names to another. For example, suppose you have a large song book in which chords have been typed using alphabetic note names, but you wish to produce a book that uses the equivalent solfedge names. You could achieve this by using the \notenamesin macro to tell the songs package which note names you typed in the input file, and then using \notenamesout to tell the songs package how you want it to typeset each note name in the output file. The final code looks like this:


The syntaxes of \notenamesin and \notenamesout are identical to that of \notenames (see above), except that the arguments of \notenamesout can consist of any LaTeX code that is legal in horizontal mode, not just uppercase letters.

To stop converting between note names, use \alphascale, \solfedge, or \notenames to reset all note names back to identical input and output scales.


Transposing Chords In Macros.  The automatic transposition logic does not find chord names that are hidden inside macro bodies. For example, if you abbreviate a chord by typing,

\newcommand{\mychord}{F\shrp sus4/C\shrp}

then the \transpose macro fails to transpose it; the resulting chord is still an F#sus4/C# chord. To fix the problem, you can use \transposehere in your macros to explicitly invoke the transposition logic on chord names embedded in macro bodies. The above example could be corrected by instead defining:

\newcommand{\mychord}{\transposehere{F\shrp sus4/C\shrp}}

Transposition can be suppressed within material that would otherwise be transposed by using the \notrans macro. For example, writing

\transposehere{G = \notrans{G}}

would typeset a transposed G followed by a non-transposed G chord. This does not suppress note name conversion (see \notenames). To suppress both transposition and note name conversion, just use braces (e.g., {G} instead of \notrans{G}).


Transposing Guitar Tablatures.  The songs package cannot automatically transpose tablature diagrams (see section 6). Therefore, when automatic transposition is taking place, only the chord names of \gtab macros are displayed (and transposed); the diagrams are omitted. To change this default, redefine the \gtabtrans macro, whose two arguments are the two arguments to \gtab. For example, to display original tablatures without transposing them even when transposition has been turned on, write


To transpose the chord name but not the diagram under it, replace \notrans{#1} with simply #1 in the above. To restore the default behavior, write


8 Between Songs

Never put any material directly into the top level of a songs environment. Doing so will disrupt the page-builder, usually producing strange page breaks and blank pages. To safely put material between songs, use one of the environments described in this section.

8.1 Intersong Displays


To put column-width material between the songs in a songs environment, use an intersong environment:


Material contributed in an intersong environment is subject to the same column-breaking rules as songs (see section 11.5), but all other formatting is up to you. By default, LaTeX inserts interline glue below the last line of an intersong environment. To suppress this, end the intersong content with \par\nointerlineskip.


To instead put page-width material above a song, use an intersong* environment:


This starts a new page if the current page already has column-width material in it.


By default, all intersong displays are omitted when generating a partial book with \includeonlysongs. You can force them to be included whenever a particular song is included by using a songgroup environment:


Each songgroup environment may include any number of intersong, intersong*, or scripture quotations (see section 8.2), but must include exactly one song. When using \includeonlysongs, the entire group is included in the book if the enclosed song is included; otherwise the entire group is omitted.

8.2 Scripture Quotations


Starting a Scripture Quotation.  A special form of intersong block typesets a scripture quotation. Scripture quotations begin and end with


where <ref> is a scripture reference that is typeset at the end of the quotation. The <ref> argument should conform to the same syntax rules as for the <ref> arguments passed to \beginsong macros (see section 5).

The text of the scripture quotation between the \beginscripture and \endscripture lines are parsed in normal paragraph mode. For example:

\beginscripture{James 5:13}
Is any one of you in trouble? He should pray. Is anyone happy? Let him sing songs of praise.


document fragment


Tuplets.  To typeset biblical poetry the way it appears in most bibles, begin each line with either \Acolon or \Bcolon. A-colons are typeset flush with the left margin, while B-colons are indented. Any lines too long to fit are wrapped with double-width hanging indentation. For example,

\beginscripture{Psalm 1:1}
\Acolon Blessed is the man
\Bcolon who does not walk in the counsel of the wicked
\Acolon or stand in the way of sinners
\Bcolon or sit in the seat of mockers.


document fragment


Stanzas.  Biblical poetry is often grouped into stanzas or "strophes", each of which is separated from the next by a small vertical space. You can create that vertical space by typing \strophe. For example,

\beginscripture{Psalm 88:2-3}
\Acolon May my prayer come before you;
\Bcolon turn your ear to my cry.
\Acolon For my soul is full of trouble
\Bcolon and my life draws near the grave.


document fragment


Indented Blocks.  Some bible passages, such as those that mix prose and poetry, contain indented blocks of text. You can increase the indentation level within a scripture quotation by using \scripindent and decrease it by using \scripoutdent. For example,

\beginscripture{Hebrews 10:17-18}
Then he adds:
\Acolon ‘‘Their sins and lawless acts
\Bcolon I will remember no more.’’
And where these have been forgiven, there is no longer any sacrifice for sin.


document fragment

9 Chapters and Sections


Song books can be divided into chapters and sections using all the usual macros provided by LaTeX (e.g., \chapter, \section, etc.) and by other macro packages. In addition, the songs package provides two helpful built-in sectioning macros:


which act like LaTeX's \chapter and \section commands except that they center the <title> text in sans serif font and omit the chapter/section number. The \songchapter macro only works in document classes that support \chapter (e.g., the book class).

10 Indexes

10.1 Index Creation


The songs package supports three kinds of indexes: indexes by title and/or notable lyrics, indexes by author, and indexes by scripture reference. To generate an index, first declare the index in the document preamble (i.e., before the \begin{document} line) with one of the following:


The <id> should be an alphabetic identifier that will be used to identify the index in other macros that reference it. The <filename> should be a string that, when appended with an extension, constitutes a valid filename on the system. Auxiliary files named <filename>.sxd and <filename>.sbx are generated during the automatic index generation process. For example:


creates a title index named "mainindex" whose data is stored in files named idxfile.sxd and idxfile.sbx.


To display the index in the document, use:


where <id> is the same identifier used in the \newindex, \newauthorindex, or \newscripindex command, and where the <title> is the title of the index, which should consist only of simple text (no font or formatting macros, since those cannot be used in pdf bookmark indexes). The [<columns>] part is optional; if specified it dictates the number of columns if the index can't fit in a single column. For example, for a 2-column title index, write:

\showindex[2]{Index of Song Titles}{mainindex}

10.2 Index Entries

Every song automatically gets entries in the current songs environment's list of title index(es) (see section 5). However, you can also add extra index entries for a song to any index.


Indexing Lyrics.  For example, title indexes often have entries for memorable lines of lyrics in a song in addition to the song's title. You can add an index entry for the current song to the section's title index(es) by adding index={<lyrics>} to the song's \beginsong line. For example,

          [index={Praise God from Whom all blessings flow}]

causes the song to be indexed both as "Doxology" and as "Praise God from Whom all blessings flow" in the section's title index(es). You can use index= multiple times in a \beginsong line to produce multiple additional index entries. Index entries produced with index={<lyrics>} are typeset in an upright font instead of in italics to distinguish them from song titles.


Indexing Extra Song Titles.  To add a regular index entry typeset in italics to the title index(es), use:


in the \beginsong line instead. Like index= keyvals, ititle= can be used multiple times to produce multiple additional index entries.


You can also create index entries by saying \indexentry[<indexes>]{<lyrics>} (which creates an entry like index=) or \indextitleentry[<indexes>]{<title>} (which creates an entry like ititle=). These two macros can be used anywhere between the song's \beginsong and \endsong lines, and can be used multiple times to produce multiple entries. If specified, <indexes> is a comma-separated list of the identifiers of indexes to which the entry should be added. Otherwise the new entry is added to all of the title indexes for the current songs environment.

10.3 Compiling

As with a typical LaTeX document, compiling a song book document with indexes requires three steps. First, use LaTeX (pdflatex is recommended) to generate auxiliary files from the .tex file:

pdflatex mybook.tex

Second, use the songidx.lua script to generate an index for each index that you declared with \newindex, \newauthorindex, or \newscripindex. The script can be launched using LuaTeX, using the following syntax:

texlua songidx.lua [-b <canon>.can] <filename>.sxd <filename>.sbx

where <filename> is the same <filename> that was used in the \newindex, \newauthorindex, or \newscripindex macro. If the index was declared with \newscripindex, then the -b option is used to specify which version of the bible you wish to use as a basis for sorting your scripture index. The <canon> part can be any of the .can files provided with the songidx distribution. If you are using a Protestant, Catholic, or Greek Orthodox Christian bible with book names in English, then the bible.can canon file should work well. For other bibles, you should create your own .can file by copying and modifying one of the existing .can files.

For example, if your song book .tex file contains the lines


then to generate indexes sorted according to a Christian English bible, execute:

texlua songidx.lua titlfile.sxd titlfile.sbx
texlua songidx.lua authfile.sxd authfile.sbx
texlua songidx.lua -b bible.can scrpfile.sxd scrpfile.sbx

Once the indexes are generated, generate the final book by invoking LaTeX one more time:

pdflatex mybook.tex

11 Customizing the Book

11.1 Song and Verse Numbering


Song Numbering.  The songnum counter defines the next song's number. It is set to 1 at the beginning of a songs environment and is increased by 1 after each \endsong. It can be redefined anywhere except within a song. For example,


sets the next song's number to be 3.


You can change the song numbering style for a song section by redefining \thesongnum. For example, to cause songs to be numbered A1, A2, etc., in the current song section, type


The expansion of \thesongnum must always produce plain text with no font formatting or unexpandable macro tokens, since its text is exported to auxiliary index generation files where it is sorted.


To change the formatting of song numbers as they appear at the beginning of each song, redefine the \printsongnum macro, which expects the text yielded by \thesongnum as its only argument. For example, to typeset song numbers in italics atop each song, define


The \songnumwidth length defines the width of the shaded boxes that contain song numbers at the beginning of each song. For example, to make each such box 2 centimeters wide, you could define


If \songnumwidth is set to zero, song numbers are not shown at all.


To turn off song numbering entirely, type \nosongnumbers. This inhibits the display of the song number atop each song (but song numbers are still be displayed elsewhere, such as in indexes). The same effect can be achieved by setting \songnumwidth to zero.


Verse Numbering.  The versenum counter defines the next verse's number. It is set to 1 after each \beginsong line and is increased by 1 after each \endverse (except if the verse begins with \beginverse*). The versenum counter can be redefined anywhere within a song. For example,


sets the next verse's number to be 3.


You can change the verse numbering style by redefining \theversenum. For example, to cause verses to be numbered in uppercase roman numerals, define


To change the formatting of verse numbers as they appear at the beginning of each verse, redefine the \printversenum macro, which expects the text yielded by \theversenum as its only argument. For example, to typeset verse numbers in italics, define

\renewcommand{\printversenum}[1]{\it\LARGE#1.\ }

The \versenumwidth length defines the horizontal space reserved for verse numbers to the left of each verse text. Verse text is shifted right by this amount. For example, to reserve half a centimeter of space for verse numbers, define


Verse numbers whose widths exceed \versenumwidth indent the first line of the verse an additional amount to make room, but subsequent lines of the verse are only indented by \versenumwidth.


To turn off verse numbering entirely, use \noversenumbers. This is equivalent to saying


The horizontal placement of verse numbers within the first line of each verse is controlled by the \placeversenum macro. By default, each verse number is placed flush-left. For more information, consult the implementation section of the pdf documentation.

11.2 Song Appearance


Font Selection.  By default, lyrics are typeset using the document-default font (\normalfont) and with the document-default point size (\normalsize). You can change these defaults by redefining \lyricfont. For example, to cause lyrics to be typeset in small sans serif font, you could define


Song titles are typeset in a sans-serif, slanted font by default (sans-serif, upright if producing slides), with minimal line spacing. You can change this default by redefining \stitlefont. For example, to cause titles to be typeset in a roman font with lines spaced 20 points apart, you could define


You can apply additional font changes to verses, choruses, meter numbers, echo parts produced with \echo, and textual notes produced with \textnote and \musicnote, by redefining \versefont, \chorusfont, \meterfont, \echofont, and \notefont, respectively. For example, to typeset choruses in italics, you could define


The colors of shaded boxes containing textual notes and song numbers can be changed by redefining the \notebgcolor and \snumbgcolor macros. For example:


By default, chords are typeset in sans serif oblique (slanted) font. You can customize chord appearance by redefining \printchord, which accepts the chord text as its argument. For example, to cause chords to be printed in roman boldface font, you could define


Accidental Symbols.  By default, sharp and flat symbols are typeset using LaTeX's \# (#) and \flat (♭) macros. Users can change this by redefining \sharpsymbol and \flatsymbol. For example, to use \sharp (♯) instead of #, one could redefine \sharpsymbol as follows.


Verse and Chorus Titles.  The \everyverse macro is executed at the beginning of each verse, and \everychorus is executed at the beginning of each chorus. Thus, to begin each chorus with the word "Chorus:" one could type,


Spacing Options.  The vertical distance between song verses and song choruses is defined by the skip register \versesep. For example, to put 12 points of space between each pair of verses and choruses, with a flexibility of plus or minus 2 points, you could define

\versesep=12pt plus 2pt minus 2pt

The vertical distance between the song's body and its prelude and postlude material is controlled by skips \afterpreludeskip and \beforepostludeskip. This glue can be made stretchable for centering effects. For example, to cause each song body to be centered on the page with one song per page, you could write:

\afterpreludeskip=2pt plus 1fil
\beforepostludeskip=2pt plus 1fil

The vertical distance between the baselines of consecutive lines of lyrics is computed by the songs package based on several factors including the lyric font size, the chord font size (if in chorded mode), and whether slides mode is currently active. You can adjust the results of this computation by redefining skip register \baselineadj. For example, to reduce the natural distance between baselines by 1 point but allow an additional 1 point of stretching when attempting to balance columns, you could define

\baselineadj=-1pt plus 1pt minus 0pt

To change the vertical distance between chords and the lyrics below them, redefine the \clineparams macro with a definition that adjusts the LaTeX parameters \baselineskip, \lineskiplimit, and \lineskip. For example, to cause the baselines of chords and their lyrics to be 12 points apart with at least 1 point of space between the bottom of the chord and the top of the lyric, you could write:


The width of the vertical line that appears to the left of choruses is controlled by the \cbarwidth length. To eliminate the line entirely (and the spacing around it), you can set \cbarwidth to 0pt:


The height of the horizontal line that appears between each pair of songs is controlled by the \sbarheight length. To eliminate the line entirely (and the spacing around it), you can set \sbarheight to 0pt:


Song Top and Bottom Material.  You can adjust the header and footer material that precedes and concludes each song by redefining \extendprelude and \extendpostlude.


By default, \extendprelude displays the song's authors and scripture references using the macros \showauthors and \showrefs. The following definition changes it to also print copyright info:


By default, \extendpostlude prints the song's copyright and licensing information as a single paragraph using \songcopyright and \songlicense. The following definition changes it to also print the words "Used with permission" at the end of every song's footer information:

  \songcopyright\ \songlicense\unskip
  \ Used with permission.

In general, any macro documented in section 12 can be used in \extendprelude and \extendpostlude to print song information, such as \songauthors, \songrefs, \songcopyright, and \songlicense. For convenience, the \showauthors and \showrefs macros display author and scripture reference information as a pre-formatted paragraph the way it appears in the default song header blocks.

See section 11.8 for how to define new \beginsong keyvals and use them in \extendprelude.


For complete control over the appearance of the header and footer material that precedes and concludes each song, you can redefine the macros \makeprelude and \makepostlude. When typesetting a song, the songs package code invokes both of these macros once (after processing all the material between the \beginsong and \endsong lines), placing the results within vboxes. The resulting vboxes are placed atop and below the song content. By default, \makeprelude displays the song's titles, authors, and scripture references to the right of a shaded box containing the song's number; and \makepostlude displays the song's copyright and licensing information in fine print.

As a simple example, the following causes each song to start with its number and title(s), centered, in a large, boldface font, and then centers the rest of the prelude material (e.g., references and authors) below that (using \extendprelude).

  {\Large\bfseries\thesongnum. \songtitle\par

Page- and Column-breaking.  Page-breaking and column-breaking within songs that are too large to fit in a single column/page is influenced by the values of several penalties. Penalties of value \interlinepenalty are inserted between consecutive lines of each verse and chorus; penalties of value \vvpenalty, \ccpenalty, \vcpenalty, and \cvpenalty are inserted into each song between consecutive verses, between consecutive choruses, after a verse followed by a chorus, and after a chorus followed by a verse, respectively; and penalties of value \brkpenalty are inserted wherever \brk is used on a line by itself. The higher the penalty, the less likely TeX is to place a page- or column-break at that site. If any are set to -10000 or lower, breaks are forced there. By default, \interlinepenalty is set to 1000 and the rest are set to 200 so that breaks between verses and choruses are preferred over breaks within choruses and verses, but are not forced.


Saying \sepverses sets all of the above penalties to -10000 except for \ccpenalty which is set to 100. This is useful in slides mode because it forces each verse and chorus to be typeset on a separate slide, except for consecutive choruses, which remain together when possible. (This default reflects an expectation that consecutive choruses typically consist of a pre-chorus and chorus that are always sung together.)

These defaults can be changed by changing the relevant penalty register directly. For example, to force a page- or column-break between consecutive choruses, type


Text Justification.  To left-justify or center the lines of verses or choruses, redefine \versejustify or \chorusjustify to \justifyleft or \justifycenter, respectively. For example, to cause choruses to be centered, one could type:


Justification of textual notes too long to fit on a single line is controlled by the \notejustify macro. By default, it sets up an environment that fully justifies the note (i.e., all but the last line of each paragraph extends all the way from the left to the right margin). For more information, consult the implementation section of the pdf documentation.


A textual note that is shorter than a single line is placed flush-left by default, or is centered when in slides mode. This placement of textual notes is controlled by \placenote. For more information, consult the implementation section of the pdf documentation.

11.3 Scripture Appearance


By default, scripture quotations are typeset in Zaph Chancery font with the document-default point size (\normalsize). You can change these defaults by redefining \scripturefont. For example, to cause scripture quotations to be typeset in sans serif italics, define:


By default, the citation at the end of a scripture quotation is typeset in sans serif font at the document-default point size (\normalsize). You can customize the appearance of the citation by redefining \printscrcite, which accepts the citation text as its argument. For example, to cause citations to be printed in roman italics font, define:


11.4 Conditional Blocks

Conditional macros allow certain material to be included in some books but not others. For example, a musician's chord book might include extra verses with alternate chordings.


A conditional block begins with a macro named \if<type>, where <type> is one of the types listed in the first column of the following Table:

TypeProcessed only if...
chordedthe chorded option is active
lyricthe chorded option is not active
slidesthe slides option is active
partiallistthe \includeonlysongs macro is being used to extract a partial list of songs
songindexesthe noindexes option is not active
measuresthe nomeasures option is not active
rawtextthe rawtext option is active
transcaposthe transposecapos option is active
nolyricsthe \nolyrics macro is in effect
pagepreludesthe \pagepreludes macro is in effect
vnumberedthe current verse is numbered (i.e., it was started with \beginverse instead of \beginverse*)

The conditional block concludes with the macro \fi. Between the \if<type> and the \fi may also appear an \else. For example, in the construction


material <A> is only included if the chorded option is active, and material <B> is only included if the chorded option is not active.

11.5 Page Layout


The number of columns per page can be set with \songcolumns. For example, to create 3 columns per page, write


The number of columns should only be changed outside of songs environments.

Setting the number of columns to zero disables the page-building algorithm entirely. This can be useful if you want to use an external package, such as multicol or LaTeX's built-in \twocolumn macro, to build pages. For example, the following sets up an environment that is suitable for a lyric book that uses \twocolumn:

\twocolumn[\LARGE\centering My Songs]

When disabling the page-builder, please note the following potential issues:

  • The \repchoruses feature does not work when the page-builder is disabled because the page-builder is responsible for inserting repeated choruses as new columns are formed.
  • External page-building packages tend to allow column- and page-breaks within songs because they have no mechanism for moving an entire song to the next column or page to avoid such a break (see \songpos below).
  • Indexes produced with \showindex are typeset to the width of the enclosing environment. Thus, you should be sure to reset LaTeX back to one column (via \onecolumn) before executing \showindex.

Song preludes (i.e., the material atop each song, including the title) are typeset by default at column width. Writing \pagepreludes typesets subsequent preludes at page width atop fresh pages, with the rest of the song in multiple columns beneath its title. (To prohibit separation of songs from their preludes, it also sets \songpos to 0.)


The horizontal distance between consecutive columns is controlled by the \columnsep dimension. For example, to separate columns by 1 centimeter of space, write


When LaTeX ends each column it inserts glue equal to \colbotglue. In lyric books this macro is set to 0pt so that each column ends flush with the bottom of the page. In other books that have ragged bottoms, it is set to stretchable glue so that columns end at whatever vertical position is convenient. The recommended setting for typsetting columns with ragged bottoms is:

\renewcommand{\colbotglue}{0pt plus .5\textheight minus 0pt}

The last column in a songs environment gets \lastcolglue appended to it instead. By default it is infinitely stretchable so that the last column ends at its natural height. By setting it to 0pt, you can force the last column to be flush with the bottom of the page:


The songs package uses a song-positioning algorithm that moves songs to the next column or page in order to avoid column- or page-breaks within songs. The algorithm has four levels of aggressiveness, numbered from 0 to 3. You can change the aggressiveness level by typing


The default level is 3, which avoids column-breaks, page-breaks, and page-turns within songs whenever possible. (Page-turns are page-breaks after odd-numbered pages in two-sided documents, or after all pages in one-sided documents.) Level 2 avoids page-breaks and page-turns but allows column-breaks within songs. Level 1 avoids only page-turns within songs. Level 0 turns off the song-positioning algorithm entirely. This causes songs to be positioned wherever TeX thinks is best based on penalty settings (see \vvpenalty and \spenalty).


The value of \spenalty controls the undesirability of column breaks at song boundaries. Usually it should be set to a value between 0 and \vvpenalty so that breaks between songs are preferable to breaks between verses within a song. By default it is set to 100. When it is -10000 or less, breaks between songs are required, so that each song always begins a fresh column.

11.6 Indexes

11.6.1 Index Appearance

Index Titles.  To customize the appearance of index titles, redefine the \songsection and/or \songchapter macros from section 9. For example, to use LaTeX's built-in \section and \chapter macros instead, you could write:


Layout and page divisions.  Indexes are by default typeset on separate pages, and when an index is sufficiently small, it is centered on the page in one column. To disable these defaults, write \sepindexesfalse. This causes indexes to avoid using unnecessary vertical space or starting unnecessary new pages. To re-enable the defaults, use \sepindexestrue.


The \idxheadwidth length defines the width of the shaded boxes that begin each alphabetic block of a large title index. Setting it to 0pt suppresses the boxes entirely. For example, to set the width of those boxes to 1 centimeter, you could define


Fonts and colors.  To control the formatting of the list of references on the right-hand side of index entries, redefine \idxrefsfont. For example, to typeset each list in boldface, write


Title indexes contain entries for song titles and also entries for notable lines of lyrics. The fonts for these entries are controlled by \idxtitlefont and \idxlyricfont, respectively. For example, to show title entries in boldface sans-serif and lyric entries in regular roman font, one could define:


To change the font used to typeset the capital letters that start each alphabetic section of a large title index, redefine \idxheadfont. For example, to typeset those letters in italics instead of boldface, type


To change the background color of the shaded boxes that contain the capital letters that start each alphabetic sectino of a large title index, redefine \idxbgcolor. For example:


The font used to typeset entries of an author index is controlled by \idxauthfont. For example, to typeset such entries in italics instead of boldface, type


The font used to typeset entries of a scripture index is controlled by \idxscripfont. For example, to typeset such entries in boldface instead of italics, type


To control the formatting of the lines that start each new book of the bible in a scripture index, redefine \idxbook, which accepts the book name as its single argument. For example, to typeset each book name in a box, one could define


In a scripture index, when a column break separates a block of entries devoted to a book of the bible, the new column is titled "<bookname> (continued)" by default. You can change this default by redefining the \idxcont macro, which receives the <bookname> as its single argument. For example, to typeset an index in German, one might define

\renewcommand{\idxcont}[1]{\small\textbf{#1} (fortgefahren)}

11.6.2 Entry References


By default, the right-hand side of each index entry contains a list of one or more song numbers. To instead list page numbers, use the \indexsongsas macro:


where <id> is the same identifier used in the \newindex, \newauthorindex, or \newscripindex macro that created the index. The second argument must always be something that expands into raw text without any formatting, since this text gets output to auxiliary files that are lexographically sorted by the index-generation program. To go back to indexing songs by song number, use \thesongnum in place of \thepage in the above.

11.6.3 PDF Bookmarks and Links


Each \beginsong environment adds a PDF bookmark (if generating a PDF) and hyperlink target (if using the hyperref package) for the song by invoking \songtarget with two arguments: (1) a suggested PDF bookmark level, and (2) a link target name. Links in indexes to these targets are created by \songlink, which also gets two arguments: (1) the link target name (same as the second argument to \songtarget), and (2) the text to be linked.

Redefine these macros to customize or suppress these bookmarks, targets, and links. For example, to enable both bookmarks and links (the default behavior) use:

  {\pdfbookmark[#1]{\thesongnum. \songtitle}{#2}}

To enable links but not bookmarks, use:


To disable both bookmarks and links, use:


11.6.4 Sort Order

The alphabetic ordering of entries in title and author indexes is dictated by the computer system on which the songs software is installed. Different languages and regions have different sorting conventions, so the songidx Lua script delegates decisions about order to your operating system. If the default ordering proves inadequate, you can modify it by changing your operating system's locale (see your system's local help files). Alternatively, you can explicitly tell the songidx program which locale to use in one of three ways:

  • Windows: Edit the generate.bat file in the Sample folder (or your working folder) with any plain text editor (e.g., Vim or Notepad). Near the top, find the line that says SET locale=. After the =, type any valid locale name. For a list of valid locale names on Windows, please see the "Language name abbreviation" column of Microsoft's online National Language Support (NLS) API Reference:

  • Unix: Create an environment variable named SONGIDX_LOCALE and set it equal to the desired locale name. The command locale -a lists all valid locale names on most Unix systems.
  • Command-line: If you are executing the songidx script manually, use the -l option to specify the locale:
    texlua songidx -l sv_SE myindex.sxd myindex.sbx

11.6.5 Special Words In Song Info

The following macros control how certain keywords are treated when parsing and sorting index entries. They only affect indexes that have already been declared, so put them strictly after all your index creation commands (see section 10.1).


In English, when a title begins with "The" or "A", it is traditional to move these words to the end of the title and sort the entry by the following word. So for example, "The Song Title" is typically indexed as "Song Title, The". To change this default behavior, you can use \titleprefixword in the document preamble to identify each word to be moved to the end whenever it appears as the first word of a title index entry. For example, to cause the word "I" to be moved to the end of title index entries, one could say,


The first use of \titleprefixword overrides the defaults, so if you also want to continue to move "The" and "A" to the end of entries, you must also say \titleprefixword{The} and \titleprefixword{A} explicitly. This macro may only be used in the document preamble but may be used multiple times to declare multiple prefix words.


When parsing author index entries, the word "and" is recognized by the songidx script as a conjunctive that separates author names. To override this default and specify a different conjunctive, use the \authsepword macro one or more times in the document preamble. For example, to instead treat "und" as a conjunctive, you could say,


The first use of \authsepword and each of the following macros overrides the default, so if you also want to continue to treat "and" as a conjunctive, you must also say \authsepword{and} explicitly.


When parsing author index entries, the word "by" is recognized as a keyword signaling that the index entry should only include material in the current list item that follows the word "by". So for example, "Music by J.S. Bach" is indexed as "Bach, J.S." rather than "Bach, Music by J.S." To recognize a different word instead of "by", you can use \authbyword in the document preamble. For example, to recognize "durch" instead, you could say


When parsing author index entries, if a list item contains the word "unknown", that item is ignored and is not indexed. This prevents items like "Composer unknown" from being indexed as names. To cause the indexer to recognize and ignore a different word, you can use the \authignoreword macro in the document preamble. For example, to ignore author index entries containing the word "unbekannt", you could say,


11.7 Page Headers and Footers

In LaTeX, page headers and footers are defined using a system of invisible marks that get inserted into the document at the beginning of each logical unit of the document (e.g., each section, song, verse, and chorus). The headers and footers are then defined so as to refer to the first and/or last invisible mark that ends up on each page once the document is divided into pages. This section describes the marks made available by the songs package. For more detailed information about the marks already provided by LaTeX and how to use them, consult any LaTeX user manual.


To add song information to page headings and footers, redefine \songmark, \versemark, or \chorusmark to add the necessary TeX marks to the current page whenever a new song, verse, or chorus begins. These macros expect no arguments; to access the current song's information including titles, use the macros documented in section 12. To access the current song's number or the current verse's number, use \thesongnum or \theversenum (see section 11.1). For example, to include the song number in the page headings produced by LaTeX's \pagestyle{myheadings} feature, you could redefine \songmark as follows:


11.8 Defining New Beginsong Keyvals


The \beginsong macro supports several optional keyval parameters for declaring song information, including by=, sr=, and cr=. Users can define their own additional keyvals as well. To do so, use the \newsongkey macro, which has the syntax


Here, <keyname> is the name of the new key for the keyval, <initcode> is LaTeX code that is executed at the start of each \beginsong line before the \beginsong arguments are processed, <default> (if specified) is the default value used for the keyval when <keyname> appears in \beginsong without a value, and <setcode> is macro code that is executed whenever <key> is parsed as part of the \beginsong keyval arguments. In <setcode>, #1 expands to the value given by the user for the keyval (or to <default> if no value was given).

For example, to define a new song key called arr which stores its value in a macro called \arranger, one could write:

                {\def\arranger{Arranged by #1\par}}

Then one could redefine \extendprelude to print the arranger below the other song header information:


A \beginsong line could then specify the song's arranger as follows:

\beginsong{The Title}[arr={R. Ranger}]\endsong

This produces

document fragment

For more detailed information about keyvals and how they work, consult the documentation for David Carlisle's keyval package, which comes standard with most LaTeX 2ε installations.

11.9 Font Kerning Corrections

Chord Overstriking.  In order to conserve space and keep songs readable, the songs package pushes chords down very close to the lyrics with which they are paired. Unfortunately, this can sometimes cause low-hanging characters in chord names to overstrike the lyrics they sit above. For example,

\[(Gsus4/D)]Overstrike            produces            document fragment

Note that the parentheses and slash symbols in the chord name have invaded the lyric that sits beneath them.


The best solution to this problem is to use a font for chord names that minimizes low-hanging symbols; but if you lack such a font, then the following trick works pretty well. Somewhere in the preamble of your document, you can write the following LaTeX code:


This sets the /, (, and ) symbols as active characters whenever they appear within chord names. For more information, consult the implementation section of the pdf documentation. Each active character is defined so that it produces a smaller, raised version of the original symbol. The result is as follows:

\[(Gsus4/D)]Overstrike (fixed)            produces            document fragment

As you can see, the low-hanging symbols have been elevated so that they sit above the baseline, correcting the overstrike problem.


Scripture Font Quotation Marks.  The songs package compensates for a kerning problem in the Zaph Chancery font (used to typeset scripture quotations) by redefining the ‘‘ and ’’ token sequences to be active characters that yield double-quotes shifted 1.1 points and 2 points left, respectively, of their normal positions. If you use a different font size for scripture quotations, then you can use the \shiftdblquotes macro when redefining \scripturefont to change this kerning correction. For example,


removes 1 point of space to the left and 2 points of space to the right of left-double-quote characters, and 3 points to the left and 4 points to the right of right-double-quotes, within scripture quotations.

12 Informational Macros

The macros described in this section can be used to retrieve information about the current song. This can be used when redefining \extendprelude, \extendpostlude, \makeprelude, \makepostlude, \songmark, \versemark, or \chorusmark, or any other macros that might typeset this information.


To get the current song's list of authors (if any) use \songauthors. This yields the value of the by= key used in the \beginsong line.


To get the current song's list of scripture references (if any) use \songrefs. This yields the value of the sr= key used in the \beginsong line, but modified with hyphens changed to en-dashes and spaces falling within a list of verse numbers changed to thin spaces for better typesetting. In addition, various penalties have been added to inhibit line breaks in strange places and encourage line breaks in others.


To get the current song's copyright info (if any), use \songcopyright. This yields the value of the cr= key used in the \beginsong line.


To get the current song's licensing information (if any), use \songlicense. This yields the value of the li= key used in the \beginsong line, or whatever text was declared with \setlicense.


The \songtitle macro yields the current song's title. By default this is the first title provided in the \beginsong line. The \nexttitle and \foreachtitle macros (see below) cause it to be set to the current song's other titles, if any.


To get the current song's primary title (i.e., the first title specified in the song's \beginsong line), execute \resettitles. This sets the \songtitle macro to be the song's primary title.


To get the song's next title, execute \nexttitle, which sets \songtitle to be the next title in the song's list of titles (or sets \songtitle to \relax if there are no more titles).


The \foreachtitle macro accepts LaTeX code as its single argument and executes it once for each (remaining) song title. Within the provided code, use \songtitle to get the current title. For example, the following code generates a comma-separated list of all of the current song's titles:

\foreachtitle{, \songtitle}

When \includeonlysongs is used to extract a partial list of songs, the \songlist macro expands to the comma-separated list of songs that is being extracted. Redefining \songlist within the document preamble alters the list of songs to be extracted. Redefining it after the preamble may have unpredictable results.

13 Other Resources

There are a number of other LaTeX packages available for typesetting songs, tablature diagrams, or song books. Probably the best of these is the Song♭ook package by Christopher Rath ( Most of the differences between other packages and this one are intentional; the following is a summary of where I've adopted various differing design decisions and why.

Ease of Song Entry.  Much of the songs package programming is devoted to easing the burden of typing chords. With most LaTeX song book packages the user types chords using a standard LaTeX macro syntax like \chord{<chord>}{<lyric>}. The songs package uses a less conventional \[<chord>]<lyric> syntax for several reasons detailed below.

First, macros in the standard LaTeX syntax require more key-presses than macros in the songs package's syntax. This can become become very taxing when typing up a large book. Chords often appear as frequently as one per syllable, especially in hymns, so keeping the syntax as brief as possible is desirable.

Second, the standard LaTeX macro syntax requires the user to estimate how much of the <lyric> will lie below the chord (because the <lyric> part must be enclosed in braces) whereas the songs package's syntax does not. Estimating this accurately can be quite difficult, since in many cases the <lyric> part must include punctuation or multiple words to get proper results. The songs package automates this for the user, significantly easing the task of chord-entry.

Third, unlike the standard LaTeX chord syntax, the songs package's syntax handles all hyphenation of chorded lyrics fully automatically. Extra hyphenation must be introduced in chord books wherever a chord is wider than the syllable it sits above. With the standard LaTeX chord syntax such hyphenation must be introduced manually by the user (usually via a special hyphenation macro), but the songs package does this automatically.

Fourth and finally, some other packages allow the user to use "b" in a <chord> to produce a flat symbol, whereas the songs package requires an "&" instead. Using "b" is more intuitive but prevents the use of "b" for any other purpose within a <chord>, such as to produce a literal "b" or to type another macro name like \hbox that contains a "b". Consequently, the songs package uses the less obvious "&" symbol to produce flat symbols.

Song Structure.  The songs package provides a relatively small number of macros for typesetting high-level song structure, including verses, choruses, textual comments, and conditional macros that indicate that certain sections should go in chord books but not lyric books. These can be combined to typeset more sophisticated structures such as intros, bridges, brackets, endings, and the like. This is done in lieu of providing a specific macro for each of these structures since it results in greater flexibility and fewer macros for users to learn.

Multiple columns.  The songs package was designed from the ground up to produce song books with many songs per page, arranged in multiple columns. As a result, it includes elaborate support for many features not found in most other packages, such as automatic column balancing, completely customizable song header and song footer blocks, and facilities for adding beautiful scripture quotations to fill in gaps between songs.

Indexes.  Another major feature of the songs package is its support for a variety of different index types, most notably indexes arranged by scripture reference. Scripture indexes can be invaluable for planning services around particular sermons or topics. The songs package allows book authors to specify the names and preferred ordering of books of the bible, and automatically handles complex issues like overlapping verse ranges to produce an easy-to-read, compact, and well-ordered index. Other supported indexes include those sorted by author, by title, and by notable lines of lyrics.

Automatic Transposition.  The songs package has a facility for automatically transposing songs, and even generating chord books that print the chords in multiple keys (e.g., so that a pianist and guitarist using a capo can play together from the same book).

The songs package was developed entirely independently of all other LaTeX song book packages. I originally developed the set of LaTeX macros that eventually became the songs package in order to typeset a song book for the Graduate Christian Fellowship (GCF) at Cornell University, and the Cornell International Christian Fellowship (CICF). Once I had fine-tuned my package to be sufficiently versatile, I decided to release it for public use. At that time I noticed the Song♭ook package and others, and wrote this summary of the most prominent differences.

For information on more song-typesetting resources for LaTeX, I recommend consulting the documentation provided with the Song♭ook package. It includes an excellent list of other resources that might be of interest to creators of song books.

14 GNU General Public License

This software is covered under version 2.0 of the GNU General Public License. A copy of the license is provided online at the Free Software Foundation website.