为什么前言章节没有显示页眉Preface
?
顺便说一句,我在.之前写了Preface
章节(我这样写) ,因为如果我在目录之后写它,页码就会乱掉。我这样做对吗?\chapter*{Preface}
tableofcontents
欢迎您编辑该帖子。
先感谢您。
编辑:这是我的命令:
\documentclass[11pt, a4paper]{book}
\usepackage{etoolbox} % for '\patchcmd' macro
\makeatletter
\patchcmd{\ps@headings}{\MakeUppercase}{}{}{}
\patchcmd{\ps@headings}{\MakeUppercase}{}{}{}
\patchcmd{\ps@headings}{\MakeUppercase}{}{}{}
\patchcmd{\ps@headings}{\@chapapp\ \thechapter. \ }{\thechapter\ }{}{}
\patchcmd{\ps@headings}{\@chapapp\ \thechapter. \ }{\thechapter\ }{}{}
\patchcmd{\ps@headings}{\thesection. \ }{\thesection\ }{}{}
\patchcmd{\tableofcontents}{\MakeUppercase}{}{}{}
\patchcmd{\tableofcontents}{\MakeUppercase}{}{}{}
\patchcmd{\thebibliography}{\MakeUppercase}{}{}{}
\patchcmd{\thebibliography}{\MakeUppercase}{}{}{}
\patchcmd{\theindex}{\MakeUppercase}{}{}{}
\patchcmd{\theindex}{\MakeUppercase}{}{}{}
\patchcmd{\ps@headings}{\slshape}{}{}{}
\patchcmd{\ps@headings}{\slshape}{}{}{}
\patchcmd{\ps@headings}{\slshape}{}{}{}
\makeatother
\pagestyle{headings}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\textwidth= 6.4in
\textheight= 8.0in
\topmargin = -18pt
\evensidemargin=0pt
\oddsidemargin=0pt
\headsep=20pt
\parskip=10pt
\usepackage{amssymb,latexsym}
\usepackage{amsmath}
\usepackage{relsize}
\usepackage{fancyhdr}
\usepackage{longtable}
\usepackage{cancel}
\usepackage[colorlinks=true,linkcolor=blue,breaklinks]{hyperref}
\usepackage[hyphenbreaks]{breakurl}
\usepackage{xcolor}
\definecolor{c1}{rgb}{0,0,1}
\definecolor{c2}{rgb}{0,0.3,0.9}
\definecolor{c3}{rgb}{0.3,0,0.9}
\hypersetup{linkcolor={c1},citecolor={c2},urlcolor={c3}}
\usepackage{booktabs}
\usepackage{array}
\begin{document}
\title{...}
\author{...}
\maketitle
\pagenumbering{roman}
\chapter*{Preface}
\tableofcontents
\chapter*{Notations}
\newpage
\setcounter{page}{0}
\pagenumbering{arabic}
\setcounter{page}{1}
\chapter{...}
\chapter{...}
.
.
.\bibliography{...}
\end{document}
答案1
我不确定你为什么使用这个包fancyhdr
,所以我删除了它。在标准book
类文件中\pagestyle{headings}
是默认的,所以不需要单独调用它。
\frontmatter
标签将\pagenumbering{roman}
自动处理,并将\mainmatter
处理所有标签\setcounter{page}{0}\pagenumbering{arabic}\setcounter{page}{1}
\markboth
标签将解决中的标题问题Preface
,并且MWE
是:
\documentclass[11pt, a4paper]{book}
\usepackage{lipsum}
\usepackage{etoolbox} % for '\patchcmd' macro
%\usepackage{fancyhdr}
\makeatletter
\patchcmd{\ps@headings}{\MakeUppercase}{}{}{}
\patchcmd{\ps@headings}{\MakeUppercase}{}{}{}
\patchcmd{\ps@headings}{\MakeUppercase}{}{}{}
\patchcmd{\ps@headings}{\@chapapp\ \thechapter. \ }{\thechapter\ }{}{}
\patchcmd{\ps@headings}{\@chapapp\ \thechapter. \ }{\thechapter\ }{}{}
\patchcmd{\ps@headings}{\thesection. \ }{\thesection\ }{}{}
\patchcmd{\tableofcontents}{\MakeUppercase}{}{}{}
\patchcmd{\tableofcontents}{\MakeUppercase}{}{}{}
\patchcmd{\thebibliography}{\MakeUppercase}{}{}{}
\patchcmd{\thebibliography}{\MakeUppercase}{}{}{}
\patchcmd{\theindex}{\MakeUppercase}{}{}{}
\patchcmd{\theindex}{\MakeUppercase}{}{}{}
\patchcmd{\ps@headings}{\slshape}{}{}{}
\patchcmd{\ps@headings}{\slshape}{}{}{}
\patchcmd{\ps@headings}{\slshape}{}{}{}
\makeatother
\pagestyle{headings}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\textwidth= 6.4in
\textheight= 8.0in
\topmargin = -18pt
\evensidemargin=0pt
\oddsidemargin=0pt
\headsep=20pt
\parskip=10pt
\usepackage{amssymb,latexsym}
\usepackage{amsmath}
\usepackage{relsize}
\usepackage{longtable}
\usepackage{cancel}
\usepackage[colorlinks=true,linkcolor=blue,breaklinks]{hyperref}
\usepackage[hyphenbreaks]{breakurl}
\usepackage{xcolor}
\definecolor{c1}{rgb}{0,0,1}
\definecolor{c2}{rgb}{0,0.3,0.9}
\definecolor{c3}{rgb}{0.3,0,0.9}
\hypersetup{linkcolor={c1},citecolor={c2},urlcolor={c3}}
\usepackage{booktabs}
\usepackage{array}
\begin{document}
\frontmatter
\title{Book Title}
\author{Author}
\maketitle
\chapter*{Preface}
\markboth{Preface}{Preface}
\lipsum[1-10]
\tableofcontents
\chapter*{Notations}
\lipsum[1-3]
\newpage
\mainmatter
\chapter{Chapter Title}
\lipsum[1-10]
\chapter{Chapter Title}
\section{Section Title}
\lipsum[1-10]
\backmatter
%\bibliography{...}
\end{document}
请注意,我刚刚保留了所有标签,\patchcmd{
因为我不确定您使用这些标签的目的是什么......