Convert text based chord sheets to LaTeX, making use of the leadsheets package. The resulting files can be turned into songbooks with adjustable formatting, utilizing the templating capabilities of the leadsheets package.
The conversion to PDF files works best using TeX Live.
Place multiple text files in the input folder:
input/interpret a - song 1.txt
input/interpret a - song 2.txt
input/interpret b - song 3.txtRun the conversion script:
./convert.py input/*A LaTeX file is created in the songs folder for each input file:
songs/interpret a - song 1.tex
songs/interpret a - song 2.tex
songs/interpret b - song 3.texAdditionaly, the latex file songs.tex is created which can be used to include all the files from the songs folder:
\input{songs/interpret a - song 1.tex}
\input{songs/interpret a - song 2.tex}
\input{songs/interpret b - song 3.tex}Run xelatex on one of the songbook files that include the songs.tex file.
xelatex -interactio=nonstopmode -shell-escape -halt-on-error songbook.texa simple chordsheet file
Interpret - Title
[Verse]
Em Am
abc abc
[Chorus]
Em B7
abc abcis converted to the following LaTeX file
% test.txt
% Interpret - Title
\begin{song}{
interpret={Interpret},
title={Title},
}
% [Verse]
% Em Am
% abc abc
\begin{verse}
\chord{Em}abc \chord{Am}abc
\end{verse}
% [Chorus]
% Em B7
% abc abc
\begin{chorus}
\chord{Em}abc \chord{B7}abc
\end{chorus}
\end{song}A 'verse' refers to any 'verse-like' part, e.g. a verse, chorus, bridge, etc.
The convert.py script adds the \versebreak command at the end of each line in a verse.
It must be defined in the songbook.tex file and can just contain a newline:
\newcommand{\versebreak}{\\}For a more compact layout, a slash or other character can be used:
\newcommand{\versebreak}{/ }Repetitions are typeset using music symbol bars and can be explicitly defined in the input files. In addition, repeating lines within a part and repeating (identical) parts are automatically detected.
These 4 examples lead to the exact same result:
[Chorus] x2
Em Am
Lorem ipsum[Chorus]
Em Am
|: Lorem ipsum :|[Chorus]
Em Am
Lorem ipsum
[Chorus]
Em Am
Lorem ipsum[Chorus]
Em Am
Lorem ipsum
Em Am
Lorem ipsumTabulatures are converted into a series of \makebox commands which allow for using variable-width fonts in a fixed-width grid.
e|--1--2--3--|-----------|
B|-----------|--1--2--3--|
G|-----------|-----------|
D|-----------|-----------|
A|-----------|-----------|
E|-----------|-----------|
The following commands and a length must be defined in the songbook.tex file.
They control the format of the different tabulature elements:
\newcommand{\tabformat}{\tiny}
\newcommand{\tabruleformat}{\color{lightgray}}
\newcommand{\tabnoteformat}{\bfseries{}\color{NavyBlue}}
\newcommand{\tabotherformat}{\color{black}}
\newcommand{\tabchordformat}{\tiny\bfseries{}\color{NavyBlue}}
\newlength{\tabcellwidth}
\setlength{\tabcellwidth}{1.0mm}from songbook.tex
from songbook-ebook.tex

