如何删除 mdframed 环境之间的多余空间?

如何删除 mdframed 环境之间的多余空间?

与环境对比amsthm,环境之间的差距mdframed比更大amsthm

mdframed 环境之间的额外空间

MWE 如下

\PassOptionsToPackage{svgnames}{xcolor}
\documentclass{book}
\usepackage{xcolor,amsthm,mdframed}

\makeatletter
\theoremstyle{definition}
\def\th@definition{%
  \thm@notefont{}% same as heading font
  \normalfont % body font
}
\newmdtheoremenv[
    hidealllines=true,      linecolor=MidnightBlue,
    leftline=true,          linewidth=.5ex,
    innerleftmargin=1.5ex,  innerrightmargin=0pt,
    innertopmargin=-1.7ex,  innerbottommargin=0]
{definition}
{\color{MidnightBlue}Definition}[chapter]

\newtheorem{lemma}{Lemma}

\begin{document}

A test with singlespacing:

\begin{definition}[The Definition Environment]\leavevmode\newline
    From WikipediA: A definition is used to give a precise meaning to a new term, by describing a condition which unambiguously qualifies what a mathematical term is and is not.
\end{definition}

\begin{definition}[The Definition Environment]\leavevmode\newline
    From WikipediA: A definition is used to give a precise meaning to a new term, by describing a condition which unambiguously qualifies what a mathematical term is and is not.
\end{definition}

\begin{lemma}[The Lemma Environment]
    
\end{lemma}

\begin{lemma}[The Lemma Environment]
    
\end{lemma}

A test with onehalfspacing:
\linespread{1.5}

\begin{definition}[The Definition Environment]\leavevmode\newline
    From WikipediA: A definition is used to give a precise meaning to a new term, by describing a condition which unambiguously qualifies what a mathematical term is and is not.
\end{definition}

\begin{definition}[The Definition Environment]\leavevmode\newline
    From WikipediA: A definition is used to give a precise meaning to a new term, by describing a condition which unambiguously qualifies what a mathematical term is and is not.
\end{definition}

\begin{lemma}[The Lemma Environment]
    
\end{lemma}

\begin{lemma}[The Lemma Environment]
    
\end{lemma}

\end{document}

答案1

长度选项框架框在其文档的第 6.3 节中进行了描述。尝试skipaboveskipbelow

\newmdtheoremenv[
    skipabove=0pt,          skipbelow=0pt,
    hidealllines=true,      linecolor=MidnightBlue,
    leftline=true,          linewidth=.5ex,
    innerleftmargin=1.5ex,  innerrightmargin=0pt,
    innertopmargin=-1.7ex,  innerbottommargin=0]
{definition}

在此处输入图片描述

相关内容