summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-02-28 23:27:11 +0000
committerKarl Berry <karl@freefriends.org>2011-02-28 23:27:11 +0000
commita0b9fe01b11de01686c8e02891c57fff5f9a96f1 (patch)
treea81b62a46b6d981bdc9e2ca770829e54e0be8ac6 /Master/texmf-dist/tex/latex
parentd026a98519637df25984ef5341b4f471608f35d0 (diff)
fwlw (28feb11)
git-svn-id: svn://tug.org/texlive/trunk@21548 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/fwlw/fwlw.sty64
1 files changed, 39 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/fwlw/fwlw.sty b/Master/texmf-dist/tex/latex/fwlw/fwlw.sty
index 17498f0bd51..10a4ee04a5c 100644
--- a/Master/texmf-dist/tex/latex/fwlw/fwlw.sty
+++ b/Master/texmf-dist/tex/latex/fwlw/fwlw.sty
@@ -2,59 +2,73 @@
%
% Donald Arseneau (1993, 1995)
%
-% Modifications to LaTeX output mechanism to determine the first and
+% The fwlw package provides a mechanism to determine the first and
% last words on the current page, plus the first word on the *next*
% page. These can be used in head-lines or foot-lines. The `words'
% you see may not be real words, but any unbreakable object.
%
-% Such labelling does not make sense when \chapter generates a page
-% break, so the last page before a \chapter (or any \clearpage) gets
-% a blank "next word", and the first page of the chapter gets a blank
-% "first word". There is a problem when footnotes split: the "next word"
-% is blank.
-%
% Two pagestyles are defined to print these words: \pagestyle{NextWordFoot}
% which helps you read ahead to the word on the next page; and \pagestyle
% {fwlwhead} which is like the headers in a lexicon. Or you can use the
-% words in your own page-style...
-% The words are available in the box registers:
-% \FirstWordBox - first word on this page
-% \NextWordBox - first word on next page
-% \LastWordBox - last word on this page
-% Use them in your header lines like: \copy\LastWordBox.
+% words in your own page-style. The words are made available in the box
+% registers:
+% \FirstWordBox - first word on this page
+% \NextWordBox - first word on next page
+% \LastWordBox - last word on this page
+% Use them in your header lines like: \usebox\LastWordBox.
+%
+% Such labelling does not make much sense when \chapter generates a page
+% break, so the last page before a \chapter (or any \clearpage) gets
+% a blank "next word", and the first page of the chapter gets a blank
+% "first word".
%
-% Note that `words' may be things like:
+% Note that `words' may unfortunately be things like:
% - two~words
% - [ ]Word ( [ ] represents a parindent box)
% - a whole displayed equation
% - the first column of an aligned equation
% - anomalously blank, if there are \writes or split footnotes etc.
-% - partial words like par- or -tial.
+% - partial words like par- or -tial due to hyphenation.
%
+% (Major digression...)
% An entirely different approach is possible using \mark and \obeyspaces,
% and would have different problems. The problems with catcode changes
-% may be more or less serious for your particular application. You are
-% welcome to write a package using that method. The best solution would
+% may be more or less serious for your particular application. (You are
+% invited to write a package using that method!) The best solution would
% involve \mark and an input filter program to
% `\w{tag} \w{each} \w{word}, \w{in} \w{some} \w{way}.'
-
+% TeX has no \everyword hook to insert such tagging.
+%
+% Copyright (C) 1993,1995 by Donald Arseneau
+% Vancouver, Canada, email asnd@triumf.ca
+% This software package may be freely used, transmitted, reproduced,
+% or modified provided that this notice is left intact.
+%
+% Declare a "unique" penalty value as flag
\mathchardef\LW@pen 12345
+
+% allocate box registers
\newbox\FirstWordBox \global\setbox\FirstWordBox\hbox{}
\newbox\NextWordBox \global\setbox\NextWordBox\hbox{}
\newbox\LastWordBox \global\setbox\LastWordBox\hbox{}
\newbox\LW@box \global\setbox\LW@box\hbox{}
\newbox\LW@saved
+% pagestyle fwlwhead: header line hsa first word and last word
\def\ps@fwlwhead{\let\@mkboth\@gobbletwo
- \def\@oddhead{\if@fcolmade\else \copy\FirstWordBox\hfil\copy\LastWordBox\fi}%
- \let\@evenhead\@oddhead % no word-heads on float pages.
+ \def\@oddhead{\if@fcolmade\else % no word-heads on float pages.
+ \usebox\FirstWordBox\hfil\usebox\LastWordBox\fi}%
+ \let\@evenhead\@oddhead
\let\@oddfoot\@empty\let\@evenfoot\@oddfoot
\let\chaptermark\@gobble\let\sectionmark\@gobble\let\subsectionmark\@gobble
}
+% pagestyle NextWordFoot: foot line has page number and next-page first word,
+% but only on odd pages
\def\ps@NextWordFoot{\let\@mkboth\@gobbletwo
\let\@oddhead\@empty\let\@evenhead\@oddhead
- \def\@oddfoot{\hfil\thepage\hfil\llap{\copy\NextWordBox}}\let\@evenfoot\@empty
+ \def\@oddfoot{\hfil\thepage\hfil\llap{\usebox\NextWordBox}}%
+ \let\@evenfoot\@empty
\let\chaptermark\@gobble\let\sectionmark\@gobble\let\subsectionmark\@gobble
}
@@ -62,10 +76,10 @@
% letting TeX continue with \vsize=0 to get a look at the next line.
% Values of \outputpenalty for \specialoutput ( -10001 to -19999 ) are
% simply run through the output routine.
-% \supereject and \clearpage give a blank "next word"
-% When called after making a stub-page the stub is returned to the vertical
-% list, the previous page is restored and shipped out normally, but
-% knowing what the next word will be.
+% \supereject and \clearpage give a blank "next word".
+% When called after making a stub-page the stub is returned to the
+% vertical list, the previous page is restored and shipped out normally,
+% but knowing what the next word will be.
\edef\FWLWnorm@L@output{\the\output}