0

I was looking into automaticallly calculating the epigraph width while keeping the epigraph quote left-aligned and non-italic. The following code, copied from a nice solution provided on the page Width of epigraphs, got me pretty far:

\usepackage{epigraph,varwidth}

\renewcommand{\epigraphsize}{\small} \setlength{\epigraphwidth}{0.6\textwidth} \renewcommand{\textflush}{flushright} \renewcommand{\sourceflush}{flushright} % A useful addition \newcommand{\epitextfont}{\itshape} \newcommand{\episourcefont}{\scshape}

\makeatletter \newsavebox{\epi@textbox} \newsavebox{\epi@sourcebox} \newlength\epi@finalwidth \renewcommand{\epigraph}[2]{% \vspace{\beforeepigraphskip} {\epigraphsize\begin{\epigraphflush} \epi@finalwidth=\z@ \sbox\epi@textbox{% \varwidth{\epigraphwidth} \begin{\textflush}\epitextfont#1\end{\textflush} \endvarwidth }% \epi@finalwidth=\wd\epi@textbox \sbox\epi@sourcebox{% \varwidth{\epigraphwidth} \begin{\sourceflush}\episourcefont#2\end{\sourceflush}% \endvarwidth }% \ifdim\wd\epi@sourcebox>\epi@finalwidth \epi@finalwidth=\wd\epi@sourcebox \fi \leavevmode\vbox{ \hb@xt@\epi@finalwidth{\hfil\box\epi@textbox} \vskip1.75ex \hrule height \epigraphrule \vskip.75ex \hb@xt@\epi@finalwidth{\hfil\box\epi@sourcebox} }% \end{\epigraphflush} \vspace{\afterepigraphskip}}} \makeatother

How can I adjust this code to keep the epigraph quote left-aligned and non-italic?

Kind regards,

Jansen

Jansenzoon
  • 11
  • 2
  • this seems to be massive amount of code but for non italic just change \newcommand{\epitextfont}{\itshape} to \upshape and for flush left change \renewcommand{\textflush}{flushright} but I would probably just replace all of this with \begin{flushright}\begin{tabular}{@{}l@{}}text here with \\ if needed\\ \hline\end{tabular}\end{flushright} – David Carlisle Nov 13 '23 at 09:13
  • Can you please add a minimal example with at least one epigraph? – egreg Nov 13 '23 at 17:01

0 Answers0