![包含新章节的页面忽略页面样式](https://linux22.com/image/449421/%E5%8C%85%E5%90%AB%E6%96%B0%E7%AB%A0%E8%8A%82%E7%9A%84%E9%A1%B5%E9%9D%A2%E5%BF%BD%E7%95%A5%E9%A1%B5%E9%9D%A2%E6%A0%B7%E5%BC%8F%20.png)
我目前正在写一本书,遇到了一个我至今无法解决的问题。似乎每当引入新章节时,当前的页面样式就会被忽略。在我的“最小”工作示例中,可以看到整体定义的页眉(“Header”)仅在没有新章节开始的页面上显示。此外,页码不再显示在页面底部,而是显示在顶部。如果您知道如何解决这个问题,或者是否已经解决了这个问题以及在哪里已经解决了这个问题,请告知。
% Document class
\documentclass[twoside,11pt,english]{book}
% Geometry
\usepackage[left=3cm,right=2cm,top=3cm,bottom=2cm]{geometry}
% change in headheight needed otherwise poemscol produces warnings
\setlength{\headheight}{14pt}
% Language
\usepackage[english]{babel}
% Fancy HDR
\usepackage{fancyhdr}
% Poem Typesetting
\usepackage{poemscol}
% Fill with text
\usepackage{lipsum}
% Chapters and Sections don't get a counter but still get into toc
\setcounter{secnumdepth}{-1}
% Page Layout
\pagestyle{fancy}
\fancyhf{}
% Put the page number at the right edge of odd pages, and left edge of even pages.
\fancyfoot[RO,LE]{\thepage}
% Custom text at the left edge of odd pages, and right edge of odd pages.
\fancyhead[RO,LE]{Header}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Document Start %%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\title{This is a fancy book title}
\author{Author Name}
\date{\today}
\maketitle
\tableofcontents
\chapter{Chap.1}
\section{Sec. 1.1}
\lipsum
\subsection{Subsec. 1.1.2}
\begin{poem}
\poemtitle{I don't have a clue}
Roses are red \verseline
Violets are blue \verseline
I am writing a poem \verseline
But I don't have a clue \verseline
\end{poem}
\lipsum[2]
\section{Sec. 1.2}
\lipsum[1]
\chapter{Chap.2}
\section{Sec 2.1}
\lipsum[1]
\section{Sec 2.2}
\section{Sec 2.3}
\section{Sec 2.4}
\end{document}
答案1
正如@UlrikeFischer 在评论中提到的,必须检查所用软件包的文档。正如软件包文档fancyhdr
指出的命令\chapter
问题\thispagestyle{plain}
。因此需要重新定义 pagestyle plain。
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrule}{}}
对我有用。