我想在我的 Beamer Slide 中使用 argmax。我发现这个问题非常有用:
argmin 或 argmax 的命令?
问题是我无法\argmax
在案例环境中使用。
示例 1: \argmax
在案例之外工作正常:
\documentclass[demo]{beamer}% <-- demo only for test, delete it in real document
\mode<presentation> {
\usetheme{Madrid}
\setbeamertemplate{footline}[page number]
}
\usepackage{booktabs} % Allows the use of \toprule,
% \midrule and \bottomrule in tables
\usepackage{tikz} % add background image
\usepackage{mathtools} % add background image
\DeclareMathOperator*{\argmax}{arg\,max}
\begin{document}
\begin{frame}
\frametitle{Solving MDP 2}
\begin{block}{Optimal Policy}
Optimal policy can be found by maximizing over $q_\ast (s,a)$
\begin{equation*}
\pi_\ast (a|s)=
\begin{cases*}
1 & \text{if } (s,a) \\
0 & \text{otherwise}
\end{cases*}
\argmax_{x \in A} q_\ast(s,a)
\end{equation*}
\end{block}
\end{frame}
\end{document}
示例 2:内部情况\argmax
不工作
\documentclass[demo]{beamer}% <-- demo only for test, delete it in real document
\mode<presentation> {
\usetheme{Madrid}
\setbeamertemplate{footline}[page number]
}
\usepackage{booktabs} % Allows the use of \toprule,
% \midrule and \bottomrule in tables
\usepackage{tikz} % add background image
\usepackage{mathtools} % add background image
\DeclareMathOperator*{\argmax}{arg\,max}
\begin{document}
\begin{frame}
\frametitle{Solving MDP 2}
\begin{block}{Optimal Policy}
Optimal policy can be found by maximizing over $q_\ast (s,a)$
\begin{equation*}
\pi_\ast (a|s)=
\begin{cases*}
1 & \text{if } \argmax_{x \in A} q_\ast(s,a) \\
0 & \text{otherwise}
\end{cases*}
\end{equation*}
\end{block}
\end{frame}
\end{document}
答案1
避免在数学显示中出现空行。
您可以使用\limits
\documentclass[demo]{beamer}% <-- demo only for test, delete it in real document
\mode<presentation> {
\usetheme{Madrid}
\setbeamertemplate{footline}[page number]
}
\usepackage{booktabs} % Allows the use of \toprule,
% \midrule and \bottomrule in tables
\usepackage{tikz} % add background image
\usepackage{mathtools} % add background image
\DeclareMathOperator*{\argmax}{arg\,max}
\begin{document}
\begin{frame}
\frametitle{Solving MDP 2}
\begin{block}{Optimal Policy}
Optimal policy can be found by maximizing over $q_\ast (s,a)$
\begin{equation*}
\pi_\ast (a|s)=
\begin{cases*}
1 & if $\argmax\limits_{x \in A} q_\ast(s,a)$ \\
0 & otherwise
\end{cases*}
\end{equation*}
\end{block}
\end{frame}
\end{document}
回想一下,cases*
右栏是以文本模式启动的。