我正在尝试创建一个新环境,该环境仅在第一段上创建悬挂缩进,但使其他段落保持缩进:
我对上图的代码是:
\begin{hang}
This should hopefully be a hanging line of text. This should hopefully have a hanging line of text.
\end{hang}
{\leftskip 0.4 in
\rightskip 0.4 in
This should hopefully not have a hanging line of text. \par
}
hang
我定义的环境是
\newenvironment{hang}{ % begin def
\leftskip 0.4 in
\rightskip 0.4 in
\parindent -0.4 in%
}{ %end def
\par%
}
但我需要\parindent -0.4 in
采取行动仅有的关于第一段。
提前致谢!
答案1
\documentclass{article}
\newenvironment{hang}
{\list{}{%
\parindent1cm
\itemindent-1cm
}\item[]}
{\endlist}
\begin{document}
\begin{hang}
This should hopefully be a hanging line of text.
This should hopefully have a hanging line of text.
This should hopefully be a hanging line of text.
This should hopefully have a hanging line of text.
This should hopefully be a hanging line of text.
This should hopefully have a hanging line of text.
This should hopefully be a hanging line of text.
This should hopefully have a hanging line of text.
\end{hang}
\end{document}