![修改 \cleardoublepage 的样式](https://linux22.com/image/284788/%E4%BF%AE%E6%94%B9%20%5Ccleardoublepage%20%E7%9A%84%E6%A0%B7%E5%BC%8F.png)
我正在寻找一种解决方案,将cleardoublepage
“空白页”居中文本放在空白页上。我想要的是,所有部分都正确打开,然后我在那里添加了一个空白页,该页面应标记为“空白页”。
\documentclass[11pt,a4paper,twoside,openright,
notitlepage,cleardoublepage=empty,
ngerman]{article}
\usepackage[a4paper,
bindingoffset=1cm,margin=2cm,
includeheadfoot,
% top=25mm, bottom=25mm,
% headheight=15mm, headsep=7mm
]{geometry}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % Load the TS1-encoding e.g. through textcomp
\usepackage{verbatim, environ}
\usepackage{lmodern}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{blindtext}
\begin{document}
\section{eins}
\blindtext
\cleardoublepage
\section{zwei}
\blindtext
\cleardoublepage
\section{drei}
\blindtext
\blindtext
\blindtext
\Blindtext
\cleardoublepage
\section{vier}
\blindtext
\blindtext
\blindtext
\Blindtext
\end{document}
第一个修改示例
注意到您的评论,这里有一个新的示例。这显示了它应该是什么样子。只缺少“空白页”标记。cleardoublepage 的功能以及页眉和页脚必须保持不变。
我所指的功能是:如果最后一节结束于奇数页,则 cleardoublepage 仅插入空白页(旧节:奇数页 -> cleardoublepage:空白偶数页 -> 下一节:奇数页)。如果某一节结束于偶数页,则 cleardoublepage 不起作用。(旧节:奇数页 -> cleardoublepage:未插入任何页面 -> 下一节:奇数页)
\documentclass[11pt,a4paper,twoside,
notitlepage,
ngerman]{article}
\usepackage[a4paper,
bindingoffset=1cm,margin=2cm,
includeheadfoot,
]{geometry}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % Load the TS1-encoding e.g. through textcomp
\usepackage{verbatim, environ}
\usepackage{lmodern}
\usepackage{amsmath,amsfonts,amssymb}
\makeatletter
\def\ps@vakatseite{%
\vspace*{\fill}
\centering This page would be intentionally left blank if we would not wish to inform about that.
\vspace{\fill}
}
\makeatother
\newcommand{\newsection}[1]
{{\cleardoublepage}
\section{#1}
}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[OL]{\scshape\leftmark}
\fancyhead[ER]{\scshape\leftmark}
\fancyhead[EL,OR]{\thepage}
\fancyfoot[OL]{\scshape\leftmark}
\fancyfoot[ER]{\scshape\leftmark}
\fancyfoot[EL,OR]{\thepage}
\renewcommand{\footrulewidth}{0.5pt}
\usepackage{blindtext}
\begin{document}
\newsection{eins}
\blindtext
\newsection{zwei}
\blindtext[3]
\newsection{drei}
\blindtext[8]
\newsection{vier}
\blindtext[4]
\end{document}
如果我使用
\clearpage{\pagestyle{vakatseite}\cleardoublepage}
我将得到一到两页空白页,其中有一页已标记。我想要的是零页或一页...
最终代码
感谢 Harish Kumar。这个解决方案正是我想要的 :)
\documentclass[11pt,a4paper,twoside,
notitlepage,
ngerman]{article}
\usepackage[a4paper,
bindingoffset=1cm,margin=2cm,
includeheadfoot,
]{geometry}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % Load the TS1-encoding e.g. through textcomp
\usepackage{verbatim, environ}
\usepackage{lmodern}
\usepackage{amsmath,amsfonts,amssymb}
\makeatletter
\def\emptypage@emptypage{%
\hbox{}%
\vspace*{\fill}
\begin{center}
This page would be intentionally left blank\\ if we would not wish to inform about that.
\end{center}
\vspace{\fill}
\newpage%
}%
\def\cleardoublepage{%
\clearpage%
\if@twoside%
\ifodd\c@page%
% do nothing
\else%
\emptypage@emptypage%
\fi%
\fi%
}%
\makeatother
\newcommand{\newsection}[1]
{\cleardoublepage
\section{#1}
}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[OL]{\scshape\leftmark}
\fancyhead[ER]{\scshape\leftmark}
\fancyhead[EL,OR]{\thepage}
\fancyfoot[OL]{\scshape\leftmark}
\fancyfoot[ER]{\scshape\leftmark}
\fancyfoot[EL,OR]{\thepage}
\renewcommand{\footrulewidth}{0.5pt}
\usepackage{blindtext}
\begin{document}
\newsection{eins}
\blindtext
\newsection{zwei}
\blindtext[3]
\newsection{drei}
\blindtext[7]
\newsection{vier}
\blindtext[4]
\end{document}
答案1
根据 OP 的更新,我认为如果你在序言中添加这些内容:
\usepackage{tikz}
\newcommand*{\blankpage}{%
\begin{tikzpicture}[remember picture,overlay]
\node[draw=orange,fill=blue!50!green,scale=4,rotate=45,anchor=center,rounded corners=2em,text=magenta] at (current page.center) {Empty Page};
\end{tikzpicture}
}
\makeatletter
\def\emptypage@emptypage{%
\hbox{}%
\blankpage%
\newpage%
}%
\def\cleardoublepage{%
\clearpage%
\if@twoside%
\ifodd\c@page%
% do nothing
\else%
\emptypage@emptypage%
\fi%
\fi%
}%
\makeatother
您将获得所需的结果。您可以\blankpage
根据需要进行替换。
完整代码:
\documentclass[11pt,a4paper,twoside,
notitlepage,
ngerman]{article}
\usepackage[a4paper,
bindingoffset=1cm,margin=2cm,
includeheadfoot,headheight=15pt
]{geometry}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % Load the TS1-encoding e.g. through textcomp
\usepackage{verbatim, environ}
\usepackage{lmodern}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{tikz}
\newcommand*{\blankpage}{%
\begin{tikzpicture}[remember picture,overlay]
\node[draw=orange,fill=blue!50!green,scale=4,rotate=45,anchor=center,rounded corners=2em,text=magenta] at (current page.center) {Empty Page};
\end{tikzpicture}
}
\makeatletter
\def\emptypage@emptypage{%
\hbox{}%
\blankpage%
\newpage%
}%
\def\cleardoublepage{%
\clearpage%
\if@twoside%
\ifodd\c@page%
% do nothing
\else%
\emptypage@emptypage%
\fi%
\fi%
}%
\makeatother
\newcommand{\newsection}[1]
{{\cleardoublepage}
\section{#1}
}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[OL]{\scshape\leftmark}
\fancyhead[ER]{\scshape\leftmark}
\fancyhead[EL,OR]{\thepage}
\fancyfoot[OL]{\scshape\leftmark}
\fancyfoot[ER]{\scshape\leftmark}
\fancyfoot[EL,OR]{\thepage}
\renewcommand{\footrulewidth}{0.5pt}
\usepackage{blindtext}
\begin{document}
\newsection{eins}
\blindtext
\newsection{zwei}
\blindtext[3]
\newsection{drei}
\blindtext[8]
\newsection{vier}
\blindtext[4]
\end{document}
如果您希望这些空白页没有页眉和页脚,请在定义\thispagestyle{empty}
之前添加:\blankpage
\emptypage@emptypage
\def\emptypage@emptypage{%
\hbox{}%
\thispagestyle{empty} %% or any page style
\blankpage%
\newpage%
}%