删除命令周围的间距

删除命令周围的间距

在此处输入图片描述假设您有一份严格采用双倍行距的文档。但是当您使用\defn或等命令时\footnote,定义前后似乎有 3 个空格。如何删除这些额外添加的行?

\begin{defn} 
some text here
\end{defn}

\begin{Properties}
\item a
\item b
\item c
\end{Properties}

我试过了\ignorespaces,但是没有用。

图片对应:

\subsection{Test Subsection}
ahdjashdsajdhasjdhsjadhasjdhsajkdhasjkdhsajkdhasas adasjkdashdksajhdsajkhdjsakdhsad
adhsakjdhsakdhsajkdhasjkhdjsakhdaskdhaskjhdkjas asdhaskjdhsajkdhsajkhdjksahdjaskhdjksadhsajkdhsa
asdhkashdjksahdjksahdjksahdjksahdjksahdkjsahdjkashdjkashdjksha
\begin{defn}a:= a letter\end{defn}
dsasjdkhsakjdhaskjdhsakjdhsadsahdsakjdhajshdjsahdjkashdjksahdkjsahdjksahdjksahjkdhsajkdhasjkdhsajkd
asdaksjdhsajkdhsajkhdjaskhdjsakhdkjsahdjsahjdksahdjsahdjkhsajkdhsajkhdjsakhdjkashdjksahdjkashdjsahdkas

使用:

\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{conj}[thm]{Conjecture}
\newtheorem*{main}{Main Theorem}
\theoremstyle{definition}
**\newtheorem{defn}[thm]{Definition}**
\newtheorem{rem}[thm]{Remark}
\newtheorem{exmp}[thm]{Example}
\newtheorem{ques}[thm]{Question}
\usepackage{enumitem}
**\newlist{Properties}{enumerate}{2}
\setlist[Properties]{label=Property \arabic*.,itemindent=*}**
\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage{xlop}

答案1

似乎环境defn以与列表类环境相同的方式在其文本上方和下方添加了垂直粘连:

如果环境本身没有形成段落,则根据寄存器的值在环境文本的上方和下方插入垂直粘连\topsep

如果环境确实本身形成了一个段落,除了 -glue 之外,还会\topsep根据寄存器的值在环境文本的上方和下方插入垂直粘连\partopsep

您可以在组/本地范围内设置\topsep并设置\partopsep为 0pt:

\documentclass{article}
\usepackage{setspace} 
\doublespacing

\usepackage{amsthm}

\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{conj}[thm]{Conjecture}
\newtheorem*{main}{Main Theorem}
\theoremstyle{definition}
\newtheorem{defn}[thm]{Definition}
\newtheorem{rem}[thm]{Remark}
\newtheorem{exmp}[thm]{Example}
\newtheorem{ques}[thm]{Question}
\usepackage{enumitem}
\newlist{Properties}{enumerate}{2}
\setlist[Properties]{label=Property \arabic*.,itemindent=*}
\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage{xlop}

\begin{document}
\subsection{Test Subsection}
ahdjashdsajdhasjdhsjadhasjdhsajkdhasjkdhsajkdhasas adasjkdashdksajhdsajkhdjsakdhsad
adhsakjdhsakdhsajkdhasjkhdjsakhdaskdhaskjhdkjas asdhaskjdhsajkdhsajkhdjksahdjaskhdjksadhsajkdhsa
asdhkashdjksahdjksahdjksahdjksahdjksahdkjsahdjkashdjkashdjksha
\begingroup
\topsep=0ex
%\partopsep=0ex
\begin{defn}a:= a letter\end{defn}%
\endgroup
dsasjdkhsakjdhaskjdhsakjdhsadsahdsakjdhajshdjsahdjkashdjksahdkjsahdjksahdjksahjkdhsajkdhasjkdhsajkd
asdaksjdhsajkdhsajkhdjaskhdjsakhdkjsahdjsahjdksahdjsahdjkhsajkdhsajkhdjsakhdjkashdjksahdjkashdjsahdkas
\end{document}

结果如下:

在此处输入图片描述

相关内容