
Estou usando esse código
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}
\lhead{\textit{\leftmark}}
\rhead{\textit{\rightmark}}
\rfoot{\textit{Page \thepage}}
\renewcommand{\sectionmark}[1]{\xdef\leftmark{\thesection\quad#1}\xdef\rightmark{}}
\renewcommand{\subsectionmark}[1]{\xdef\rightmark{\thesubsection\quad#1}}
para imprimir o título da subseção no cabeçalho. No entanto, tenho o problema de que, se a subseção for impressa no topo da página, ela será exibida no cabeçalho da página anterior. Isso é mostrado abaixo.
Esta é a Seção 1.1, mas o cabeçalho mostra a Seção 1.2. Como faço para corrigir isso? Minha solução atual é fazer o seguinte.
\begin{Def}
Let $\{M_i:i \in \{1,\ldots ,k\} \}$ be a family of submodules of an $R$-module $M$. Then $M$ is the \textit{direct sum} of $M_1,\ldots ,M_k$ if\\
\indent i) $M=M_1\oplus \ldots \oplus M_k\coloneqq \{ m_1+\ldots +m_k: m_i \in M_i\}$; \\
\indent ii) $M_i \cap M_j = \emptyset $ for all $i \neq j$.
\end{Def}
\newpage
Acabei de adicionar um \newpage
comando no final da página e isso resolve o problema.
Responder1
No seu código, substitua \xdef\leftmark
by \markboth
e \xdef\rightmark
by \markright
, para que as duas linhas redefinindo \sectionmark
e \subsectionmark
fiquem assim:
\renewcommand{\sectionmark}[1]{\markboth{\thesection\quad#1}{}}
\renewcommand{\subsectionmark}[1]{\markright{\thesubsection\quad#1}}