나는 여기서 찾을 수 있는 것과 똑같은 작업을 수행하고 싶습니다.견적 환경:
\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}
하지만! 단락 인용 전후에 자동 프랑스어 인용문을 갖고 싶습니다.
나는 starttext=<~ 옵션을 시도했는데, 처음에는 괜찮습니다. 하지만 최종 텍스트는 ~»를 새 줄에 넣습니다.
나는 또한 시도했다 :
\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}