![如何消除两个投影仪块之间的高度差异?](https://linux22.com/image/303921/%E5%A6%82%E4%BD%95%E6%B6%88%E9%99%A4%E4%B8%A4%E4%B8%AA%E6%8A%95%E5%BD%B1%E4%BB%AA%E5%9D%97%E4%B9%8B%E9%97%B4%E7%9A%84%E9%AB%98%E5%BA%A6%E5%B7%AE%E5%BC%82%EF%BC%9F.png)
这两个方块的高度为何不同? \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
询问问题的原因凱文。