Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
Couldn't \begin{minipage}{\linewidth}...\end{minipage} serve as a samecol environment? –  cgnieder Jul 14 '12 at 10:39
    
doesn't \begin{samepage}..\end{somepage} work? –  David Carlisle Jul 14 '12 at 14:20
    
Thanks for both suggestions. minipage works, of course with its usual drawbacks. samepage doesn't work. –  mac-p Jul 23 '12 at 19:11
add comment

2 Answers

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).

share|improve this answer
    
Thank you for the answer. However, it doesn't work. Maybe due to the fact that inside multicol environment I put the`verse` environment. –  mac-p Jul 23 '12 at 19:08
    
@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. –  Mico Jul 23 '12 at 19:21
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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