關於這個主題有一些問題,但我仍然很困惑(因為我仍然不明白給出的答案是如何運作的)。如何隱藏每章開頭的標題?
\documentclass{book}
\usepackage{lipsum}
\title{My Book}
\author{Me}
\makeatletter
\markboth{\textsc{\@title}}{\textsc{\@title}}
\makeatother
\usepackage{fancyhdr}
\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[C]{\hrulefill\quad\raisebox{-3pt}{\thepage}\quad\hrulefill}
\fancyhead[CO]{\hrulefill\quad\raisebox{-3pt}{\leftmark}\quad\hrulefill}
\fancyhead[CE]{\hrulefill\quad\raisebox{-3pt}{\rightmark}\quad\hrulefill}
\renewcommand{\headrulewidth}{0pt}
}
\pagestyle{plain}
\renewcommand{\chaptermark}[1]{\markright{\textsc{#1}}}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{}
\begin{document}
\maketitle
\chapter{My Chapter}
\lipsum
\end{document}
答案1
章節頁面使用 plain,對其餘部分使用 fancy:
\documentclass{book}
\usepackage{lipsum}
\title{My Book}
\author{Me}
\makeatletter
\markboth{\textsc{\@title}}{\textsc{\@title}}
\makeatother
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{\hrulefill\quad\raisebox{-3pt}{\thepage}\quad\hrulefill}
\fancyhead[CO]{\hrulefill\quad\raisebox{-3pt}{\leftmark}\quad\hrulefill}
\fancyhead[CE]{\hrulefill\quad\raisebox{-3pt}{\rightmark}\quad\hrulefill}
\renewcommand{\headrulewidth}{0pt}
\fancypagestyle{plain}{% for chapter pages
\fancyhf{}
\fancyfoot[C]{\hrulefill\quad\raisebox{-3pt}{\thepage}\quad\hrulefill}%
}
\renewcommand{\chaptermark}[1]{\markright{\textsc{#1}}}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{}
\begin{document}
\maketitle
\chapter{My Chapter}
\lipsum
\end{document}