页码仅出现在章节起始页上。如何让它们出现在所有页面上

页码仅出现在章节起始页上。如何让它们出现在所有页面上

我知道\pagestyle{empty}只在章节第一页上添加页码。但我评论了同样的内容,除了章节第一页之外,我仍然没有得到页码。

%This is the main file.  This is where you set up your preferences, name the packages you need, and use the "input" command to order the chapters and other major components of your thesis, most of which are set up as separate .tex files.  To see other project files, click the "Project" tab on the upper left.  If you click on a section in the pdf preview, you will jump to that file (Overleaf)
\documentclass[12pt]{report}  %12 point font is set - Times New Roman is the default

%These are a bunch of packages that may or may not be needed for features I use later
\usepackage{graphicx}
\usepackage[table]{xcolor}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage{url}
\usepackage{multicol}
\usepackage{booktabs}
\usepackage[toc,page]{appendix}
\usepackage{glossaries}
\input{glossary}
\renewcommand\bibname{References}
\usepackage{setspace}
\usepackage[letterpaper,left=1in,right=1in,top=1in,bottom=1in]{geometry} %margin of bound side 1.5 in, rest of margins 1 in, per Creighton Thesis guideline formats
\usepackage{pdflscape}
\usepackage{subfigure}
\usepackage{pdfpages}
\widowpenalty10000% This automatically groups lines so there is at least 2 from each paragraph on a page.  Optional
\clubpenalty10000 %see above comment
\usepackage{indentfirst} %This makes the first paragraph of a section indented.  Optional.

\usepackage{breqn}
\usepackage{gensymb}

%To float image where the syntax is%
\usepackage{float}
%For algorithm%
\usepackage[]{algorithm2e}
%For theorem environment
\theoremstyle{definition}
\newtheorem{theorem} {Theorem}

\begin{document}
\pagestyle{plain}
\frenchspacing

\newpage
%\thispagestyle{empty}

\mbox{}
\clearpage %blank page at beginning of pdf.  not numbered

\input{approval} %Have this page printed and signed, then delete from your thesis and insert the signed version.

%\includepdf[scale=1.0]{Sig2.pdf} % After the dean signs the approval page, LuAnn Schwery sends you a pdf, which you insert into your thesis

\pagenumbering{roman} %begin roman numeral page numbers for the front matter
\input{cover} %title page

\doublespacing

\newpage %insert blank page, counted in page numbers
%\thispagestyle{empty} % do not display page number
\mbox{}
\clearpage 

\addcontentsline{toc}{chapter}{Abstract} 
\input{abstract}  %Abstract is the first thing in the thesis after the title

\clearpage

\addcontentsline{toc}{chapter}{Acknowledgments}
\input{acknowledgments} %optional

\clearpage

\addcontentsline{toc}{chapter}{Dedication
\input{dedication} %optional

\clearpage


\tableofcontents %automatically generate TOC
\clearpage

\listoftables %automatically generates list of tables
\clearpage
\listoffigures%automatically generates list of figures

\clearpage

\pagenumbering{arabic} % start normal numbering on the first page of chapter 1
\input{chapter1}

\input{chapter2}

\input{chapter3}

\input{chapter4}

\input{chapter5}
\clearpage

\appendix %begin appendix section
\chapter{Style guide} \label{sec:appa}
\input{appendixa}
\clearpage



\end{document}

答案1

您的陈述有些错误: \pagestyle{empty}清空常规页眉和页脚。但\chapter在标准类中,会自动\thispagestyle{plain}为包含章节页眉的页面发出一个,从而在页脚中生成页码,无论前一个pagestyle{...}

因此如果您想在任何页面上使用它,只需使用\pagestyle{plain}

当您使用该类时report,您可以选择使用生成的运行页眉\pagestyle{headers},其中页码位于页眉中,并且页脚为空,显然除了章节页面之外。

相关内容