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 use the lettrine package to lower the first letter at the beginning of some paragraphs. But sometimes it happens to be the last line of the page and the result is awful. Is there any way to move it to the next page automatically?

Here is a small example file to show the problem.

\documentclass{article}
\usepackage{lettrine}

\usepackage[paperwidth=200pt,paperheight=300pt, offset=0pt, hmargin=40pt, tmargin=50pt, bmargin=80pt,
noheadfoot]{geometry}

\newcommand{\TestLettrine}[2]{\lettrine[lines=2, loversize=1.0]{#1}{ #2}}

\begin{document}

\TestLettrine{L}{atex} as found in nature is a milky fluid found in 10\% of all flowering plants (angiosperms). It is a complex
emulsion consisting of proteins, alkaloids, starches, sugars, oils, tannins, resins, and gums that coagulates on
exposure to air. It is usually exuded after tissue injury. In most plants, latex is white, but some have yellow, orange,

\TestLettrine{L}{atex} as found in nature is a milky fluid found in 10\% of all flowering plants (angiosperms). It is a complex

\end{document}
share|improve this question

1 Answer 1

up vote 7 down vote accepted

Use the needspace package. It provides \needspace{<length>} (or \Needspace{<length>}) that issues a break if <length> is not available on the page, or does nothing otherwise:

\documentclass{article}
\usepackage{lettrine}% http://ctan.org/pkg/lettrine
\usepackage{needspace}% http://ctan.org/pkg/needspace

\usepackage[paperwidth=200pt,paperheight=300pt, offset=0pt, hmargin=40pt, tmargin=50pt, bmargin=80pt,
noheadfoot]{geometry}

\newcommand{\TestLettrine}[2]{\lettrine[lines=2, loversize=1.0]{#1}{ #2}}

\begin{document}

\TestLettrine{L}{atex} as found in nature is a milky fluid found in 10\% of all flowering plants (angiosperms). It is a complex
emulsion consisting of proteins, alkaloids, starches, sugars, oils, tannins, resins, and gums that coagulates on
exposure to air. It is usually exuded after tissue injury. In most plants, latex is white, but some have yellow, orange,

\needspace{2\baselineskip}% Break if needed.

\TestLettrine{L}{atex} as found in nature is a milky fluid found in 10\% of all flowering plants (angiosperms). It is a complex

\end{document}

enter image description here

It may even be better to include the \needspace command in your definition of \TestLettrine:

\newcommand{\TestLettrine}[2]{%
  \needspace{2\baselineskip}% Need at least 2 lines of text available on page, or else...
  \lettrine[lines=2, loversize=1.0]{#1}{ #2}%
}

The "relative" length 2\baselineskip ensures that there should be at least 2 lines of text that need to fit at the bottom of the page, otherwise a \break is issued.

Of course, you could also just use \newpage or \pagebreak yourself before the paragraph. However, that's a little too manual that doesn't adapt to changes in your document.

share|improve this answer
1  
This can only be manually applied, imagine a page that is almost typeset, you giving it two extra lines and will then insert the lettrine paragraph. Me thinks rather save the position and automate, rather use \pdfsavepos. –  Yiannis Lazarides Oct 8 '11 at 4:29
    
By including \needspace in the \TestLettrine macro, how can the page breaking requirement be considered manual? –  Werner Oct 8 '11 at 5:05
    
Sorry if I was not very clear, when I said can only be manually applied, I meant rather use \needspace manually as required. Personally, I wouldn't like the page to end with a dropcap. –  Yiannis Lazarides Oct 8 '11 at 5:57

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.