77 lines
2.0 KiB
TeX
77 lines
2.0 KiB
TeX
\NeedsTeXFormat{LaTeX2e}
|
|
\ProvidesExplPackage{PrimeTeX/packages/Header}{2025-08-16}{1.0}{
|
|
Customize header and footer layout and contents.
|
|
}
|
|
|
|
\RequirePackage{PrimeTeX/packages/Layout}
|
|
|
|
\dim_new:N \g_header_insideoffset_dim
|
|
\dim_set:Nn \g_header_insideoffset_dim {\c_BigFloat_overhang_dim}
|
|
\dim_new:N \g_header_outsideoffset_dim
|
|
\dim_set:Nn \g_header_outsideoffset_dim {
|
|
\fp_to_dim:n {\c_BigFloat_overhang_dim * \c_BigFloat_offset_fp}
|
|
}
|
|
|
|
\ProvideLength{\HeaderInsideOffset}[\BigFloatOverhang]
|
|
\ProvideLength{\HeaderOutsideOffset}[\BigFloatOverhang * \real{\BigFloatOffset}]
|
|
|
|
% Header & Footer Options
|
|
\RequirePackage{fancyhdr}
|
|
\pagestyle{fancy}
|
|
|
|
% Clear all header & footer formatting.
|
|
\fancyhf{}
|
|
|
|
\renewcommand{\headrulewidth}{0pt}
|
|
\renewcommand{\footrulewidth}{0pt}
|
|
|
|
\NewDocumentCommand{\chapappname}{}{Chapter \thechapter{}: }
|
|
\NewDocumentCommand{\partlabel}{}{\partname{} \thepart{}: \parttitle}
|
|
|
|
\NewDocumentCommand{\Appendix}{}{
|
|
\appendix
|
|
\RenewDocumentCommand{\chapappname}{}{Appendix \thechapter{}: }
|
|
\RenewDocumentCommand{\partlabel}{}{}
|
|
}
|
|
|
|
\NewDocumentCommand{\BackMatter}{}{
|
|
\RenewDocumentCommand{\chapappname}{}{}
|
|
\RenewDocumentCommand{\partlabel}{}{}
|
|
}
|
|
|
|
\NewDocumentCommand{\parttitle}{}{}
|
|
|
|
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
|
|
|
|
\fancypagestyle{fancy}{
|
|
\ifthenelse{\boolean{isElectronic}}{
|
|
\fancyhfoffset[L]{\HeaderInsideOffset}
|
|
\fancyhfoffset[R]{\HeaderOutsideOffset}
|
|
\fancyhead[L]{\partlabel}
|
|
\fancyhead[R]{\chapappname{}\leftmark}
|
|
|
|
\fancyfoot[R]{\thepage}
|
|
}{
|
|
\fancyhfoffset[LE,RO]{\HeaderOutsideOffset}
|
|
\fancyhead[LE]{\partlabel}
|
|
\fancyhead[RO]{\chapappname\leftmark}
|
|
|
|
\fancyfoot[LE,RO]{\thepage}
|
|
}
|
|
}
|
|
|
|
\fancypagestyle{plain}{ %
|
|
\fancyhf{} % remove everything
|
|
\renewcommand{\headrulewidth}{0pt} % remove lines as well
|
|
\renewcommand{\footrulewidth}{0pt}
|
|
|
|
\ifthenelse{\boolean{isElectronic}}{
|
|
\fancyhfoffset[L]{\HeaderInsideOffset}
|
|
\fancyhfoffset[R]{\HeaderOutsideOffset}
|
|
\fancyfoot[R]{\thepage}
|
|
}{
|
|
\fancyhfoffset[LE,RO]{\HeaderOutsideOffset}
|
|
\fancyfoot[LE,RO]{\thepage}
|
|
}
|
|
}
|