summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/underlin/underlin.dtx
blob: 663aedf14a013a20055b0463b9e377adeb27a163 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
% \iffalse
%% File: underlin.dtx Copyright (C) 1987-1997 Rainer Sch"opf
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{underlin}
%<package>         [1997/02/16 v1.01 underlined running head (RmS)]
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{underlin}
\pagestyle{underline}
\GetFileInfo{underlin.sty}
\begin{document}
\title{Two {\sf pagestyles} for underlining headers\thanks{This file
       has version number \fileversion, last revised \filedate.}}
\author{Rainer Sch\"opf}
\date{\filedate}
\maketitle
\DocInput{underlin.dtx}
\end{document}
%</driver>
% \fi
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \CheckSum{47}
%
% \changes{1.01}{1997/02/16}{Version 1.0a converted to \LaTeXe
%    documentation format.}
%
% \begin{abstract}
%   This package implements two new {\sf pagestyles}
%   {\tt underline} and {\tt myunderline} that are similar
%   to the standard {\tt headings} and {\tt myheadings}
%   {\sf pagestyles} but provide a horizontal line just below
%   the head line.
% \end{abstract}
%
% The purpose of this package file is to provide a way to
% underline a running head.
% This is done by redefining the \verb+\@evenhead+ and \verb+\@oddhead+
% macros.
% To understand this you must know that whenever a given pagestyle
% (say `xxx') is selected by a \verb+\pagestyle{xxx}+ command the
% macro \verb+\ps@xxx+ is executed.
% Therefore we define a macro \verb+\ps@underline+ which is called
% when you say \verb+\pagestyle{underline}+.
% To provide for a rule with user-defined headings we also define
% the pagestyle `myunderline' , i.e.\ the macro \verb+\ps@myunderline+.
%
% \StopEventually{}
%
% \section{Implementation}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
% \begin{macro}{\ps@underline}
%    The first thing the macro \verb+\ps@underline+
%    does is to call
%    \verb+\ps@headings+ to set up everything like the `headings'
%    pagestyle does.
%    Here we do not need to distinguish onesided and twosided
%    printing since this is already done correctly by
%    \verb+\ps@headings+.
%    \begin{macrocode}
\def\ps@underline{\ps@headings
%    \end{macrocode}
%    Then we redefine \verb+\@evenhead+. The first part is a copy of
%    the definition in \verb+\ps@headings+.
%    This has the advantage that this style option works with
%    document styles `article', `report', and `book'.
%    \begin{macrocode}
  \def\@evenhead{\thepage\hfil\slshape\leftmark\null
%    \end{macrocode}
%    \verb|\null| is defined to be \verb|\hbox{}| in the \LaTeX{}
%    kernel file \texttt{ltplain.dtx}.
%    Additionally we include a \verb+\vadjust+ primitive. The effect of
%    this primitive is to add its argument after the current
%    \verb+\hbox+ to the enclosing vertical list.
%    \begin{macrocode}
    \vadjust{\vskip .3ex\hrule}}%
%    \end{macrocode}
%    The \verb+\@oddhead+ macro is constructed
%    analogously.
%    \begin{macrocode}
  \def\@oddhead{\null{\slshape \rightmark}\hfil\thepage
    \vadjust{\vskip .3ex\hrule}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ps@myunderline}
%    The macro \verb+\ps@myunderline+ for underlining user defined
%    running heads is constructed analogously.
%    \begin{macrocode}
\def\ps@myunderline{\ps@myheadings
  \def\@oddhead{\null{\slshape\rightmark}\hfil
    \rm\thepage\vadjust{\vskip .3ex\hrule}}%
  \def\@evenhead{\thepage\hfil\slshape \leftmark \null
    \vadjust{\vskip .3ex\hrule}}}
%    \end{macrocode}
% \end{macro}
%
%
% Well, that's all. Use it and enjoy.
%
% \Finale
%
\endinput