如何在標題中顯示目前部分標題

如何在標題中顯示目前部分標題

如何在章節標題的標題中顯示目前章節標題?

我正在使用bookfancychap

微量元素

\documentclass [11pt,oneside,final]{book}
\usepackage[nohints]{minitoc}
\usepackage[round]{natbib}
\usepackage{longtable}
\usepackage[font={footnotesize,it}]{caption}
\usepackage{bookman} 
\usepackage[T1]{fontenc} 
\usepackage{setspace}
\doublespacing
%\onehalfspacing
\usepackage{multirow}
\usepackage[left=35mm,top=30mm,right=30mm,bottom=30mm]{geometry}
\pagenumbering{Roman}
\usepackage[small,compact]{titlesec}
\usepackage[Lenny]{fncychap}
\usepackage{arabtex}
\usepackage{cp1256}
\setcode{cp1256}
\usepackage{float}
\usepackage[final]{graphicx}
\usepackage{epstopdf}
\usepackage{array}

\setarab
\raggedbottom
\begin{document}
\chapter{introduction} \thispagestyle{empty}

\section{one}
bla bla bla bla bla

\section{two}
bla bla bla bla 

\end{document}

答案1

您可以使用fancyhdr

\documentclass{book}

\usepackage{fancyhdr}
\usepackage{lipsum}% just to generate text for the example

\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\rightmark}
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}

\begin{document}
\chapter{Chapter title}
\section{section title}

\lipsum[1-20]

\end{document}
  • \pagestyle{fancy}將頁面樣式設定為可使用 交付和編輯的樣式fancyhdr
  • \fancyhf{}將所有 head 和 foot 元素設為空。
  • \fancyhead[L]{\rightmark}將左頭元素設定為\rightmark,其中包含當前節(\leftmark是當前章節)。
  • \fancyhead[R]{\thepage}將右頭元素設定為頁碼。
  • \renewcommand{\headrulewidth}{0pt}讓頭部規則消失。

\fancyhead/的可選參數的可能選擇器\fancyfootL(左)、C(中)或R(右)元素位置以及E(偶數)或O(奇數)以區分偶數頁和奇數頁。如果省略E/,O則為所有頁面設定該元素。

答案2

更新答案

請改用scrlayer-scrpage...

\documentclass{book}

\usepackage{scrlayer-scrpage}
\usepackage{lipsum}% just to generate text for the example

\pagestyle{scrheadings}
\clearpairofpagestyles
\ohead{\rightmark}
\cfoot[\pagemark]{\pagemark}

\begin{document}
\chapter{Chapter title}
\section{section title}

\lipsum[1-20]

\end{document}

除了\clearscrheadfoot{}被替換之外\clearpairofpagestyles,對於用戶來說沒有任何改變。

您可能還想進一步閱讀我的德語部落格:TeX-Beispiel des Monats “佈局 II:Kopf- und Fußzeilen”


原答案

您可以使用scrpage2來自 KOMA-Script 套件

\documentclass{book}

\usepackage{scrpage2}
\usepackage{lipsum}% just to generate text for the example

\pagestyle{scrheadings}
\clearscrheadfoot{}
\ohead{\rightmark}
\cfoot[\pagemark]{\pagemark}

\begin{document}
\chapter{Chapter title}
\section{section title}

\lipsum[1-20]

\end{document}
  • \pagestyle{scrheadings}將頁面樣式設定為可使用 交付和編輯的樣式scrpage2
  • \clearscrheadfoot{}將所有 head 和 foot 元素設為空。
  • \ohead{\rightmark}將外部頭元素 ( o) 設定為\rightmark,其中包含當前節(\leftmark是當前章節)。
  • \cfoot[\pagemark]{\pagemark}將頁碼設定為中心腳元素 ( c)。最佳參數定義plain樣式(在章節起始頁上使用)。

該圖像顯示了所有可能的元素。

scrpage2 頭/腳元素
資料來源:scrguien.pdf,p。 198

答案3

我會在這些部分使用標籤並用 引用它們\nameref{}。在每一個新的部分,我認為你必須用新的部分重新定義你的標題...

相關內容