24.4 Header and Footer
Instead the noweb page style we define our own header and footer. Up to
ALLPROSE version 0.2.3 we have built on the fancyhdr package. Since we do not
need so much flexibility and since fancyhdr as well as hyperref use ∖edef (which led to
difficulties), it was easier to define a page style for an appropriate header and footer
directly.
In the html version, there are no headers and footers. The dvi and pdf versions
are hyperlinked in the following way.
-
Header left:
- Section or subsection name.
-
Header right:
- Links to the table of contents and the index or (for .as files) name of
domain, category, package, function or constant that is defined on the
corresponding page. The (temporary) redefinition appears in Section 24.3.3.
216b⟨page style allprose header 216a⟩+
≡ (218a) ⊲216a
\def\headerhyperlink#1{\hyperlink{sec:#1}{#1}}
\def\rhead#1{\gdef\@rhead{#1}}\rhead{}
\def\rheaddefault{\rhead{\headerhyperlink{Contents} \headerhyperlink{Index}}}
Defines:
rhead, used in chunk 205.
rheaddefault, used in chunk 218.
-
Footer left:
- Name of the project and its version followed by the full filename
(∖currentfile) which links to the starting page of that file.
Note that we use the filename that is active at the bottom of the page
(∖botmark). See also ∖nwfilename.
217a⟨page style allprose footer 217a⟩≡ (218a) 217b ⊳
\def\footerhyperlink#1#2{\hyperlink{s:#2}{\textbf{#2}}}
% Disable \defineterm if \xProject appears in the footer.
\def\uProject{{\def\@@xnamedef##1##2##3{\useterm{##2}}\xProject}}
\def\@lfoot{\uProject{} \LIBRARYVERSION{}:
\expandafter\footerhyperlink\botmark\@empty\@empty}
Uses LIBRARYVERSION 362.
-
Footer right:
- Date and time of the compilation of the documentation followed by
the page number.
217b⟨page style allprose footer 217a⟩+
≡ (218a) ⊲217a
\def\@rfoot{\hyperlink{sec:Index}{{[\rhxtoday~\CurrentTime]} \thepage}}
\newcount\hours\newcount\minutes
\hours=\time
\divide\hours by 60
\minutes=-\hours \multiply\minutes by 60 \advance\minutes \time
\def\rhx@twodigits#1{\ifnum#1<10 0\fi\number#1}
\newcommand{\CurrentTime}{\the\hours:\rhx@twodigits{\the\minutes}}
\edef\rhxtoday{\rhx@twodigits{\the\day}-\ifcase\month\or
Jan\or Feb\or Mar\or Apr\or May\or Jun\or
Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi-\number\year}
By putting everything together, we define the allprose page style.
218a⟨page header/footer 218a⟩≡ (199)
⟨page style allprose header 216a⟩
⟨page style allprose footer 217a⟩
⟨page style allprose mark 218b⟩
\def\ps@allprose{%
\def\sectionmark##1{\rhxmark{\z@}{\thesection}{##1}}
\def\subsectionmark##1{\rhxmark{\@ne}{\thesection}{##1}}
\let\@mkboth\@gobbletwo
\rheaddefault
\def\@oddhead{{\reset@font\footnotesize\@lhead\hfill\@rhead}}%
\def\@oddfoot{{\reset@font\footnotesize\@lfoot\hfill\@rfoot}}
\let\@evenhead\@oddhead
\let\@evenfoot\@oddfoot
}
\pagestyle{allprose}
Uses rheaddefault 216b.
In order to get the right file name at the bottom of the page, we use TEX’s ∖mark
command via an abuse of ∖markboth. Instead of marking for even and odd pages, we
use the left mark for the section name that appears in the header and the right mark
for the current filename.