我尝试在方程中使用 overbrace 和 parbox,但效果并不理想。有什么好的办法吗?
\documentclass[10pt]{beamer}
\usetheme[progressbar=frametitle]{metropolis}
\usepackage{mathtools}
\begin{document}
\begin{frame}[fragile]
\begin{align*}
X + \overbrace{\parbox{8em}{some text \\ and some more}}{\text{written above}}=Y+Z
\end{align*}
\end{frame}
\end{document}
答案1
^
两个参数之间缺少一个符号\overbrace
。因此,只需替换
\overbrace{\parbox{8em}{some text \\ and some more}}{\text{written above}}
和
\overbrace{\parbox{8em}{some text \\ and some more}}^{\text{written above}}
以下屏幕截图显示了错误和正确使用的结果\overbrace
:
\documentclass{beamer}
\usetheme[progressbar=frametitle]{metropolis}
\usepackage{mathtools}
\begin{document}
\begin{frame}[fragile]
Incorrect
\[
X + \overbrace{\parbox{8em}{some text \\ and some more}}{\text{written above}}=Y+Z
\]
Correct
\[
X + \overbrace{\parbox{8em}{some text \\ and some more}}^{\text{written above}}=Y+Z
\]
\end{frame}
\end{document}
答案2
使用pbox
, \overbrace 将更好地适应段落大小:
\documentclass[10pt]{beamer}
\usetheme[progressbar=frametitle]{metropolis}
\usepackage{pbox}
\usepackage{mathtools}
\begin{document}
\begin{frame}[fragile]
\begin{align*}
X + \overbrace{\pbox{8em}{some text \\ and some more}}^{\text{written above}}=Y+Z
\end{align*}
\end{frame}
\end{document}