我对使用 beamer 还不是很有经验,并且在使用 textcolorbox 和在框架中对齐时遇到了反复出现的问题。
\documentclass{beamer}
\usetheme{Darmstadt}
\newcommand\FontSmall{\fontsize{7}{10}\selectfont}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{mathtools} % coloneqq
\usepackage{tcolorbox}
\DeclareMathOperator*{\argmax}{argmax}
\DeclareMathOperator*{\argmin}{argmin}
\renewcommand{\d}{\mathrm{d}}
\newcommand{\E}{\mathbb{E}}
\renewcommand{\P}{\mathbb{P}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\A}{\mathcal{A}}
\newcommand{\B}{\mathcal{B}}
\newcommand{\C}{\mathcal{C}}
\newcommand{\D}{\mathcal{D}}
\newcommand{\G}{\mathcal{G}}
\newcommand{\bigK}{\mathbb{K}}
\newcommand{\bigL}{\mathbb{L}}
\newcommand{\bigU}{\mathbb{U}}
\newcommand{\bigV}{\mathbb{V}}
\begin{document}
%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Separation of mean and covariance steering}
\FontSmall
\begin{columns}
\begin{column}{0.48\textwidth}
\begin{tcolorbox}[colframe=blue!10!black,before skip=10pt,after skip=10pt,top=0pt,bottom=0pt,right=2pt]
\abovedisplayskip=0pt
\belowdisplayskip=0pt
\begin{align*}
J(U,V) &= \E[X^\intercal\bar{Q}X + U^\intercal \bar{R} U - V^\intercal \bar{S} V] \\
X &= \A x_0 + \B U + \C V + \D W
\end{align*}
\end{tcolorbox}
\vspace{2cm}
\begin{tcolorbox}[colback=blue!5!white,colframe=blue!75!black,before skip=10pt,after skip=10pt,top=5pt,bottom=0pt,right=2pt]
Unconstrained Mean Steering Game (UMSG)
\begin{align}
&\textrm{Payoff Function}: J_{\mu}(\bar{U},\bar{V}), \nonumber\\
&\textrm{where}\quad \bar{X} = \A\mu_0 + \B\bar{U} + \C\bar{V}, \nonumber
\end{align}
\end{tcolorbox}
\end{column}
\begin{column}{0.52\textwidth}
\begin{tcolorbox}[colback=blue!5!white,colframe=blue!75!black,before skip=10pt,after skip=10pt,top=0pt,bottom=0pt,right=2pt]
\abovedisplayskip=0pt
\belowdisplayskip=0pt
\begin{align*}
J_{\mu}(\bar{U},\bar{V}) &= \bar{X}^\intercal\bar{Q}\bar{X} + \bar{U}^\intercal \bar{R} \bar{U} - \bar{V}^\intercal\bar{S}\bar{V} \\
\bar{X} := \E[X] &= \A \mu_0 + \B \bar{U} + \C\bar{V}
\end{align*}
\end{tcolorbox}
\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,before skip=10pt,after skip=10pt,top=0pt,bottom=0pt,right=2pt]
\begin{align*}
\hspace*{-3cm}
J_{\Sigma}(\tilde{U},\tilde{V}) &= \textrm{tr}(\bar{Q}\Sigma_{XX}) + \textrm{tr}(\bar{R}\Sigma_{UU}) - \textrm{tr}(\bar{S}\Sigma_{VV}) \\
\tilde{X} := X - &\E[X] = \A \tilde{x}_0 + \B \tilde{U} + \C\tilde{V} + \D W
\end{align*}
\end{tcolorbox}
\vspace{0.6cm}
\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,before skip=10pt,after skip=10pt,top=5pt,bottom=0pt,right=0pt]
Unconstrained Covariance Steering Game (CCSG)
\begin{align*}
&\textrm{Payoff Function}: J_{\Sigma}(\tilde{U},\tilde{V}), \nonumber\\
&\textrm{where}\quad \tilde{X} = \A \tilde{x}_0 + \B \tilde{U} + \C\tilde{V} + \D W, \nonumber
\end{align*}
\end{tcolorbox}
\end{column}
\end{columns}
\end{frame}
我的目标只是让这两列文本块居中显示在阴影框中。这似乎很简单,但我一直遇到问题。任何建议都将不胜感激!
答案1
您可以halign=center
在包含文本和数学的 tcolorbox 中使用,也可以在仅包含数学的框中使用,我认为使用ams gather*
选项将每个方程式居中更容易。使用ams gather*
或其他数学环境选项,您可以避免将它们写入框内(请参阅 tcolorbox 文档中的第 367-370 页)
\documentclass{beamer}
\usetheme{Darmstadt}
\newcommand\FontSmall{\fontsize{7}{10}\selectfont}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{mathtools} % coloneqq
\usepackage[most]{tcolorbox}
\DeclareMathOperator*{\argmax}{argmax}
\DeclareMathOperator*{\argmin}{argmin}
\renewcommand{\d}{\mathrm{d}}
\newcommand{\E}{\mathbb{E}}
\renewcommand{\P}{\mathbb{P}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\A}{\mathcal{A}}
\newcommand{\B}{\mathcal{B}}
\newcommand{\C}{\mathcal{C}}
\newcommand{\D}{\mathcal{D}}
\newcommand{\G}{\mathcal{G}}
\newcommand{\bigK}{\mathbb{K}}
\newcommand{\bigL}{\mathbb{L}}
\newcommand{\bigU}{\mathbb{U}}
\newcommand{\bigV}{\mathbb{V}}
\newtcolorbox{mybox}[1][]{
before skip=10pt,
after skip=10pt,
top=0pt,
bottom=0pt,
left=1pt,
right=1pt,
halign=center,
#1
}
\tcbset{
mystyle/.style={colback=#1!10!white,colframe=#1!75!black}}
\begin{document}
%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]
\frametitle{Separation of mean and covariance steering}
\FontSmall
\begin{columns}[T]
\begin{column}{0.47\textwidth}
\begin{mybox}[mystyle=blue]
\abovedisplayskip=0pt
\belowdisplayskip=0pt
\begin{align*}
J(U,V) &= \E[X^\intercal\bar{Q}X + U^\intercal \bar{R} U - V^\intercal \bar{S} V] \\
X &= \A x_0 + \B U + \C V + \D W
\end{align*}
\end{mybox}
\vspace{2cm}
\begin{mybox}[mystyle=blue]
Unconstrained Mean Steering Game (UMSG)
\begin{align}
&\textrm{Payoff Function}: J_{\mu}(\bar{U},\bar{V}), \nonumber\\
&\textrm{where}\quad \bar{X} = \A\mu_0 + \B\bar{U} + \C\bar{V}, \nonumber
\end{align}
\end{mybox}
\end{column}
\begin{column}{0.53\textwidth}
\begin{mybox}[mystyle=blue, ams gather*]
\abovedisplayskip=0pt
\belowdisplayskip=0pt
J_{\mu}(\bar{U},\bar{V}) = \bar{X}^\intercal\bar{Q}\bar{X} + \bar{U}^\intercal \bar{R} \bar{U} - \bar{V}^\intercal\bar{S}\bar{V} \\
\bar{X} := \E[X] = \A \mu_0 + \B \bar{U} + \C\bar{V}
\end{mybox}
\begin{mybox}[mystyle=red, ams gather*]
J_{\Sigma}(\tilde{U},\tilde{V}) = \textrm{tr}(\bar{Q}\Sigma_{XX}) + \textrm{tr}(\bar{R}\Sigma_{UU}) - \textrm{tr}(\bar{S}\Sigma_{VV}) \\
\tilde{X} := X - \E[X] = \A \tilde{x}_0 + \B \tilde{U} + \C\tilde{V} + \D W
\end{mybox}
\vspace{0.6cm}
\begin{mybox}[mystyle=red]
Unconstrained Covariance Steering Game (CCSG)
\begin{align*}
&\textrm{Payoff Function}: J_{\Sigma}(\tilde{U},\tilde{V}), \nonumber\\
&\textrm{where}\quad \tilde{X} = \A \tilde{x}_0 + \B \tilde{U} + \C\tilde{V} + \D W, \nonumber
\end{align*}
\end{mybox}
\end{column}
\end{columns}
\end{frame}
\end{document}
答案2
在下面的 MWE 中,我定义了一个新的 tcolorbox,以避免一遍又一遍地重复边距设置。我还添加了left=2pt
以使每个框中的内容水平居中。右列第二个框的内容仍然比框宽。因此,您必须在那里调整间距。
\documentclass{beamer}
\usetheme{Darmstadt}
\newcommand\FontSmall{\fontsize{7}{10}\selectfont}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{mathtools} % coloneqq
\usepackage{tcolorbox}
\DeclareMathOperator*{\argmax}{argmax}
\DeclareMathOperator*{\argmin}{argmin}
\renewcommand{\d}{\mathrm{d}}
\newcommand{\E}{\mathbb{E}}
\renewcommand{\P}{\mathbb{P}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\A}{\mathcal{A}}
\newcommand{\B}{\mathcal{B}}
\newcommand{\C}{\mathcal{C}}
\newcommand{\D}{\mathcal{D}}
\newcommand{\G}{\mathcal{G}}
\newcommand{\bigK}{\mathbb{K}}
\newcommand{\bigL}{\mathbb{L}}
\newcommand{\bigU}{\mathbb{U}}
\newcommand{\bigV}{\mathbb{V}}
\colorlet{MyBoxGray}{blue!10!black}
\colorlet{MyBoxLightGray}{black!5!white}
\colorlet{MyBoxBlue}{blue!75!black}
\colorlet{MyBoxLightBlue}{blue!5!white}
\colorlet{MyBoxRed}{red!75!black}
\colorlet{MyBoxLightRed}{red!5!white}
\newtcolorbox{mybox}[2][MyBoxLightGray]{colback=#1,% first argument determines box' background color, optional, if not given, MyBoxLightGray is used
colframe=#2,% second argument determines frame color, mandatory argument
before skip=10pt,
after skip=10pt,
top=0pt,
bottom=0pt,
right=2pt,
left=2pt
}
\begin{document}
%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Separation of mean and covariance steering}
\FontSmall
\begin{columns}
\begin{column}{0.48\textwidth}
\begin{mybox}{MyBoxGray}
\abovedisplayskip=0pt
\belowdisplayskip=0pt
\begin{align*}
J(U,V) &= \E[X^\intercal\bar{Q}X + U^\intercal \bar{R} U - V^\intercal \bar{S} V] \\
X &= \A x_0 + \B U + \C V + \D W
\end{align*}
\end{mybox}
\vspace{2cm}
\begin{mybox}[MyBoxLightBlue]{MyBoxBlue}
Unconstrained Mean Steering Game (UMSG)
\begin{align}
&\textrm{Payoff Function}: J_{\mu}(\bar{U},\bar{V}), \nonumber\\
&\textrm{where}\quad \bar{X} = \A\mu_0 + \B\bar{U} + \C\bar{V}, \nonumber
\end{align}
\end{mybox}
\end{column}
\begin{column}{0.52\textwidth}
\begin{mybox}[MyBoxLightBlue]{MyBoxBlue}
\abovedisplayskip=0pt
\belowdisplayskip=0pt
\begin{align*}
J_{\mu}(\bar{U},\bar{V}) &= \bar{X}^\intercal\bar{Q}\bar{X} + \bar{U}^\intercal \bar{R} \bar{U} - \bar{V}^\intercal\bar{S}\bar{V} \\
\bar{X} := \E[X] &= \A \mu_0 + \B \bar{U} + \C\bar{V}
\end{align*}
\end{mybox}
\begin{mybox}[MyBoxLightRed]{MyBoxRed}
\begin{align*}
J_{\Sigma}(\tilde{U},\tilde{V}) &= \textrm{tr}(\bar{Q}\Sigma_{XX}) + \textrm{tr}(\bar{R}\Sigma_{UU}) - \textrm{tr}(\bar{S}\Sigma_{VV}) \\
\tilde{X} := X - &\E[X] = \A \tilde{x}_0 + \B \tilde{U} + \C\tilde{V} + \D W
\end{align*}
\end{mybox}
\vspace{0.6cm}
\begin{mybox}[MyBoxLightRed]{MyBoxRed}
Unconstrained Covariance Steering Game (CCSG)
\begin{align*}
&\textrm{Payoff Function}: J_{\Sigma}(\tilde{U},\tilde{V}), \nonumber\\
&\textrm{where}\quad \tilde{X} = \A \tilde{x}_0 + \B \tilde{U} + \C\tilde{V} + \D W, \nonumber
\end{align*}
\end{mybox}
\end{column}
\end{columns}
\end{frame}
\end{document}