1

Here's my current code:

\documentclass[11pt]{book}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{color}
\usepackage{CJK}
\usepackage{draftwatermark}
\usepackage{fancyhdr}
\usepackage[colorlinks]{hyperref}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{ulem}
\usepackage{siunitx}
\usepackage{xcolor}

%----------------------------------------------------------------------

\geometry{a4paper,hmargin=1.25in,vmargin=1in}
\graphicspath{{Figures/}}
\setlength{\fboxrule}{1.6pt}
\pdfstringdefDisableCommands{\let \bm=\relax}

\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}{}}

\pagestyle{fancy}
\fancyhead{}
\fancyhead[LO]{\textit{\rightmark}}
\fancyhead[RE]{\textit{\leftmark}}
\fancyhead[LE,RO]{\thepage}
\fancyfoot{}
\fancyfoot[L]{\textit{Eureka! Journal Entry}}
\fancyfoot[C]{March 10, 2024}
\fancyfoot[R]{\textit{Some Rights Reserved.}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\SetWatermarkText{\shortstack{\textsc{Eureka!}}}
\SetWatermarkLightness{0.75}
\SetWatermarkScale{7.5}

%----------------------------------------------------------------------

\begin{document}

%----------------------------------------------------------------------

\frontmatter

\chapter*{\Huge \center Eureka!}
\newpage

%----------------------------------------------------------------------

\chapter*{Preface}

Preface...

%----------------------------------------------------------------------

\tableofcontents

\mainmatter

%----------------------------------------------------------------------

\chapter{Topics in Elementary Mathematics}
Introduction to Topics in Elementary Mathematics...
\newpage
Currently, there are no submissions in this section.

%----------------------------------------------------------------------

\end{document}

So here goes the problem, in those pages with the chapter number, the footer doesn't work as it normally would. I want the footer to work on those pages, BUT not the header. I have no idea how to do it, please help me out.

Plus, there's another minor issue: the header normally works in the style of "Chapter 2. Elementary Mathematics Contests", but on the content page, it still remains the style of default, which is "CONTENT". How can I change it to "Content"?

6
  • There is no \tableofcontents in your MWE, nor is there any \chapter. Please supply us with some "content" between \begin{document} and \end{document} so we can better see the issue. Feb 17 at 6:44
  • 2
    In terms of the header/footer issue, the "culprit" is the fact that on opening pages of chapters, a different page style is used. The standard definition of \chapter includes issuing \thispagestyle{plain}. So you just need to redefine what plain looks like. See, e.g. tex.stackexchange.com/questions/117328 Feb 17 at 6:49
  • @WillieWong I've added some of the contents to it: \tableofcontents and \chapter lines. Please check it again.
    – Jacky Wang
    Feb 17 at 6:59
  • 1
    For a stab at what is probably your second problem: where you have \fancyhead[LO]{\textit{\rightmark}} \fancyhead[RE]{\textit{\leftmark}}, replace \rightmark by \nouppercase{\rightmark} ad similarly for \leftmark. The LaTeX book class hardcodes \MakeUpperCase into the \markboth when issuing \tableofcontents, you can undo it with \nouppercase. Feb 17 at 6:59
  • @WillieWong Thanks a lot for solving my problem. Have a good day!
    – Jacky Wang
    Feb 17 at 7:07

1 Answer 1

1

In the starting chapter pages, the book class uses the plain page style, so you just need to redefine it, which fancyhdr allows through \fancypagestyle.

\documentclass[11pt]{book}
\usepackage{geometry}
\usepackage{fancyhdr}

\geometry{
  a4paper,
  hmargin=1.25in,
  vmargin=1in,
  headheight=13.6pt, % as suggested by fancyhdr
}


\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}{}}

\pagestyle{fancy}
\fancyhf{}% clear all fields
\fancyhead[LO]{\textit{\rightmark}}
\fancyhead[RE]{\textit{\leftmark}}
\fancyhead[LE,RO]{\thepage}
\fancyfoot[L]{\textit{Eureka! Journal Entry}}
\fancyfoot[C]{March 10, 2024}
\fancyfoot[R]{\textit{Some Rights Reserved.}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\fancypagestyle{plain}{%
  \fancyhf{}%
  \fancyfoot[L]{\textit{Eureka! Journal Entry}}%
  \fancyfoot[C]{March 10, 2024}%
  \fancyfoot[R]{\textit{Some Rights Reserved.}}%
  \renewcommand{\headrulewidth}{0pt}%
  \renewcommand{\footrulewidth}{0.4pt}%
}
  

\begin{document}

\frontmatter

\chapter{Eureka!}

\chapter{Preface}

Preface...

\tableofcontents

\mainmatter

\chapter{Topics in Elementary Mathematics}
Introduction to Topics in Elementary Mathematics...
\newpage
Currently, there are no submissions in this section.

\end{document}

I removed all packages unnecessary for the example, except for geometry in order to point out that you need to set the headheight.

enter image description here

I also used \chapter and not \chapter* in the front matter, so you get those chapters in the table of contents. Don't use formatting declarations in a chapter title, unless you want \Huge also in the table of contents (which I don't think you do). If you really need the \Huge chapter title, do

\chapter[Eureka!]{\Huge Eureka!}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .