报价环境

报价环境

我正在尝试创建一个如下图所示的报价环境。

在此处输入图片描述

环境缩进与\parindent每侧相同,环境自动为斜体,并且您可以将人和日期放在括号中而不是斜体中。

我没有 MWE,因为我不知道从哪里开始。我猜它与有关\newinvironment,但我以前从未使用过它。

有人能帮忙吗?提前谢谢。

答案1

这个quoting包非常有用,还可以和 TeXbook 中的一个技巧一起使用(在索引中查找 Bourbaki)。

\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}

在此处输入图片描述

答案2

以下是基于该csquotes包的解决方案:

在此处输入图片描述

\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}

相关内容