2

Latex (on overleaf) complains that "there's no line here to end":

l.6 \end{enumerate}}{B.~Spinoza}

I think the problem is the enumerate environment. Specifically, the error disappear when I add something else after the end of the enumerate, e.g. one space \ .

It's not creating any problem, but I wonder 1) if someone can explain what's happening here, and 2) what's the best fix.

Here's a MWE:

\documentclass{report}
\usepackage{epigraph} % per le frasi inizio capitolo
\begin{document}
\epigraph{\begin{enumerate}
 \item[Corollario] Ne segue che l'uomo consta di Mente e Corpo e che il Corpo umano, in quanto lo sentiamo, esiste
\end{enumerate}}{B.~Spinoza}
\end{document}

I'm not sure about the stackexchange policy on overleaf, but here's the link to the doc in case anyone (with an overleaf account...) wants to play with it: https://www.overleaf.com/4833837299zjfnjgwjtpgd#92ee82

2 Answers 2

3

\epigraph{text}{source} is, more or less text\\source so as your text is a display environment you have

\begin{enumerate}
\item..
\end{enumerate}
\\ % oops
source

The simplest way to avoid the error would be to start an empty paragraph eg

enter image description here

Note it needs to be empty so \noindent if you use \ or \leavevmode etc, then the paragraph will have an indentation box and so make an extra white line of text above the rule.

\documentclass{report}
\usepackage{epigraph} % per le frasi inizio capitolo
\begin{document}
\epigraph{\begin{enumerate}
 \item[Corollario] Ne segue che l'uomo consta di Mente e Corpo e che il Corpo umano, in quanto lo sentiamo, esiste
\end{enumerate}\noindent}{B.~Spinoza}
\end{document}

Alternatively you could modify the package not to use \\ if the text ends in vertical mode so there is no need to force a line break

\documentclass{report}
\usepackage{epigraph} % per le frasi inizio capitolo
\makeatletter
\renewcommand{\@epitext}[1]{%
  \begin{minipage}{\epigraphwidth}\begin{\textflush} #1\ifhmode\\\fi% only do \\ if in horizontal mode
    \ifdim\epigraphrule>\z@ \@epirule \else \vspace*{1ex} \fi
  \end{\textflush}\end{minipage}}
\makeatother
\begin{document}
\epigraph{\begin{enumerate}
 \item[Corollario] Ne segue che l'uomo consta di Mente e Corpo e che il Corpo umano, in quanto lo sentiamo, esiste
\end{enumerate}}{B.~Spinoza}
\end{document}
2

Using a minipage of width \epigraphwidth is what you want.

However I propose two solutions that don't abuse enumerate.

\documentclass{report}
\usepackage{epigraph} % per le frasi inizio capitolo
\usepackage{showframe}

\newenvironment{spinoza}[1]{%
  \begin{minipage}[b]{\epigraphwidth}
  \settowidth{\dimen0}{#1\enspace}%
  \begin{\textflush}
  \hangindent=\dimen0 \hangafter=1
  #1\enspace\ignorespaces
}{\end{\textflush}\end{minipage}}

\newenvironment{spinoza2}[1]{%
  \begin{minipage}[b]{\epigraphwidth}
  \begin{\textflush}
  \makebox[0pt][r]{#1\enspace}\ignorespaces
}{\end{\textflush}\end{minipage}}


\begin{document}

\epigraph{\begin{spinoza}{Corollario}
  Ne segue che l'uomo consta di Mente e Corpo e che 
  il Corpo umano, in quanto lo sentiamo, esiste
\end{spinoza}}{B. Spinoza}

\epigraph{\begin{spinoza2}{Corollario}
  Ne segue che l'uomo consta di Mente e Corpo e che 
  il Corpo umano, in quanto lo sentiamo, esiste
\end{spinoza2}}{B. Spinoza}

\end{document}

I'd prefer the second solution, so the width of the actual quotation is not so narrow. If you prefer the first one, then increase \epigraphwidth.

The showframe package is only used to show the text block margins.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .