抑制 \cleardoublepage 上的格式?

抑制 \cleardoublepage 上的格式?

我如何抑制格式\cleardoublepage

\documentclass[a5paper,10pt, twoside]{book}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyhead[RO]{The College Savings Factor}  %title of the book
\fancyhead[LE]{\chaptername \ \thechapter}
%\fancyfoot{} % clear all footer fields
%\fancyfoot[LC,RC]{\thepage}
\renewcommand{\headrulewidth}{0.2pt}
\renewcommand{\footrulewidth}{0.0pt}    % 0.0 makes line dissapear
%\fancyfoot[LE, RO]{\thepage}   
\usepackage{nextpage}

\begin{document}
Chapter 1
text
\cleardoublepage
Chapter 2
text
\end{document}

页眉格式和页码出现在那些构建了额外页面以将章节开头推到奇数页的章节上。我怎样才能抑制格式并保持页面空白?
我试过但没有成功。我的最终解决方案是完成这本书,并在需要的地方\thispagestyle{empty}手动插入空白页 。\afterpage{\null \thispagestyle{empty} \newpage }

答案1

使用emptypage包。

\documentclass[a5paper,10pt, twoside]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyhead[RO]{The College Savings Factor}  %title of the book
\fancyhead[LE]{\chaptername \ \thechapter}
%\fancyfoot{} % clear all footer fields
%\fancyfoot[LC,RC]{\thepage}
\renewcommand{\headrulewidth}{0.2pt}
\renewcommand{\footrulewidth}{0.0pt}    % 0.0 makes line dissapear
%\fancyfoot[LE, RO]{\thepage}
\usepackage{nextpage}

\usepackage{emptypage}   %%<--- add this line

\begin{document}
Chapter 1
text
\cleardoublepage
Chapter 2
text
\end{document}

答案2

这里有两个回应。

由于nextpage.sty已经加载,因此只需使用该多功能包即可。下面,原始的“添加此行”行被注释掉,并nextpage.sty \cleartooddpage添加了命令,如所示。

\documentclass[a5paper,10pt, twoside]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyfoot{} % clear all footer fields
\fancyhead[RO]{The College Savings Factor}  %title of the book
\fancyhead[LE]{\chaptername \ \thechapter}
%\fancyfoot{} % clear all footer fields
%\fancyfoot[LC,RC]{\thepage}
\renewcommand{\headrulewidth}{0.2pt}
\renewcommand{\footrulewidth}{0.0pt}    % 0.0 makes line dissapear
\fancyfoot[LE, RO]{\thepage}
\usepackage{nextpage}

%%%\usepackage{emptypage}   %%<--- add this line

\begin{document}
Chapter 1
text
%%%\cleardoublepage
\cleartooddpage[\thispagestyle{empty}]  %%% <-- this line added
Chapter 2
text
\end{document}

由于 MWE 和原始(2015)答案中讨论的是模拟章节,并且实际章节有时需要处理独特的功能,因此还包括nextpage.stybook类一起使用的实际章节的示例。有些设计要求“无格式”,就像 OP 的情况一样。有些设计要求“仅页码”;有些要求“此页故意空白”,带或不带页码。 nextpage处理所有这些选项,如下所示。各种选项保留为注释,说明进一步的自定义选项。

\documentclass[a5paper,10pt, twoside]{book}
\usepackage{tocloft}

%https://tex.stackexchange.com/questions/142871/how-to-customize-a-brief-table-of-contents-generated-from-tocloft-and-shorttoc-i
%https://tex.stackexchange.com/a/250822/170846
\setlength\cftbeforetoctitleskip{0pt} % change space before TOC title
\setlength\cftaftertoctitleskip{20pt}  % change space after  TOC title

\usepackage[latin,english]{babel}
\usepackage{csquotes} % smart quotes

\usepackage{fancyhdr}
\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}}

\newcommand{\resetHRule}[1]{\renewcommand\headrulewidth{#1}}

\newcommand{\setHdrFtr}[0]{%
    \fancyhf{}%
    \fancyhead[RO]{The College Savings Factor}%
    \fancyhead[LE]{\leftmark}%
    \renewcommand\footrulewidth{0.2pt}
    \fancyfoot[LE, RO]{\thepage}%
    }

\fancypagestyle{plain}{%
    \fancyhf{}
    \renewcommand\headrulewidth{0pt}
    \fancyfoot[LE, RO]{\thepage}
    \renewcommand\footrulewidth{0pt}
    }

\newcommand{\clrHdr}[0]{
    \thispagestyle{plain}
}

\usepackage{nextpage}

%%% minor modification to nextpage for even-to-even clearing
\makeatletter
\renewcommand{\cleartoevenpage}[2]{%
    \ifodd\c@page\clearpage%
    \else\newpage\thispagestyle{#2}\hbox{}#1
    \newpage\hbox{}
    \fi}
\makeatother

\usepackage[texcoord]{eso-pic}
\usepackage{graphicx}
\usepackage{url}
\usepackage{lipsum}
\usepackage[pagebackref=true]{hyperref}

\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=blue,      
    urlcolor=blue,
}

\setcounter{tocdepth}{1} % -1, 0, 1    

\begin{document}
\clrHdr
\renewcommand{\contentsname}{Contents}
\phantomsection
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents

% odd to odd -- blank
\cleartooddpage[\thispagestyle{empty}]%  <--- square

% odd to odd -- blank (w/ pg no.)
%\cleartooddpage[\thispagestyle{plain}]

\phantomsection
\addcontentsline{toc}{chapter}{Chapter 1}
\chapter*{Chapter 1}
\chaptermark{Chapter 1}
\setHdrFtr

\lipsum[44-48]

% odd to odd -- skipped pg filled (no page number)
\cleartooddpage[{\vspace*{\fill}\begin{center}THIS PAGE LEFT BLANK\end{center}\vspace*{\fill}}\thispagestyle{empty}]

% odd to odd -- skipped pg filled (with page number)
%\cleartooddpage[{\vspace*{\fill}\begin{center}THIS PAGE LEFT BLANK\end{center}\vspace*{\fill}}\thispagestyle{plain}]

% odd to odd -- just page number
%\cleartooddpage[\thispagestyle{plain}]

\phantomsection
\addcontentsline{toc}{chapter}{Chapter 2}
\chapter*{Chapter 2}
\chaptermark{Chapter 2}

\lipsum[49-51]

% even to odd -- blank    and
% even to odd -- filled 
% are the same -- there is no blank page to handle
\cleartooddpage[{\vspace*{\fill}\begin{center}THIS PAGE LEFT BLANK\end{center}\vspace*{\fill}}\thispagestyle{plain}]

\phantomsection
\addcontentsline{toc}{chapter}{Chapter 3}
\chapter*{Chapter 3}
\chaptermark{Chapter 3}

\lipsum[52]

% odd to even -- blank    and
% odd to even -- filled 
% are the same -- there is no blank page to handle
\cleartoevenpage{some text that won't ever show up}{plain}

\phantomsection
\addcontentsline{toc}{chapter}{A plain PreChap page}
% for no page number
%\thispagestyle{empty}
% for page number
\thispagestyle{plain}
This is the recto page that was advanced/cleared to.  Typically, there'll be pre-chapter text or graphics on this page.

\clearpage

\phantomsection
\addcontentsline{toc}{chapter}{Chapter 4}
\chapter*{Chapter 4}
\chaptermark{Chapter 4}

\lipsum[53-56]

% even to even -- blank (w/ pg no)
\cleartoevenpage{}{plain}

% even to even -- blank (w/o pg no)
%\cleartoevenpage{}{empty}

\phantomsection
\addcontentsline{toc}{chapter}{PreChap Graphics with preceding blank page with page no}
\thispagestyle{plain}

%adapted from https://tex.stackexchange.com/a/248829/170846
\begin{minipage}[c]{\textwidth}
    \href{https://ctan.org/lion/files/ctan_lion_350x350.png}{\includegraphics[scale=0.75]{ctan_lion_350x350.png}{}}\\
\end{minipage}

\clearpage

\phantomsection
\addcontentsline{toc}{chapter}{Chapter 5}
\chapter*{Chapter 5}
\chaptermark{Chapter 5}

\lipsum[57-60]

% even to even -- skipped pg filled (w/ page no)
\cleartoevenpage{\vspace*{\fill}\begin{center}THIS PAGE LEFT BLANK\end{center}\vspace*{\fill}}{plain}

% even to even -- skipped pg filled (no page number)
%\cleartoevenpage{\vspace*{\fill}\begin{center}THIS PAGE LEFT BLANK\end{center}\vspace*{\fill}}{empty}

% even to even -- skipped pg w/ page number only
%\cleartoevenpage{}{plain}

\phantomsection
\addcontentsline{toc}{chapter}{The \enquote{cleared-to} verso page, ready for pre-Chap content, with preceding Notice of deliberate blankness}
\thispagestyle{plain}

% or, for no page no.
%\thispagestyle{empty}

Here is a famous quote by a famous author.

{\textit{Famous Author}}

\clearpage

\phantomsection
\addcontentsline{toc}{chapter}{Chapter 6}
\chapter*{Chapter 6}
\chaptermark{Chapter 6}

\lipsum[70-73]

\end{document}

相关内容