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
\newcommand{\epitextfont}{\itshape}to\upshapeand 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