Latex 有些页面没有为我编号-let\clearpage\relax
我使用\let\clearpage\relax在一页上保留两个章节,这会导致下一页上的页码无法显示 是否有一种方法可以撤消文档中的命令,同时保留一页两章 提供了更多细节Latex 有些页面没有为我编号-let\clearpage\relax,latex,Latex,我使用\let\clearpage\relax在一页上保留两个章节,这会导致下一页上的页码无法显示 是否有一种方法可以撤消文档中的命令,同时保留一页两章 提供了更多细节 \documentclass[12pt,a4paper]{report} \usepackage[left=3cm,right=3cm,top=-2cm,bottom=4cm]{geometry} \usepackage[utf8x]{inputenc} \usepackage{amsmath} \usepackage{grap
\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
\documentclass[12pt,a4paper]{report}
\usepackage[left=3cm,right=3cm,top=-2cm,bottom=4cm]{geometry}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{placeins}
\使用包{tocloft}
\使用包{ifthen}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{float}
\floatstyle{plaintop}
\restylefloat{table}
\usepackage{caption}
\字幕设置[表]{skip=10pt}
\页面样式{fancy}
\usepackage{setspace}
\马克特莱特
%添加未显示“第1章”
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent\z@\raggedright\normalfont
\行间惩罚\@M
\大型\bF系列
\伊夫纳姆\c@secnumdepth >\m@ne
\章节\n空白
\fi
#1\par\nobreak
\vskip 40\p@
}}
\@如果未定义{章节}%
{}%
{\renewcommand{\chaptermark}[1]{%
\如果其他{\value{chapter}<1}%
{\markboth{1}{}}%
{\markboth{\thechapter\#1}{}
}}
\addtolength{\headheight}{\baselineskip}
\renewcommand{\headrulewidth}{0.4pt}%%标题下的细线
%\renewcommand{\headrulewidth}{0pt}%%标题下无行
\更新命令{\footrulewidth}{0pt}
\fancyhf{}%%清除所有字段。
%\fancyhead[LE,RO]{\sffamily\thepage}
%\fancyhead[LO,RE]{\sffamily\nouppercase{\leftmark}}
\fancyhead[R]{\sffamily\thepage}
\fancyhead[L]{\sffamily\nouppercase{\leftmark}
\fancypagestyle{plain}{%
\fancyhf{}%清除所有页眉和页脚字段
\fancyfoot[C]{\sffamily\thepage}%除中心外
\更新命令{\headrulewidth}{0pt}
\更新命令{\footrulewidth}{0pt}
}
\Maketother
该问题是由两个因素共同造成的:
- 您的文档对章节页面和普通页面使用不同的页面样式。在章节页面上,页码位于底部中间,在正常页面上,有一个标题,标题上有章节标题和页码
- 您使用的是带有较大负上边距的
包。这会将正常页面的页眉从页面上推下,而您不再在页眉上看到页码几何体
- 为页面几何图形使用合理的值,例如
这还有一个优点,即可以删除图形和表格中的大多数硬代码\usepackage[left=3cm,right=3cm,top=2cm,bottom=4cm]{geometry}
s\vspace
- 如果要在所有正常页面上删除页眉并将页码移动到底部中间位置,可以使用以下定义:
\fancyhf{} % clear all header and footer fields \fancyfoot[C]{\sffamily\thepage} % except the center \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt}
book
替换为report
,它仍然可以正常工作。@MichałWietlicki几何设置中的问题是top=-2cm
。这会将带有页码的页眉推离页面。如果我删除这个,我会再次看到页码。当我删除顶部或底部时,同样的问题仍然存在。@MichałWietlicki,这很奇怪。你能做一个小的,但可编译的例子来重现这个问题吗?如果我将您在问题中显示的序言添加到我的回答中的文档中,它就可以正常工作。