
我找不到這個問題的解決方案。我用谷歌搜尋了一下,什麼也沒出來。我的專案有 3 章和附錄,但據我使用\chapter*{Ap\'endice}
,附錄頁首與第三章相同(我認為這就是原因)。
我想在偶數頁上有「數字(空格)Apéndice」之類的內容,在奇數頁上有「Apéndice(空格)數字」之類的內容。
我已經嘗試過這個afterpage
包了。\afterpage{\lhead{Ap\'endice}
或\afterpage{\rhead{Ap\'endice}}
修改此後的每一頁,並且由於這是book
具有不同偶數頁和奇數頁標題的類,\lhead
因此偶數頁上替換頁碼,\rhead
奇數頁上替換頁碼。有什麼辦法可以解決這個問題嗎?
我將衷心感謝您的幫助。
我正在使用 fancyhdr 包,很抱歉我之前沒有說清楚。這是我的程式碼。正如您在編譯時所看到的,第 4 頁(附錄)標題是 Capítulo 1 而不是 Ap\'endice。
\documentclass{book}
\usepackage{fancyhdr}
\usepackage{lipsum}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}
\begin{document}
\chapter{Cap\'itulo 1}
\lipsum[1]
\chapter*{Ap\'endice}
\addcontentsline{toc}{chapter}{Ap\'endice: Teor\'ia de Grupos}
\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
\lipsum[2]. \newpage
\lipsum[3]
\end{document}
答案1
您可以使用奇特博士包和命令\fancyhead
\chapter*{Ap\'endice}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{Ap\'endice}
\fancyhead[LO]{Ap\'endice}
編輯:為了澄清這一點,您必須設定正確的頁面樣式才能使其運作。添加
\pagestyle{fancy}
到文檔的開頭。
或者,您可以簡單地聲明該章為附錄:
\appendix
\chapter{Name of the appendix}
注意,這裡我用的是標準\chapter
指令,而不是\chapter*
指令。這會產生略有不同的結果,但是,它可能是一個更強大(並且在我看來更好)的解決方案。