LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Achim Blumensath <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Tue, 18 Jan 2000 21:05:27 CET
Content-Type:
text/plain
Parts/Attachments:
text/plain (296 lines)
Hello,

I wrote some templates for head- and footlines. The code is taken
mainly from the fancyhdr package.

Achim
________________________________________________________________________
                                _                             | \_____/ |
    //  Achim Blumensath       | \  _                        \O/ \___/\ |
   //   [log in to unmask]   |-< /_\                       =o=  \ /\ \|
 \X/    (p^2 - m^2)\psi = 0    |_/ \_                        /"\   o----|
____________________________________________________________________\___|

% \iffalse
%%
%% (C) Copyright 1999 Achim Blumensath
%% All rights reserved.
%%
%% Not for general distribution. In its present form it is not allowed
%% to put this package onto CD or an archive without consulting the
%% the authors.
%%
%<*dtx>
          \ProvidesFile{xhdr.dtx}
%</dtx>
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{xhdr}
%<driver>\ProvidesFile{xhdr.drv}
% \fi
%         \ProvidesFile{xhdr.dtx}
          [2000/01/16 v0.1 header styles]
%
% \iffalse
%<*driver>
 \documentclass{ltxdoc}
 \usepackage{textcomp}

% \usepackage{xparse,xlists,xlists-samples}
% \usepackage{ldcdoc}

% next three definitions are big hacks to run the file
% without the above packages
%
\newcommand\NoValue{\texttt{\textbackslash NoValue}}

\newenvironment{TemplateInterfaceDescription}[1]
  {\subsection{The Template Type `#1'}%
   \begingroup\description
   \def\TemplateArgument##1##2{\item[Arg: ##1]##2\par}%
   \def\TemplateSemantics{\enddescription\endgroup
       \subsubsection*{Semantics:}}%
  }
  {\par\bigskip}

\newenvironment{TemplateDescription}[2]
  {\subsection{The Template `#2' (type #1)}%
   \subsubsection*{Attributes:}%
   \begingroup\description
   \def\TemplateKey##1##2##3##4{\item[##1 (##2)]##3%
     \ifx\TemplateKey##4\TemplateKey\else
%         \hskip0ptplus3em\penalty-500\hskip 0pt plus 1filll Default:~##4%
         \hfill\penalty500\hbox{}\hfill Default:~##4%
         \nobreak\hskip-\parfillskip\hskip0pt\relax
     \fi
     \par}%
   \def\TemplateSemantics{\enddescription\endgroup
       \subsubsection*{Semantics \& Comments:}}%
  }
  {\par\bigskip}

 \begin{document}
 \DocInput{xhdr.dtx}
 \end{document}
%</driver>
% \fi
%
%
% \GetFileInfo{xhdr.dtx}
%
% \title{The \textsf{xhdr} package\thanks{This file
%         has version number \fileversion, last
%         revised \filedate.}}
% \author{AB}
% \date{\filedate}
%
%  \maketitle
%
% \tableofcontents
%
% \begin{abstract}
%   Package for head- and footline styles derived from the
%   \textsf{fancyhdr} package.
% \end{abstract}
%
% \section{Interfaces}
%
% \begin{TemplateInterfaceDescription}{header}
%
%   \TemplateArgument{1}
%       {Page number (\texttt{\textbackslash thepage})}
%
%   \TemplateArgument{2}
%       {Left mark (\texttt{\textbackslash leftmark})}
%
%   \TemplateArgument{3}
%       {Right mark (\texttt{\textbackslash rightmark})}
%
%   \TemplateSemantics
%
%   This template typesets a head- or footline.
%
% \end{TemplateInterfaceDescription}
%
%
% \begin{TemplateDescription}{header}{std}
%
%   \TemplateKey{pre-action}{f0}
%     {Action to perform before the header, e.g., \texttt{\textbackslash hss}.}
%     {empty}
%   \TemplateKey{post-action}{f0}
%     {Action to perform after the header, e.g., \texttt{\textbackslash hss}.}
%     {empty}
%   \TemplateKey{left-text}{f3}
%     {Text to appear at the left of the header. The arguments are the
%      same as the templates arguments.}
%     {empty}
%   \TemplateKey{center-text}{f3}
%     {Text to appear at the center of the header. The arguments are the
%      same as the templates arguments.}
%     {empty}
%   \TemplateKey{right-text}{f3}
%     {Text to appear at the right of the header. The arguments are the
%      same as the templates arguments.}
%     {empty}
%   \TemplateKey{valign}{f0}
%     {\texttt{b} for headlines, \texttt{t} for footlines.}
%     {\texttt{b}}
%   \TemplateKey{width}{l}
%     {Width of the header.}
%     {\texttt{\textbackslash textwidth}}
%   \TemplateKey{above-skip}{l}
%     {Skip above the header. Should be 0 for headlines.}
%     {0.3\texttt{\textbackslash normalbaselineskip}}
%   \TemplateKey{above-rule}{l}
%     {Height of the rule above the header.}
%     {0pt}
%   \TemplateKey{below-rule}{l}
%     {Height of the rule below the header.}
%     {0pt}
%
%   \TemplateSemantics
%   This implements the \textsf{fancyhdr} layout. Separate instances for
%   even/odd and head-/footlines are required.
%
% \end{TemplateDescription}
%
% \DescribeMacro\setheader
% The \verb|\setheader| command determines which headers should be used.
% The arguments are the names of instances for odd head, odd foot,
% even head, and even foot headers.
%
% \section{Implementation}
%
%    \begin{macrocode}
%<*package>
\RequirePackage{xparse}
\RequirePackage{template}

\IgnoreWhiteSpace
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTemplateType{header}{3}

\newdimen\HL@width
\newdimen\HL@aboverule
\newdimen\HL@belowrule
\newskip\HL@aboveskip

\DeclareTemplate{header}{std}{3}
{
  pre-action  =f0 []    \HL@preaction,
  post-action =f0 []    \HL@postaction,
  left-text   =f3 []    \HL@left,
  center-text =f3 []    \HL@center,
  right-text  =f3 []    \HL@right,
  valign      =f0 [b]   \HL@align,
  width       =l  [\DelayEvaluation{\textwidth}]
                        \HL@width,
  above-skip  =l  [\DelayEvaluation{0.3\normalbaselineskip}]
                        \HL@aboveskip,
  above-rule  =l  [0pt] \HL@aboverule,
  below-rule  =l  [0pt] \HL@belowrule
}
{
  \DoParameterAssignments
  \HL@preaction
  \hbox to\HL@width{
    \@normalsize
    \vbox{
      \vskip-\HL@aboveskip
      \vskip-\HL@aboverule
      \hrule\@width\HL@width\@height\HL@aboverule
      \vskip\HL@aboveskip
      \hbox{
        \rlap{\parbox[\HL@align]{\HL@width}
                {\raggedright\HL@left{#1}{#2}{#3}\strut}}\hfill
        \parbox[\HL@align]{\HL@width}
                {\centering\HL@center{#1}{#2}{#3}\strut}\hfill
        \llap{\parbox[\HL@align]{\HL@width}
                {\raggedleft\HL@right{#1}{#2}{#3}\strut}}
      }
      \hrule\@width\HL@width\@height\HL@belowrule
      \vskip-\HL@belowrule
    }
  }
  \HL@postaction
}
%    \end{macrocode}
% Two sample styles.
%    \begin{macrocode}
\DeclareInstance{header}{head-plain}{std}
{
  above-skip  = 0pt,
  pre-action  = {\if@reversemargin\hss\else\relax\fi},
  post-action = {\if@reversemargin\relax\else\hss\fi}
}
\DeclareInstance{header}{foot-plain}{std}
{
  center-text = {#1},
  valign      = t,
  pre-action  = {\if@reversemargin\hss\else\relax\fi},
  post-action = {\if@reversemargin\relax\else\hss\fi}
}
\DeclareInstance{header}{head-headings-odd}{std}
{
  left-text   = {\small\textsl{#2}},
  right-text  = {#1},
  above-skip  = 0pt,
  below-rule  = 0.4pt,
  pre-action  = {\if@reversemargin\hss\else\relax\fi},
  post-action = {\if@reversemargin\relax\else\hss\fi}
}
\DeclareInstance{header}{head-headings-even}{std}
{
  left-text   = {#1},
  right-text  = {\small\textsl{#3}},
  above-skip  = 0pt,
  below-rule  = 0.4pt,
  pre-action  = {\if@reversemargin\relax\else\hss\fi},
  post-action = {\if@reversemargin\hss\else\relax\fi}
}
\DeclareInstance{header}{foot-headings-odd}{std}
{
  valign      = t,
  pre-action  = {\if@reversemargin\hss\else\relax\fi},
  post-action = {\if@reversemargin\relax\else\hss\fi}
}
\DeclareInstance{header}{foot-headings-even}{std}
{
  valign      = t,
  pre-action  = {\if@reversemargin\relax\else\hss\fi},
  post-action = {\if@reversemargin\hss\else\relax\fi}
}
%    \end{macrocode}
%
% \texttt{\textbackslash setheader} determines which instances are used.
% The arguments consist of instace names for odd head, odd foot, even
% head, and even foot.
%    \begin{macrocode}
\DeclareDocumentCommand{\setheader}{mmmm}
{
  \def\@oddhead{
    \UseInstance{header}{#1}{\thepage}{\leftmark}{\rightmark}}
  \def\@oddfoot{
    \UseInstance{header}{#2}{\thepage}{\leftmark}{\rightmark}}
  \def\@evenhead{
    \UseInstance{header}{#3}{\thepage}{\leftmark}{\rightmark}}
  \def\@evenfoot{
    \UseInstance{header}{#4}{\thepage}{\leftmark}{\rightmark}}
}
%    \end{macrocode}
%
%    \begin{macrocode}
\endinput
%    \end{macrocode}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
%
% \Finale
%
\endinput

ATOM RSS1 RSS2