这两个方块的高度为何不同? \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
询问问题的原因凱文。