# Quote environment with long reference at the end right – without widows

I need a quote-environment to end with source-references in a new line, flush right.

Simply using

\begin{quote}
QUOTED TEXT
\begin{flushright}
SOURCE
\end{flushright}
\end{quote}


more or less gives the result I want. But when QUOTED TEXT happens to end at the end of a page, SOURCE (usually only a single line) is moved to the new page, looking silly.

These pseudo-widows can be corrected manually (adding \pagebreak or \enlargethispage where needed), but for a whole book with a lot of block-quotes, this is quite a nuisance...

\nopagebreak between the environments is ignored.

Using

\begin{quote}
QUOTED TEXT
\par
\nopagebreak
\hfill
SOURCE
\end{quote}


instead, doesn't produce widows, but SOURCE is only formatted correctly as long as it isn't longer than one line.

Is there a way to make two environments behave as if they were one and thus the widow-control to be in effect?

-
Would it be possible to include an image of a 'manually corrected' quote? –  Werner Aug 8 '11 at 18:45
I should have been more specific: By 'manually corrected' I was only refering to the possibility to correct for widows and orphans by adding \pagebreak or \enlargethispage where appropriate. –  Florian Aug 8 '11 at 20:56
I think that one problem inherent problem in your current setup (removing all 'manual correction' and leaving things as-is) is that LaTeX would have no way of knowing where the QUOTED TEXT ends and the SOURCE starts. Would restructuring your quote environments work? For example, via something like \begin{quote}[SOURCE] QUOTED TEXT \end{quote}. –  Werner Aug 8 '11 at 21:05
I had hoped that nesting the environments would do, but it doesn't. \nopagebreak in between the environments is ignored -- I edited the question to be clearer. –  Florian Aug 9 '11 at 6:59

Placing the SOURCE in a \parbox[<v-align>]{<width>}{<stuff>} allows you to display it in a paragraph with \raggedleft justification (similar to flushright). It also allows for less of a separation between the QUOTE and SOURCE. Together with \nobreak, the following minimal example hopefully produces what you want:

\documentclass{article}
\usepackage{lipsum}
\begin{document}

\newcommand{\source}[1]{%
\nobreak\parbox[t]{\linewidth}{\raggedleft #1}% Placing a quote source
}%

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus
et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra
metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus
eu tellus sit amet tortor gravida placerat.

\lipsum[1-3]
\begin{quote}
\lipsum[2]
\source{%
This is the source for this quote and it is very long. Must be an important
reference, otherwise it would not warrant having as much here.%
}
\end{quote}
\lipsum[3]

\end{document}


You may need to play around with the SOURCE formatting to suit your liking.

-
That's precisely what I need! By adding \par before \nobreak I don't even have to remember to make \source a new paragraph every time. –  Florian Aug 9 '11 at 12:45