# Catchwords: Print first word from next page at bottom of current page

I would like to typeset catchwords. That is, I would like to put a “preview” of the next page’s first word at the bottom of every page.

The next page begins with the word (actually word fragment in this particular case) “dos”, and so that word is typeset flush right just below the text-block.

(How) can this be done with TeX?

-
try with "\looseness=-1" after the last word ? –  madit Oct 3 '12 at 18:26
Are you asking about en.wikipedia.org/wiki/Catchword? “A catchword is a word placed at the foot of a handwritten or printed page that … anticipates the first word of the following page.” –  J. C. Salomon Oct 3 '12 at 18:43
@J.C.Salomon Yes, exactly! –  Erasm Oct 3 '12 at 18:46
@Erasm I don't think this is possible in (La)TeX, but maybe some LuaTeX trickery can help. –  egreg Oct 3 '12 at 19:28
This is surely possible in LuaTeX: use the post_linebreak_filter to analyze the paragraphs and then atbegshi to find the last line on the page and add the information you've got from step one. Easy ;-)) –  topskip Oct 3 '12 at 19:45

You can use the fwlw ("First Word, Last Word") package; a little example using a footer defined with the fancyhdr package:

\documentclass{article}
\usepackage[latin]{babel}
\usepackage[a6paper,footskip=0pt]{geometry}
\usepackage{fwlw}
\usepackage{fancyhdr}
\usepackage[veryoldstyle]{kpfonts}
\usepackage{lipsum}
\fancyhf{}
\fancyfoot[R]{\usebox\NextWordBox}
\pagestyle{fancy}

\begin{document}

\lipsum[4-60]

\end{document}


An image of the first four pages:

The package gives access to the ﬁrst word on the current page (\FirstWordBox), the ﬁrst word on the next page (\NextWordBox), and the last word on the current page (\LastWordBox).

The package also offers a predefined page style NextWordFoot to read ahead to the first word on the next page:

\documentclass{article}
\usepackage[latin]{babel}
\usepackage[a6paper,footskip=0pt]{geometry}
\usepackage{fwlw}
\usepackage[veryoldstyle]{kpfonts}
\usepackage{lipsum}

\pagestyle{NextWordFoot}

\begin{document}

\lipsum[4-60]

\end{document}


-
Who could imagine there's a package for this? :) –  henrique Oct 4 '12 at 1:25
Is there another way of doing it without wasting the footer? –  NVaughan Oct 4 '12 at 1:49
@NVaughan sure; in many ways. You can use, for example, the background package: \documentclass{article} \usepackage[latin]{babel} \usepackage[a6paper,footskip=0pt]{geometry} \usepackage{fwlw} \usepackage{fancyhdr} \usepackage[veryoldstyle]{kpfonts} \usepackage{lipsum} \usepackage[bottom]{background} \backgroundsetup{ scale=1, color=black, opacity=1, vshift=64pt, contents={\makebox[\textwidth][r]{\usebox\NextWordBox}}, } \begin{document} \lipsum[4-60] \end{document} –  Gonzalo Medina Oct 4 '12 at 2:02
@GonzaloMedina, cheers! –  NVaughan Oct 4 '12 at 2:10
@GonzaloMedina Great find! –  egreg Oct 4 '12 at 6:29
show 1 more comment