定义引用环境,不缩进第一段

定义引用环境,不缩进第一段

我想要一个quotation不缩进第一段的环境。

\documentclass{scrbook} 

\begin{document}

\makeatletter
\renewenvironment{quotation}
           {\list{}{\listparindent 1.5em%
                    \itemindent    \listparindent
                    \rightmargin \leftmargin
                    \parsep        \z@ \@plus\p@}%
            \item\relax}
           {\endlist}
\makeatother

This is normal text. This is normal text. This is normal text.
This is normal text. This is normal text. 
\begin{quotation}

This is a sentence that is devoid of any meaning. It should not be indented.

This ia another sentence. It should be indented. The other one shouldn't.
Some more text here. Some more text here. Some more text here. Some more text here. 

\end{quotation}
This again normal text. This again normal text. This again normal text.
This again normal text.

\end{document}

(另一个问题是如何修改环境,以便引文不在右侧缩进,而是与正常文本对齐。)

答案1

在此处输入图片描述

\documentclass{scrbook} 

\begin{document}

\makeatletter
\renewenvironment{quotation}
           {\list{}{\listparindent 1.5em%
                    %\itemindent    \listparindent
                    %\rightmargin \leftmargin
                    \parsep        \z@ \@plus\p@}%
            \item\relax}
           {\endlist}
\makeatother

This is normal text. This is normal text. This is normal text.
This is normal text. This is normal text. 
\begin{quotation}

This is a sentence that is devoid of any meaning. It should not be indented.

This ia another sentence. It should be indented. The other one shouldn't.
Some more text here. Some more text here. Some more text here. Some more text here. 

\end{quotation}
This again normal text. This again normal text. This again normal text.
This again normal text.

\end{document}

第一个%停止第一段缩进,第二个%停止右边距的改变。

答案2

你可以使用quoting我的环境包裹同名并激活包选项indentfirst=falserightmargin=0pt

为了保持一致性,引号内的后续段落应\parindent与普通文本具有相同的功能。如果必须使用不同的缩进,请使用\AtBeginEnvironment{quoting}{\setlength{\parindent}{1.5em}}

\documentclass{scrbook} 

\usepackage[indentfirst=false,rightmargin=0pt]{quoting}

% \AtBeginEnvironment{quoting}{\setlength{\parindent}{1.5em}}

\begin{document}

This is normal text. This is normal text. This is normal text.
This is normal text. This is normal text. 

\begin{quoting}

This is a sentence that is devoid of any meaning. It should not be indented.

This is another sentence. It should be indented. The other one shouldn't.
Some more text here. Some more text here. Some more text here. Some more text here. 

\end{quoting}

This again normal text. This again normal text. This again normal text.
This again normal text.

\end{document}

答案3

使用\itemindent=0pt

如果您不希望引文与右边距齐平,请删除\rightmargin=\leftmargin

\documentclass{scrbook}

\makeatletter
\renewenvironment{quotation}
  {\list{}{\listparindent=1.5em
           \itemindent=0pt
           \parsep\z@ \@plus\p@}%
           \item\relax}
  {\endlist}
\makeatother

\begin{document}

This is normal text. This is normal text. This is normal text. 
This is normal text. This is normal text.
\begin{quotation}
This is a sentence that is devoid of any meaning. It should not be indented.

This ia another sentence. It should be indented. The other one shouldn't. 
Some more text here. Some more text here. Some more text here. Some more text here.
\end{quotation}
This again normal text. This again normal text. This again normal text.
This again normal text.

\end{document}

在此处输入图片描述

相关内容