LaTeX forum ⇒ LyXPrevent Page Breaks in linguistic Gloss

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
User avatar
Posts: 15
Joined: Thu Nov 29, 2012 2:05 am

Prevent Page Breaks in linguistic Gloss

Postby Hiram » Fri Feb 21, 2014 9:06 am

Hi folks,

after some trial and error, I came up with some global code to keep all the linguistic glosses in your document from splitting across pages. I'm sure this would work with modification for equations, etc... Thanks to the hint in the TeX UK FAQ.

In LyX just put the following code in your preamble.
  1. \let\oldlinggloss\linggloss
  2. \let\endoldlinggloss\endlinggloss
  3. \renewenvironment{linggloss}{%
  4. \filbreak
  5. \begin{oldlinggloss}%
  6. }{%
  7. \end{oldlinggloss}%
  8. }

Voilà! Glossed examples previously broken across pages will now occur fully on a single page.



So the above solution didn't work as well as I hoped. I got some weird page breaks, which, when I re-read the linked page noted above, made sense.

After a bit more experimentation, with samepage and minipage, I discovered that adding a \needspace command provided the necessary number of lines for most of my glossed examples. The 4 represents the number of lines - 3 was actually sufficient generally, but some of my examples were a bit long, so I used 4 just to be on the safe side. And it will still require a bit of individual editing.

This fix requires the needspace package

So the better code for your preamble:

  1. \usepackage{needspace}
  3. \let\oldlinggloss\linggloss
  4. \let\endoldlinggloss\endlinggloss
  5. \renewenvironment{linggloss}{%
  6. \needspace{4\baselineskip}
  7. \begin{oldlinggloss}%
  8. }{%
  9. \end{oldlinggloss}%
  10. }


Return to “LyX”

Who is online

Users browsing this forum: No registered users and 2 guests