使用 cellcolor 时 \begin{block}{|ccc|} 不起作用
\documentclass[10pt,dvipsnames,svgnames]{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage{amsmath,mathtools}
\usepackage{colortbl}
\usepackage{blkarray}
\newcommand\y{\cellcolor{green!20}}
\begin{document}
%
\begin{frame}
%
\begin{align*}
\begin{blockarray}{ccc}
\begin{block}{|ccc|}
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
\end{block}
C_1 & C_2 & C_3 \\
\end{blockarray}
%
=
%
\begin{blockarray}{ccc}
\begin{block}{|ccc|}
1 & \multicolumn{1}{c}{\cellcolor{blue!10}2} & 3 \\
1 & 2 & 3 \\
1 & \multicolumn{1}{c}{\y 2} & 3 \\
\end{block}
C_1 & C_2 & C_3 \\
\end{blockarray}
\end{align*}
%
\end{frame}
\end{document}
答案1
回答这个问题:使用\makecell
。我还添加了一种临时方法来使=
标志居中。
\documentclass[10pt,dvipsnames,svgnames]{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage{amsmath,mathtools}
\usepackage{colortbl}
\usepackage{blkarray}
\usepackage{makecell}
\newcommand\y{\cellcolor{green!20}}
\begin{document}
%
\begin{frame}
%
\begin{align*}
\begin{blockarray}{ccc}
\begin{block}{|ccc|}
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
\end{block}
C_1 & C_2 & C_3 \\
\end{blockarray}
%
\begin{blockarray}{c}
\begin{block}{c}
\\
=\\
\\
\end{block}
\\
\end{blockarray}
%
\begin{blockarray}{ccc}
\begin{block}{|ccc|}
1 & \makecell{\cellcolor{blue!10}2} & 3 \\
1 & 2 & 3 \\
1 & \makecell{\y 2} & 3 \\
\end{block}
C_1 & C_2 & C_3 \\
\end{blockarray}
\end{align*}
%
\end{frame}
\end{document}