0

I am writing songbook and would like to add guitar chords. I consider them secondary to actual lyric and woludn't like them to interfere with normal reading nor take a lot of vertical space.

I use songs package and know that it can show chords above words. I want to have chords after each line, adjusted to left.

This website can show both versions. By default it shows chords as songs package does, but if you click "Zmień styl" at the top it shows how I want it.

How to achieve this effect in latex?

Example file using songs package

\documentclass[a5paper, portrait, 10pt]{article}
\usepackage[chorded, onesongcolumn]{songs}

\noversenumbers

\begin{document}

\songsection{Worship Songs}

\begin{songs}{}
\beginsong{Doxology}[by={Louis Bourgeois and Thomas Ken}]
\beginverse
\[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.
\[C]A\[G]men.
\endverse
\beginverse
% pretend there is second verse; chords are the same, so don't repeat them
Praise God, from Whom all blessings flow;
Praise Him, all creatures here below;
Praise Him above, ye heav'nly host;
Praise Father, Son, and Holy Ghost.
Amen.
\endverse
\endsong
% second song
\beginsong{Second song}[]
\beginverse
\[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.
\[C]A\[G]men.
\endverse
\endsong
\end{songs}

\end{document}

It produces: enter image description here

  • There are a number of ways to to do this, the simplest being to use a tabular. OTOH, I'm not familiar with the songs package or why you are using it. Perhaps a Minimal Working Example with the chords on top? – John Kormylo Feb 6 '18 at 2:07
1

Please see my answer to a similar question. I think this solution will also work for you, but you will have to configure your line spacing carefully to avoid overlaps in the marginal notes if you put full-sized tablatures there.

\usepackage[chorded]{songs}

% Create lengths for the width of the chord area and its left margin
\newlength\chordswidth\setlength\chordswidth{1in}
\newlength\chordsmargin\setlength\chordsmargin{3pt}

\newbox\chbox
\newcommand\clist[1]{\ifchorded
  \ifvmode\leavevmode\fi
  \setbox\chbox\vtop{\raggedright
    \leftskip=\hsize\advance\leftskip-\chordswidth\advance\leftskip\chordsmargin
    \printchord{\transposehere{#1}}\par
  }\vadjust{\vbox{\kern-2pt\kern-\ht\chbox\box\chbox}}\fi\ignorespaces}

\let\oldjustifyleft=\justifyleft
\renewcommand\justifyleft{\oldjustifyleft
  \ifchorded\advance\rightskip\chordswidth\fi}

%no need to have wide spacing between lines if chords above never used:
\newcommand\pausechords{}
\newcommand\resumechords{}
\ifchorded
  \renewcommand\pausechords{\setlength\baselineadj{0pt}\chordsoff}
  \renewcommand\resumechords{\setlength\baselineadj{-10pt}\chordson}
\fi

\begin{document}

\songsection{Worship Songs}

\begin{songs}{}
\beginsong{Doxology}
\beginverse
\clist{G Em G} Praise God, from Whom all blessings flow;
\clist{G Em D} Praise Him, all creatures here below;
\clist{Em D C Em} Praise Him above, ye heav'nly host;
\clist{G D G} Praise Father, Son, and Holy Ghost.
\clist{C G} Amen.
\endverse

\pausechords % second verse without chords
\beginverse
Praise God, from Whom all blessings flow;
Praise Him, all creatures here below;
Praise Him above, ye heav'nly host;
Praise Father, Son, and Holy Ghost.
Amen.
\endverse
\resumechords
\endsong

\end{songs}

\end{document}
  • Seems to be exactly what I need, however there is problem with first line: ibb.co/cxUQZy - do you know how to fix it? I use songs 2.18 – MateuszL Jul 3 '18 at 21:06
  • I fixed it; please try the new code. (My original didn't account for numbered verses.) – Kevin Hamlen Jul 5 '18 at 22:09
  • This is great solution, thank you! Any chance of improving it further so that verses between \chordsoff \chordson don't have superfluous margin? – MateuszL Jul 8 '18 at 19:48
  • That's pretty easy to do. Just surround the part that advances \rightskip by \chordswidth with \ifchorded...\fi. I've done so. – Kevin Hamlen Jul 10 '18 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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