以新行开始环境(无 par)

以新行开始环境(无 par)

我有自定义环境。我希望我的环境(简单​​地)以新行开始,因为我有自定义的长度\parskip\parindent。我如何调整我的环境以从新行开始并以一行结束并避免出现像下一个这样的代码?

    \\
    \begin{envenv}
    ...
    \end{envenv}
    \\

答案1

根据您的使用情况,您可能只需要

在此处输入图片描述

其中啊啊啊环境中的文本不会因 1cm 段落间距而偏移。在更复杂的上下文中,您可能需要根据某些测试来设置负间距,但上述内容只是

\documentclass{article}

\setlength\parskip{1cm}

\newenvironment{envenv}
 {\par\addvspace{-\parskip}\itshape}
 {\par\addvspace{-\parskip}}
\begin{document}



zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 

zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
\begin{envenv}
aa aa aa aa aa aa aa aa aa aa aa aa aa aa 
aa aa aa aa aa aa aa aa aa aa aa aa aa aa 
aa aa aa aa aa aa aa aa aa aa aa aa aa aa 
aa aa aa aa aa aa aa aa aa aa aa aa aa aa 
aa aa aa aa aa aa aa aa aa aa aa aa aa aa 
\end{envenv}
zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 

zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz zzz 
\end{document}

相关内容