2

I'm new to the forum and LaTeX, so be gentle with me :) I'm trying to write a songbook with chords on the side, an example of my target look:
!https://ibb.co/imwkmJ
I'm using songs package to mark my chords, so that I can use lyrics and chorded versions of my songbook output. I don't want to use tabular for this matter, cause it would mean that I'd have to code each cell with ifchorded. My current code looks like this:

% Preamble
\documentclass[11pt,twocolumn]{book}

% Packages
\usepackage{a4wide}
\usepackage[margin=1.5cm,footskip=0.25in,headheight=34.5pt]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{polski}
\usepackage[polish]{babel}
\usepackage{comment}
%\usepackage{multicol}
\usepackage{titlesec, color}
\usepackage{lmodern}
\usepackage{fancyhdr}
%\usepackage[defaultlines=1,all]{nowidow}
\usepackage[chorded]{songs}
\usepackage{verse}

%styles
\definecolor{gray75}{gray}{0.75}
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
\titlespacing{\section}{0cm}{0.7cm}{0.2cm}[0pt]
\parindent=0pt
\parskip=0pt
%\def\hmm{\par\if@firstcolumn\else \par \nopagebreak \fi\par\bigskip}

%head and foot
\pagestyle{fancy}
%\headheight{14pt}
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
%

% Document
\begin{document}
   \section{Bezdroża}
\begin{minipage}[t]{\dimexpr.4\textwidth-.4\columnsep}
Powiewając kaszkietem nieba\\
Witają nas bezdroża wzbijając kurz\\
Zarosłym trawą Łemków traktem\\
Wędrownej pieśni jedzie wóz\\
\hfill\break
Wypłowiały na płótna budzie\\
Fruwa ruski Michał z mieczem\\
Na wozie tym namiot nieba\\
I długowłosy wicher jedzie\\
\hfill\break
\vin I świat wronieje i koń i wóz\\
\vin I wiatr jak żagle wydyma balkony\\
\vin Kiedyż ja wreszcie z tych domów stu\\
\vin Choć jeden nazwę swoim domem\\
\hfill\break
\vin I świat wronieje i koń i wóz\\
\vin I wiatr jak żagle wydyma balkony\\
\vin Kiedyż ja wreszcie z tych domów stu\\
\vin Choć jeden nazwę swoim domem\\
\hfill\break
Tam jesień wokół niczyja\\
I świat też w chmurach jest niczyj\\
Dusza nasza w liście ubrana\\
Paradnych kroków nie ćwiczy\\
\hfill\break
Niezmierzona jest duszy przestrzeń\\
Roni złote liście na drzewach\\
Płomienisty wolności szych\\
Przez jesienne pisze się nieba\\
\hfill\break
\vin I świat wronieje i koń i wóz\\
\vin I wiatr jak żagle wydyma balkony\\
\vin Kiedyż ja wreszcie z tych domów stu\\
\vin Choć jeden nazwę swoim domem\\
\hfill\break
\vin Już świat wronieje i koń i wóz\\
\vin I wiatr jak żagle wydyma balkony\\
\vin Wiem teraz - piórka wiatru trzy\\
\vin Są moim domem rozpędzonym\\
\end{minipage}
\hfill
\begin{minipage}[t]{\dimexpr.05\textwidth-.05\columnsep}
\ifchorded
F G\\
a^7\\
F G\\
a^7\\
\hfill\break
a e\\
F G\\
a e\\
F G\\
\vfill\null
\else
\fi
\end{minipage}
\end{document}

This approach works great as long as the text of the song isn't too long. If it is, there is an overflow in column and it goes beyond the page. I would like to enable text spanning between columns, but not between pages, or if plausible, only in even->uneven direction, so that I don't have to turn the page in the middle of a song. I would preffer to avoid manual breaking of the minipages, I'm putting each song in diffirent .tex file and then include them in main file for ease of "filling the blanks" between songs by adjusting song order.
Do You guys have any advice on the approach to this problem?

1

Your MWE doesn't use the songs package's environments for typesetting songs, but I'm assuming you'd like to since they provide the sort of page-breaking you desire. The following solution creates a \clist macro that works within songs environments to put a list of chords on the side.

% 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}

You can then write songs in the following style:

\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
\endsong

If you don't plan to also put chords between the lyrics, you'll probably also want to change \baselineadj to a negative distance in chord books to eliminate the spacing for chords between lyric lines.

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.