3

Friends, consider the following code using the songs package:

\documentclass[a4paper]{book}

\usepackage[lyric]{songs}
\usepackage{lipsum}

\renewcommand{\chorusfont}{\bfseries}

\newindex{titleidx}{cbtitle}

\begin{document}

\showindex{My index}{titleidx}

\begin{songs}{titleidx}

\beginsong{My cool song}[
  by={John Doe}]

\beginchorus
\lipsum[4]
\endchorus

\beginverse
\lipsum[4]
\endverse

\endsong

\end{songs}

\end{document}

I'm stuck with this line identation from both choruses and verses:

Songs

I'd like to make the subsequent lines aligned with the first line of the group. I tried to alter the \versenumwidth lenght, but it defines the horizontal space reserved for verse numbers to the left. Besides, there is the chorus indentation as well, which I couldn't find anything meaningful.

Any ideas?

3

The lengths involved are \leftskip and \parindent which are used by the command \justifyleft which, in is turn, is used by \versejustify and \chorusjustify. One possible solution would be then to redefine \justifyleft, but perhaps the original definition would be needed somewhere else, so I opted for defining a new command (which I called \myjustify) to be used by \versejustify and \chorusjustify producing the desired result:

\documentclass[a4paper]{book}
\usepackage[lyric]{songs}
\usepackage{lipsum}

\renewcommand{\chorusfont}{\bfseries}

\newindex{titleidx}{cbtitle}

\makeatletter
 \newcommand\myjustify{%%
 \ifSB@inverse\advance\leftskip\versenumwidth\fi%
 \SB@cbarshift%
 \parindent0pt
}
\makeatother
\renewcommand\versejustify{\myjustify}
\renewcommand\chorusjustify{\myjustify}

\begin{document}

\showindex{My index}{titleidx}

\begin{songs}{titleidx}

\beginsong{My cool song}[
  by={John Doe}]

\beginchorus
\lipsum[4]
\endchorus

\beginverse
\lipsum[3]
\endverse

\endsong

\end{songs}

\end{document}

enter image description here

  • Awesome, @Gonzalo! I managed to make verses work with \parindent, but failed when dealing with choruses. Your code is very intuitive and elegant, thanks a million! – Paulo Cereda Aug 2 '11 at 22:34
2

It looks as if this is intended behaviour for the package. Song lyrics are divided into lines (or so it assumes), which are indented if they spill over into more than one line on the page. Unlike standard TeX, inside the songs environment line breaks are significant. So all you need to do is decide where you want the lines to break, and write something like

\documentclass[a4paper]{book}

\usepackage[lyric]{songs}
\usepackage{lipsum}

\renewcommand{\chorusfont}{\bfseries}

\newindex{titleidx}{cbtitle}

\begin{document}

\showindex{My index}{titleidx}

\begin{songs}{titleidx}

\beginsong{My cool song}[
  by={John Doe}]

\beginchorus
Lorem ipsum dolor sit amet, 
consectetur adipiscing elit.
This is a very long line which is going to break if I'm not careful.
\endchorus

\beginverse
Here we go round the mulberry bush,
Mulberry bush, mulberry bush.
\endverse

\endsong

\end{songs}

\end{document}

But if you still don't want any indentation, even on the broken line,

\parindent=0pt

is your friend.

  • Thanks @Ant for mentioning it. =) These line breaks serve a good purpose. I usually stick with the default parameters (and I'm happy with them), but in this particular case I had to make an exception. We are finishing a pocket songbook and the indentation takes a significant amount of space (altering the \versenumwidth lenght does not look good at all. =( ). I'll try \parindent as you suggested. – Paulo Cereda Aug 2 '11 at 22:28

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.