下面的 MWE 产生了以下图片:
问题在于如何在内联行之间获得更好的垂直间距。问题似乎是由于 sigma 的额外高度造成的。我使用了包spacing
中的环境setspace
,但似乎还包括列表前后看起来明显更多的空间。
所以我的问题是:当使用 enumitem 的内联选项时,有没有办法只拉伸项目之间的空间?
注:tabbedenum
环境来自这个答案。
\documentclass{article}
\usepackage[inline]{enumitem}
\usepackage{tabto}
\newenvironment{tabbedenum}[2][]
{\NumTabs{#2}\begin{enumerate*}[
before={\unskip\hspace{\dimexpr-\parindent-1pt}\tab},itemjoin={\tab},#1]}%
{\end{enumerate*}}
\usepackage{setspace}
\begin{document}
\begin{enumerate}
\item Some text.
\begin{spacing}{3}
\begin{tabbedenum}{2}
\item $\displaystyle\sum_{r=1}^{n}x_r + \displaystyle\sum_{r=1}^{n}y_r = \displaystyle\sum_{r=1}^{n}(x_r+y_r)?$
\item $\displaystyle\sum_{r=1}^{n}x_r \cdot \displaystyle\sum_{r=1}^{n}y_r = \displaystyle\sum_{r=1}^{n}(x_r\cdot y_r)?$
\item $\displaystyle\sum_{r=1}^{n}(c\cdot x_r) = \displaystyle c\cdot\sum_{r=1}^{n}x_r?$
\item $\displaystyle\sum_{r=1}^{n}x_r + \displaystyle\sum_{r=1}^{n}y_r = \displaystyle\sum_{r=1}^{n}(x_r+y_r)?$
\end{tabbedenum}
\end{spacing}
\item Some text.
\end{enumerate}
\end{document}
答案1
我会用tasks
:
\documentclass{article}
\usepackage{tasks}
\begin{document}
\begin{enumerate}
\item Some text.
\begin{tasks}[counter-format=(tsk[a]),label-width=1.5em](2)
\task $\displaystyle\sum_{r=1}^{n}x_r + \sum_{r=1}^{n}y_r = \sum_{r=1}^{n}(x_r+y_r)$?
\task $\displaystyle\sum_{r=1}^{n}x_r \cdot \sum_{r=1}^{n}y_r = \sum_{r=1}^{n}(x_r\cdot y_r)$?
\task $\displaystyle\sum_{r=1}^{n}(c\cdot x_r) = c\cdot\sum_{r=1}^{n}x_r$?
\task $\displaystyle\sum_{r=1}^{n}x_r + \sum_{r=1}^{n}y_r = \sum_{r=1}^{n}(x_r+y_r)$?
\end{tasks}
\item Some text.
\end{enumerate}
\end{document}
请注意,这\displaystyle
是适用于整个公式的声明,并且通常外部标点符号位于公式之外。
您可以自定义行之间的分隔:使用
\begin{tasks}[counter-format=(tsk[a]),label-width=1.5em,after-item-skip=5ex](2)
你会得到
答案2
\rule
我找到了一个解决方案。它依赖于在每个 实例上通过零宽度放置一些垂直空间\item
。下面是代码,我保留了原始代码以进行比较。(我也在开头添加了一个新段落。)
\documentclass{article}
\usepackage[inline]{enumitem}
\usepackage{tabto}
\newenvironment{tabbedenum}[2][]
{\NumTabs{#2}\begin{enumerate*}[
before={\unskip\hspace{\dimexpr-\parindent-1pt}\tab},itemjoin={\tab},#1]}%
{\end{enumerate*}}
\usepackage{setspace}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{tabbedenumNEW}[3][]
{\par\vspace{\baselineskip}\NumTabs{#2}\begin{enumerate*}[
before={\unskip\hspace{\dimexpr-\parindent-1pt}\tab},itemjoin={\tab\rule[-#3]{0mm}{#3}},#1]}%
{\end{enumerate*}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{enumerate}
\item Some text followed by original, note too much space before the next item.
\begin{spacing}{3}
\begin{tabbedenum}{2}
\item $\displaystyle\sum_{r=1}^{n}x_r + \displaystyle\sum_{r=1}^{n}y_r = \displaystyle\sum_{r=1}^{n}(x_r+y_r)?$
\item $\displaystyle\sum_{r=1}^{n}x_r \cdot \displaystyle\sum_{r=1}^{n}y_r = \displaystyle\sum_{r=1}^{n}(x_r\cdot y_r)?$
\item $\displaystyle\sum_{r=1}^{n}(c\cdot x_r) = \displaystyle c\cdot\sum_{r=1}^{n}x_r?$
\item $\displaystyle\sum_{r=1}^{n}x_r + \displaystyle\sum_{r=1}^{n}y_r = \displaystyle\sum_{r=1}^{n}(x_r+y_r)?$
\end{tabbedenum}
\end{spacing}
\item Some text followed by new and improved.
\begin{tabbedenumNEW}{2}{2\baselineskip}
\item $\displaystyle\sum_{r=1}^{n}x_r + \displaystyle\sum_{r=1}^{n}y_r = \displaystyle\sum_{r=1}^{n}(x_r+y_r)?$
\item $\displaystyle\sum_{r=1}^{n}x_r \cdot \displaystyle\sum_{r=1}^{n}y_r = \displaystyle\sum_{r=1}^{n}(x_r\cdot y_r)?$
\item $\displaystyle\sum_{r=1}^{n}(c\cdot x_r) = \displaystyle c\cdot\sum_{r=1}^{n}x_r?$
\item $\displaystyle\sum_{r=1}^{n}x_r + \displaystyle\sum_{r=1}^{n}y_r = \displaystyle\sum_{r=1}^{n}(x_r+y_r)?$
\end{tabbedenumNEW}
\item Some text.
\end{enumerate}
\end{document}