法语社会学逐字引述环境

法语社会学逐字引述环境

我想要做的和你在这里找到的完全一样:报价环境

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

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

\end{pquotation}
This is not a quotation, this is normal text.


\end{document}

但是!我想在段落引用之前和之后自动使用法语引用。

我尝试了 begintext=«~ 选项,对于开始来说没问题。但是 endtext 却将 ~» 放在了新行。

我也尝试过:

\NewDocumentEnvironment{verba}{m}
{\begin{quotation}«~\small\itshape}
    {~»{}\bywhom{#1}\end{quotation}}

但结束引文是到新的一行...

如果您能建议我如何为社会学逐字记录创建一个新的环境,我将非常感激。

答案1

请注意,xparse不再需要。对于法语引文,您需要 T1 编码。

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{quoting}

\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«\ignorespaces}
  {\unskip»\bywhom{#1}\end{quoting}}

\begin{document}

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.
\end{pquotation}
This is not a quotation, this is normal text.

\end{document}

之前没有空行\end{pquotation}

在此处输入图片描述

如果您觉得必须在之前留空行\end{pquotation},可以按如下方式操作:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{quoting,xparse}

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

\ExplSyntaxOn
\NewDocumentCommand{\removetrailingpar}{+m}
 {
  \tl_set:Ne \l_tmpa_tl { \tl_trim_spaces:n { #1 } }
  \regex_replace_once:nnN { (?:\s|\c{par})*\Z } { } \l_tmpa_tl
  \tl_use:N \l_tmpa_tl
 }
\ExplSyntaxOff

\NewDocumentEnvironment{pquotation}{m+b}
 {
  \begin{quoting}[
    indentfirst=true,
    leftmargin=\parindent,
    rightmargin=\parindent
  ]\itshape
  «\removetrailingpar{#2}»
  \bywhom{#1}
  \end{quoting}
 }{}
\ExplSyntaxOff

\begin{document}

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.

\end{pquotation}
This is not a quotation, this is normal text.

\end{document}

相关内容