如何抑制定理头和枚举环境之间的垂直空间?

如何抑制定理头和枚举环境之间的垂直空间?

如何抑制定理头和enumitem 环境之间的垂直空间?我希望输出看起来像下面的版本 3,但我希望有一个没有和的自动解决~方案\vspace

\documentclass{article}
\usepackage{amsthm}
\usepackage{enumitem}
\newtheoremstyle{mythmstyle}%
{0.5em}% space above
{0.5em}% space below
{}% body font
{}% indent amount
{\sffamily\bfseries}% head font
{}% punctuation after head
{\newline}% space after head
{\thmname{#1}\ \thmnumber{#2}\ \thmnote{(#3)}}% head spec
\theoremstyle{mythmstyle}
\newtheorem{Theorem}{Theorem}
\begin{document}

%% version 1: vertical spacing correct
\begin{Theorem}
Dummy text
\begin{enumerate}[label=(\arabic*),leftmargin=*,align=left]
\item Item 1: More dummy text
\item Item 2: More dummy text
\end{enumerate}
\end{Theorem}

%% version 2: vertical spacing too large
\begin{Theorem}
~
\begin{enumerate}[label=(\arabic*),leftmargin=*,align=left]
\item Item 1: More dummy text
\item Item 2: More dummy text
\end{enumerate}
\end{Theorem}

%% version 3: desirable output, but ugly solution via \vspace
\begin{Theorem}
~\vspace{-1.4em}
\begin{enumerate}[label=(\arabic*),leftmargin=*,align=left]
\item Item 1: More dummy text
\item Item 2: More dummy text
\end{enumerate}
\end{Theorem}

%% version 4: does it work with enumitem alone? (no, topsep seems to be ignored)
\begin{Theorem}
~
\begin{enumerate}[label=(\arabic*),leftmargin=*,align=left, topsep=-1.4em]
\item Item 1: More dummy text
\item Item 2: More dummy text
\end{enumerate}
\end{Theorem}
\end{document}

答案1

不要~在标记中使用任何内容(或空白行)。然后,如果紧跟在插入标题后面,则乳胶列表会使用插入样式作为第一个项目。这是设计使然(要实现这一点会有些麻烦)如果您不喜欢这种样式,则需要更改它,而不是在文档中添加标记。我不像以前那样熟悉该代码,但这似乎有效,可能需要多加注意以确保在所有正确的位置都抑制分页符等,但是...

在此处输入图片描述

\documentclass{article}
\usepackage{amsthm}
\usepackage{enumitem}
\newtheoremstyle{mythmstyle}%
{0.5em}% space above
{0.5em}% space below
{}% body font
{}% indent amount
{\sffamily\bfseries}% head font
{}% punctuation after head
{\newline}% space after head
{\thmname{#1}\ \thmnumber{#2}\ \thmnote{(#3)}}% head spec
\theoremstyle{mythmstyle}
\newtheorem{Theorem}{Theorem}


\makeatletter
\def\enumfix{%
\if@inlabel
 \noindent \par\nobreak\vskip-\parskip\vskip-\baselineskip\hrule\@height\z@
\fi}

\let\oldenumerate\enumerate
\def\enumerate{\enumfix\oldenumerate}


\begin{document}

%% version 1: vertical spacing correct
\begin{Theorem}
Dummy text
\begin{enumerate}[label=(\arabic*),leftmargin=*,align=left]
\item Item 1: More dummy text
\item Item 2: More dummy text
\end{enumerate}
\end{Theorem}


%% version 2a: vertical spacing too large
\begin{Theorem}

\begin{enumerate}[label=(\arabic*),leftmargin=*,align=left]
\item Item 1: More dummy text
\item Item 2: More dummy text
\end{enumerate}
\end{Theorem}
\end{document}

答案2

您的方法可能不太好看,它确实应该使用像 这样的垂直单位ex而不是em,但如果它能给出您想要的结果,为什么不直接将它嵌入到 中\newenvironment呢?

例如,

\newenvironment{thmenumerate}{%
\leavevmode\vspace{-1.4em}
\begin{enumerate}[label=(\arabic*),leftmargin=*,align=left]
}{%
\end{enumerate}
}

像这样使用它:

\begin{Theorem}
\begin{thmenumerate}
\item Item 1: More dummy text
\item Item 2: More dummy text
\end{thmenumerate}
\end{Theorem}

相关内容