ここで見つけられるものとまったく同じことをしたいです:引用環境:
\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=«~ オプションを試しましたが、begin には問題ありません。しかし、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}