\documentclass[pagesize=auto]{scrartcl} \usepackage{fixltx2e} \setlength\parskip{3pt} \newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}} \newcommand*{\pkg}[1]{\textsf{#1}} \newcommand*{\cls}[1]{\textsf{#1}} \newcommand*{\cs}[1]{\texttt{\textbackslash#1}} \makeatletter \newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}} \makeatother \newcommand*{\env}[1]{\texttt{#1}} \newcommand*{\opt}[1]{\texttt{#1}} \newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle} \newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}} \newcommand*{\oarg}[1]{\texttt{[}\meta{#1}\texttt{]}} \newcommand*{\widevisiblespace}{% \vrule height 2pt depth 0pt width 0.2pt \kern -.1pt \vrule height 0.2pt depth 0pt width 15pt \kern -.1pt \vrule height 2pt depth 0pt width 0.2pt} \addtokomafont{title}{\rmfamily} \title{The \pkg{fwlw} package} \subtitle{First Word, Last Word} \author{Donald Arseneau} \date{1995} \begin{document} \maketitle \noindent The fwlw package provides a mechanism to determine the first and last words on the current page, plus the first word on the \emph{next} page. (So perhaps it should have been named `fwlwnw'). These words can be used in head-lines or foot-lines. The `words' you see may not be real words, but any unbreakable object. Two pagestyles are defined to print these words: \verb+\pagestyle{NextWordFoot}+ which helps you read ahead to the word on the next page; and \verb+\pagestyle{fwlwhead}+ which is like the headers in a lexicon. Or you can use the words in your own page-style. The words are made available in the box registers: % \begin{labeling}[\hspace{\labelsep}--]{\quad\cmd{\FirstWordBox}} \setlength\itemsep{0pt} \item[\quad\cmd{\FirstWordBox}] first word on this page \item[\quad\cmd{\NextWordBox}] first word on next page \item[\quad\cmd{\LastWordBox}] last word on this page \end{labeling} % Use them in your header lines like: \verb+\usebox\LastWordBox+. Such labelling does not make sense when \cmd{\chapter} generates a page break, so the last page before a \cmd{\chapter} (or any \cmd{\clearpage}) gets a blank ``next word'', and the first page of the chapter gets a blank ``first word''. The fwlwhead page style produces blank headers on float pages. Note that `words' are any unsplittable unit and may be things like: % \begin{itemize} \setlength\itemsep{0pt} \item two\textvisiblespace words (\texttt{two}% \lower 2pt\hbox{\verb+~+}\texttt{words}) with unbreakable space between them \item \widevisiblespace Word (where \widevisiblespace\ represents a paragraph indent) \item a whole displayed equation \item the first column of an aligned equation \item a list item label \item anomalously blank, if there are \cmd{\write}s or split footnotes etc. \item blank for the first word of the document (because of a \cmd{\write}) \item partial words like `par-' or `-tial' due to hyphenation. \end{itemize} % In short, a wide range of irregularities will cause non-words to be captured, or nothing at all. \end{document}