我使用\let\clearpage\relax将两个章节保留在一个页面上,这将导致不显示页面上的页码。
是否有一种方法可以撤销文档中的命令,但仍保留两章一页?
提供了更多细节。
\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发布于 2019-02-26 15:26:28
造成这一问题的因素有两个:
geometry包具有很大的负上限。这将普通页的页眉从页面中推开,并且您没有再看到它们上的页码。建议的解决方案:
\usepackage[left=3cm,right=3cm,top=2cm,bottom=4cm]{geometry}
这也有一个优点,即可以删除数字和表格中的大多数硬代码\vspace。https://stackoverflow.com/questions/54884854
复制相似问题