更改 \abovedisplayskip 和 \belowdisplayskip

更改 \abovedisplayskip 和 \belowdisplayskip

要更改数学显示上方和下方的垂直间距,答案https://tex.stackexchange.com/a/47776/13492用途:

\g@addto@macro \normalsize{%
\setlength\abovedisplayskip{4pt plus 0pt minus 0pt}%
\setlength\belowdisplayskip{4pt plus 0pt minus 0pt}}

但这似乎不起作用:应用的间距仍然是默认的 10pt (+/-) 如何修复?

\documentclass{article}
\usepackage{amsmath,amsfonts}

\makeatletter
\AtBeginDocument{%
  \g@addto@macro \normalsize{%
    \setlength\abovedisplayskip{4pt plus 0pt minus 0pt}%
    \setlength\belowdisplayskip{4pt plus 0pt minus 0pt}}%
}
\makeatother

\begin{document}

\noindent Since $D$ is denumerable, the set 
\[
C = \bigcup_{d \in D} \bigl(J_{d} \setminus f^{-1}(1)\bigr)
\]
is countable. Here, for each $x$,
\begin{align*}
I_{x} &= \{(x, y) : 0 \leq y < 2\},\\
J_{x} &= \{(x + y, y) : 0 \leq y < 2\},
\end{align*}
respectively.

\medskip

\noindent\begin{tabular}{ll}
\verb!\abovedisplayskip! & \the\abovedisplayskip\\
\verb!\belowdisplayskip! & \the\belowdisplayskip
\end{tabular}

\end{document}

仍然使用默认垂直间距

有关的: https://tex.stackexchange.com/a/605918/13492

答案1

更改序言中而不是文档开头的值。

\documentclass{article}
\usepackage{amsmath,amsfonts}

\makeatletter
  \g@addto@macro \normalsize{%
    \setlength\abovedisplayskip{4pt plus 0pt minus 0pt}%
    \setlength\belowdisplayskip{4pt plus 0pt minus 0pt}}%
\makeatother

\begin{document}

\noindent Since $D$ is denumerable, the set 
\[
C = \bigcup_{d \in D} \bigl(J_{d} \setminus f^{-1}(1)\bigr)
\]
is countable. Here, for each $x$,
\begin{align*}
I_{x} &= \{(x, y) : 0 \leq y < 2\},\\
J_{x} &= \{(x + y, y) : 0 \leq y < 2\},
\end{align*}
respectively.

\medskip

\noindent\begin{tabular}{ll}
\verb!\abovedisplayskip! & \the\abovedisplayskip\\
\verb!\belowdisplayskip! & \the\belowdisplayskip
\end{tabular}

\end{document}

相关内容