如何消除两个投影仪块之间的高度差异?

如何消除两个投影仪块之间的高度差异?

这两个方块的高度为何不同? \hole 定义中应做哪些更改才能使其高度相同?

\documentclass[10pt,lmodern,handout]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{block title}{bg=blue!20}
\setbeamercolor{block body}{bg=blue!5}
\newcommand\hole[1]{%
    \alt<handout>{\invisible<1->{#1}}{#1}%
}
\setbeamertemplate{navigation symbols}{}

%--------------------
\begin{document}
%--------------------

\begin{frame}
\frametitle{Some title}
\framesubtitle{Some subtitle}
Some text.
\begin{block}{A block}
    Text:
    %
    \begin{align*}
        ax=b
    \end{align*}
    %
\end{block}
\begin{block}{A block}
    \hole{Text:
    %
    \begin{align*}
        ax=b
    \end{align*}
    %
    }
\end{block}
Why is there a difference in the two blocks' height? How to get rid of that?
\end{frame}

%---------------%
\end{document}
%---------------%

在此处输入图片描述

答案1

添加\par关闭之前\hole解决了该问题:

\documentclass[10pt,lmodern,handout]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{block title}{bg=blue!20}
\setbeamercolor{block body}{bg=blue!5}
\newcommand\hole[1]{%
    \alt<handout>{\invisible<1->{#1}}{#1}%
}

\begin{document}

\begin{frame}
\frametitle{Some title}
\framesubtitle{Some subtitle}
Some text.
\begin{block}{A block}
    Text:
    \begin{align*}
        ax=b
    \end{align*}
\end{block}
\begin{block}{A block}
    \hole{Text:
    \begin{align*}
        ax=b
    \end{align*}\par
    }
\end{block}
There's no difference in the two blocks' height!
\end{frame}

\end{document}

输出:

在此处输入图片描述

\hole当然,你也可以将的定义改为

\newcommand\hole[1]{%
    \alt<handout>{\invisible<1->{#1\par}}{#1}%
}

是什么导致了这个问题?坦白说,我真的不知道(尽管我有些怀疑)。无论如何,related question询问问题的原因凱文

相关内容