首先是一个 MWS,其输出如下。
\documentclass{article}
\usepackage{lipsum,indentfirst}
\setlength{\parindent}{2em}
\setlength{\parskip}{0.3\baselineskip plus 0.2ex minus 0.1ex}
%%%enumerate and so on%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{enumitem}
%space for items--------------------------------------------
\setenumerate[1,2,3]{itemsep=0pt,partopsep=0.3\baselineskip plus 0.2ex minus 0.1ex,parsep=0pt,topsep=0pt}
\setitemize[1,2,3]{itemsep=0pt,partopsep=0.3\baselineskip plus 0.2ex minus 0.1ex,parsep=0pt,topsep=0pt,align=left}
\setdescription{itemsep=0pt,partopsep=0.3\baselineskip plus 0.2ex minus 0.1ex,parsep=0pt,topsep=0pt,align=left}
%indent for items-------------------------------------------
\setlist[enumerate]{leftmargin=\parindent,align=left,labelwidth=\parindent,labelsep=0em}%
\setlist[itemize]{leftmargin=0.5\parindent,align=left,labelwidth=0.5\parindent,labelsep=0em}
%%%define a new quotation%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\renewenvironment{quotation}
{\list{}{\listparindent 2em%equal to \parindent
\partopsep 0.3\baselineskip plus 0.2ex minus 0.1ex%equal to \parskip
\topsep 0em%here
\itemindent 2em%equal to \parindent
\rightmargin 2em%equal to \parindent
\leftmargin 2em%equal to \parindent
\parsep 0.3\baselineskip plus 0.2ex minus 0.1ex%equal to \parskip
}%
\item\relax}
{\endlist}
\makeatother
\begin{document}
\lipsum[1][1-3]
\begin{quotation}
\lipsum[2][1-3]
\end{quotation}
\lipsum[3][1-3]
\begin{enumerate}
\item \lipsum[4][1-3]
\item \lipsum[5][1-3]
\begin{quotation}
\lipsum[6][1-3]
\end{quotation}
\lipsum[7][1-3]
\end{enumerate}
\end{document}
如你所见,enumerate 环境中第一个引号前后的空格是合适的,而 enumerate 环境中第二个引号前后的空格是不合适的。那么如何达到下列目标?
- 枚举内外引号前后的空格相同;
- 引号前后的空格都等于
\parskip
。
答案1
试试这个代码。在环境中使用时,它会在引号环境前后添加空格enumerate
。
使用环境\parskip
中的定义list
来更改引号前后的空格。
\documentclass{article}
\usepackage{lipsum,indentfirst}
\setlength{\parindent}{2em}
\setlength{\parskip}{0.3\baselineskip plus 0.2ex minus 0.1ex}
%%%enumerate and so on%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{enumitem}
%space for items--------------------------------------------
\setenumerate[1,2,3]{itemsep=0pt,partopsep=0.3\baselineskip plus 0.2ex minus 0.1ex,parsep=0pt,topsep=0pt}
\setitemize[1,2,3]{itemsep=0pt,partopsep=0.3\baselineskip plus 0.2ex minus 0.1ex,parsep=0pt,topsep=0pt,align=left}
\setdescription{itemsep=0pt,partopsep=0.3\baselineskip plus 0.2ex minus 0.1ex,parsep=0pt,topsep=0pt,align=left}
%indent for items-------------------------------------------
\setlist[enumerate]{leftmargin=\parindent,align=left,labelwidth=\parindent,labelsep=0em}%
\setlist[itemize]{leftmargin=0.5\parindent,align=left,labelwidth=0.5\parindent,labelsep=0em}
%%%define a new quotation%%%%%%%%%%%%%%%%%%%%%%
\renewenvironment{quotation}
{\par\list{}{% changed <<<<<<<<<<
\setlength{\parskip}{0.5\baselineskip plus 0.2ex minus 0.1ex}% use this <<<<<<<<<<<<
\setlength{\partopsep}{\parskip}%
\setlength{\parsep}{\parskip}%
\setlength{\topsep}{0em}%
\setlength{\leftmargin}{2em}%
\setlength{\rightmargin}{2em}%
\setlength{\itemindent}{2em}%
}
\item[]}
{\endlist}
\begin{document}
\lipsum[1][1-3]
\begin{quotation}
\lipsum[2][1-3]
\end{quotation}
\lipsum[3][1-3]
\begin{enumerate}
\item \lipsum[4][1-3]
\item \lipsum[5][1-3]
\begin{quotation}
\lipsum[6][1-3]
\end{quotation}
\lipsum[7][1-3]
\end{enumerate}
\lipsum[1][1-3]
\end{document}
选项使用 LaTeXquotation
环境,定义为:
\renewenvironment{quotation}{\list{}{%
\listparindent 20pt%
\itemindent\listparindent%
\rightmargin\leftmargin}%
\item[]}
{\endlist}
\documentclass{article}
\usepackage{lipsum,indentfirst}
\setlength{\parindent}{2em}
\setlength{\parskip}{0.3\baselineskip plus 0.2ex minus 0.1ex}
%%%enumerate and so on%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{enumitem}
%space for items--------------------------------------------
\setenumerate[1,2,3]{itemsep=0pt,partopsep=0.3\baselineskip plus 0.2ex minus 0.1ex,parsep=0pt,topsep=0pt}
\setitemize[1,2,3]{itemsep=0pt,partopsep=0.3\baselineskip plus 0.2ex minus 0.1ex,parsep=0pt,topsep=0pt,align=left}
\setdescription{itemsep=0pt,partopsep=0.3\baselineskip plus 0.2ex minus 0.1ex,parsep=0pt,topsep=0pt,align=left}
%indent for items-------------------------------------------
\setlist[enumerate]{leftmargin=\parindent,align=left,labelwidth=\parindent,labelsep=0em}%
\setlist[itemize]{leftmargin=0.5\parindent,align=left,labelwidth=0.5\parindent,labelsep=0em}
\begin{document}
\lipsum[1][1-3]
\begin{quotation}
\lipsum[2][1-3]
\end{quotation}
\lipsum[3][1-3]
\begin{enumerate}
\item \lipsum[4][1-3]
\item \lipsum[5][1-3]
\begin{quotation}
\lipsum[6][1-3]
\end{quotation}
\lipsum[7][1-3]
\end{enumerate}
\lipsum[1][1-3]
\end{document}