Chords & lyrics, songbook
The code from my other answer was the beginning for my leadsheets
package which is on CTAN and in TeX Live since January 2015 (and which I now use extensively myself).
\documentclass{article}
\usepackage{leadsheets}
\definesongtitletemplate{empty}{}
\begin{document}
\begin{song}{title=Nobody Knows You When You're Down And Out}
\begin{verse}
^*{C}O nce I lived the ^{E7}life of a ^*{A7}mil lionaire \\
^{Dmi} Spent all my ^*{A7}mon ey, didn't ^{Dmi}have any cares \\
^{F}Took all my ^{F#dim}friends out for a ^*{C}migh ty good ^{A7}time \\
^{D7} Bought bootleg liquor, ^*{G7}cham pagne and wine
\end{verse}
\end{song}
\setleadsheets{
title-template = empty ,
song-format = \ttfamily ,
chords/sharp = \# ,
chords/flat = b
}
\begin{song}{title=Nobody Knows You When You're Down And Out}
\begin{verse}
^*{C}O nce I lived the ^{E7}life of a ^*{A7}mil lionaire \\
^{Dmi} Spent all my ^*{A7}mon ey, didn't ^{Dmi}have any cares \\
^{F}Took all my ^{F#dim}friends out for a ^*{C}migh ty good ^{A7}time \\
^{D7} Bought bootleg liquor, ^*{G7}cham pagne and wine
\end{verse}
\end{song}
\end{document}
\documentclass{article}
\newcommand\chord[2][l]{%
\makebox[0pt][#1]{\begin{tabular}[b]{@{}l@{}}#2\\\mbox{}\end{tabular}}}
\begin{document}
\chord{Eb}Shine \chord[c]{Dm}on you\chord[r]{Cm} cr\chord{Bb}azy di\chord{F}amond
\end{document}
Every now and then I create a lead sheet. For that purpose I created an environment Verse
that enumerates its contents (it is an enumerate
environment, really) and a command \chord
with the following syntax:
\chord*{<chord symbol>}<text><space>
where the star and <text>
are optional. The starred version gobbles the trailing space and the unstarred doesn't. If <text>
is empty \quad
is inserted for some horizontal space.
Below is the code I used. (The second example uses my realbookchords
package for typesetting the chords and needs XeLaTeX or LuaLaTeX and of course the package and the font installed.)
% arara: xelatex
\documentclass{article}
\usepackage{fontspec}
\usepackage{realbookchords}
\newfontfamily\Augie[Ligatures=TeX]{Augie}
\makeatletter
% \chord*{<chord>}<word><space>
% * gobbles following space
% <chord> chord symbol specification
% <word> chord is placed above this (optional)
% <space> mandatory end of argument
\newcommand*\printchord[1]{#1}
\newif\if@chord@gobble
\newcommand*\chord{%
\@ifstar
{\@chord@gobbletrue\@chord}
{\@chord@gobblefalse\@chord}%
}
\newcommand*\@chord[1]{%
\@chord@aux{#1}%
}
\newcommand*\@chord@aux{}
\def\@chord@aux#1#2 #3{%
\placeabove{\printchord{#1}}{\ifemptyquad{#2}}%
\if\relax\detokenize{#3}\relax
\else
\if@chord@gobble\else\space\fi
\fi
#3%
}
\newcommand*\ifemptyquad[1]{%
\if\relax\detokenize{#1}\relax
\quad\expandafter\@gobble
\else
\expandafter\@firstofone
\fi
{#1}%
}
\newcommand*\placeabove[2]{%
\begingroup
\linespread{1}\selectfont
\begin{tabular}[b]{@{}c@{}}#1\\#2\end{tabular}%
\endgroup
}
% \begin{Verse}[<text>]
% if <text> is not present then the Verse is enumerated, else <text> is
% inserted as a label
\newcounter{Verse}
\renewcommand\theVerse{\arabic{Verse}.}
\newcommand*\Versefont{\normalfont}
% enumerated:
\newenvironment{Verse}[1][]
{%
\if\relax\detokenize{#1}\relax
\stepcounter{Verse}%
\enumerate\item[\theVerse]\relax
\else
\enumerate\item[{#1}]\relax
\fi
\par\Versefont
}
{\endenumerate}
% not enumerated:
\newenvironment{Verse*}[1][]
{%
\if\relax\detokenize{#1}\relax
\itemize\item[]\relax
\else
\itemize\item[{#1}]\relax
\fi
\par\Versefont
}
{\enditemize}
\makeatletter
\begin{document}
\begin{Verse*}
\chord*{C}O nce I lived the \chord{E7}life of a \chord*{A7}mil lionaire \\
\chord{Dmi} Spent all my \chord*{A7}mon ey, didn't \chord{Dmi}have any
cares \\
\chord{F}Took all my \chord{F\#dim}friends out for a \chord*{C}migh ty
good \chord{A7}time \\
\chord{D7} Bought bootleg liquor, \chord*{G7}cham pagne and wine
\end{Verse*}
\renewcommand*\printchord[1]{{\footnotesize\rbc{#1}}}
\renewcommand*\Versefont{\Augie}
\begin{Verse*}
\chord*{C}O nce I lived the \chord{E7}life of a \chord*{A7}mil lionaire \\
\chord{Dmi} Spent all my \chord*{A7}mon ey, didn't \chord{Dmi}have any
cares \\
\chord{F}Took all my \chord{F\s dim}friends out for a \chord*{C}migh ty
good \chord{A7}time \\
\chord{D7} Bought bootleg liquor, \chord*{G7}cham pagne and wine
\end{Verse*}
\renewcommand*\printchord[1]{\texttt{#1}}
\renewcommand*\Versefont{\ttfamily}
\begin{Verse*}
\chord*{C}O nce I lived the \chord{E7}life of a \chord*{A7}mil lionaire \\
\chord{Dmi} Spent all my \chord*{A7}mon ey, didn't \chord{Dmi}have any
cares \\
\chord{F}Took all my \chord{F\#dim}friends out for a \chord*{C}migh ty
good \chord{A7}time \\
\chord{D7} Bought bootleg liquor, \chord*{G7}cham pagne and wine
\end{Verse*}
\end{document}
Remark: the above is now implemented in a more general way in my
leadsheets
package…