![报告类前言中的章节页码](https://linux22.com/image/464019/%E6%8A%A5%E5%91%8A%E7%B1%BB%E5%89%8D%E8%A8%80%E4%B8%AD%E7%9A%84%E7%AB%A0%E8%8A%82%E9%A1%B5%E7%A0%81.png)
[![第 2 章第 3 页,隐藏页码][8]][8] [![第 2 章第 4 页,必须显示页码][9]][9]
还有什么办法可以隐藏目录第一页、简介第一页、第一章和第二章?前言中的页码是必要的,但正文中每章的第一页不需要!
以下是完整的代码。
\documentclass[12pt,a4paper]{report}
\usepackage{import}
\usepackage[none]{hyphenat}
\usepackage{chappg}
\usepackage{fancyhdr}
\usepackage{lipsum}
% document starts here...
\begin{document}
%%frontmatter starts here
\pagenumbering{roman}
\chapter*{Main logo for the Project} \thispagestyle{empty}
{\centering
title\\
\vspace{2cm}
name\\
\vspace{2cm}
reg.no.\\
\vspace{2cm}
month\\
\vspace{2cm}
year}
\clearpage
\chapter*{\centering Certificate}
\lipsum[1-2]
\clearpage
\chapter*{\centering Acknowledge}
\lipsum[1-7]
\clearpage
%%Main matter starts here...
\pagenumbering{roman}
\chapter*{thesis abstract}
\addcontentsline{toc}{chapter}{Abstract}
\lipsum[1-3]
\clearpage
\tableofcontents
\clearpage
\pagenumbering{arabic}
\chapter{Introduction}
Brief note of Main content of the chapters.
\lipsum[1-4]
\chapter{one}
first chapter content...
\section{lispum one}
\lipsum[1-7]
\chapter{two}
second chapter content...
\section{lipsum two}
\lipsum[1-2]
\end{document}
答案1
我会使用像这样一致的东西:
\documentclass[12pt,a4paper,oneside]{book}
\usepackage{import}% Loaded but currently not used. Note: You should not load
% not used packages.
\usepackage[none]{hyphenat}% Deactivating hyphenation with justified text is
% not recommended and will result in several
% overfull \hboxes! If you use this, you should at
% least also use \raggedright. But I would
% recommend to not deactivate hyphenation.
\usepackage{chappg}
\usepackage{fancyhdr}
\fancyhead[R]{}
\fancyfoot[C]{\thepage}
\renewcommand*{\headrulewidth}{0pt}
\pagestyle{fancy}
\makeatletter
\let\ps@plain\ps@empty% Make page style plain the same like page style empty.
\makeatother
\usepackage{lipsum}
% document starts here...
\begin{document}
\frontmatter
\begin{titlepage}% Recommended for titlepages
\centering
\vspace*{1cm}
{\Huge Main logo for the Project\par}
\vspace{2cm}
title\\[2cm]
name\\[2cm]
reg.no.\\[2cm]
month\\[2cm]
year
\end{titlepage}
\chapter*{\centering Certificate}
\lipsum[1-2]
\chapter*{\centering Acknowledge}
\lipsum[1-7]
\chapter{thesis abstract}
\lipsum[1-3]
\tableofcontents
\mainmatter
\chapter{Introduction}
Brief note of Main content of the chapters.
\lipsum[1-4]
\chapter{one}
first chapter content...
\section{lispum one}
\lipsum[1-7]
\chapter{two}
second chapter content...
\section{lipsum two}
\lipsum[1-2]
\end{document}
也许您还想要:
\fancyhead[L]{}% remove the running head
作为替代方案
\makeatletter
\let\ps@plain\ps@empty% Make page style plain the same like page style empty.
\makeatother
你也可以使用
\fancypagestyle{plain}{\fancyhf{}}
“论文摘要”之前的章节起始页码不一致的完整示例:
\documentclass[12pt,a4paper,oneside]{book}
\usepackage{import}% Loaded but currently not used. Note: You should not load
% not used packages.
\usepackage[none]{hyphenat}% Deactivating hyphenation with justified text is
% not recommended and will result in several
% overfull \hboxes! If you use this, you should at
% least also use \raggedright. But I would
% recommend to not deactivate hyphenation.
\usepackage{chappg}
\usepackage{fancyhdr}
\fancyhead[R]{}
\fancyfoot[C]{\thepage}
\renewcommand*{\headrulewidth}{0pt}
\pagestyle{fancy}
\usepackage{lipsum}
% document starts here...
\begin{document}
\frontmatter
\begin{titlepage}% Recommended for titlepages
\centering
\vspace*{1cm}
{\Huge Main logo for the Project\par}
\vspace{2cm}
title\\[2cm]
name\\[2cm]
reg.no.\\[2cm]
month\\[2cm]
year
\end{titlepage}
\chapter*{\centering Certificate}
\lipsum[1-2]
\chapter*{\centering Acknowledge}
\lipsum[1-7]
\chapter{thesis abstract}
\fancypagestyle{plain}{\fancyhf{}}
\lipsum[1-3]
\tableofcontents
\mainmatter
\chapter{Introduction}
Brief note of Main content of the chapters.
\lipsum[1-4]
\chapter{one}
first chapter content...
\section{lispum one}
\lipsum[1-7]
\chapter{two}
second chapter content...
\section{lipsum two}
\lipsum[1-2]
\end{document}
fancyhdr
注意:您可以在文档中多次更改页面样式。有关\fancyhead
、\fancyfoot
或等命令的更多信息,请参阅手册\fancypagestyle
。另一种方法是使用fancyhdr
,scrlayer-scrpage
我更了解它,它还提供了一个功能,可以在文档序言中定义几对标题页面样式和普通页面样式,并在文档中从一对切换到另一对。
顺便说一句:每章的页码对读者来说并不是很有用,因为找到第 5-13 页并不像找到第 89 页那么容易。但是,我知道,它经常用于某些类型的文档。