Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

For this to work, you need to install the New Real Book fonts and the experimental realbookchords package by cgnieder, then compile with XeLaTeX or LuaLaTeX.

I'm working on a simple set of macros to typeset chord progressions. Here's an MWE:

\documentclass{article}
\usepackage{array, collcell, realbookchords}
\setlength{\unitlength}{12pt}
\renewcommand{\|}{\rule[-.2\unitlength]{.7pt}{1.4\unitlength}} % measure bar
\newcommand{\zif}[1]{\multicolumn{4}{l}{\fbox{\sffamily #1}}\\} % ziffer
\newcommand{\hd}{\Large\textsf{\o}} % half diminished
\newenvironment{chordprog}[1]
               {\bigskip\bigskip
                \SongTitle{#1}
                \par\medskip\noindent
                \begin{tabular}{l !{\|} l !{\|} l !{\|} l}}
               {\end{tabular}}
\newcolumntype{Z}{>{\collectcell\rbc}l<{\endcollectcell}}
\newenvironment{chordprog*}[1]
               {\bigskip\bigskip
                \SongTitle{#1}
                \par\medskip\noindent
                \begin{tabular}{ZZZZ !{\|} ZZZZ !{\|} ZZZZ !{\|} ZZZZ}}
               {\end{tabular}}
\setmainfont{Century Gothic}
\RBCsetup{songtitle-format-center={\rmfamily\LARGE\bfseries}}

\begin{document}
\begin{chordprog}{After You've Gone}
\zif A
\rbc{Abmaj} & \rbc{Abmi6} \rbc{Db9} & \rbc{Ebmaj} & \rbc{Gmi7} \rbc{C9} \\
\rbc{F9}   & \rbc{Bb9} & \rbc{Eb6} & \rbc{Bbmi7} \rbc{Eb7} \\
\zif B
\rbc{Abmaj} & \rbc{Abmi6} \rbc{Db9} & \rbc{Ebmaj} & \rbc{Gmi7} \rbc{C9} \\
\rbc{Fmi} \rbc{C7alt} & \rbc{Fmi7} \rbc{Db9} & \rbc{Ebmaj} \rbc{D\hd} \rbc{G7} & \rbc{Cmi7} \rbc{A0} \\
\rbc{Eb6} \rbc{C7} & \rbc{Fmi7} \rbc{Bb7} & \rbc{Eb6} & \rbc{Bbmi7} \rbc{Eb7}
\end{chordprog}

\begin{chordprog*}{At Last}
\zif{Intro}
F && F7 && Bb && B0 && F & F7/{Eb} & D7\b9 && Db7 && C7\\
\zif{Verse 1.}
F && Dmi7 && Gmi7 && C7 && F && Dmi7 && Gmi7 && Cmi7  & C7 \\
F && Dmi7 && Gmi7 && C7 && F & F7/{Eb} & D7\b9 && Db7 && Gmi7 & C9 \\
\end{chordprog*}
\end{document}

output

Comments: In the unstarred environment, one tabular cell corresponds to one measure; in the starred version, one cell is one quarter note. The latter is needed when I want to align the beats, and not only the measures. It also allows me to wrap the table cell in the \rbc (realbookchord) macro, but creates more space even when there are one or two chords in a measure.

I'm asking for

  1. How to simplify / beautify this code? (The vertical bar seems hackish.)
  2. How to make the starred environment as narrowly spaced as the unstarred one? May not be as beautiful, but I want to print it out on small paper and stick it onto a synth with no music stand :)
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can adjust the spacing between the tabular columns. Below I use

\newcolumntype{Z}{>{\collectcell\rbc}l<{\endcollectcell}@{\,}}

The \@{\,} suppresses the usual inter-column space and adds \, instead. In the tabular column specification I suppressed in the beginning completely:

\tabular{@{}ZZZZ !{\|} ZZZZ !{\|} ZZZZ !{\|} ZZZZ}

I also made small changes to the environment definitions. The \begin and \end are not needed. They add an additional group and will lead to misleading error messages if there is some erroneous input. The changes also reflect a small fix I made to the \SontTitle command. The new version of realbookchords can be found on the Bitbucket site.

Since I prefer to see every quarter in these kinds of leadsheet I added a version with a small rule for every quarter with no chord change. (It's not a perfect solution, though). I'd also add measure bars at the beginning and the end of each line, too.

% arara: lualatex
\documentclass{article}
\usepackage{array,collcell,graphicx}
\usepackage{realbookchords}[2013/09/07]
\setlength{\unitlength}{12pt}
\renewcommand{\|}{\rule[-.2\unitlength]{.7pt}{1.4\unitlength}} % measure bar
\newcommand{\zif}[1]{\multicolumn{4}{@{}l}{\fbox{\sffamily #1}}\\[3pt]} % ziffer
\newcommand{\hd}{\Large\textsf{\o}} % half diminished

\protected\def\qu{\rotatebox{-45}{\rule[.75ex]{2pt}{8pt}}}

\newenvironment{chordprog}[1]
  {%
    \par
    \SongTitle{#1}%
    \par\medskip\noindent
    \tabular{@{}l !{\|} l !{\|} l !{\|} l}%
  }
  {\endtabular\bigskip\bigskip}

\newcolumntype{Z}{>{\collectcell\rbc}l<{\endcollectcell}@{\,}}
\newenvironment{chordprog*}[1]
  {%
    \par
    \SongTitle{#1}%
    \par\medskip\noindent
    \tabular{@{}ZZZZ !{\|} ZZZZ !{\|} ZZZZ !{\|} ZZZZ}%
  }
  {\endtabular\bigskip\bigskip}
% \setmainfont{Century Gothic}
\RBCsetup{songtitle-format-center={\rmfamily\LARGE\bfseries}}

\begin{document}

\begin{chordprog}{After You've Gone}
\zif A
\rbc{Abmaj} & \rbc{Abmi6} \rbc{Db9} & \rbc{Ebmaj} & \rbc{Gmi7} \rbc{C9} \\
\rbc{F9}   & \rbc{Bb9} & \rbc{Eb6} & \rbc{Bbmi7} \rbc{Eb7} \\
\zif B
\rbc{Abmaj} & \rbc{Abmi6} \rbc{Db9} & \rbc{Ebmaj} & \rbc{Gmi7} \rbc{C9} \\
\rbc{Fmi} \rbc{C7alt} & \rbc{Fmi7} \rbc{Db9} & \rbc{Ebmaj} \rbc{D\hd} \rbc{G7} & \rbc{Cmi7} \rbc{A0} \\
\rbc{Eb6} \rbc{C7} & \rbc{Fmi7} \rbc{Bb7} & \rbc{Eb6} & \rbc{Bbmi7} \rbc{Eb7}
\end{chordprog}

\begin{chordprog*}{At Last}
\zif{Intro}
F && F7 && Bb && B0 && F & F7/{Eb} & D7\b9 && Db7 && C7\\
\zif{Verse 1.}
F && Dmi7 && Gmi7 && C7 && F && Dmi7 && Gmi7 && Cmi7  & C7 \\
F && Dmi7 && Gmi7 && C7 && F & F7/{Eb} & D7\b9 && Db7 && Gmi7 & C9 \\
\end{chordprog*}

\begin{chordprog*}{At Last}
 \zif{Intro}
  F   & \qu     & F7    & \qu &
  Bb  & \qu     & B0    & \qu &
  F   & F7/{Eb} & D7\b9 & \qu &
  Db7 & \qu     & C7    & \qu \\
 \zif{Verse 1.}
  F    & \qu & Dmi7 & \qu &
  Gmi7 & \qu & C7   & \qu &
  F    & \qu & Dmi7 & \qu &
  Gmi7 & \qu & Cmi7 & C7 \\
  F    & \qu & Dmi7 & \qu &
  Gmi7 & \qu & C7 & \qu &
  F & F7/{Eb} & D7\b9 & \qu &
  Db7 & \qu & Gmi7 & C9 \\
\end{chordprog*}


\end{document}

enter image description here

share|improve this answer
    
Thank you for fixing the songtitle indentation. In the end I completely abandoned the originally unstarred environment and went for the second one, because it's easier to enter and with the suppressed space, looks almost the same. –  marczellm Sep 8 '13 at 12:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.