TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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? – clemens 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
    
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? – ahorn Jul 13 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? – Werner Jul 13 at 19:50

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 theverse environment. – mac-p Jul 23 '12 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. – Mico Jul 23 '12 at 19:21

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

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.

share|improve this answer
    
Well, it's the first time I'm not going to award a bounty. – ahorn Jul 20 at 17:26

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.