我对一本“书籍” Latex 文档有点困惑,其中我使用了章节、部分和 Epigraph 包。
我希望每个“部分”页面都有一个包含部分标题和题词的页面。当我尝试这样做时,我得到了预期的结果,但是我还在最后一页重复了题词,那里有文字(由于格式原因,章节后可能会有空白页)...这是一个最小工作示例:
\documentclass[12pt,a4paper,twoside,openright]{book}
%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
% Packages for PART and EPIGRAPH
\usepackage{epigraph}
\usepackage{titlesec}
% Format pages for PART
\makeatletter
\titleformat{\part}[display]
{\Huge\scshape\filright}
{\partname~\thepart:}
{20pt}
{\thispagestyle{epigraph}}
\makeatother
\setlength\epigraphwidth{.6\textwidth}
%%%%
\title{Why does the epigraph in the part page appears in the previous page as well?}
\author{A. Concerned Author}
\date{}
\begin{document}
\maketitle
\chapter{Introduction}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin congue leo quis libero pretium, sed porttitor nibh rutrum. Donec at mi eu turpis porttitor vulputate nec dignissim ex. Mauris venenatis tempus urna eu vulputate. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec molestie magna elit, ut rhoncus arcu lobortis nec. Morbi nec laoreet enim. In suscipit finibus turpis, cursus sollicitudin purus ullamcorper sit amet.
\epigraphhead[450]{This is a very fancy citation from a very classy novel, and should not appear in the previous page, but nevertheless it does.\par\hfill\textsc{Some Dude}}
\part{A New Part}
\chapter{Some examples to get started}
Aliquam tempus, orci sit amet interdum blandit, nibh enim molestie arcu, ac convallis justo mi eu dolor. Integer vel egestas orci, eu ultricies nisl. Aliquam ac malesuada mauris. Etiam quis ipsum sollicitudin, gravida augue vitae, placerat risus. Nunc porta enim vitae vehicula molestie. Suspendisse ultricies massa egestas leo volutpat, id placerat magna tempus. Praesent iaculis consequat laoreet. Ut eu ullamcorper odio, a sollicitudin augue. Maecenas bibendum velit ut ultrices facilisis. Suspendisse molestie tristique commodo. Nulla ultricies elit eu metus vehicula vestibulum. Nulla efficitur, magna non pharetra gravida, ex nunc luctus nulla, sit amet aliquet odio mauris eu sapien. Sed dui dui, viverra ut libero sit amet, rutrum efficitur lacus.
\epigraphhead[450]{This is a very fancy citation from a very classy novel, and should not appear in the previous page, but nevertheless it does.\par\hfill\textsc{Some Dude}}
\part{Another New Part}
\end{document}
我一直在尝试不同的组合,阅读“epigraph”包文档并进行一些调整,但我只是想不通为什么会发生这种情况,以及如何防止这种情况发生......有什么想法吗?
提前致谢! :)
答案1
\epigraphhead
包含\thispagestyle{epigraph}
,因此它会影响其所在的页面。例如,您可以添加 \cleardoublepage:
\documentclass[12pt,a4paper,twoside,openright]{book}
%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8]{inputenc} %normally better than utf8x
% Packages for PART and EPIGRAPH
\usepackage{epigraph}
\usepackage{titlesec}
% Format pages for PART
\makeatletter
\titleformat{\part}[display]
{\Huge\scshape\filright}
{\partname~\thepart:}
{20pt}
{\thispagestyle{epigraph}}
\makeatother
\setlength\epigraphwidth{.6\textwidth}
%%%%
\title{Why does the epigraph in the part page appears in the previous page as well?}
\author{A. Concerned Author}
\date{}
\begin{document}
\maketitle
\chapter{Introduction}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin congue leo quis libero pretium, sed porttitor nibh rutrum. Donec at mi eu turpis porttitor vulputate nec dignissim ex. Mauris venenatis tempus urna eu vulputate. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec molestie magna elit, ut rhoncus arcu lobortis nec. Morbi nec laoreet enim. In suscipit finibus turpis, cursus sollicitudin purus ullamcorper sit amet.
\cleardoublepage
\epigraphhead[450]{This is a very fancy citation from a very classy novel, and should not appear in the previous page, but nevertheless it does.\par\hfill\textsc{Some Dude}}
\part{A New Part}
\chapter{Some examples to get started}
Aliquam tempus, orci sit amet interdum blandit, nibh enim molestie arcu, ac convallis justo mi eu dolor. Integer vel egestas orci, eu ultricies nisl. Aliquam ac malesuada mauris. Etiam quis ipsum sollicitudin, gravida augue vitae, placerat risus. Nunc porta enim vitae vehicula molestie. Suspendisse ultricies massa egestas leo volutpat, id placerat magna tempus. Praesent iaculis consequat laoreet. Ut eu ullamcorper odio, a sollicitudin augue. Maecenas bibendum velit ut ultrices facilisis. Suspendisse molestie tristique commodo. Nulla ultricies elit eu metus vehicula vestibulum. Nulla efficitur, magna non pharetra gravida, ex nunc luctus nulla, sit amet aliquet odio mauris eu sapien. Sed dui dui, viverra ut libero sit amet, rutrum efficitur lacus.
\cleardoublepage
\epigraphhead[450]{This is a very fancy citation from a very classy novel, and should not appear in the previous page, but nevertheless it does.\par\hfill\textsc{Some Dude}}
\part{Another New Part}
\end{document}
答案2
epigraph
而且titlesec
相处起来不太顺利。
这是一个独立的实现。
\documentclass[12pt,a4paper,twoside,openright]{book}
%% Language and font encodings
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
% Packages for PART and EPIGRAPH
\usepackage{titlesec}
\makeatletter
\newcommand{\partepigraph}[2][]{%
\gdef\@partepigraph{#2}%
\gdef\@partepigraphauthor{#1}%
}
\newcommand{\afterpart}{%
\vfil
\noindent\hspace*{\fill}%
\ifx\@partepigraph\@empty
\else
\begin{minipage}[c][0pt]{.6\textwidth}
\normalfont\normalsize\itshape
\@partepigraph
\ifx\@partepigraphauthor
\par\hspace*{\fill}\textsc{\@partepigraphauthor}%
\fi
\end{minipage}
\fi
\gdef\@partepigraph{}%
\gdef\@partepigraphauthor{}%
}
\makeatother
% Format pages for PART
\titleformat{\part}[display]
{\Huge\scshape\filright}
{\partname~\thepart:}
{20pt}
{}
[\afterpart]
%%%%
\title{Why does the epigraph in the part page appears in the previous page as well?}
\author{A. Concerned Author}
\date{}
\begin{document}
\maketitle
\chapter{Introduction}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Proin congue leo quis libero pretium, sed porttitor nibh
rutrum. Donec at mi eu turpis porttitor vulputate nec
dignissim ex. Mauris venenatis tempus urna eu vulputate.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec molestie magna elit, ut rhoncus arcu lobortis nec.
Morbi nec laoreet enim. In suscipit finibus turpis, cursus
sollicitudin purus ullamcorper sit amet.
\partepigraph[Some Dude]{This is a very fancy citation from a very
classy novel, and should not appear in the previous page,
but nevertheless it does.}
\part{A New Part}
\chapter{Some examples to get started}
Aliquam tempus, orci sit amet interdum blandit, nibh enim
molestie arcu, ac convallis justo mi eu dolor. Integer vel
egestas orci, eu ultricies nisl. Aliquam ac malesuada mauris.
Etiam quis ipsum sollicitudin, gravida augue vitae, placerat
risus. Nunc porta enim vitae vehicula molestie. Suspendisse
ultricies massa egestas leo volutpat, id placerat magna tempus.
Praesent iaculis consequat laoreet. Ut eu ullamcorper odio,
a sollicitudin augue. Maecenas bibendum velit ut ultrices
facilisis. Suspendisse molestie tristique commodo. Nulla
ultricies elit eu metus vehicula vestibulum. Nulla efficitur,
magna non pharetra gravida, ex nunc luctus nulla, sit amet
aliquet odio mauris eu sapien. Sed dui dui, viverra ut libero
sit amet, rutrum efficitur lacus.
\part{Another New Part}
\end{document}
此处题词将垂直居中显示在部分标题下方的可用空间中。如果您未指定\partepigraph
before \part
,则不会显示任何内容。