Files
PrimeTeX/packages/Header.sty
Silcantar 7945ab0e6b - Change parameter order in \providelength to match \setlength.
- Remove Part name from appendix and back matter headers.
2025-08-24 22:33:29 -05:00

68 lines
1.7 KiB
TeX

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/Header}[2025-08-16]
% Header & Footer Options
\RequirePackage{fancyhdr}
\pagestyle{fancy}
% Clear all header & footer formatting.
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\newlength{\insideheaderoffset}
\setlength{\insideheaderoffset}{0.5in}
\newlength{\outsideheaderoffset}
\setlength{\outsideheaderoffset}{1.0in}
\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]{\insideheaderoffset}
\fancyhfoffset[R]{\outsideheaderoffset}
\fancyhead[L]{\partlabel}
\fancyhead[R]{\chapappname{}\leftmark}
\fancyfoot[R]{\thepage}
}{
\fancyhfoffset[LE,RO]{\outsideheaderoffset}
\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]{\insideheaderoffset}
\fancyhfoffset[R]{\outsideheaderoffset}
\fancyfoot[R]{\thepage}
}{
\fancyhfoffset[LE,RO]{\outsideheaderoffset}
\fancyfoot[LE,RO]{\thepage}
}
}