
我正在嘗試獲取當前部分名稱並將其添加到右側的標題中。
\documentclass[12pt,french]{report}
\renewcommand\chaptername{Chapitre}
\renewcommand\appendixname{Annexe}
\let\@oldmakechapterhead\@makechapterhead
\def\@makechapterhead#1{%
\vspace*{10\p@}%
{\parindent \z@
{\reset@font
\usefont{OT1}{phv}{m}{n}
\LARGE\@chapapp~\thechapter\par\nobreak}%
\par\nobreak
\vspace*{30\p@}
\interlinepenalty\@M
\usefont{OT1}{ptm}{b}{n}
{\raggedright \Huge #1}%
\par\nobreak
\vskip 20\p@
\hrule height 1pt
\par\nobreak
\vskip 45\p@
}}
\rhead{\nouppercase\rightmark}
\begin{document}
\addtocontents{toc}{\protect\thispagestyle{empty}}
\chapter{ABC}
\end{document}
請問如何取得目前部分名稱並將其放入該行而不將其新增至 TOC、TO 表和 TO 圖?
答案1
如果我正確理解您的問題,您將嘗試在內容頁面上新增標題,而不將相同的標題新增至 TOC、LOT、LOF 頁面。
這最好透過fancyhdr
套件來完成,它將使常規頁面具有您定義的標題,同時將 frontmatter 頁面和其他特殊頁面(例如章節的首頁)保留為「普通」樣式,僅具有頁碼在底部。
這段程式碼給了這樣的結果:
\documentclass[12pt,french]{report}
\usepackage{blindtext} % For example
\usepackage{fancyhdr}
\fancyhead{} % Clear the headers
\renewcommand{\headrulewidth}{0pt} % Width of line at top of page
\fancyhead[R]{\slshape\leftmark} % Mark right [R] of page with Chapter name [\leftmark]
\pagestyle{fancy} % Set default style for all content pages (not TOC, etc)
\begin{document}
\tableofcontents
%\chapter{ABC}
\blinddocument
\end{document}
輸出: