templates/icml2026/fancyhdr.sty
templates/icml2026/fancyhdr.styBrowse 56 files
13,213 tokens
31,715 bytes
Token encoding: o200k_base
Snapshot 24fd22b
← Back to SKILL.md
1%%2%% This is file `fancyhdr.sty',3%% generated with the docstrip utility.4%%5%% The original source files were:6%%7%% fancyhdr.dtx (with options: `fancyhdr')8%% 9%% This is a generated file.10%% 11%% This file may be distributed and/or modified under the conditions of12%% the LaTeX Project Public License, either version 1.3 of this license13%% or (at your option) any later version. The latest version of this14%% license is in:15%% 16%% http://www.latex-project.org/lppl.txt17%% 18%% and version 1.3 or later is part of all distributions of LaTeX version19%% 2005/12/01 or later.20%% 21%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%22\NeedsTeXFormat{LaTeX2e}[2018-04-01]23\ProvidesPackage{fancyhdr}%24 [2025/02/07 v5.225 Extensive control of page headers and footers]%26% Copyright (C) 1994-2025 by Pieter van Oostrum <pieter@vanoostrum.org>27%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%28\ifdefined\NewDocumentCommand\else\RequirePackage{xparse}\fi29\newif\iff@nch@check30\f@nch@checktrue31\DeclareOption{nocheck}{%32 \f@nch@checkfalse33}34\let\f@nch@gbl\relax35\newif\iff@nch@compatViii36\DeclareOption{compatV3}{%37 \PackageWarningNoLine{fancyhdr}{The `compatV3' option is deprecated.\MessageBreak38 It will disappear in one of the following releases.\MessageBreak39 Please change your document to work\MessageBreak40 without this option}41 \let\f@nch@gbl\global42 \f@nch@compatViiitrue43}44\newif\iff@nch@twoside45\f@nch@twosidefalse46\DeclareOption{twoside}{%47 \if@twoside\else\f@nch@twosidetrue\fi48}49\newcommand\f@nch@def[2]{%50 \def\temp@a{#2}\ifx\temp@a\@empty\f@nch@gbl\def#1{}%51 \else\f@nch@gbl\def#1{#2\strut}\fi}52\DeclareOption{myheadings}{%53 \@ifundefined{chapter}{%54 \def\ps@myheadings{\ps@f@nch@fancyproto \let\@mkboth\@gobbletwo55 \fancyhf{}56 \fancyhead[LE,RO]{\thepage}%57 \fancyhead[RE]{\slshape\leftmark}%58 \fancyhead[LO]{\slshape\rightmark}%59 \let\sectionmark\@gobble60 \let\subsectionmark\@gobble61 }%62 }%63 {\def\ps@myheadings{\ps@f@nch@fancyproto \let\@mkboth\@gobbletwo64 \fancyhf{}65 \fancyhead[LE,RO]{\thepage}%66 \fancyhead[RE]{\slshape\leftmark}%67 \fancyhead[LO]{\slshape\rightmark}%68 \let\chaptermark\@gobble69 \let\sectionmark\@gobble70 }%71 }%72}73\DeclareOption{headings}{%74 \@ifundefined{chapter}{%75 \if@twoside76 \def\ps@headings{\ps@f@nch@fancyproto \def\@mkboth{\protect\markboth}77 \fancyhf{}78 \fancyhead[LE,RO]{\thepage}%79 \fancyhead[RE]{\slshape\leftmark}%80 \fancyhead[LO]{\slshape\rightmark}%81 \def\sectionmark##1{%82 \markboth{\MakeUppercase{%83 \ifnum \c@secnumdepth >\z@ \thesection\quad \fi##1}}{}}%84 \def\subsectionmark##1{%85 \markright{%86 \ifnum \c@secnumdepth >\@ne \thesubsection\quad \fi##1}}%87 }%88 \else89 \def\ps@headings{\ps@f@nch@fancyproto \def\@mkboth{\protect\markboth}90 \fancyhf{}91 \fancyhead[LE,RO]{\thepage}%92 \fancyhead[RE]{\slshape\leftmark}%93 \fancyhead[LO]{\slshape\rightmark}%94 \def\sectionmark##1{%95 \markright {\MakeUppercase{%96 \ifnum \c@secnumdepth >\z@ \thesection\quad \fi##1}}}%97 \let\subsectionmark\@gobble % Not needed but inserted for safety98 }%99 \fi100 }{\if@twoside101 \def\ps@headings{\ps@f@nch@fancyproto \def\@mkboth{\protect\markboth}102 \fancyhf{}103 \fancyhead[LE,RO]{\thepage}%104 \fancyhead[RE]{\slshape\leftmark}%105 \fancyhead[LO]{\slshape\rightmark}%106 \def\chaptermark##1{%107 \markboth{\MakeUppercase{%108 \ifnum \c@secnumdepth >\m@ne \if@mainmatter109 \@chapapp\ \thechapter. \ \fi\fi##1}}{}}%110 \def\sectionmark##1{%111 \markright {\MakeUppercase{%112 \ifnum \c@secnumdepth >\z@ \thesection. \ \fi##1}}}%113 }%114 \else115 \def\ps@headings{\ps@f@nch@fancyproto \def\@mkboth{\protect\markboth}116 \fancyhf{}117 \fancyhead[LE,RO]{\thepage}%118 \fancyhead[RE]{\slshape\leftmark}%119 \fancyhead[LO]{\slshape\rightmark}%120 \def\chaptermark##1{%121 \markright{\MakeUppercase{%122 \ifnum \c@secnumdepth >\m@ne \if@mainmatter123 \@chapapp\ \thechapter. \ \fi\fi##1}}}%124 \let\sectionmark\@gobble % Not needed but inserted for safety125 }%126 \fi127 }%128}129\ProcessOptions*130\newcommand{\f@nch@forc}[3]{\expandafter\f@nchf@rc\expandafter#1\expandafter{#2}{#3}}131\newcommand{\f@nchf@rc}[3]{\def\temp@ty{#2}\ifx\@empty\temp@ty\else132 \f@nch@rc#1#2\f@nch@rc{#3}\fi}133\long\def\f@nch@rc#1#2#3\f@nch@rc#4{\def#1{#2}#4\f@nchf@rc#1{#3}{#4}}134\newcommand{\f@nch@for}[3]{\edef\@fortmp{#2}%135 \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}}136\newcommand\f@nch@default[3]{%137 \edef\temp@a{\lowercase{\edef\noexpand\temp@a{#3}}}\temp@a \def#1{}%138 \f@nch@forc\tmpf@ra{#2}%139 {\expandafter\f@nch@ifin\tmpf@ra\temp@a{\edef#1{#1\tmpf@ra}}{}}%140 \ifx\@empty#1\def#1{#2}\fi}141\newcommand{\f@nch@ifin}[4]{%142 \edef\temp@a{#2}\def\temp@b##1#1##2\temp@b{\def\temp@b{##1}}%143 \expandafter\temp@b#2#1\temp@b\ifx\temp@a\temp@b #4\else #3\fi}144\newcommand{\fancyhead}[2][]{\f@nch@fancyhf\fancyhead h[#1]{#2}}%145\newcommand{\fancyfoot}[2][]{\f@nch@fancyhf\fancyfoot f[#1]{#2}}%146\newcommand{\fancyhf}[2][]{\f@nch@fancyhf\fancyhf {}[#1]{#2}}%147\newcommand{\fancyheadoffset}[2][]{\f@nch@fancyhfoffs\fancyheadoffset h[#1]{#2}}%148\newcommand{\fancyfootoffset}[2][]{\f@nch@fancyhfoffs\fancyfootoffset f[#1]{#2}}%149\newcommand{\fancyhfoffset}[2][]{\f@nch@fancyhfoffs\fancyhfoffset {}[#1]{#2}}%150\def\f@nch@fancyhf@Echeck#1{%151 \if@twoside\else152 \iff@nch@twoside\else153 \if\f@nch@@eo e%154 \PackageWarning{fancyhdr} {\string#1's `E' option without twoside option is useless.\MessageBreak155 Please consider using the `twoside' option}%156 \fi\fi\fi157}158\long\def\f@nch@fancyhf#1#2[#3]#4{%159 \def\temp@c{}%160 \f@nch@forc\tmpf@ra{#3}%161 {\expandafter\f@nch@ifin\tmpf@ra{eolcrhf,EOLCRHF}%162 {}{\edef\temp@c{\temp@c\tmpf@ra}}}%163 \ifx\@empty\temp@c\else \PackageError{fancyhdr}{Illegal char `\temp@c' in164 \string#1 argument: [#3]}{}%165 \fi \f@nch@for\temp@c{#3}%166 {\f@nch@default\f@nch@@eo{eo}\temp@c167 \f@nch@fancyhf@Echeck{#1}%168 \f@nch@default\f@nch@@lcr{lcr}\temp@c169 \f@nch@default\f@nch@@hf{hf}{#2\temp@c}%170 \f@nch@forc\f@nch@eo\f@nch@@eo171 {\f@nch@forc\f@nch@lcr\f@nch@@lcr172 {\f@nch@forc\f@nch@hf\f@nch@@hf173 {\expandafter\f@nch@def\csname174 f@nch@\f@nch@eo\f@nch@lcr\f@nch@hf\endcsname {#4}}}}}}175\def\f@nch@fancyhfoffs#1#2[#3]#4{%176 \def\temp@c{}%177 \f@nch@forc\tmpf@ra{#3}%178 {\expandafter\f@nch@ifin\tmpf@ra{eolrhf,EOLRHF}%179 {}{\edef\temp@c{\temp@c\tmpf@ra}}}%180 \ifx\@empty\temp@c\else \PackageError{fancyhdr}{Illegal char `\temp@c' in181 \string#1 argument: [#3]}{}%182 \fi \f@nch@for\temp@c{#3}%183 {\f@nch@default\f@nch@@eo{eo}\temp@c184 \f@nch@fancyhf@Echeck{#1}%185 \f@nch@default\f@nch@@lcr{lr}\temp@c186 \f@nch@default\f@nch@@hf{hf}{#2\temp@c}%187 \f@nch@forc\f@nch@eo\f@nch@@eo188 {\f@nch@forc\f@nch@lcr\f@nch@@lcr189 {\f@nch@forc\f@nch@hf\f@nch@@hf190 {\expandafter\setlength\csname191 f@nch@offset@\f@nch@eo\f@nch@lcr\f@nch@hf\endcsname {#4}}}}}%192 \f@nch@setoffs}193\NewDocumentCommand {\fancyheadwidth}{ s O{} O{} m }194 {\f@nch@fancyhfwidth{#1}\fancyheadwidth h[#2][#3]{#4}}%195\NewDocumentCommand {\fancyfootwidth}{ s O{} O{} m }196 {\f@nch@fancyhfwidth{#1}\fancyfootwidth f[#2][#3]{#4}}%197\NewDocumentCommand {\fancyhfwidth} { s O{} O{} m }198 {\f@nch@fancyhfwidth{#1}\fancyhfwidth {}[#2][#3]{#4}}%199\def\f@nch@fancyhfwidth#1#2#3[#4][#5]#6{%200 \setlength\@tempdima{#6}%201 \def\temp@c{}%202 \f@nch@forc\tmpf@ra{#4}%203 {\expandafter\f@nch@ifin\tmpf@ra{eolcrhf,EOLCRHF}%204 {}{\edef\temp@c{\temp@c\tmpf@ra}}}%205 \ifx\@empty\temp@c\else \PackageError{fancyhdr}{Illegal char `\temp@c' in206 \string#2 argument: [#4]}{}%207 \fi208 \f@nch@for\temp@c{#4}%209 {\f@nch@default\f@nch@@eo{eo}\temp@c210 \f@nch@fancyhf@Echeck{#2}%211 \f@nch@default\f@nch@@lcr{lcr}\temp@c212 \f@nch@default\f@nch@@hf{hf}{#3\temp@c}%213 \f@nch@forc\f@nch@eo\f@nch@@eo214 {\f@nch@forc\f@nch@lcr\f@nch@@lcr215 {\f@nch@forc\f@nch@hf\f@nch@@hf216 {%217 \IfBooleanTF{#1}{%218 \expandafter\edef\csname219 f@nch@width@\f@nch@eo\f@nch@lcr\f@nch@hf\endcsname{\the\@tempdima}%220 }%221 {%222 \expandafter\def\csname223 f@nch@width@\f@nch@eo\f@nch@lcr\f@nch@hf\endcsname{#6}%224 }%225 \csname f@nchdrwdt@align@v@\f@nch@hf\endcsname226 \edef\f@nch@align@@h{\f@nch@lcr}%227 \def\temp@a{#5}%228 \ifx\temp@a\@empty \else \f@nchdrwdt@align#5\@nil{#2}\fi229 \expandafter\edef\csname230 f@nch@align@\f@nch@eo\f@nch@lcr\f@nch@hf\endcsname231 {\f@nch@align@@v\f@nch@align@@h}}}}}}232\def\f@nch@width@elh{\headwidth}233\def\f@nch@width@ech{\headwidth}234\def\f@nch@width@erh{\headwidth}235\def\f@nch@width@olh{\headwidth}236\def\f@nch@width@och{\headwidth}237\def\f@nch@width@orh{\headwidth}238\def\f@nch@width@elf{\headwidth}239\def\f@nch@width@ecf{\headwidth}240\def\f@nch@width@erf{\headwidth}241\def\f@nch@width@olf{\headwidth}242\def\f@nch@width@ocf{\headwidth}243\def\f@nch@width@orf{\headwidth}244\def\f@nch@align@elh{bl}245\def\f@nch@align@ech{bc}246\def\f@nch@align@erh{br}247\def\f@nch@align@olh{bl}248\def\f@nch@align@och{bc}249\def\f@nch@align@orh{br}250\def\f@nch@align@elf{tl}251\def\f@nch@align@ecf{tc}252\def\f@nch@align@erf{tr}253\def\f@nch@align@olf{tl}254\def\f@nch@align@ocf{tc}255\def\f@nch@align@orf{tr}256\def\f@nchdrwdt@align@v@h{\def\f@nch@align@@v{b}}%257\def\f@nchdrwdt@align@v@f{\def\f@nch@align@@v{t}}%258\long\def\f@nchdrwdt@align#1#2\@nil#3{%259 \f@nch@ifin{#1}{TtcbB-}{%260 \f@nch@ifin{#1}{-}{}{\def\f@nch@align@@v{#1}}%261 \def\@tempa{#2}%262 \ifx\@tempa\@empty \else \def\f@nch@align@@h{#2}\fi263 }%264 {\def\f@nch@align@@h{#1}}%265 \expandafter\f@nch@ifin\expandafter{\f@nch@align@@h}{lcrj}{}%266 {\PackageError{fancyhdr}267 {\string#3: Illegal char `\f@nch@align@@h'\MessageBreak268 in alignment argument}{}}%269}270\newcommand{\lhead}[2][\f@nch@olh]%271 {\f@nch@def\f@nch@olh{#2}\f@nch@def\f@nch@elh{#1}}272\newcommand{\chead}[2][\f@nch@och]%273 {\f@nch@def\f@nch@och{#2}\f@nch@def\f@nch@ech{#1}}274\newcommand{\rhead}[2][\f@nch@orh]%275 {\f@nch@def\f@nch@orh{#2}\f@nch@def\f@nch@erh{#1}}276\newcommand{\lfoot}[2][\f@nch@olf]%277 {\f@nch@def\f@nch@olf{#2}\f@nch@def\f@nch@elf{#1}}278\newcommand{\cfoot}[2][\f@nch@ocf]%279 {\f@nch@def\f@nch@ocf{#2}\f@nch@def\f@nch@ecf{#1}}280\newcommand{\rfoot}[2][\f@nch@orf]%281 {\f@nch@def\f@nch@orf{#2}\f@nch@def\f@nch@erf{#1}}282\newlength{\f@nch@headwidth} \let\headwidth\f@nch@headwidth283\newlength{\f@nch@offset@elh}284\newlength{\f@nch@offset@erh}285\newlength{\f@nch@offset@olh}286\newlength{\f@nch@offset@orh}287\newlength{\f@nch@offset@elf}288\newlength{\f@nch@offset@erf}289\newlength{\f@nch@offset@olf}290\newlength{\f@nch@offset@orf}291\newcommand{\headrulewidth}{0.4pt}292\newcommand{\footrulewidth}{0pt}293\@ifundefined{headruleskip}%294 {\newcommand{\headruleskip}{0pt}}{}295\@ifundefined{footruleskip}%296 {\newcommand{\footruleskip}{.3\normalbaselineskip}}{}297\newcommand{\plainheadrulewidth}{0pt}298\newcommand{\plainfootrulewidth}{0pt}299\newif\if@fancyplain \@fancyplainfalse300\def\fancyplain#1#2{\if@fancyplain#1\else#2\fi}301\headwidth=-123456789sp302\let\f@nch@raggedleft\raggedleft303\let\f@nch@raggedright\raggedright304\let\f@nch@centering\centering305\let\f@nch@everypar\everypar306\ifdefined\ExplSyntaxOn307 \ExplSyntaxOn308 \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}309 \IfFormatAtLeastTF{2021-06-01}{310 \def\f@nch@saveclr@parhook #1{311 \expandafter\let\csname f@nch@__hook~#1\expandafter\endcsname312 \csname __hook~#1\endcsname313 \expandafter\let\csname f@nch@__hook_toplevel~#1\expandafter\endcsname314 \csname __hook_toplevel~#1\endcsname315 \expandafter\let\csname f@nch@__hook_next~#1\expandafter\endcsname316 \csname __hook_next~#1\endcsname317 \expandafter\let\csname f@nch@g__hook_#1_code_prop\expandafter\endcsname318 \csname g__hook_#1_code_prop\endcsname319 \RemoveFromHook{#1}[*]320 \ClearHookNext{#1}321 }322 \def\f@nch@restore@parhook #1{323 \global\expandafter\let\csname __hook~#1\expandafter\endcsname324 \csname f@nch@__hook~#1\endcsname325 \global\expandafter\let\csname __hook_toplevel~#1\expandafter\endcsname326 \csname f@nch@__hook_toplevel~#1\endcsname327 \global\expandafter\let\csname __hook_next~#1\expandafter\endcsname328 \csname f@nch@__hook_next~#1\endcsname329 \global\expandafter\let\csname g__hook_#1_code_prop\expandafter\endcsname330 \csname f@nch@g__hook_#1_code_prop\endcsname331 }332 \def\f@nch@resetpar{333 \f@nch@everypar{}334 \f@nch@saveclr@parhook{para/before}335 \f@nch@saveclr@parhook{para/begin}336 \f@nch@saveclr@parhook{para/end}337 \f@nch@saveclr@parhook{para/after}338 }339 \def\f@nch@restorepar{340 \f@nch@restore@parhook{para/before}341 \f@nch@restore@parhook{para/begin}342 \f@nch@restore@parhook{para/end}343 \f@nch@restore@parhook{para/after}344 }345 }{346 \def\f@nch@resetpar{347 \f@nch@everypar{}348 }349 \def\f@nch@restorepar{}350 }351 \ExplSyntaxOff352\else353 \def\f@nch@resetpar{%354 \f@nch@everypar{}%355 }356 \def\f@nch@restorepar{}357\fi358\newcommand\f@nch@noUppercase[2][]{#2}359\def\f@nch@reset{\f@nch@resetpar\restorecr\endlinechar=13360 \catcode`\\=0\catcode`\{=1\catcode`\}=2\catcode`\$=3\catcode`\&=4361 \catcode`\#=6\catcode`\^=7\catcode`\_=8\catcode`\ =10\catcode`\@=11362 \catcode`\:=11\catcode`\~=13\catcode`\%=14363 \catcode0=15 %NULL364 \catcode9=10 %TAB365 \let\\\@normalcr \let\raggedleft\f@nch@raggedleft366 \let\raggedright\f@nch@raggedright \let\centering\f@nch@centering367 \def\baselinestretch{1}%368 \hsize=\headwidth369 \def\nouppercase##1{{%370 \let\uppercase\relax\let\MakeUppercase\f@nch@noUppercase371 \expandafter\let\csname MakeUppercase \endcsname\relax372 \expandafter\def\csname MakeUppercase\space\space\space\endcsname373 [####1]####2{####2}%374 ##1}}%375 \@ifundefined{@normalsize} {\normalsize} % for ucthesis.cls376 {\@normalsize}%377 }378\newcommand*{\fancycenter}[1][1em]{%379 \@ifnextchar[{\f@nch@center{#1}}{\f@nch@center{#1}[3]}%380}381\def\f@nch@center#1[#2]#3#4#5{%382 \def\@tempa{#4}\ifx\@tempa\@empty383 \hbox to\linewidth{\color@begingroup{#3}\hfil {#5}\color@endgroup}%384 \else385 \setlength\@tempdima{#1}%386 \setlength{\@tempdimb}{#2\@tempdima}%387 \@tempdimc \@tempdimb \advance\@tempdimc -\@tempdima388 \setlength\@tempskipa{\@tempdimb \@plus 1fil \@minus \@tempdimc}%389 \@tempskipb\@tempskipa390 \def\@tempa{#3}\ifx\@tempa\@empty391 \addtolength\@tempskipa{\z@ \@minus \@tempdima}%392 \fi393 \def\@tempa{#5}\ifx\@tempa\@empty % empty right394 \addtolength\@tempskipb{\z@ \@minus \@tempdima}%395 \fi396 \settowidth{\@tempdimb}{#3}%397 \settowidth{\@tempdimc}{#5}%398 \ifdim\@tempdimb>\@tempdimc399 \advance\@tempdimb -\@tempdimc400 \addtolength\@tempskipb{\@tempdimb \@minus \@tempdimb}%401 \else402 \advance\@tempdimc -\@tempdimb403 \addtolength\@tempskipa{\@tempdimc \@minus \@tempdimc}%404 \fi405 \hbox to\linewidth{\color@begingroup{#3}\hskip \@tempskipa406 {#4}\hskip \@tempskipb {#5}\color@endgroup}%407 \fi408}409\newcommand{\f@nch@headinit}{}410\newcommand{\fancyheadinit}[1]{%411 \def\f@nch@headinit{#1}%412}413\newcommand{\f@nch@footinit}{}414\newcommand{\fancyfootinit}[1]{%415 \def\f@nch@footinit{#1}%416}417\newcommand{\fancyhfinit}[1]{%418 \def\f@nch@headinit{#1}%419 \def\f@nch@footinit{#1}%420}421\ifdefined\NewMirroredHookPair422 \NewMirroredHookPair{fancyhdr/before}{fancyhdr/after}423 \NewMirroredHookPair{fancyhdr/head/begin}{fancyhdr/head/end}424 \NewMirroredHookPair{fancyhdr/foot/begin}{fancyhdr/foot/end}425\fi426\newlength\f@nch@height427\newlength\f@nch@footalignment428\newif\iff@nch@footalign\f@nch@footalignfalse429\newcommand{\fancyfootalign}[1]{%430 \def\temp@a{#1}%431 \ifx\temp@a\@empty432 \f@nch@footalignfalse433 \else434 \f@nch@footaligntrue435 \setlength\f@nch@footalignment{#1}%436 \fi437}438\newcommand\fancyhdrsettoheight[2]{%439 \expandafter\ifx\csname f@nch@#2\endcsname\fancyhdrsettoheight440 \else\PackageError{fancyhdr}{Unknown parameter #2 in \string\fancyhdrsettoheight}{}\fi441 \setbox\@tempboxa\hbox{{\f@nch@checkfalse\csname @#2\endcsname}}%442 \setlength{#1}\f@nch@height443 \setbox\@tempboxa\box\voidb@x444}445\let\f@nch@oddhead\fancyhdrsettoheight446\let\f@nch@evenhead\fancyhdrsettoheight447\let\f@nch@oddfoot\fancyhdrsettoheight448\let\f@nch@evenfoot\fancyhdrsettoheight449\newcommand\f@nch@vbox[2]{%450 \setbox0\vbox{#2}%451 \global\f@nch@height=\ht0452 \ifdim\ht0>#1\relax453 \iff@nch@check454 \dimen0=#1\advance\dimen0-\ht0455 \PackageWarning{fancyhdr}{%456 \string#1 is too small (\the#1): \MessageBreak457 Make it at least \the\ht0, for example:\MessageBreak458 \string\setlength{\string#1}{\the\ht0}%459 \iff@nch@compatViii .\MessageBreak460 We now make it that large for the rest of the document.\MessageBreak461 This may cause the page layout to be inconsistent, however462 \fi463 \ifx#1\headheight .\MessageBreak464 You might also make \topmargin smaller:\MessageBreak465 \string\addtolength{\string\topmargin}{\the\dimen0}%466 \fi467 \@gobble468 }%469 \iff@nch@compatViii470 \dimen0=#1\relax471 \global#1=\ht0\relax472 \ht0=\dimen0 %473 \else474 \ht0=#1\relax475 \fi476 \else477 \ht0=#1\relax478 \fi479 \fi480 \box0}481\newcommand\f@nch@head[6]{%482 \f@nch@reset483 \ifdefined\UseHook\UseHook{fancyhdr/before}\UseHook{fancyhdr/head/begin}\fi484 \f@nch@headinit\relax485 #1%486 \hbox to\headwidth{%487 \f@nch@vbox\headheight{%488 \f@nch@hfbox{#2}{#3}{#4}{#6}{h}%489 \vskip\headruleskip\relax490 \headrule491 }%492 }%493 #5%494 \ifdefined\UseHook\UseHook{fancyhdr/head/end}\UseHook{fancyhdr/after}\fi495 \f@nch@restorepar496}497\newcommand\f@nch@foot[6]{%498 \f@nch@reset499 \ifdefined\UseHook\UseHook{fancyhdr/before}\UseHook{fancyhdr/foot/begin}\fi500 \f@nch@footinit\relax501 #1%502 \hbox to\headwidth{%503 \f@nch@vbox\footskip{%504 \setbox0=\vbox{\footrule}\unvbox0505 \vskip\footruleskip506 \f@nch@hfbox{#2}{#3}{#4}{#6}{f}%507 \iff@nch@footalign \vskip\f@nch@footalignment \fi508 }%509 }%510 #5%511 \ifdefined\UseHook\UseHook{fancyhdr/foot/end}\UseHook{fancyhdr/after}\fi512 \f@nch@restorepar513}514\newlength\f@nch@widthL515\newlength\f@nch@widthC516\newlength\f@nch@widthR517\newcommand\f@nch@hfbox[5]{%518 \setlength\f@nch@widthL{\csname f@nch@width@#4l#5\endcsname}%519 \setlength\f@nch@widthC{\csname f@nch@width@#4c#5\endcsname}%520 \setlength\f@nch@widthR{\csname f@nch@width@#4r#5\endcsname}%521 \let\@tempa\f@nch@hfbox@center522 \ifdim \dimexpr \f@nch@widthL+\f@nch@widthC+\f@nch@widthR>\headwidth523 \else524 \ifdim \dimexpr \f@nch@widthL+0.5\f@nch@widthC>0.5\headwidth525 \let \@tempa\f@nch@hfbox@fit526 \fi527 \ifdim \dimexpr \f@nch@widthR+0.5\f@nch@widthC>0.5\headwidth528 \let \@tempa\f@nch@hfbox@fit529 \fi530 \fi531 \@tempa{#1}{#2}{#3}#4#5%532}533\newcommand\f@nch@hfbox@center[5]{%534 \hbox to \headwidth{%535 \rlap{\f@nch@parbox{#1}\f@nch@widthL{#4}l{#5}}%536 \hfill537 \f@nch@parbox{#2}\f@nch@widthC{#4}c{#5}%538 \hfill539 \llap{\f@nch@parbox{#3}\f@nch@widthR{#4}r{#5}}%540 }%541}542\newcommand\f@nch@hfbox@fit[5]{%543 \hbox to \headwidth{%544 \f@nch@parbox{#1}\f@nch@widthL{#4}l{#5}%545 \hfill546 \f@nch@parbox{#2}\f@nch@widthC{#4}c{#5}%547 \hfill548 \f@nch@parbox{#3}\f@nch@widthR{#4}r{#5}%549 }%550}%551\newcommand\f@nch@parbox[5]{%552 \expandafter\expandafter\expandafter\f@nch@parbox@align553 \csname f@nch@align@#3#4#5\endcsname554 \parbox[\f@nch@align@@v]{#2}%555 {%556 \f@nch@align@@pre557 \f@nch@align@@h\leavevmode\ignorespaces#1%558 \f@nch@align@@post559 }%560}561\newcommand\f@nch@parbox@align[2]{%562 \def\f@nch@align@@pre{}%563 \def\f@nch@align@@post{}%564 \csname f@nch@parbox@align@v#1\endcsname565 \csname f@nch@parbox@align@h#2\endcsname566}567\def\f@nch@parbox@align@vT{\def\f@nch@align@@v{t}\def\f@nch@align@@pre{\vspace{0pt}}}568\def\f@nch@parbox@align@vt{\def\f@nch@align@@v{t}}569\def\f@nch@parbox@align@vc{\def\f@nch@align@@v{c}}570\def\f@nch@parbox@align@vb{\def\f@nch@align@@v{b}}571\def\f@nch@parbox@align@vB{\def\f@nch@align@@v{b}\def\f@nch@align@@post{\vspace{0pt}}}572\def\f@nch@parbox@align@hl{\def\f@nch@align@@h{\raggedright}}573\def\f@nch@parbox@align@hc{\def\f@nch@align@@h{\centering}}574\def\f@nch@parbox@align@hr{\def\f@nch@align@@h{\raggedleft}}575\def\f@nch@parbox@align@hj{\def\f@nch@align@@h{}}576\@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}%577\def\f@nch@initialise{%578 \@ifundefined{chapter}%579 {\def\sectionmark##1{\markboth{\MakeUppercase{\ifnum \c@secnumdepth>\z@580 \thesection\hskip 1em\relax581 \fi ##1}}{}}%582 \def\subsectionmark##1{\markright {\ifnum \c@secnumdepth >\@ne583 \thesubsection\hskip 1em\relax \fi ##1}}}%584 {\def\chaptermark##1{\markboth {\MakeUppercase{\ifnum585 \c@secnumdepth>\m@ne \@chapapp\ \thechapter. \ \fi ##1}}{}}%586 \def\sectionmark##1{\markright{\MakeUppercase{\ifnum \c@secnumdepth >\z@587 \thesection. \ \fi ##1}}}%588 }%589 \def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi590 \hrule\@height\headrulewidth\@width\headwidth591 \vskip-\headrulewidth}}%592 \def\footrule{{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi593 \hrule\@width\headwidth\@height\footrulewidth}}%594 \def\headrulewidth{0.4pt}%595 \def\footrulewidth{0pt}%596 \def\headruleskip{0pt}%597 \def\footruleskip{0.3\normalbaselineskip}%598 \fancyhf{}%599 \if@twoside600 \fancyhead[el,or]{\fancyplain{}{\slshape\rightmark}}%601 \fancyhead[er,ol]{\fancyplain{}{\slshape\leftmark}}%602 \else603 \fancyhead[l]{\fancyplain{}{\slshape\rightmark}}%604 \fancyhead[r]{\fancyplain{}{\slshape\leftmark}}%605 \fi606 \fancyfoot[c]{\rmfamily\thepage}% page number607}608\f@nch@initialise609\def\ps@f@nch@fancyproto{%610 \ifdim\headwidth<0sp611 \global\advance\headwidth123456789sp\global\advance\headwidth\textwidth612 \fi613 \gdef\ps@f@nch@fancyproto{\@fancyplainfalse\ps@f@nch@fancycore}%614 \@fancyplainfalse\ps@f@nch@fancycore615}%616\@namedef{f@nch@ps@f@nch@fancyproto-is-fancyhdr}{}617\def\ps@fancy{\ps@f@nch@fancyproto}618\@namedef{f@nch@ps@fancy-is-fancyhdr}{}619\def\ps@fancyplain{\ps@f@nch@fancyproto \let\ps@plain\ps@plain@fancy}620\def\ps@plain@fancy{\@fancyplaintrue\ps@f@nch@fancycore}621\let\f@nch@ps@empty\ps@empty622\def\ps@f@nch@fancycore{%623 \f@nch@ps@empty624 \def\@mkboth{\protect\markboth}%625 \def\f@nch@oddhead{\f@nch@head\f@nch@Oolh\f@nch@olh\f@nch@och\f@nch@orh\f@nch@Oorh{o}}%626 \def\@oddhead{%627 \iff@nch@twoside628 \ifodd\c@page629 \f@nch@oddhead630 \else631 \@evenhead632 \fi633 \else634 \f@nch@oddhead635 \fi636 }637 \def\f@nch@oddfoot{\f@nch@foot\f@nch@Oolf\f@nch@olf\f@nch@ocf\f@nch@orf\f@nch@Oorf{o}}%638 \def\@oddfoot{%639 \iff@nch@twoside640 \ifodd\c@page641 \f@nch@oddfoot642 \else643 \@evenfoot644 \fi645 \else646 \f@nch@oddfoot647 \fi648 }649 \def\@evenhead{\f@nch@head\f@nch@Oelh\f@nch@elh\f@nch@ech\f@nch@erh\f@nch@Oerh{e}}%650 \def\@evenfoot{\f@nch@foot\f@nch@Oelf\f@nch@elf\f@nch@ecf\f@nch@erf\f@nch@Oerf{e}}%651}652\def\f@nch@Oolh{\if@reversemargin\hss\else\relax\fi}653\def\f@nch@Oorh{\if@reversemargin\relax\else\hss\fi}654\let\f@nch@Oelh\f@nch@Oorh655\let\f@nch@Oerh\f@nch@Oolh656\let\f@nch@Oolf\f@nch@Oolh657\let\f@nch@Oorf\f@nch@Oorh658\let\f@nch@Oelf\f@nch@Oelh659\let\f@nch@Oerf\f@nch@Oerh660\def\f@nch@offsolh{\headwidth=\textwidth\advance\headwidth\f@nch@offset@olh661 \advance\headwidth\f@nch@offset@orh\hskip-\f@nch@offset@olh}662\def\f@nch@offselh{\headwidth=\textwidth\advance\headwidth\f@nch@offset@elh663 \advance\headwidth\f@nch@offset@erh\hskip-\f@nch@offset@elh}664\def\f@nch@offsolf{\headwidth=\textwidth\advance\headwidth\f@nch@offset@olf665 \advance\headwidth\f@nch@offset@orf\hskip-\f@nch@offset@olf}666\def\f@nch@offself{\headwidth=\textwidth\advance\headwidth\f@nch@offset@elf667 \advance\headwidth\f@nch@offset@erf\hskip-\f@nch@offset@elf}668\def\f@nch@setoffs{%669 \f@nch@gbl\let\headwidth\f@nch@headwidth670 \f@nch@gbl\def\f@nch@Oolh{\f@nch@offsolh}%671 \f@nch@gbl\def\f@nch@Oelh{\f@nch@offselh}%672 \f@nch@gbl\def\f@nch@Oorh{\hss}%673 \f@nch@gbl\def\f@nch@Oerh{\hss}%674 \f@nch@gbl\def\f@nch@Oolf{\f@nch@offsolf}%675 \f@nch@gbl\def\f@nch@Oelf{\f@nch@offself}%676 \f@nch@gbl\def\f@nch@Oorf{\hss}%677 \f@nch@gbl\def\f@nch@Oerf{\hss}%678}679\newif\iff@nch@footnote680\AtBeginDocument{%681 \let\latex@makecol\@makecol682 \def\@makecol{\ifvoid\footins\f@nch@footnotefalse\else\f@nch@footnotetrue\fi683 \let\f@nch@topfloat\@toplist\let\f@nch@botfloat\@botlist\latex@makecol}%684}685\newcommand\iftopfloat[2]{\ifx\f@nch@topfloat\@empty #2\else #1\fi}%686\newcommand\ifbotfloat[2]{\ifx\f@nch@botfloat\@empty #2\else #1\fi}%687\newcommand\iffloatpage[2]{\if@fcolmade #1\else #2\fi}%688\newcommand\iffootnote[2]{\iff@nch@footnote #1\else #2\fi}%689\ifx\@temptokenb\undefined \csname newtoks\endcsname\@temptokenb\fi690\newif\iff@nch@pagestyle@star691\newcommand\fancypagestyle{%692 \@ifstar{\f@nch@pagestyle@startrue\f@nch@pagestyle}%693 {\f@nch@pagestyle@starfalse\f@nch@pagestyle}%694}695\newcommand\f@nch@pagestyle[1]{%696 \@ifnextchar[{\f@nch@@pagestyle{#1}}{\f@nch@@pagestyle{#1}[f@nch@fancyproto]}%697}698\long\def\f@nch@@pagestyle#1[#2]#3{%699 \@ifundefined{ps@#2}{%700 \PackageError{fancyhdr}{\string\fancypagestyle: Unknown base page style `#2'}{}%701 }{%702 \@ifundefined{f@nch@ps@#2-is-fancyhdr}{%703 \PackageError{fancyhdr}{\string\fancypagestyle: Base page style `#2' is not fancyhdr-based}{}%704 }%705 {%706 \f@nch@pagestyle@setup707 \def\temp@b{\@namedef{ps@#1}}%708 \expandafter\temp@b\expandafter{\the\@temptokenb709 \let\f@nch@gbl\relax\@nameuse{ps@#2}#3\relax}%710 \@namedef{f@nch@ps@#1-is-fancyhdr}{}%711 }%712 }%713}714\newcommand\f@nch@pagestyle@setup{%715 \iff@nch@pagestyle@star716 \iff@nch@check\@temptokenb={\f@nch@checktrue}\else\@temptokenb={\f@nch@checkfalse}\fi717 \@tfor\temp@a:=718 \f@nch@olh\f@nch@och\f@nch@orh\f@nch@elh\f@nch@ech\f@nch@erh719 \f@nch@olf\f@nch@ocf\f@nch@orf\f@nch@elf\f@nch@ecf\f@nch@erf720 \f@nch@width@elh\f@nch@width@ech\f@nch@width@erh\f@nch@width@olh721 \f@nch@width@och\f@nch@width@orh\f@nch@width@elf\f@nch@width@ecf722 \f@nch@width@erf\f@nch@width@olf\f@nch@width@ocf\f@nch@width@orf723 \f@nch@align@elh\f@nch@align@ech\f@nch@align@erh\f@nch@align@olh724 \f@nch@align@och\f@nch@align@orh\f@nch@align@elf\f@nch@align@ecf725 \f@nch@align@erf\f@nch@align@olf\f@nch@align@ocf\f@nch@align@orf726 \f@nch@Oolh\f@nch@Oorh\f@nch@Oelh\f@nch@Oerh727 \f@nch@Oolf\f@nch@Oorf\f@nch@Oelf\f@nch@Oerf728 \f@nch@headinit\f@nch@footinit729 \headrule\headrulewidth\footrule\footrulewidth730 \do {%731 \toks@=\expandafter\expandafter\expandafter{\temp@a}%732 \toks@=\expandafter\expandafter\expandafter{%733 \expandafter\expandafter\expandafter\def734 \expandafter\expandafter\temp@a\expandafter{\the\toks@}}%735 \edef\temp@b{\@temptokenb={\the\@temptokenb\the\toks@}}%736 \temp@b737 }%738 \@tfor\temp@a:=739 \f@nch@offset@olh\f@nch@offset@orh\f@nch@offset@elh\f@nch@offset@erh740 \f@nch@offset@olf\f@nch@offset@orf\f@nch@offset@elf\f@nch@offset@erf741 \do {%742 \toks@=\expandafter\expandafter\expandafter{\expandafter\the\temp@a}%743 \toks@=\expandafter\expandafter\expandafter{%744 \expandafter\expandafter\expandafter\setlength745 \expandafter\expandafter\temp@a\expandafter{\the\toks@}}%746 \edef\temp@b{\@temptokenb={\the\@temptokenb\the\toks@}}%747 \temp@b748 }%749 \else750 \@temptokenb={}%751 \fi752}753\newcommand\fancypagestyleassign[2]{%754 \@ifundefined{ps@#2}{%755 \PackageError{fancyhdr}{\string\fancypagestyleassign: Unknown page style `#2'}{}%756 }{%757 \expandafter\let758 \csname ps@#1\expandafter\endcsname759 \csname ps@#2\endcsname760 \@ifundefined{f@nch@ps@#2-is-fancyhdr}{%761 \expandafter\let\csname f@nch@ps@#1-is-fancyhdr\endcsname\@undefined762 }{%763 \@namedef{f@nch@ps@#1-is-fancyhdr}{}%764 }%765 }%766}767\fancypagestyle*{fancydefault}{\f@nch@initialise}768\def\f@nchdrbox@topstrut{\vrule height\ht\strutbox width\z@}769\def\f@nchdrbox@botstrut{\vrule depth\dp\strutbox width\z@}770\def\f@nchdrbox@nostrut{\noalign{\vspace{0pt}}\let\f@nchdrbox@@crstrut\f@nchdrbox@botstrut}771\NewDocumentCommand{\fancyhdrbox}{ O{cl} o m }{%772\begingroup773 \let\f@nchdrbox@@pre\f@nchdrbox@topstrut774 \let\f@nchdrbox@@postx\f@nchdrbox@botstrut775 \let\f@nchdrbox@@posty\relax776 \let\f@nchdrbox@@crstrut\strut777 \IfNoValueTF{#2}%778 {\let\f@nchdrbox@@halignto\@empty}%779 {\setlength\@tempdima{#2}%780 \def\f@nchdrbox@@halignto{to\@tempdima}}%781 \def\@tempa{#1}%782 \ifx\@tempa\@empty783 \f@nchdrbox@align cl\@nil{#3}%784 \else785 \f@nchdrbox@align #1\@nil{#3}%786 \fi787\endgroup788}789\protected\def\f@nchdrbox@cr{%790 {\ifnum0=`}\fi\@ifstar\@f@nchdrbox@xcr\@f@nchdrbox@xcr}791 792\def\@f@nchdrbox@xcr{%793 \unskip\f@nchdrbox@@crstrut794 \@ifnextchar[\@f@nchdrbox@argc{\ifnum0=`{\fi}\cr}%795}796 797\def\@f@nchdrbox@argc[#1]{%798 \ifnum0=`{\fi}%799 \ifdim #1>\z@800 \unskip\@f@nchdrbox@xargc{#1}%801 \else802 \@f@nchdrbox@yargc{#1}%803 \fi}804 805\def\@f@nchdrbox@xargc#1{\@tempdima #1\advance\@tempdima \dp \strutbox806 \vrule \@height\z@ \@depth\@tempdima \@width\z@ \cr}807 808\def\@f@nchdrbox@yargc#1{\cr\noalign{\setlength\@tempdima{#1}\vskip\@tempdima}}809\def\f@nchdrbox@T{\let\f@nchdrbox@@pre\f@nchdrbox@nostrut810 \f@nchdrbox@t}811\def\f@nchdrbox@t{\def\f@nchdrbox@@v{t}\def\f@nchdrbox@@h{l}}812\def\f@nchdrbox@c{\def\f@nchdrbox@@v{c}\def\f@nchdrbox@@h{c}}813\def\f@nchdrbox@b{\def\f@nchdrbox@@v{b}\def\f@nchdrbox@@h{l}}814\def\f@nchdrbox@B{\let\f@nchdrbox@@postx\relax815 \def\f@nchdrbox@@posty{\vspace{0pt}}%816 \f@nchdrbox@b}817\long\def\f@nchdrbox@align#1#2\@nil#3{%818 \f@nch@ifin{#1}{TtcbB}{%819 \@nameuse{f@nchdrbox@#1}%820 \def\@tempa{#2}%821 \ifx\@tempa\@empty\else \def\f@nchdrbox@@h{#2}\fi822 }%823 {\def\f@nchdrbox@@v{c}\def\f@nchdrbox@@h{#1}}%824 \expandafter\f@nch@ifin\expandafter{\f@nchdrbox@@h}{lcr}{}%825 {\PackageError{fancyhdr}{\string\fancyhdrbox: Illegal char `\f@nchdrbox@@h'\MessageBreak826 in alignment argument}{}}%827 \let\\\f@nchdrbox@cr828 \setbox0=\if \f@nchdrbox@@v t\vtop829 \else \vbox830 \fi831 {%832 \ialign \f@nchdrbox@@halignto833 \bgroup \relax834 {\if \f@nchdrbox@@h l\hskip 1sp\else \hfil \fi835 \ignorespaces ##\unskip836 \if\f@nchdrbox@@h r\else \hfil \fi837 }%838 \tabskip\z@skip \cr839 \f@nchdrbox@@pre840 #3\unskip \f@nchdrbox@@postx841 \crcr842 \egroup843 \f@nchdrbox@@posty844 }%845 \if\f@nchdrbox@@v c\@tempdima=\ht0\advance\@tempdima\dp0%846 \ht0=0.5\@tempdima\dp0=0.5\@tempdima\fi847 \leavevmode \box0848}849\@ifclassloaded{newlfm}850{851 \let\ps@@empty\f@nch@ps@empty852 \AtBeginDocument{%853 \renewcommand{\@zfancyhead}[5]{\relax\hbox to\headwidth{\f@nch@reset854 \@zfancyvbox\headheight{\hbox855 {\rlap{\parbox[b]{\headwidth}{\raggedright\f@nch@olh}}\hfill856 \parbox[b]{\headwidth}{\centering\f@nch@olh}\hfill857 \llap{\parbox[b]{\headwidth}{\raggedleft\f@nch@orh}}}%858 \zheadrule}}\relax}%859 }860}861{}862\endinput863%%864%% End of file `fancyhdr.sty'.865