0
\documentclass{article}
\usepackage{lipsum}

\usepackage{titlesec}
\titleformat{\section}
  {\normalfont\scshape}
  {\thesection}
  {1em}
  {}
\titlespacing*{\section}
  {0pt}
  {2ex plus 1ex minus .2ex}
  {1ex plus .2ex}

\makeatletter
\newenvironment{myquote}[1]{%
  \small\par\addvspace{3ex}
  \if@nobreak
    % we're at the start of a section
    % add the indent
    \if@afterindent\else\hspace*{\parindent}\fi
    % and instruct LaTeX to reset \@afterheading at the end
    \def\reset@nobreakatend{\@afterheading}%
  \else
    \def\reset@nobreakatend{}%
  \fi
  \begin{minipage}{\dimexpr\linewidth -2\parindent\relax}%
    \def\myquoteauthorname{#1}%
  }{%
    \par\vspace{1ex}
    \noindent
    \hspace*{0.25\linewidth}%
      \rule{0.5\linewidth }{.4pt}
    \par\addvspace{1ex}
    \centering
    \textsc{\myquoteauthorname}\par\vspace{3ex}
  \end{minipage}
  \par\nobreak\reset@nobreakatend}
\makeatother

\begin{document}

\begin{myquote}{---test}
\lipsum[1-4]
\end{myquote}

\begin{myquote}{---test-2}
\lipsum[3-4]
\end{myquote}

\end{document}

enter image description here

In the above MWE (the code generously offered by @egreg) the second myquote environment continues to overflow in the same page instead of breaking to the next page. How is it possible to edit the myquote environment so that it nicely breaks and continues in the next page. (Is it possible to have the option that if it is going to break, it shall start from the next page.)

3
  • 4
    it's a minipage, the main point of a minipage is that it is an unbreakable box Commented Aug 25, 2020 at 10:22
  • A breakable quote uses \leftskip and \rightskip for the margins. Commented Aug 25, 2020 at 14:58
  • @JohnKormylo or more idiomatic in latex \leftmargin and \rightmargin using trivlist, like quote environment Commented Aug 25, 2020 at 15:14

0

You must log in to answer this question.

Browse other questions tagged .