| 1 |
\documentclass[pagesize=auto]{scrartcl} |
| 2 |
|
| 3 |
\usepackage{fixltx2e} |
| 4 |
\setlength\parskip{3pt} |
| 5 |
|
| 6 |
\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}} |
| 7 |
\newcommand*{\pkg}[1]{\textsf{#1}} |
| 8 |
\newcommand*{\cls}[1]{\textsf{#1}} |
| 9 |
\newcommand*{\cs}[1]{\texttt{\textbackslash#1}} |
| 10 |
\makeatletter |
| 11 |
\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}} |
| 12 |
\makeatother |
| 13 |
\newcommand*{\env}[1]{\texttt{#1}} |
| 14 |
\newcommand*{\opt}[1]{\texttt{#1}} |
| 15 |
\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle} |
| 16 |
\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}} |
| 17 |
\newcommand*{\oarg}[1]{\texttt{[}\meta{#1}\texttt{]}} |
| 18 |
\newcommand*{\widevisiblespace}{% |
| 19 |
\vrule height 2pt depth 0pt width 0.2pt |
| 20 |
\kern -.1pt |
| 21 |
\vrule height 0.2pt depth 0pt width 15pt |
| 22 |
\kern -.1pt |
| 23 |
\vrule height 2pt depth 0pt width 0.2pt} |
| 24 |
|
| 25 |
\addtokomafont{title}{\rmfamily} |
| 26 |
|
| 27 |
\title{The \pkg{fwlw} package} |
| 28 |
\subtitle{First Word, Last Word} |
| 29 |
\author{Donald Arseneau} |
| 30 |
\date{1995} |
| 31 |
|
| 32 |
|
| 33 |
\begin{document} |
| 34 |
|
| 35 |
\maketitle |
| 36 |
|
| 37 |
\noindent |
| 38 |
The fwlw package provides a mechanism to determine the first and |
| 39 |
last words on the current page, plus the first word on the \emph{next} |
| 40 |
page. (So perhaps it should have been named `fwlwnw'). These words |
| 41 |
can be used in head-lines or foot-lines. The `words' you see may |
| 42 |
not be real words, but any unbreakable object. |
| 43 |
|
| 44 |
Two pagestyles are defined to print these words: |
| 45 |
\verb+\pagestyle{NextWordFoot}+ which helps you read ahead to the |
| 46 |
word on the next page; and \verb+\pagestyle{fwlwhead}+ which is like |
| 47 |
the headers in a lexicon. Or you can use the |
| 48 |
words in your own page-style. The words are made available in the box |
| 49 |
registers: |
| 50 |
% |
| 51 |
\begin{labeling}[\hspace{\labelsep}--]{\quad\cmd{\FirstWordBox}} |
| 52 |
\setlength\itemsep{0pt} |
| 53 |
\item[\quad\cmd{\FirstWordBox}] first word on this page |
| 54 |
\item[\quad\cmd{\NextWordBox}] first word on next page |
| 55 |
\item[\quad\cmd{\LastWordBox}] last word on this page |
| 56 |
\end{labeling} |
| 57 |
% |
| 58 |
Use them in your header lines like: \verb+\usebox\LastWordBox+. |
| 59 |
|
| 60 |
Such labelling does not make sense when \cmd{\chapter} generates a page |
| 61 |
break, so the last page before a \cmd{\chapter} (or any \cmd{\clearpage}) gets |
| 62 |
a blank ``next word'', and the first page of the chapter gets a blank |
| 63 |
``first word''. The fwlwhead page style produces blank headers on |
| 64 |
float pages. |
| 65 |
|
| 66 |
Note that `words' are any unsplittable unit and may be things like: |
| 67 |
% |
| 68 |
\begin{itemize} |
| 69 |
\setlength\itemsep{0pt} |
| 70 |
\item two\textvisiblespace words (\texttt{two}% |
| 71 |
\lower 2pt\hbox{\verb+~+}\texttt{words}) |
| 72 |
with unbreakable space between them |
| 73 |
\item \widevisiblespace Word (where \widevisiblespace\ represents a |
| 74 |
paragraph indent) |
| 75 |
\item a whole displayed equation |
| 76 |
\item the first column of an aligned equation |
| 77 |
\item a list item label |
| 78 |
\item anomalously blank, if there are \cmd{\write}s or split footnotes etc. |
| 79 |
\item blank for the first word of the document (because of a \cmd{\write}) |
| 80 |
\item partial words like `par-' or `-tial' due to hyphenation. |
| 81 |
\end{itemize} |
| 82 |
% |
| 83 |
In short, a wide range of irregularities will cause non-words to |
| 84 |
be captured, or nothing at all. |
| 85 |
|
| 86 |
|
| 87 |
\end{document} |