4

I use linguex and I don't want my examples to be separated from their interlinear gloss and translation by a page break. Currently I have to check the PDF output and use the package needspace, but obviously this is a chore/bore.

\needspace{4\baselineskip}

Keeps the next 3 lines together.

Is there any way of telling LaTeX not to split linguex examples across two pages, ever?

Clarification: I don't want it to keep sub-examples a. b. c. together.

Edit: adding a new command such as in the response to this same question in gb4e is not a solution to this question - I have already stated that the solution should not involve returning to each example environment manually. The solution for gb4e is undesirable as it would involve finding each already written example, but also because it changes line spacing slightly to the old gb4e style. It also involves the addition of a command to each linguex example, making it a less than elegant solution to a global problem within the document's style. There might be a solution in adding the \nobreak command to the package somehow, but as of now, there is no solution.

What I mean is that a linguex example looks like this:

\documentclass{article}
\usepackage{linguex}
\usepackage{leipzig}
\usepackage{lipsum}
\def\glt{\nobreak}

\begin{document}

\lipsum[1-5] 

\exg. y cath-od\\
{\Art} cat-{\Pl}\\
`the cats'

Some text about cats.

\end{document}

normal example with linguex spacing

whereas the solution proposed would be this:

\exg. y cath-od\\
{\Art} cat-{\Pl}\\
\glt `the cats'

Proposed solution screenshot

and I want my examples to stay as they were because 1) don't want to edit them all by hand 2) inelegant solution to a straightforward issue.

Laua
  • 175
  • Since an example can have subexamples, are you only concerned about keeping example/glosse/translation together for any particular sentence or also keeping e.g. (1) a, b, c together? – Alan Munn Sep 25 '14 at 14:38
  • Oh sorry yeah just the ex/gloss/trans – Laua Sep 25 '14 at 14:40
  • Since gb4e and linguex use the same glossing macros (cgloss4e) this is a duplicate. – Alan Munn Aug 03 '16 at 14:11
  • @AlanMunn this is not a solution as linguex does not use a command for its translation line, meaning I would have to go in and change all the hundreds of \exg. examples manually, which I have already stated that I do not want to do. I was talking about having to insert \needspace manually, but \nobreak only offers a similar solution so I think it's clear that it is undesirable. Would it help if I showed the layout of a linguex example or should we assume respondents know the package basics? – Laua Aug 05 '16 at 15:57
  • 1
    Well a minimal example is always helpful. – Alan Munn Aug 05 '16 at 16:02
  • (Your edit doesn't actually add a minimal example.) I'm sorry to say this, but this is a misuse of the glossing macros. What linguex should have done was define \glt to do whatever it liked and keep the markup. The spacing issue is just a matter of removing the \vskip from the definition of \glt. But linguex by design eschews markup and so as a result you have no way to know that the translation line is a translation line. – Alan Munn Aug 05 '16 at 16:11
  • Also the spacing issue is true of using \trans in linguex examples too (iirc), so not just an issue of editing the newly defined command. – Laua Aug 05 '16 at 16:26

1 Answers1

3

Here's a solution to the problem which doesn't require the use of the \glt macro. This will also work with gb4e (with the \glt macro), and I've added a combined answer to the linked (almost duplicate) question

\documentclass[11pt,letterpaper]{article}
\usepackage{lipsum}
\usepackage{etoolbox}
\usepackage{linguex}
\makeatletter
\apptocmd{\gl@stop}{\nobreak}{}{}
\makeatother
\begin{document}
\lipsum[1-4]
\exg. wuz x̃ũch it-ak xohish-em\\
         1\textsc{sg.prn} bread eat-\textsc{inf} want.\textsc{prs}-1\textsc{sg}\\
          `I want to eat bread.'


\ex.    This is another example.

\end{document}
Alan Munn
  • 218,180