summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ncctools/nccfancyhdr.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-13 00:00:29 +0000
committerKarl Berry <karl@freefriends.org>2006-01-13 00:00:29 +0000
commit8b8fbae5990dee3b8ab739df0de8b7c365e4d227 (patch)
tree824392c1bb07fe8c8b620efd3992cc0daa3e433a /Master/texmf-dist/tex/latex/ncctools/nccfancyhdr.sty
parente9351f8ac4f8603d6020be78e092e939e24d89d0 (diff)
ncctools
git-svn-id: svn://tug.org/texlive/trunk@1132 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ncctools/nccfancyhdr.sty')
-rw-r--r--Master/texmf-dist/tex/latex/ncctools/nccfancyhdr.sty345
1 files changed, 345 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/ncctools/nccfancyhdr.sty b/Master/texmf-dist/tex/latex/ncctools/nccfancyhdr.sty
new file mode 100644
index 00000000000..8e1b4f02ced
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/ncctools/nccfancyhdr.sty
@@ -0,0 +1,345 @@
+%%
+%% This is file `nccfancyhdr.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% nccfancyhdr.dtx (with options: `package')
+%%
+%% IMPORTANT NOTICE:
+%%
+%% This file is a generated file from the sources of the `ncctools'
+%% bundle.
+%%
+%% You are not allowed to modify this file.
+%%
+%% You are allowed to distribute this file if and only if
+%% it is distributed with the corresponding source files in
+%% the `ncctools' bundle.
+%%
+%% For the copying and distribution conditions of the source files,
+%% see the README file distributed with the ncctools bundle.
+%%
+%% File: nccfancyhdr.dtx Copyright (C) 2002--2004 by Alexander I. Rozhenko
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{nccfancyhdr}
+ [2004/12/07 v1.1 Improved Fancy Header Package (NCC)]
+\newcommand*{\newpagestyle}[1]{%
+ \@ifnextchar[{\NCC@newpagestyle{#1}}{\NCC@newpagestyle{#1}[fancy]}%
+}
+\long\def\NCC@newpagestyle#1[#2]#3{%
+ \@ifundefined{ps@#2}{%
+ \PackageError{nccfancyhdr}
+ {\string\newpagestyle: Unknown base page style `#2'}{}%
+ }{}%
+ \edef\@tempa{\noexpand\newcommand \expandafter\noexpand
+ \csname ps@#1\endcsname}%
+ \expandafter\@tempa\expandafter{\csname ps@#2\endcsname #3}%
+}
+\@onlypreamble\newpagestyle
+\@onlypreamble\NCC@newpagestyle
+\newcommand*{\fancyhf}[1][lh,ch,rh,lf,cf,rf]{\NCC@fancyhf{}{#1}}
+\newcommand*{\fancyhead}[1][l,c,r]{\NCC@fancyhf h{#1}}
+\newcommand*{\fancyfoot}[1][l,c,r]{\NCC@fancyhf f{#1}}
+\newcommand{\lhead}{\@dblarg{\NCC@fancy{lh}}}
+\newcommand{\chead}{\@dblarg{\NCC@fancy{ch}}}
+\newcommand{\rhead}{\@dblarg{\NCC@fancy{rh}}}
+\newcommand{\lfoot}{\@dblarg{\NCC@fancy{lf}}}
+\newcommand{\cfoot}{\@dblarg{\NCC@fancy{cf}}}
+\newcommand{\rfoot}{\@dblarg{\NCC@fancy{rf}}}
+\def\NCC@fancy#1[#2]#3{
+ \expandafter\def\csname NCC@f@e#1\endcsname{#2}%
+ \expandafter\def\csname NCC@f@o#1\endcsname{#3}%
+}
+\def\NCC@fancyhf#1#2#3{%
+ \@for\@tempa:=#2\do
+ {\edef\@tempa{\noexpand\NCC@fancydef{#1\@tempa}}\@tempa{#3}}%
+}
+\def\NCC@fancydef#1#2{%
+ \let\NCC@hf\relax \let\NCC@lcr\relax \let\NCC@oe\relax
+ \@tfor \@nextchar:=#1\do
+ {\edef\@tempa{\noexpand\uppercase{\noexpand\def%
+ \noexpand\@tempa{\@nextchar}}}\@tempa
+ \if\@tempa H\NCC@fancyclass\NCC@hf{h}{#1}\else
+ \if\@tempa F\NCC@fancyclass\NCC@hf{f}{#1}\else
+ \if\@tempa L\NCC@fancyclass\NCC@lcr{l}{#1}\else
+ \if\@tempa C\NCC@fancyclass\NCC@lcr{c}{#1}\else
+ \if\@tempa R\NCC@fancyclass\NCC@lcr{r}{#1}\else
+ \if\@tempa O\NCC@fancyclass\NCC@oe{o}{#1}\else
+ \if\@tempa E\NCC@fancyclass\NCC@oe{e}{#1}\else
+ \NCC@fancyerror{Illegal char `\@nextchar' in argument `#1'}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ }%
+ \ifx\NCC@hf\relax \NCC@fancyerror{No `h' or `f' specified}\else
+ \ifx\NCC@lcr\relax \NCC@fancyerror{No `l' or `c' or `r' specified}\else
+ \ifx\NCC@oe\relax
+ \expandafter\def\csname NCC@f@o\NCC@lcr\NCC@hf\endcsname{#2}%
+ \expandafter\def\csname NCC@f@e\NCC@lcr\NCC@hf\endcsname{#2}%
+ \else
+ \expandafter\def\csname NCC@f@\NCC@oe\NCC@lcr\NCC@hf\endcsname{#2}%
+ \fi
+ \fi
+ \fi
+}
+\def\NCC@fancyclass#1#2#3{%
+ \ifx#1\relax
+ \def#1{#2}%
+ \else
+ \NCC@fancyerror{Misusing the char `\@nextchar' in argument `#3'}%
+ \fi
+}
+\def\NCC@fancyerror#1{%
+ \PackageError{nccfancyhdr}%
+ {Fancy mark definitions:\MessageBreak#1}%
+}
+\newdimen\headwidth
+\newcommand{\extendedheaders}{
+ \@tempdima\marginparwidth \advance\@tempdima\marginparsep
+ \@tempdimb\textwidth \advance\@tempdimb\@tempdima
+ \if@twocolumn \advance\@tempdimb\@tempdima \fi
+ \global\headwidth\@tempdimb
+}
+\newcommand{\normalheaders}{\global\headwidth\textwidth}
+\newcommand{\headrulewidth}{.4\p@}
+\newcommand{\footrulewidth}{\z@}
+\newcommand{\headstrutheight}{.3\normalbaselineskip}
+\newcommand{\footstrutheight}{.3\normalbaselineskip}
+\newcommand{\headrule}{%
+ \setlength\@tempdima{\headrulewidth}%
+ \hrule\@height\@tempdima\@width\headwidth
+ \vskip-\@tempdima
+}
+\newcommand{\footrule}{%
+ \setlength\@tempdima{\footrulewidth}% Can use calc here
+ \vskip -\@tempdima
+ \hrule \@height\@tempdima \@width\headwidth
+}
+\def\NCC@fancyreset{\let\baselinestretch\@empty
+ \long\def\nouppercase##1{%
+ \begingroup
+ \long\def\uppercase####1{####1}%
+ \long\def\MakeUppercase####1{####1}%
+ ##1%
+ \endgroup
+ }%
+ \reset@font
+}
+\def\NCC@fancyhead#1#2#3{%
+ \hb@xt@\headwidth{\NCC@fancyreset
+ \setbox\@tempboxa\vtop{%
+ \hbox{%
+ \rlap{\parbox[b]\headwidth{\raggedright#1}}%
+ \setlength\@tempdima{\headstrutheight}%
+ \vrule\@width\z@\@height\z@\@depth\@tempdima
+ \parbox[b]\headwidth{\centering#2}%
+ \llap{\parbox[b]\headwidth{\raggedleft#3}}%
+ }%
+ \headrule
+ }%
+ \NCC@fancytest\headheight
+ \box\@tempboxa
+ }%
+}
+\def\NCC@fancyfoot#1#2#3{%
+ \hb@xt@\headwidth{\NCC@fancyreset
+ \setbox\@tempboxa\vbox{%
+ \footrule
+ \hbox{%
+ \rlap{\parbox[t]\headwidth{\raggedright#1}}%
+ \@tempdima .55\normalbaselineskip
+ \addtolength\@tempdima{\footstrutheight}%
+ \vrule\@width\z@\@height\@tempdima\@depth\z@
+ \parbox[t]\headwidth{\centering#2}%
+ \llap{\parbox[t]\headwidth{\raggedleft#3}}%
+ }%
+ }%
+ \NCC@fancytest\footskip
+ \box\@tempboxa
+ }%
+}
+\def\NCC@fancytest#1{%
+ \ifdim\ht\@tempboxa>#1%
+ \PackageWarning{nccfancyhdr}%
+ {\string#1 is too small (\the#1):\MessageBreak
+ Make it at least \the\ht\@tempboxa.\MessageBreak
+ We now enlarge it for the rest of the document.\MessageBreak
+ This may cause the page layout to be inconsistent, however}%
+ \@tempdima#1\global\setlength{#1}{\ht\@tempboxa}%
+ \ht\@tempboxa\@tempdima
+ \fi
+}
+\def\NCC@ihss{\if@twocolumn\hss\else\if@reversemargin\hss\fi\fi}
+\def\NCC@ohss{\if@twocolumn\hss\else\if@reversemargin\else\hss\fi\fi}
+\newcommand*{\fancycenter}[1][1em]{%
+ \@ifnextchar[{\NCC@fancycenter{#1}}{\NCC@fancycenter{#1}[3]}%
+}
+\def\NCC@fancycenter#1[#2]#3#4#5{%
+ \def\@tempa{#4}\ifx\@tempa\@empty
+ \hb@xt@\linewidth{\color@begingroup{#3}\hfil {#5}\color@endgroup}%
+ \else
+ \setlength\@tempdima{#1}%
+ \setlength{\@tempdimb}{#2\@tempdima}%
+ \@tempdimc \@tempdimb \advance\@tempdimc -\@tempdima
+ \setlength\@tempskipa{\@tempdimb \@plus 1fil \@minus \@tempdimc}%
+ \@tempskipb\@tempskipa
+ \def\@tempa{#3}\ifx\@tempa\@empty
+ \addtolength\@tempskipa{\z@ \@minus \@tempdima}%
+ \fi
+ \def\@tempa{#5}\ifx\@tempa\@empty % empty right
+ \addtolength\@tempskipb{\z@ \@minus \@tempdima}%
+ \fi
+ \settowidth{\@tempdimb}{#3}%
+ \settowidth{\@tempdimc}{#5}%
+ \ifdim\@tempdimb>\@tempdimc
+ \advance\@tempdimb -\@tempdimc
+ \addtolength\@tempskipb{\@tempdimb \@minus \@tempdimb}%
+ \else
+ \advance\@tempdimc -\@tempdimb
+ \addtolength\@tempskipa{\@tempdimc \@minus \@tempdimc}%
+ \fi
+ \hb@xt@\linewidth{\color@begingroup{#3}\hskip \@tempskipa
+ {#4}\hskip \@tempskipb {#5}\color@endgroup}%
+ \fi
+}
+\def\ps@fancy{\ps@empty
+ \def\@oddhead{%
+ \NCC@ihss \NCC@fancyhead\NCC@f@olh\NCC@f@och\NCC@f@orh \NCC@ohss}%
+ \def\@evenhead{%
+ \NCC@ohss \NCC@fancyhead\NCC@f@elh\NCC@f@ech\NCC@f@erh \NCC@ihss}%
+ \def\@oddfoot{%
+ \NCC@ihss \NCC@fancyfoot\NCC@f@olf\NCC@f@ocf\NCC@f@orf \NCC@ohss}%
+ \def\@evenfoot{%
+ \NCC@ohss \NCC@fancyfoot\NCC@f@elf\NCC@f@ecf\NCC@f@erf \NCC@ihss}%
+ \fancyhf{}%
+}
+\DeclareOption{empty}{%
+ \let\NCC@psempty\ps@empty
+ \def\ps@empty{\NCC@psempty
+ \def\@oddhead{%
+ \NCC@ihss \NCC@fancyhead\NCC@f@olh\NCC@f@och\NCC@f@orh \NCC@ohss}%
+ \def\@evenhead{%
+ \NCC@ohss \NCC@fancyhead\NCC@f@elh\NCC@f@ech\NCC@f@erh \NCC@ihss}%
+ \def\@oddfoot{%
+ \NCC@ihss \NCC@fancyfoot\NCC@f@olf\NCC@f@ocf\NCC@f@orf \NCC@ohss}%
+ \def\@evenfoot{%
+ \NCC@ohss \NCC@fancyfoot\NCC@f@elf\NCC@f@ecf\NCC@f@erf \NCC@ihss}%
+ \fancyhf{}%
+ }%
+ \pagestyle{empty}%
+}
+\DeclareOption{plain}{%
+ \def\ps@plain{\ps@fancy \let\@mkboth\@gobbletwo
+ \fancyfoot[c]{\thepage}%
+ }%
+ \pagestyle{plain}%
+}
+\DeclareOption{myheadings}{%
+ \@ifundefined{chapter}{%
+ \def\ps@myheadings{\ps@fancy \let\@mkboth\@gobbletwo
+ \fancyhead[ce]{\fancycenter{\thepage}{}{\slshape\leftmark}}%
+ \fancyhead[co]{\fancycenter{\slshape\rightmark}{}{\thepage}}%
+ \let\sectionmark\@gobble
+ \let\subsectionmark\@gobble
+ }%
+ }{\def\ps@myheadings{\ps@fancy \let\@mkboth\@gobbletwo
+ \fancyhead[ce]{\fancycenter{\thepage}{}{\slshape\leftmark}}%
+ \fancyhead[co]{\fancycenter{\slshape\rightmark}{}{\thepage}}%
+ \let\chaptermark\@gobble
+ \let\sectionmark\@gobble
+ }%
+ }%
+ \pagestyle{myheadings}%
+}
+\DeclareOption{headings}{%
+ \@ifundefined{chapter}{%
+ \if@twoside
+ \def\ps@headings{\ps@fancy \let\@mkboth\markboth
+ \fancyhead[ce]{\fancycenter{\thepage}{}{\slshape\leftmark}}%
+ \fancyhead[co]{\fancycenter{\slshape\rightmark}{}{\thepage}}%
+ \def\sectionmark##1{%
+ \markboth{\MakeUppercase{%
+ \ifnum \c@secnumdepth >\z@ \thesection\quad \fi##1}}{}}%
+ \def\subsectionmark##1{%
+ \markright{%
+ \ifnum \c@secnumdepth >\@ne \thesubsection\quad \fi##1}}%
+ }%
+ \else
+ \def\ps@headings{\ps@fancy \let\@mkboth\markboth
+ \fancyhead[ce]{\fancycenter{\thepage}{}{\slshape\leftmark}}%
+ \fancyhead[co]{\fancycenter{\slshape\rightmark}{}{\thepage}}%
+ \def\sectionmark##1{%
+ \markright {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\z@ \thesection\quad \fi##1}}}%
+ \let\subsectionmark\@gobble % Not needed but inserted for safety
+ }%
+ \fi
+ }{\if@twoside
+ \def\ps@headings{\ps@fancy \let\@mkboth\markboth
+ \fancyhead[ce]{\fancycenter{\thepage}{}{\slshape\leftmark}}%
+ \fancyhead[co]{\fancycenter{\slshape\rightmark}{}{\thepage}}%
+ \def\chaptermark##1{%
+ \markboth{\MakeUppercase{%
+ \ifnum \c@secnumdepth >\m@ne \if@mainmatter
+ \@chapapp\ \thechapter. \ \fi\fi##1}}{}}%
+ \def\sectionmark##1{%
+ \markright {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\z@ \thesection. \ \fi##1}}}%
+ }%
+ \else
+ \def\ps@headings{\ps@fancy \let\@mkboth\markboth
+ \fancyhead[ce]{\fancycenter{\thepage}{}{\slshape\leftmark}}%
+ \fancyhead[co]{\fancycenter{\slshape\rightmark}{}{\thepage}}%
+ \def\chaptermark##1{%
+ \markright{\MakeUppercase{%
+ \ifnum \c@secnumdepth >\m@ne \if@mainmatter
+ \@chapapp\ \thechapter. \ \fi\fi##1}}}%
+ \let\sectionmark\@gobble % Not needed but inserted for safety
+ }%
+ \fi
+ }%
+ \pagestyle{headings}%
+}
+\DeclareOption{testfloats}{%
+ \let\NCC@fancymakecol\@makecol
+ \let\NCC@fancytoplist\@empty
+ \let\NCC@fancybotlist\@empty
+ \def\@makecol{%
+ \let\NCC@fancytoplist\@toplist
+ \let\NCC@fancybotlist\@botlist
+ \NCC@fancymakecol
+ }%
+ \newcommand\iftopfloat{%
+ \ifx\NCC@fancytoplist\@empty
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi
+ }%
+ \newcommand\ifbotfloat{%
+ \ifx\NCC@fancybotlist\@empty
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi
+ }%
+ \newcommand\iffloatpage{%
+ \if@fcolmade
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+ }%
+}
+\ProcessOptions*
+\normalheaders
+\fancyhf{}
+\endinput
+%%
+%% End of file `nccfancyhdr.sty'.