# “Inspirational” quote at start of chapter

I recall seeing a package to make quotes like that of the following image at the start of a chapter, but I can't seem to find it again.

(This image is from the book Combinatorics and Graph Theory by Harris, Hirst, and Mossinghoff)

-
How to do just the beautiful quote in the first picture example by redefining \newenvironment{quote} and also by defining my own myQuote{<quote>}{<my whom>} in \documentclass{article}? –  user16637 Jul 15 '12 at 18:23
That is an awesome quote. –  Jason Oct 20 '13 at 17:36

I think it is the package epigraph and is included in both TeX Live and MiKTeX distributions.

\documentclass{book}
\usepackage{epigraph}
\begin{document}
\chapter{First Chapter}
\epigraph{I recall seeing a package to make quotes}{Snowball}
\end{document}


-
I had to laugh out loud when I read the quote. Thanks for that. ;-) –  mre Aug 28 '13 at 22:53

And if you want to do yourself something very basic, just define a new command:

\documentclass{book}

\newcommand{\chapquote}[3]{\begin{quotation} \textit{#1} \end{quotation} \begin{flushright} - #2, \textit{#3}\end{flushright} }

\begin{document}
\chapter{First Chapter}

\chapquote{Begin at the beginning,¨ the King said gravely, and go on till you come to the end: then stop."}{Lewis Carroll}{Alice in Wonderland}

\end{document}


-
Since the quotation paragraph allows paragraph breaks, and some users may therefore be tempted to provide a two-paragraph inspirational quote, you may want to use {\itshape#1} instead of \textit{#1}, as \textit does not permit paragraph breaks in its scope. –  Mico Jan 20 at 17:34
@Mico Good to know, thanks! +1 –  wondering Jan 20 at 20:33

For the sake of completeness, I provide the following. It might be your alternate.

\documentclass{book}
\usepackage{quotchap}

\begin{document}

\begin{savequote}[0.55\linewidth]
Don't give up on your dreams, keep on sleeping.''
\qauthor{Higgs Boson (2012 -- present)}

Stick together team and hold this position!''
\qauthor{Counter Terrorist (1999 -- present)}
\end{savequote}

\chapter{Introduction}

\end{document}


## More inspirational quotes

If you're an underdog, mentally disabled, physically disabled, if you don't fit in, if you're not as pretty as the others, you can still be a hero, read \TeX Book!''
\qauthor{Bug Buster (2014 -- present)}

Motivation isn't enough. If you've an idiot and you motivate him, now you've a motivated idiot.''
\qauthor{Stiff Jokes (2014 -- present)}

Learning (La)\TeX, PSTricks, and PGF/TikZ is similar to learning how to swim or drive a car. You don’t get the full benefit by watching someone else do it. Your own fingers must get involved.''
\qauthor{Donut E. Knot (2014 -- present)}

Don't be lukewarm! If you cannot be the best, be the worst!''
\qauthor{Code Mocker (2014 -- present)}

Beauty without intelligence is a masterpiece painted on a toilet paper.''
\qauthor{The Last Error (2014 -- present)}

For every problem, there is always a solution that is simple, neat, but wrong.''
\qauthor{Weirdstress Function (2014 -- present)}

-
+1: These quotes are truly inspirational. "Terrorits win!" –  Henri Menke Mar 18 '14 at 21:07
@HenriMenke: There is a typo. It should be "Terrorists win!". –  kiss my armpit Apr 13 '14 at 14:56

You can gain a finer control of the epigraph and chapter heading by the following package.

\begin{filecontents}{chapterhead.sty}
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\RequirePackage{xkeyval}
\RequirePackage{catoptions}
\new@def\chd@alltoendif#1\endif{#1}
\new@def\chd@firsttoendif#1#2\endif{#1}
\new@def*\chdifnumcmpTF#1#2#3{\ifnumcmpTF#1#2{#3}}
% \chdifchoice can be used to define choice keys via command keys:
\new@def*\chdifchoice{\chdifcase\ifstrcmpTF}
\new@def*\chdifcase#1#2{%
\ifstrcmpTF{#1}\ifnone{%
\chd@alltoendif
}{%
\ifstrcmpTF{#1}\endif{}{%
\ifstrcmpTF{#2}\ifnone{%
\chd@alltoendif
}{%
\ifstrcmpTF{#2}\endif{}{\chd@ifcase{#1}{#2}}%
}%
}%
}%
}
\new@def*\chd@ifcase#1#2#3{%
\ifstrcmpTF{#3}\ifnone{%
\chd@alltoendif
}{%
\ifstrcmpTF{#3}\endif{}{%
#1{#2}{#3}\chd@firsttoendif{\chd@ifcase@i{#1}{#2}}%
}%
}%
}
\new@def*\chd@ifcase@i#1#2#3{\chd@ifcase{#1}{#2}}
\define@cmdkey[DKV]{definekeys}[defkey@]{prefix}[KV]{}
\define@cmdkey[DKV]{definekeys}[defkey@]{family}{}
\define@cmdkey[DKV]{definekeys}[defkey@]{holder prefix}[mp@]{}
\define@boolkey[DKV]{definekeys}[defkey@]{initialize}[true]{}
\define@boolkey[DKV]{definekeys}[defkey@]{preset}[true]{}
% Keys not specified in the optional argument of \chddefinekeys will
% get default values:
\presetkeys[DKV]{definekeys}{prefix,family,holder prefix,
initialize=false,preset=false}{}

\robust@def*\chddefinekeys{\@testopt\chd@definekeys{}}
\new@def*\chd@definekeys[#1]#2{%
\setkeys[DKV]{definekeys}{#1}%
\def\defkey@defaultlist{}%
\edef\reserved@a{\cptcommanormalize{#2}}%
\expandafter\defkey@loop\reserved@a,\defkey@nil,%
\ifboolTF{defkey@preset}{%
\cptexpanded{\noexpand\presetkeys
[\defkey@prefix]{\defkey@family}{\expandcsonce\defkey@defaultlist}{}%
}%
}{}%
\ifboolTF{defkey@initialize}{%
\cptexpanded{\noexpand\setkeys
[\defkey@prefix]{\defkey@family}{\expandcsonce\defkey@defaultlist}%
}%
}{}%
}
\begingroup
\lccode\&=1 \catcode\&=7
\lowercase{\endgroup
\new@def*\chd@rejecttoks{&}%
\new@def*\defkey@loop#1,{%
\def\reserved@a{\defkey@nil}%
\edef\reserved@b{\cpttrimspace{#1}}%
\ifx\reserved@a\reserved@b\expandafter\@gobble\else\expandafter\@iden\fi
{\defkey@splitatslash#1/&/&/&/&/&/&/&/\defkey@nil\defkey@loop}%
}
}
\new@def*\chd@cmprejecttoks#1{\ifx#1\chd@rejecttoks\else\expandcsonce#1\fi}
\new@def*\defkey@splitatslash#1/#2/#3/#4/#5/#6/#7/#8/#9\defkey@nil{%
\edef\keytype{\cpttrimspace{#1}}%
\edef\keyname{\cpttrimspace{#2}}%
\edef\keydefault{\cpttrimspace{#3}}%
\edef\keycode{\cpttrimspace{#4}}%
\ifx\keyname\chd@rejecttoks
\@latexerr{Empty key name}\@ehd
\fi
\def\reserved@a##1{%
\def\reserved@a####1##1####2####3\@nil{%
\def\reserved@a{####2}%
}%
\reserved@a cmd{0}bool{1}\@nil
}%
\expandafter\reserved@a\expandafter{\keytype}%
\ifcase\reserved@a\relax
\let\reserved@a\define@cmdkey
\or
\xifinsetTF{,\cptoxdetok\keydefault,}{,\detokenize{true,false},}{%
\let\reserved@a\define@boolkey
}{%
\@latexerr{Illegal default value '\cptoxdetok\keydefault'
\MessageBreak for bool key '\keyname'}\@ehd
}%
\else
\@latexerr{Illegal key type '#1'}\@ehd
\fi
\cptexpanded{\noexpand\reserved@a
[\defkey@prefix]{\defkey@family}[\usecsn{defkey@holder prefix}]%
{\chd@cmprejecttoks\keyname}%
\ifx\keydefault\chd@rejecttoks\else[\expandcsonce\keydefault]\fi
{\chd@cmprejecttoks\keycode}%
}%
\edef\defkey@defaultlist{%
\ifx\defkey@defaultlist\@empty\else\expandcsonce\defkey@defaultlist,\fi
\keyname
\ifx\keydefault\chd@rejecttoks\else=%
\oifstrcmpTF\keytype{bool}{%
\oifstrcmpTF\keydefault{true}{false}{false}%
}{%
\expandcsonce\keydefault
}%
\fi
}%
}
\chddefinekeys[
prefix=CHD,family=epigraf,holder prefix=epg@,initialize,preset
]{%
cmd/width/\hsize,
cmd/author/,
cmd/color/black,
cmd/authorcolor/black,
bool/use italics for author/true,
cmd/fontencoding/\encodingdefault,
cmd/fontfamily/\familydefault,
cmd/fontseries/\seriesdefault,
cmd/fontshape/\shapedefault,
cmd/fontsize/10pt,
cmd/hskip/0ex,
cmd/prevskip/0ex,
cmd/postvskip/1ex,
bool/frame/true,
}
\chddefinekeys[
]{%
cmd/textcolor/black,
cmd/textfontencoding/\encodingdefault,
cmd/textfontfamily/\familydefault,
cmd/textfontseries/eb,
cmd/textfontshape/\shapedefault,
cmd/textfontsize/100pt,
cmd/numberfontencoding/\encodingdefault,
cmd/numberfontfamily/\familydefault,
cmd/numberfontseries/eb,
cmd/numberfontshape/\shapedefault,
cmd/numberfontsize/100pt,
%  cmd/leftmargin/\leftmargin,
%  cmd/rightmargin/\rightmargin,
cmd/texthskip/0em,
cmd/textprevskip/0ex,
cmd/textpostvskip/1ex,
cmd/numberprevskip/0ex,
cmd/numberpostvskip/0ex,
cmd/numberhskip/0em,
cmd/numbercolor/black,
cmd/pagestyle/empty,
bool/make text raggedleft/true,
bool/make number raggedleft/true,
bool/print number before text/true,
bool/frame number/true,
bool/no clear page/true
}
\newbox\chd@boxa
\newcommand\epigraf[2][]{%
\setkeys[CHD]{epigraf}{#1}%
\setbox\chd@boxa=\vbox{%
\ifepg@frame\fbox{\fi
\parbox\epg@width{%
\fontsize{\epg@fontsize}{1.5\epg@fontsize}%
\usefont{\epg@fontencoding}{\epg@fontfamily}%
{\epg@fontseries}{\epg@fontshape}%
\ignorespaces
\textcolor{\epg@color}{#2}%
\hspace*{\fill}\nolinebreak[1]%
\begingroup
\ifboolTF{epg@use italics for author}{\itshape}{}%
\textcolor{\epg@authorcolor}{\epg@author}%
\endgroup
}%
\ifepg@frame}\fi
}%
\global\let\chd@printepigraf\chd@bprintepigraf
\@ignoretrue
}

\AtBeginDocument{%
\@ifundefined{@mainmattertrue}{\newif\if@mainmatter\@mainmattertrue}{}%
}
\new@def*\chd@insertchaptertext#1{%
\begingroup
\ifboolTF{chd@make text raggedleft}{%
\raggedleft
}{%
\hskip\chd@texthskip\relax
}%
\interlinepenalty\@M
\vskip\chd@textprevskip\relax
\fontsize{\chd@textfontsize}{1.2\chd@textfontsize}%
\usefont{\chd@textfontencoding}{\chd@textfontfamily}%
{\chd@textfontseries}{\chd@textfontshape}%
\textcolor{\chd@textcolor}{\ignorespaces#1}%
\par\nobreak
\vskip\chd@textpostvskip\relax
\endgroup
}
\new@def*\chd@insertchapternumber{%
\begingroup
\ifnum\c@secnumdepth>\m@ne
\if@mainmatter
\vskip\chd@numberprevskip\relax
\fontsize{\chd@numberfontsize}{1.2\chd@numberfontsize}%
\usefont{\chd@numberfontencoding}{\chd@numberfontfamily}%
{\chd@numberfontseries}{\chd@numberfontshape}%
\usecsn{ifchd@frame number}\fbox{\fi
\textcolor{\chd@numbercolor}{\thechapter}%
\usecsn{ifchd@frame number}}\fi
\par\nobreak
\vskip\chd@numberpostvskip\relax
\fi
\fi
\endgroup
}
\renewcommand\chapter[1][]{%
\ifboolTF{chd@no clear page}{}{%
\if@openright\cleardoublepage\else\clearpage\fi
}%
\thispagestyle{\chd@pagestyle}%
\global\@topnum\z@
\ifdefTF\chd@printepigraf\chd@printepigraf\relax
\@afterindentfalse
\secdef\@chapter\@schapter
}
\begingroup
\begingroup
\leavevmode
\ifboolTF{chd@make number raggedleft}{%
\raggedleft
}{%
\hskip\chd@numberhskip\relax
}%
\ifboolTF{chd@print number before text}{%
\chd@insertchapternumber\chd@insertchaptertext{#1}%
}{%
\chd@insertchaptertext{#1}\chd@insertchapternumber
}%
\endgroup
\nobreak
\endgroup
}
\begingroup
\endgroup
}
\newcommand*\chd@bprintepigraf{%
\vskip\epg@prevskip
\hskip\epg@hskip\relax
\copy\chd@boxa
\vskip\epg@postvskip
\global\let\chd@printepigraf\relax
}
\endinput
\end{filecontents}

\documentclass{book}
\usepackage[dvipsnames]{xcolor}

\begin{document}
\epigraf[
author={Lewis Carroll, \textit{Alice in Wonderland}},
color=blue,
width=.75\hsize,
use italics for author=false,
fontsize=8pt,
fontfamily=cmr,
hskip=10em,
postvskip=2ex,
frame,
]{
Begin at the beginning,'' the King said, gravely, and go on till you
come to an end; then stop.''
}

\chapter[
numberpostvskip=.2ex,
numberfontseries=ux,
numberfontfamily=cmbr,
textfontseries=ex,
textfontsize=50pt,
textfontfamily=cmbr,
textfontshape=it,% not obtainable because of other choices above
textcolor=red,
make text raggedleft=false,
make number raggedleft=false,
print number before text,
no clear page
]{Graph Theory}

\noindent The Pregolya River passes through the city once known as K\"onigsberg.
In the 1700s seven bridges were situated across this river in a manner similar
to what you see in Figure \ldots

\par\vskip3\baselineskip
\hrule height.5pt depth .4pt \relax

\epigraf[
author={Lewis Carroll, \textit{Alice in Wonderland}},
color=black,
width=.75\hsize,
use italics for author,
fontsize=8pt,
fontfamily=cmr,
hskip=-3em,
prevskip=2ex,
postvskip=2ex,
]{
Begin at the beginning,'' the King said, gravely, and go on till you
come to an end; then stop.''
}

\chapter[
numberpostvskip=.2ex,
numberfontseries=ux,
numberfontfamily=cmbr,
textfontseries=ex,
textfontsize=50pt,
textfontfamily=cmss,
textfontshape=it,
textcolor=Brown,
numbercolor=ForestGreen,
make text raggedleft,
make number raggedleft,
frame number,
no clear page
]{Graph Theory}

\noindent The Pregolya River passes through the city once known as K\"onigsberg.
In the 1700s seven bridges were situated across this river in a manner similar
to what you see in Figure \ldots
\end{document}


-

Since it hasn't been mentioned before: KOMA-Script also has built-in possibilities for this. There are two main commands of interest here. First

\setchapterpreamble[<position>][<width>]{<preamble>}


where position is determined by one or two letters, o (above the chapter) or u (below the chapter) and l,c or r (left-aligned, centered or right-aligned). It allows to put arbitrary stuff before or after the next chapter title without shifting the chapter title itself.

The second command is

\dictum[<author>]{<quote>}


which sets the quote and can be used anywhere in the document.

The default settings look like this:

\documentclass{scrbook}
\usepackage[T1]{fontenc}

\begin{document}

\setchapterpreamble{%
\dictum[Lewis Carroll, \textit{Alice in Wonderland}]{%
Begin at the beginning,'' the King said, gravely, and go on till you
come to an end; then stop.''}}
\chapter{Graph Theory}
The Pregolya River passes through the city once known as K\"onigsberg. In the 1700s
seven bridges were situated across this river in a manner similar to what you see
in Figure \ldots

\end{document}


They can be customized by a series of options and commands to obtain a similar output like in the picture of the question:

\documentclass{scrbook}
\usepackage[T1]{fontenc}

% customize chapter format:
\renewcommand*\chapterformat{\thechapter\autodot}

% customize dictum format:
\setkomafont{dictumtext}{\itshape\small}
\setkomafont{dictumauthor}{\normalfont}
\renewcommand*\dictumwidth{\linewidth}
\renewcommand*\dictumauthorformat[1]{--- #1}
\renewcommand*\dictumrule{}
\begin{document}

\setchapterpreamble[uc][.75\textwidth]{%
\dictum[Lewis Carroll, \textit{Alice in Wonderland}]{%
Begin at the beginning,'' the King said, gravely, and go on till you
come to an end; then stop.''}\vskip1em}
\chapter{Graph Theory}
The Pregolya River passes through the city once known as K\"onigsberg. In the 1700s
seven bridges were situated across this river in a manner similar to what you see
in Figure \ldots

\end{document}


-
Excellent answer! –  Mario S. E. Jan 4 '14 at 13:55

An adaptation of a piece of code found on line but I do not remember where exactly.

\documentclass[11pt]{book}
%%%%********************************************************************
\usepackage{microtype}
\usepackage{times}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{lipsum}
%%%%********************************************************************
% fancy quotes
\definecolor{quotemark}{gray}{0.7}
\makeatletter
\def\fquote{%
\@ifnextchar[{\fquote@i}{\fquote@i[]}%]
}%
\def\fquote@i[#1]{%
\def\tempa{#1}%
\@ifnextchar[{\fquote@ii}{\fquote@ii[]}%]
}%
\def\fquote@ii[#1]{%
\def\tempb{#1}%
\@ifnextchar[{\fquote@iii}{\fquote@iii[]}%]
}%
\def\fquote@iii[#1]{%
\def\tempc{#1}%
\vspace{1em}%
\noindent%
\begin{list}{}{%
\setlength{\leftmargin}{0.1\textwidth}%
\setlength{\rightmargin}{0.1\textwidth}%
}%
\item[]%
\begin{picture}(0,0)%
\put(-15,-5){\makebox(0,0){\scalebox{3}{\textcolor{quotemark}{}}}}%
\end{picture}%
\begingroup\itshape}%
%%%%********************************************************************
\def\endfquote{%
\endgroup\par%
\makebox[0pt][l]{%
\hspace{0.8\textwidth}%
\begin{picture}(0,0)(0,0)%
\put(15,15){\makebox(0,0){%
\scalebox{3}{\color{quotemark}''}}}%
\end{picture}}%
\ifx\tempa\empty%
\else%
\ifx\tempc\empty%
\hfill\rule{100pt}{0.5pt}\\\mbox{}\hfill\tempa,\ \emph{\tempb}%
\else%
\hfill\rule{100pt}{0.5pt}\\\mbox{}\hfill\tempa,\ \emph{\tempb},\ \tempc%
\fi\fi\par%
\vspace{0.5em}%
\end{list}%
}%
\makeatother
%%%%********************************************************************
\begin{document}
\chapter{Graph theory}
\begin{fquote}[Lewis Carroll][Alice in Wonderland][1899]Begin at the beginning,'' the King said, gravely, and go on till you come to an end; then stop.
\end{fquote}
\lipsum[2]
\begin{fquote}[Lewis Carroll][Alice in Wonderland][1899]Begin at the beginning,'' the King said, gravely, and go on till you come to an end; then stop.
\end{fquote}
\lipsum[2]
\end{document}


-

The memoir document class offers "out of the box" commands \chapterprecis, \chapterprecishere, and \chapterprecistoc:

\documentclass{memoir}

\begin{document}

\chapter{Graph Theory}
\chapterprecishere{Begin at the beginning,¨ the King said gravely, and go on till you come to the end: then stop."\par\raggedleft--- \textup{Lewis Carroll}, Alice in Wonderland}

\end{document}


As Brent.Longborough mentions in his comment, memoir also offers an \epigraph command and an epigraph environment:

\documentclass{memoir}

\epigraphfontsize{\small\itshape}
\setlength\epigraphwidth{8cm}
\setlength\epigraphrule{0pt}

\begin{document}

\chapter{Graph Theory}

\epigraphfontsize{\small\itshape}
\epigraph{Begin at the beginning," the King said gravely, and go on till you come to the end: then stop."}{--- \textup{Lewis Carroll}, Alice in Wonderland}

\end{document}


-
memoir also offers the \epigraph command, as well as the epigraphs environment. Putting on my semantic pedant's hat, this case (and the OP's intent) is, I think, strictly an epigraph; a chapter précis is meant to be an additional information key, rather than amusement. –  Brent.Longborough Apr 26 '12 at 10:42
@Brent.Longborough: I've added an example to my answer using \epigraph; thank you. –  Gonzalo Medina Apr 26 '12 at 12:04
@Brent.Longborough Putting on my semantic pedant's cap, while an epigraph could be a chapter précis only incidentally, amusement could be non-incidentally missing from its purpose. –  cfr Apr 13 '14 at 19:19
@cfr OH, now my brain hurts; 'Venn diagram needed'. –  Brent.Longborough Apr 14 '14 at 4:07
@Brent.Longborough Not possible in a comment ;). –  cfr Apr 14 '14 at 9:54

You can also do it yourself:

\documentclass{book}

\makeatletter
\renewcommand{\@chapapp}{}% Not necessary...
\newenvironment{chapquote}[2][2em]
{\setlength{\@tempdima}{#1}%
\def\chapquote@author{#2}%
\parshape 1 \@tempdima \dimexpr\textwidth-2\@tempdima\relax%
\itshape}
{\par\normalfont\hfill--\ \chapquote@author\hspace*{\@tempdima}\par\bigskip}
\makeatother

\begin{document}
\chapter{Graph Theory}

\begin{chapquote}{Lewis Carroll, \textit{Alice in Wonderland}}
Begin at the beginning,'' the King said, gravely, and go on till you
come to an end; then stop.''
\end{chapquote}

\noindent The Pregolya River passes through the city once known as K\"onigsberg. In the 1700s
seven bridges were situated across this river in a manner similar to what you see
in Figure \ldots
\end{document}


The above MWE provides the chapquote environment that takes one argument - the author of the quote. It indents the quote by 2em (default), but that can also be changed via an optional argument:

\begin{chapquote}[30pt]{author}

The default setting is in \itshape, with a right-aligned "author".
@YiannisLazarides: True, multiple paragraphs would cause problems when working with \parshape. In those instances, the adjustwidth environment (from changepage) would be more appropriate. Regarding the alignment: All things are subject to change, based on the OP's requirement. For example, one could box the content to check for line length and issue \par conditionally. Regardless, this provides one means to do it. –  Werner Apr 26 '12 at 5:38