我需要在页脚右侧设置页码。在章节的第二页就可以了。
但在章节标题页中,页码显示在该页的中心。
这是我的 MWE:
\documentclass[a4paper,12pt]{report}
\usepackage[left=1.5in,right=1in,top=1in,bottom=1in,includefoot,heightrounded]{geometry}
\usepackage{lipsum}
\usepackage{fancyhdr}
\renewcommand{\baselinestretch}{1.3}
\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries\centering}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing{\chapter}{0pt}{0pt}{1cm}
\begin{document}
\begin{center}
{\huge \textbf{ Abstract}}
\end{center}
\addcontentsline{toc}{section}{Abstract}
\lipsum[2-4]
\pagenumbering{roman}
\pagestyle{fancy}
\fancyfoot{}
\fancyfoot[R]{\thepage}
\fancyhead[L]{\textit{\chaptername\thechapter}}
\chapter{Introduction}
\pagenumbering{arabic}
\setcounter{page}{1}
\lipsum[2-4]
\lipsum[2-4]
\end{document}
请告诉我解决办法。
答案1
由于您加载了,因此使用选项和使用titlesec
加载它会简单得多。您必须重新定义页面样式,该样式用于章节的第一页。使用 重新定义页面样式特别容易:pagestyles
titleps
plain
titleps
\documentclass[a4paper,12pt]{report}
\usepackage[left=1.5in,right=1in,top=1in,bottom=1in,includefoot,heightrounded]{geometry}
\usepackage{lipsum}
\renewcommand{\baselinestretch}{1.3}
\usepackage[pagestyles]{titlesec}
\newpagestyle{mine}{%
\headrule
\sethead{\itshape\chaptername\thechapter}{}{\itshape\chaptertitle}
\setfoot{}{}{\thepage}}%
\renewpagestyle{plain}{%
\setfoot{}{}{\thepage}}%
\titleformat{\chapter}[display]{\normalfont\huge\bfseries\centering}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing{\chapter}{0pt}{0pt}{1cm}
\pagenumbering{roman}
\pagestyle{mine}
\begin{document}
\chapter{Introduction}
\pagenumbering{arabic}
\setcounter{page}{1}
\lipsum[2-10]
\end{document}
答案2
您需要重新定义plain
章节标题页使用的页面样式,例如:
\fancypagestyle{plain}{% <==============================================
\fancyhf{}
\fancyfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}%
}
附完整代码
\documentclass[a4paper,12pt]{report}
\usepackage[%
left=1.5in,right=1in,top=1in,bottom=1in,
includefoot,heightrounded
]{geometry}
\usepackage{lipsum}
\usepackage{fancyhdr}
\renewcommand{\baselinestretch}{1.3}
\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries\centering}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing{\chapter}{0pt}{0pt}{1cm}
\fancypagestyle{plain}{% <==============================================
\fancyhf{}
\fancyfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}%
}
\begin{document}
\pagenumbering{roman}
\pagestyle{fancy}
\fancyfoot{}
\fancyfoot[R]{\thepage}
\fancyhead[L]{\textit{\chaptername\thechapter}}
\chapter{Introduction}
\pagenumbering{arabic}
\setcounter{page}{1}
\lipsum[2-4]
\lipsum[2-4]
\end{document}
你得到:
更新:
要在第 1 章之前添加章节/摘要,请将使用的代码更改为:
%\begin{center} % <======================================================
\chapter*{Abstract} % <============================= usualy not numbered!
%\end{center}
%\addcontentsline{toc}{section}{Abstract}
\lipsum[2-4] % <========================================================
附完整代码
\documentclass[a4paper,12pt]{report}
\usepackage[%
left=1.5in,right=1in,top=1in,bottom=1in,
includefoot,heightrounded
]{geometry}
\usepackage{lipsum}
\usepackage{fancyhdr}
\renewcommand{\baselinestretch}{1.3}
\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries\centering}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing{\chapter}{0pt}{0pt}{1cm}
\fancypagestyle{plain}{% <==============================================
\fancyhf{}
\fancyfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}%
}
\begin{document}
\pagenumbering{roman}
\pagestyle{fancy}
\fancyfoot{}
\fancyfoot[R]{\thepage}
\fancyhead[L]{\textit{\chaptername\thechapter}}
%\begin{center} % <======================================================
\chapter*{Abstract}
%\end{center}
%\addcontentsline{toc}{section}{Abstract}
\lipsum[2-4] % <========================================================
\chapter{Introduction}
\pagenumbering{arabic}
\setcounter{page}{1}
\lipsum[2-4]
\lipsum[2-4]
\end{document}
你会得到: