# The Quotation Environment

I am trying to make a quotation environment as picture below.

The environment is indented the same as \parindent on each side, the environment is automatically italic, and you can put the person and the date in brackets not in italics.

I don't have an MWE since I'm not really sure where to start. I guess it's something to do with \newinvironment, but I've never used that before.

• Don't reinvent the wheel. Your document class probably already contains a quote and a quotation environment, with slightly different formats, and one of them might be exactly what you want. The simplest way to get the attribution at the right margin is just to put \hfill in front of it - though if you have a lot of quotes and you need to automatically handle the situation where the attribution needs to go on a separate line because it won't fit on the last line of the quote, you might want a more sophisticated alternative. If so, ask another question just about that. – alephzero Sep 16 '17 at 19:45
• To customise a quote/quotation environment, take a look at the quoting package. Another posssibility: the epigraph package. – Bernard Sep 16 '17 at 20:02
• @alephzero ok good point. It'd be nice if I could do it automatically. But I guess that'll do. Also thanks to Bernard for the suggestion. – PercyF2519 Sep 16 '17 at 20:11

The quoting package is very useful, together with a trick found in the TeXbook (look for Bourbaki in the index).

\documentclass{article}
\usepackage{quoting,xparse}

\NewDocumentCommand{\bywhom}{m}{% the Bourbaki trick
{\nobreak\hfill\penalty50\hskip1em\null\nobreak
\hfill\mbox{\normalfont(#1)}%
\parfillskip=0pt \finalhyphendemerits=0 \par}%
}

\NewDocumentEnvironment{pquotation}{m}
{\begin{quoting}[
indentfirst=true,
leftmargin=\parindent,
rightmargin=\parindent]\itshape}
{\bywhom{#1}\end{quoting}}

\begin{document}

This is not a quotation, this is normal text.
This is not a quotation, this is normal text.
This is not a quotation, this is normal text.
This is not a quotation, this is normal text.
This is not a quotation, this is normal text.
\begin{pquotation}{Jack Johnson, 2003}
This is a quotation. This is a quotation.
This is a quotation. This is a quotation.
This is a quotation. This is a quotation.
This is a quotation. This is a quotation.
This is a quotation.'
\end{pquotation}
This is not a quotation, this is normal text.
This is not a quotation, this is normal text.
This is not a quotation, this is normal text.
This is not a quotation, this is normal text.
This is not a quotation, this is normal text.
\begin{pquotation}{Jack Johnson, 2003}
This is a quotation. This is a quotation.
This is a quotation. This is a quotation.
This is a quotation. This is a quotation.
This is a quotation. This is a quotation.
This is a quotation. This is a quotation.'
\end{pquotation}
This is not a quotation, this is normal text.
This is not a quotation, this is normal text.
This is not a quotation, this is normal text.
This is not a quotation, this is normal text.
This is not a quotation, this is normal text.

\end{document}


Here's a solution based on the csquotes package:

\documentclass{memoir}
% filler text:
\newcommand\lipx{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.}

\usepackage{csquotes}
\SetBlockThreshold{2}
\newcommand\myblockquote[2]{%
\blockquote{\hspace*{2em}\emph{#1'}\hfill(#2)}\par}

\begin{document}
\lipx\ \lipx

\myblockquote{\lipx}{Jack Johnson, 2003}

\lipx\ \lipx
\end{document}

• Add some words to the quotation and see what happens. A possible failure is that the name may be split across lines; the second, less obvious failure is when the \hfill` is used as a line break point, whence the name will be flush left. – egreg Sep 16 '17 at 20:50