无法删除 Beamer 中的 Displayskips

无法删除 Beamer 中的 Displayskips

PDF 中显示的align*环境上方和下方的空间太大了。根据删除对齐周围的垂直空间,两条注释掉的行中的一条应该将其删除(至少是上面的空间),但它们什么也没有改变。

  1. 我怎样才能删除不需要的空间,最好是全局的?
  2. 为什么这个空间这么大?这是一个错误还是一个功能?

梅威瑟:

\documentclass{beamer}
\usepackage{mathtools}
\newtheorem{question}{Question}
\newtheorem{answer}{Answer}

%\addtobeamertemplate{theorem begin}{\setlength\abovedisplayskip{0pt}\setlength\abovedisplayshortskip{0pt}}

\DeclareMathOperator{\argmax}{arg\,max}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\begin{document}

\begin{frame}{Vector offsets}
We assume that a linguistic relationship between two words corresponds to a constant, cosine distance based offset.
\begin{question}[Syntactic test]
$a\:b\ c\:\_$?
\end{question}
\begin{answer}
%\setlength\abovedisplayskip{0pt}\setlength\abovedisplayshortskip{0pt}
\begin{align*}
y   &= x_b-x_a+x_c \\
d^* &= \argmax_d \frac{x_dy}{\norm{x_d}\norm{y}}
\end{align*}
\end{answer}
%
\begin{question}[Semantic test]
How valid is $a\:b\ c\:d$?
\end{question}
\begin{answer}
\end{answer}
\end{frame}
\end{document}

插图

答案1

解决方法:

\documentclass{beamer}
\usepackage{mathtools}
\newtheorem{question}{Question}
\newtheorem{answer}{Answer}

\usepackage{etoolbox}
\newcommand{\zerodisplayskips}{%
    \setlength{\abovedisplayskip}{0pt}
    \setlength{\belowdisplayskip}{0pt}
    \setlength{\abovedisplayshortskip}{0pt}
    \setlength{\belowdisplayshortskip}{0pt}}
\appto{\normalsize}{\zerodisplayskips}
\appto{\small}{\zerodisplayskips}
\appto{\footnotesize}{\zerodisplayskips}


\DeclareMathOperator{\argmax}{arg\,max}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\begin{document}

\begin{frame}{Vector offsets}
We assume that a linguistic relationship between two words corresponds to a constant, cosine distance based offset.
\begin{question}[Syntactic test]
$a\:b\ c\:\_$?
\end{question}
\begin{answer}
\nointerlineskip
\begin{align*}
y   &= x_b-x_a+x_c \\
d^* &= \argmax_d \frac{x_dy}{\norm{x_d}\norm{y}}
\end{align*}
\end{answer}
%
\begin{question}[Semantic test]
How valid is $a\:b\ c\:d$?
\end{question}
\begin{answer}
\end{answer}
\end{frame}
\end{document}

在此处输入图片描述

相关内容