我想让每页顶部只显示章节标题而不显示节标题。下面是一个 MWE。我该如何修改它以消除节标题的出现,从而避免每页顶部的章节标题和节标题重叠?
\documentclass[a4paper,12pt,oneside]{book}
\usepackage[top=1.0in, bottom=1.0in, left=1.0in,right=1.0in,bindingoffset=2.3cm]{geometry}
\usepackage[lenny]{fncychap}
\usepackage{fancyhdr}
%\fancyhf{}
\cfoot{\thepage}
\pagestyle{fancy}
\usepackage{lipsum}
\begin{document}
\chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some Chapter}
\lipsum[1-1]
\section{Some Sections Some section1}
\lipsum[2-3]
\section{Some Sections Some section2}
\lipsum[1-16]
\chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some Chapter1 }
\section{Some Sections Some section5}
\lipsum[4-5]
\section{Some Sections Some section6}
\lipsum[6-7]
\chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some Chapter45}
\section{Some Sections Some section6}
\lipsum[4-5]
\section{Some Sections Some section7}
\lipsum[10-11]
\end{document}
答案1
可以使用命令\rhead
和\lhead
来完成。标题周围的框的代码取自这个答案。
\documentclass[a4paper,12pt,oneside]{book}
\usepackage[top=1.0in, bottom=1.0in, left=1.0in,right=1.0in,bindingoffset=2.3cm]{geometry}
\usepackage[lenny]{fncychap}
\usepackage{fancyhdr}
\cfoot{\thepage}
\pagestyle{fancy}
\usepackage{lipsum}
\renewcommand{\headrulewidth}{0pt} %remove header rule
\rhead{\flushleft\leftmark}
\rhead{\noindent\fbox{\parbox{\dimexpr\linewidth-2\fboxsep-\fboxrule\relax}{\leftmark}}} %make box on th header
\setlength{\headsep}{1cm} %add some additional space between header and text
\lhead{}
\begin{document}
\chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some Chapter}
\lipsum[1-1]
\section{Some Sections Some section1}
\lipsum[2-3]
\section{Some Sections Some section2}
\lipsum[1-16]
\chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some Chapter1 }
\section{Some Sections Some section5}
\lipsum[4-5]
\section{Some Sections Some section6}
\lipsum[6-7]
\chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some Chapter45}
\section{Some Sections Some section6}
\lipsum[4-5]
\section{Some Sections Some section7}
\lipsum[10-11]
\end{document}