在一本 200 页的书中,我尝试使用\usepackage{emptypage}
来删除新章节前自动生成的空白页上的页码。对于其中一些页面,我仍然会得到页码。我看不到任何内容上的不同之处来触发此操作。我被难住了!
如果我在新章节之前删除任何一行内容,emptypage 就会起作用!因此,LaTeX 好像认为内容溢出到了空白页,但事实并非如此。
有任何想法吗?
代码如下:
% Designed to run under "pdfLaTeX + BibTeX + MakeIndex" option in TeXworks
\documentclass[openright,twoside,10pt]{book}
% Page Setup:
\usepackage[
paperwidth=6in,
paperheight=9in,
bindingoffset=0.2in,
left=1.25in,
right=1.25in,
top=1.1in,
bottom=1.1in,
includefoot
]{geometry}
\usepackage{graphicx}
\usepackage[usenames]{xcolor}
% Header/Footer Page Numbering and color:
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\setlength{\footskip}{45pt}
\fancyfoot[C]{\textcolor{gray}{\thepage}}
\pagestyle{fancy}
\fancypagestyle{frontmatter}{%
\renewcommand{\headrulewidth}{0pt}% No header rule
\renewcommand{\footrulewidth}{0pt}% No footer rule
\fancyhf{}% Clear header/footer
\fancyfoot[C]{\thepage}%
}
\fancypagestyle{mainmatter}{%
\renewcommand{\headrulewidth}{.4pt}% Header rule
\renewcommand{\footrulewidth}{.4pt}% Footer rule
\fancyhf{}% Clear header/footer
\fancyhead[L]{\leftmark}% Chapter in header Left
\fancyhead[R]{\thepage}% Page number in header Right
}
% Remove page numbers on empty pages
\usepackage{emptypage}
% Add dummy text:
\usepackage{lipsum}
% Paragraph Formatting:
\parindent=0in
\parskip=12pt
% Turn off section numbers (0=no numbers, 1=numbers):
\setcounter{secnumdepth}{0}
% package for adding pages after a page:
\usepackage{afterpage}
\newcommand\blankpage{%
\null
\thispagestyle{empty}%
\addtocounter{page}{0}% change to -1 if you don't want page numbers additive
\newpage}
%
%---------------------------------------Begin Book-------------------------- -------------
%
\begin{document}
. . .
\thispagestyle{empty}
\tableofcontents
\thispagestyle{empty}
\frontmatter
\pagestyle{frontmatter}
\section{Forward}
\lipsum[1-5]
\mainmatter
\pagestyle{frontmatter}
This is not where I want to live\\
In my heaven\\
Flags are for burning\\
And the only God is possibility\\
\\
We can change this\\
F-cked up world\\
Into whatever we want, so\\
Why does it always stay the same\\
\chapter*{Man With a Suitcase}
\thispagestyle{empty}
\addcontentsline{toc}{chapter}{Man With a Suitcase}
\newpage
\blankpage
\section{Two Little Sparrows}
All my heroes \\
have flown away \\
While the blossoms \\
\\
On the trees \\
Are bursting out \\
Beautiful, in the \\
\\
Spring air \\
Followed by the hot winds \\
That will blow across my face \\
\end{document}
答案1
您的示例会产生多个以下形式的警告
Underfull \hbox (badness 10000) in paragraph at lines 82--93
请注意,这是 TeX 指定的最大糟糕程度,因此 TeX 会根据其对输出可接受性的内部衡量标准警告您输出已经糟糕到极致。
在段落末尾使用\\ \\
或\\
不会产生垂直空间。它会导致段落中没有文本的行“不完整”,这样的“白色”行不会在分页符处被丢弃,因此会出现在正常分页符的顶部,使第一行显得太低,而最后一行可能会出现在页面上,使页面看起来是白色的,但不是空的。
使用空白行不\\
标记段落(或诗句)
% 设计用于 TeXworks 中的“pdfLaTeX + BibTeX + MakeIndex”选项下运行
\documentclass[openright,twoside,10pt]{book}
% Page Setup:
\usepackage[
paperwidth=6in,
paperheight=9in,
bindingoffset=0.2in,
left=1.25in,
right=1.25in,
top=1.1in,
bottom=1.1in,
includefoot
]{geometry}
\usepackage{graphicx}
\usepackage[usenames]{xcolor}
% Header/Footer Page Numbering and color:
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\setlength{\footskip}{45pt}
\fancyfoot[C]{\textcolor{gray}{\thepage}}
\pagestyle{fancy}
\fancypagestyle{frontmatter}{%
\renewcommand{\headrulewidth}{0pt}% No header rule
\renewcommand{\footrulewidth}{0pt}% No footer rule
\fancyhf{}% Clear header/footer
\fancyfoot[C]{\thepage}%
}
\fancypagestyle{mainmatter}{%
\renewcommand{\headrulewidth}{.4pt}% Header rule
\renewcommand{\footrulewidth}{.4pt}% Footer rule
\fancyhf{}% Clear header/footer
\fancyhead[L]{\leftmark}% Chapter in header Left
\fancyhead[R]{\thepage}% Page number in header Right
}
% Remove page numbers on empty pages
\usepackage{emptypage}
% Add dummy text:
\usepackage{lipsum}
% Paragraph Formatting:
\parindent=0in
\parskip=12pt
% Turn off section numbers (0=no numbers, 1=numbers):
\setcounter{secnumdepth}{0}
% package for adding pages after a page:
\usepackage{afterpage}
\newcommand\blankpage{%
\null
\thispagestyle{empty}%
\addtocounter{page}{0}% change to -1 if you don't want page numbers additive
\newpage}
%
%---------------------------------------Begin Book-------------------------- -------------
%
\begin{document}
. . .
\thispagestyle{empty}
\tableofcontents
\thispagestyle{empty}
\frontmatter
\pagestyle{frontmatter}
\section{Forward}
\lipsum[1-5]
\mainmatter
\pagestyle{frontmatter}
\begin{verse}
This is not where I want to live\\
In my heaven\\
Flags are for burning\\
And the only God is possibility
We can change this\\
F-cked up world\\
Into whatever we want, so\\
Why does it always stay the same
\end{verse}
\chapter*{Man With a Suitcase}
\thispagestyle{empty}
\addcontentsline{toc}{chapter}{Man With a Suitcase}
\newpage
\blankpage
\section{Two Little Sparrows}
\begin{verse}
All my heroes \\
have flown away \\
While the blossoms
On the trees \\
Are bursting out \\
Beautiful, in the
Spring air \\
Followed by the hot winds \\
That will blow across my face
\end{verse}
\end{document}