
我可以編寫一個命令,以便 LaTeX 選擇覆蓋大部分頁面的小節放在頁眉中嗎?例如,請參見下圖。
如何使標題顯示第 2.2 節而不是第 2.3 節?我目前正在使用這段程式碼。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{ragged2e}
\usepackage{lmodern}
\renewcommand*\familydefault{\sfdefault}
\usepackage{lipsum}
\usepackage{fancyhdr}
\begin{document}
\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}}
\section{Section 1}
\subsection{Subsection 1.1}
\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]
\subsection{Subsection 1.2}
\lipsum[1]
\end{document}