# Vertical outline chord diagrams with the songs package

I would like to better outline my chord diagrams with the songs latex package if this is possible. My output now is this:

As you can see the F# (the name of the chord) is not aligned with C#m7, G#m has too many notes before the barre and the diagram of Dmaj7 is not aligned with the rest.

What I would like is something like:

This is from ultimate-guitar.com, but as you can see all chord diagrams and chord names are outlined.

Is it possible to do this with the Songs package?

Below is a minimal working example:

\documentclass{article}
\usepackage{ifpdf}
\usepackage[chorded, onesongcolumn]{songs}
\begin{document}
\begin{songs}{}
\beginsong{Some Song}[by={Some Guy}]

\gtab{C#m7}{X42100:042100}
\gtab{F#}{2:(244322):034200}
\gtab{G#m}{(477444):034000}
\gtab{E}{022100:023100}
\gtab{Dmaj7}{XX(222)}
\gtab{C#}{X43(121):X43020}

\beginverse
\[Am]Alas my love, you\[G]do me wrong
\[F]to cast me off so \[E7]discourteously,
\[Am]for I have loved you \[G]for so long,
\endverse

\beginchorus
\[C]Greensleeves was \[G]all my joy,
\[F]Greensleeves was\[E7]my delight,
\[C]Greensleeves was my \[G]heart of gold,
and \[F]who but my \[E7]lady \[Am]Greensleeves.
\endchorus

\endsong
\end{songs}
\end{document}



EDIT: I solved the issue with G#m having too many notes before the barre by editing the chord into:

\gtab{G#m}{4:(133111):034000}


But the alignment issue of the chordname of F# diagram of Dmaj7 still exists.

EDIT 2: While Sandy G's solution is a good way to do it, I solved it using \patchcmd from the \usepackage{etoolbox} package. Now it looks like this:

The relevant code for this is:

% make chord diagrams same length
\minfrets=5

% raise chord name when no open/muted strings
\patchcmd{\SB@topempty}
{\relax}% search
%{{\phantom{\framebox(1,5.15){}}}}% replace
{{\phantom{$\times$}}}% replace
{}{}

% raise chord diagram when no fingering is present TODO still one 0 must be present for this to work!
\patchcmd{\SB@finger}
{\SB@topempty}
{{\phantom{$\times$}}}
{}{}


What this does is insert a hidden x (with \phantom) above and below the chord diagram. This must be added in the preamble.

To get the chord names vertically aligned, you can enclose any chord name in a \raisebox command. Depending on the font you may have to adjust this some. But then \gtab won't center the chord name. To correct that, add a \quad space before the chord name. It doesn't matter how wide the chord name is.

\gtab{\raisebox{5.15pt}{\quad F#}}{2fr:(133211):034200}


To simplify this, I created the command \all that takes the chord name as an argument:

\newcommand{\all}[1]{\raisebox{5.15pt}{\quad #1}}


I don't have a great solution for the bottom alignment issue, except to use a ' character. It's the most innocuous character I could find that songs will accept for a finger.

I also changed the barre chords to be more consistent with the notation from ultimate-guitar.

Here is the code to produce the above image:

\documentclass{article}
\usepackage{ifpdf}
\usepackage[chorded, onesongcolumn]{songs}

\begin{document}

\begin{songs}{}

\minfrets=5
\gtab{C#m7}{X42100:042100}
\gtab{\all{F#}}{2fr:(133211):034200}
\gtab{\all{G#m}}{4fr:(133111):034000}
\gtab{E}{022100:023100}
\gtab{Dmaj7}{XX0(222):{00000'}}
\gtab{C#}{X43(121):X43020}

\end{songs}

\end{document}

• Thanks for your answer. Do you know how to automate the inclusion of the \raisebox like this? Maybe with \patchcmd from etoolbox? – jansen Oct 21 '20 at 8:42
• @jansen, it's probably easier if you just use \newcommand. I edited my answer. Does that do what you want? – Sandy G Oct 21 '20 at 11:42
• This is a good solution and a quick way to make the chords better, thank you! But I ended up hacking the desired functionality in with \patchcmd after reading the songs source code, see my edit for the details – jansen Oct 21 '20 at 15:36
• @jansen, I like your way better. :) – Sandy G Oct 21 '20 at 15:54

You can set \minfrets=5 to make all the tabs the same height.