我正在尝试输入下图中的公式。括号上的文字很长,无法换行。你能帮我解决这个问题吗?谢谢。
\documentclass{article}
\usepackage{underoverlap}
\begin{document}
$Q_{t+1}(s_t,a_t)= \UOLunderbrace{Q_{t}(s_t,a_t)}_{old\ value} +
\UOLunderbrace{\alpha_{t}(s_t,a_t)}_{learning\ rate}
\bigg(
\UOLoverbrace{
\UOLunderbrace{R_{t+1}}_{reward}+
\UOLunderbrace{\gamma}_{discount\ factor}
\UOLunderbrace{max Q_{t}(s_t,a)}_{optimal\ future\ value}
}^{learned\ value}-
\UOLunderbrace{Q_{t}(s_t,a_t)}_{old\ value}
\bigg)$
\end{document}
答案1
您不想使用underoverlap
,因为这样不会留下必要的空间;您可以使用\substack
,但在这种情况下,我更喜欢“手动”完成。
\documentclass{article}
\usepackage{amsmath}
\newcommand{\xsub}[1]{%
\mbox{\scriptsize\begin{tabular}{@{}c@{}}#1\end{tabular}}%
}
\begin{document}
$Q_{t+1}(s_t,a_t)= \underbrace{Q_{t}(s_t,a_t)}_{\xsub{old value}} +
\underbrace{\alpha_{t}(s_t,a_t)}_{\xsub{learning rate}}
\bigg(
\overbrace{
\underbrace{R_{t+1}}_{\xsub{reward}}+
\underbrace{\gamma}_{\xsub{discount\\factor}}
\underbrace{\max Q_{t}(s_t,a)}_{\xsub{optimal\\future value}}
}^{\xsub{learned value}}-
\underbrace{Q_{t}(s_t,a_t)}_{\xsub{old value}}
\bigg)$
\end{document}