首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >有些页面没有编号-让\清除页\放松

有些页面没有编号-让\清除页\放松
EN

Stack Overflow用户
提问于 2019-02-26 11:47:14
回答 1查看 448关注 0票数 0

我使用\let\clearpage\relax将两个章节保留在一个页面上,这将导致不显示页面上的页码。

是否有一种方法可以撤销文档中的命令,但仍保留两章一页?

提供了更多细节。

代码语言:javascript
复制
\documentclass[12pt,a4paper]{report}
\usepackage[left=3cm,right=3cm,top=-2cm,bottom=4cm]{geometry}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{tocloft}
\usepackage{ifthen}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{float}
\floatstyle{plaintop}
\restylefloat{table}
\usepackage{caption} 
\captionsetup[table]{skip=10pt}
\pagestyle{fancy}
\usepackage{setspace}
\makeatletter

% addition for not showing 'Chapter 1'
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \interlinepenalty\@M
    \Huge \bfseries
    \ifnum \c@secnumdepth >\m@ne
      \thechapter\nobreakspace
    \fi
    #1\par\nobreak
    \vskip 40\p@
  }}


\@ifundefined{chapter}%
   {}%
     {\renewcommand{\chaptermark}[1]{%
            \ifthenelse{\value{chapter} < 1}%
                {\markboth{#1}{}}%
                {\markboth{\thechapter\ #1}{}}
        }}


\addtolength{\headheight}{\baselineskip}
\renewcommand{\headrulewidth}{0.4pt} %% thin line under header
%\renewcommand{\headrulewidth}{0pt} %% no line under header
\renewcommand{\footrulewidth}{0pt}
\fancyhf{}                            %% Clear all fields.
%\fancyhead[LE,RO]{\sffamily\thepage}
%\fancyhead[LO,RE]{\sffamily\nouppercase{\leftmark}}
\fancyhead[R]{\sffamily\thepage}
\fancyhead[L]{\sffamily\nouppercase{\leftmark}}

\fancypagestyle{plain}{%
    \fancyhf{} % clear all header and footer fields
    \fancyfoot[C]{\sffamily\thepage} % except the center
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
}
\makeatother
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-02-26 15:26:28

造成这一问题的因素有两个:

  • 文档对章节页和普通页使用不同的页面样式。在章节页上,页码位于最下面的中心,在普通页上有一个带有章节标题和页码的标题。
  • 您使用的geometry包具有很大的负上限。这将普通页的页眉从页面中推开,并且您没有再看到它们上的页码。

建议的解决方案:

  • 对页面几何使用合理的值,例如\usepackage[left=3cm,right=3cm,top=2cm,bottom=4cm]{geometry} 这也有一个优点,即可以删除数字和表格中的大多数硬代码\vspace
  • 如果要删除页眉并将页码移动到所有普通页的底部中心,则可以使用以下定义: \fancyhf{} %清除所有页眉和页脚字段\fancy脚注C{\sffamily\ the header }%,但中间命令{\headrulewidth}{0PT}\更新命令{\footrulewidth}{0PT}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54884854

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档