# How to define, once and for all, the size of the area (for an epigraph following a chapter)?

I am using 'memoir' for a thesis, and I have chosen the vertical space between a chapter title and the following section to be exactly fixed, \afterchapskip being 120pt for each new chapter. What I would like to do now is to create an epigraph environment such that, for each chapter, the quote is put inside this vertical (fixed) region.

EDIT: Here is a sketch of what I mean, which might make things clearer

The idea is to keep the vertical space between the title and the first section at 120pt, no matter the size of the quote (they'll remain short).

How can I achieve this? I have tried to first 'save' the vertical space using a minipage environment of 120pt, and then put the quote inside. The problem I encounter, however, is that the actual minipage position is moved together with the main text by LaTeX, so that in the end nothing is fixed at all.

The following does not work but, for your information, I have tried something like this:

%ifemptyarg[
\makeatletter
\def\ifemptyarg#1{%
\if\relax\detokenize{#1}\relax % H. Oberdiek
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi}
\makeatother
%%source: http://tex.stackexchange.com/questions/308/different-command-definitions-with-and-without-optional-argument
%ifemptyarg]

\newcommand{\chaptercustom}[4]{
\ifemptyarg{#2}
{
%if no quote is provided, just go for the usual chapter:
\chapter{#1}
}
{
%otherwise:
\renewcommand*{\afterchaptertitle}{} %remove the space normally following the chapter title
\chapter{#1} %display title

\begin{flushright}
\noindent\begin{minipage}[b][\afterchapskip]{0.5\linewidth}
\flushright             \normalsize\normalfont
#2\\
\textsc{#3}\hspace{1pt}---\hspace{1pt}#4%
\end{minipage}
\end{flushright}
\renewcommand*{\afterchaptertitle}{
\vspace{\afterchapskip} % recover the usual structure for fore-coming chapters
}
}
}

Called inside the main document via:

\chaptercustom{<CHAPTERTITLE>}{<QUOTE>}{<AUTHOR>}{<SOURCE>}

If needed, here is the chapter style I have written:

\newcommand{\afterchapskipcustomvalue}{120pt}

\makechapterstyle{myChapStyle}{
\setlength{\midchapskip}{7pt}
\setlength{\afterchapskip}{\afterchapskipcustomvalue}
\renewcommand*{\chapnamefont}{\Large\scshape\MakeLowercase}
\renewcommand*{\chapnumfont}{\normalsize}
\renewcommand*{\afterchapternum}{
\vspace{\midchapskip}
\hrule
}
\renewcommand*{\chaptitlefont}{
\LARGE
\bfseries
}
\renewcommand*{\printchaptertitle}[1]{
\vspace{\onelineskip}
\chaptitlefont ##1
}
\renewcommand*{\printchapternonum}{
\vphantom{\printchaptername}
\afterchapternum
}
\renewcommand*{\afterchaptertitle}{
\vspace{\afterchapskip}
}
}

Thank you very much for your time and suggestions!

-

Maybe you could use \epigraphpicture. The following do not work optimal, but you get the idea.

\documentclass{memoir}

\makechapterstyle{standard}{%
\setlength{\afterchapskip}{120pt}
\renewcommand{\afterchaptertitle}{\par \raggedleft\epigraphpicture\par\nobreak\vskip \afterchapskip}

}
\chapterstyle{standard}

\usepackage{lipsum}

\begin{document}

\epi{A short quote.}{Prof. Dr. Awesome}

\chapter{First Chapter}

\lipsum[1]

\epi{In the beginning was the Word, and the Word was with God, and the Word was God.}{John}

\chapter{Second Chapter}

\lipsum[1]

\end{document}
-
Thank you very much for your time. Meanwhile, and somehow along the lines of what you proposed, I've decided to use \epigraphhead, which does exactly what I wanted for my epigraphs (but strictly does not answer this question about defining the size of an area). – Alex Nov 21 '12 at 14:53

A little bit late... but I had nearly exactly the same problem, only I wanted the whole chapter style to take exactly 16 lines, and have the chapter number in the margin, relative to the title.

My solution is to define the space in tikz and then write and draw whatever I like inside that space using tikz. To position the number, I have to use execute at end picture to be able to access the named node title. Here is my solution:

\makechapterstyle{chapterstylefixed}{
\renewcommand*{\printchaptername}{}
\renewcommand*{\afterchapternum}{}

\renewcommand*{\printchapternum}{
\begin{tikzpicture}[
execute at end picture={%
\begin{scope}[overlay]
\draw let \p1 = (title.base)
in node [anchor=base west,outer sep=0pt,inner sep=0pt]
at (\textwidth + \marginparsep, \y1)
{\chapternumberfont\thechapter};
\end{scope}
}
]
}
\renewcommand*{\printchapternonum}{
\begin{tikzpicture}
}
\renewcommand*{\printchaptertitle}[1]{
\pgfresetboundingbox
\useasboundingbox (0,0) rectangle (\textwidth, -\chapterskip);
%
\@chapterepigraph
%
\draw (0, -\titleskip) node(title) [anchor=south west,outer sep=0pt,inner sep=0pt]
{\raisebox{0pt}[\height][\titledepth]{\makebox[\textwidth][r]{\chaptertitlefont##1}}};
}

\renewcommand*{\afterchaptertitle}{
\end{tikzpicture}%
\par\nobreak\ignorespaces%
}
}

And before this code, I define \titledepth, \titleskip, \chapterskip, \chapter*font. \@chapterepigraph then uses \node [] at (x,y) to typeset the epigraph. Works flawlessly :-)

-