代码:

代码:

当我尝试使用以下代码将复选标记变为黑色时,它不起作用;复选标记显示为红色。我如何将其变为黑色?

\documentclass{beamer}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\usepackage{color, xcolor, graphicx}
\usepackage[english]{babel}

\usetheme{Warsaw}
\usecolortheme{beaver}
\setbeamercolor{math text}{fg=darkred!70!black}

\begin{document}
\begin{frame}{Title}
    \begin{block}{Example}
        Let $G = <a, b, c \mid [ab], [bc]>$, $w_1 = c$, and $w_2 = ab$.

        Shortest? \pause \textcolor{black}{\checkmark}
    \end{block}
\end{frame}
\end{document}

答案1

您已将数学文本的颜色定义为红色。因此,您得到的是红色。要使其他数学以其他颜色显示,您可以采用以下技巧:

重新定义组中的数学文本颜色:

{\setbeamercolor{math text}{fg=black}{\checkmark}}

查看左括号和右括号(组)

或者定义一个具有可选颜色的宏(默认为黑色):

\newcommand{\blaak}[2][black]{%
\bgroup
\setbeamercolor{math text}{fg=#1}{#2}
\egroup
}%

并将其用作:

\blaak[blue]{\checkmark} %% or
\blaak{\checkmark}

代码:

\documentclass{beamer}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\usepackage{color, xcolor, graphicx}
\usepackage[english]{babel}

\usetheme{Warsaw}
\usecolortheme{beaver}
\setbeamercolor{math text}{fg=darkred!70!black}
\newcommand{\blaak}[2][black]{%
\bgroup
\setbeamercolor{math text}{fg=#1}{#2}
\egroup
}%

\begin{document}
\begin{frame}{Title}
    \begin{block}{Example}
        Let $G = <a, b, c \mid [ab], [bc]>$, $w_1 = c$, and $w_2 = ab$.

        Shortest? \pause {\setbeamercolor{math text}{fg=black}{\checkmark}} $\textcolor{black}{\checkmark}$
        \blaak[blue]{\checkmark} \blaak{\checkmark}
    \end{block}
\end{frame}
\end{document}

相关内容