15

I am typesetting a simple songbook and would like some songs to be displayed in two columns (I use the multicol package). However, I would like to prevent inserting a columnbreak within a stanza. It would be great to have something like a samecol environment.

I tried to apply hints from Prevent column break in multicolumn index, but it didn't yield the expected result.

I'd be grateful for any advice.

7
  • 2
    Couldn't \begin{minipage}{\linewidth}...\end{minipage} serve as a samecol environment? Commented Jul 14, 2012 at 10:39
  • doesn't \begin{samepage}..\end{somepage} work? Commented Jul 14, 2012 at 14:20
  • Thanks for both suggestions. minipage works, of course with its usual drawbacks. samepage doesn't work. Commented Jul 23, 2012 at 19:11
  • I want this question to be answered correctly. I have a MWE. What is the best way for me to share my MWE? Should I start a new question? Commented Jul 13, 2016 at 19:43
  • @ahorn: Post it to Pastebin and then add the link to this post. I assume your setup is similar to the question? Commented Jul 13, 2016 at 19:50

4 Answers 4

10

I found the answer accidentally, while looking for something else. In order to prevent column break within a stanza I mark line ends with \\* instead of \\. Example:

\begin{multicols}{2} \begin{verse} I heard, I heard, the old man say,\\* John Kanaka-naka tu-lai-ay!\\* Today, today is a holiday,\\* John Kanaka-naka tu-lai-ay! Tu-lai-ay, Oh! Tu-lai-ay!\\* John Kanaka-naka tu-lai-ay! \end{verse} \end{multicols} 

I realize this does not solve the general problem of column break prevention, but perfectly fits my needs.

2
6

I suggest you take a look at the needspace package and its macro \Needspace{}. This macro should be invoked with the number of lines that need to be kept together, expressed in multiples of \baselineskip. Thus, \Needspace{5\baselineskip} will keep the next five lines together by forcing a column break, if necessary, before the start of the stanza. Note that it should only be used between paragraphs (stanzas).

2
  • Thank you for the answer. However, it doesn't work. Maybe due to the fact that inside multicol environment I put theverse environment. Commented Jul 23, 2012 at 19:08
  • 1
    @mac-p - thanks for this feedback. Please consider editing your question to include a more specific description; providing a full MWE (minimum working example) that reproduces the problem in question would be especially helpful. Hopefully, having this additional information will help me and/or others figure out a solution. Commented Jul 23, 2012 at 19:21
1

I have found a solution that works for me, although the factor that \linewidth needs to be multiplied by may need to be adjusted in different situations:

Put

\newenvironment{stanza} {\begin{minipage}{1.1\linewidth} \begin{verse}} {\end{verse} \end{minipage}} 

in the preamble, and use the stanza environment for the stanzas that are troublesome.

1
  • Well, it's the first time I'm not going to award a bounty. Commented Jul 20, 2016 at 17:26
0

This worked perfectly for me

\begin{minipage}{\linewidth} no line break after ":": \begin{compactitem} \item no line break before me \item yay \end{compactitem} \end{minipage} 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.