2

I'm struggling a bit with a "book" Latex document where I'm using Chapters, Parts and the Epigraph package.

I want to have, for each "Part" page, a single page containing the title of the part and an epigraph. When I try doing so, I get the expected results, but I also get the epigraph repeated at the last previous page where there was text (there may be a blank page after a chapter for formatting reasons)... Here is a minimum working example:

\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}

I've been trying different combinations, reading the "epigraph" package documentation and fiddling around a bit, but I just can't figure out why is this happening, and how can I prevent it... Any ideas?

Thanks in advance! :)

1

\epigraphhead contains a \thispagestyle{epigraph}, and so it affects the page it is on. You can e.g. add a \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}
1

epigraph and titlesec don't go along very well.

Here's an independent implementation.

\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}

Here the epigraph will be vertically centered in the available space below the part title. If you don't specify \partepigraph before \part, nothing will appear.

enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.