wspr / herries-press

A collection of LaTeX packages by Peter Wilson
http://wspr.github.com/herries-press/
30 stars 5 forks source link

epigraph: natural width #39

Open wspr opened 4 years ago

wspr commented 4 years ago

From Michael Palmer:

Regarding the epigraph package, may I suggest an \epigraphx macro that adjusts the overall width to the natural text width of the quote, or maybe to the larger of the quote and the author's name?

Here is what I use myself. (The negative vertical space is owing to my preferred font setup.)

\newsavebox{\epbox}
\newcommand{\epigraphx}[2]{%
 % need minibox for manual line breaks
 \sbox{\epbox}{\epigraphsize{}\minibox{#1}}%
 \setlength{\epigraphwidth}{\wd\epbox}%
 \epigraph{#1\vspace{-4pt}}{#2}\noindent\ignorespaces%
}