我希望所有页码都显示在页面的右上角,目前只有没有 、\part
或 的页面才显示此页码\chapter
。
此外,我希望简介(目录和图表)之前的页面的右上角有罗马数字(目前中间下方有阿拉伯数字)。
这是我的代码:
\documentclass[a4paper,twoside,12pt]{report}
\usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, left=2.5cm]{geometry}
\setlength{\parskip}{0.2cm}
% A lot of packages here I won't include to make it as clear as possible
\usepackage{fancyhdr}
\pagestyle{plain}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{0pt}{10pt}
\begin{document}
\begin{titlepage}
\includepdf{cover}
\end{titlepage}
\tableofcontents
\thispagestyle{empty}
\clearpage
\listoffigures
\cleardoublepage %The first chapter should start on an odd page.
\pagestyle{fancy}
\fancyhf{}
\fancyhead[R]{\thepage}
\setcounter{page}{1}
\chapter{Introduction}
lot of text
\part{part 1}
\chapter{chapter 2}
lot of text
\section{section 1}
\subsection{subsection 1}
etc.
\cleardoublepage
\includepdf{back}
\end{document}
非常感谢
答案1
也许以下内容有帮助:
\documentclass[a4paper,twoside,12pt]{report}
\usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, left=2.5cm,
headheight=14.5pt% as suggested by fancyhdr
]{geometry}
\usepackage[skip=.2cm,indent]{parskip}% do not change \parskip manually
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[R]{\thepage}
\renewcommand\headrulewidth{0pt}
\fancypagestyle{plain}{
\fancyhf{}
\fancyhead[R]{\thepage}
\renewcommand\headrulewidth{0pt}
\renewcommand\footrulewidth{0pt}
}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{0pt}{10pt}
\usepackage{blindtext}% only for dummy text in a MWE
\begin{document}
\begin{titlepage}
\centering\Huge Cover
\end{titlepage}
\thispagestyle{empty}
\cleardoublepage
\pagenumbering{roman}
\tableofcontents
\listoffigures
\cleardoublepage
\pagenumbering{arabic}
\chapter{Introduction}
\Blindtext[2]
\part{part 1}
\chapter{chapter 2}
\blindtext
\section{section 1}
\subsection{subsection 1}
\blinddocument
\end{document}