色が多すぎるのを避けるために、テキストの項目を強調するために、beamer の色を使用します。次のようになります。
\documentclass[xcolor=dvipsnames]{beamer}
\usetheme{Madrid}
\newcommand{\gn}[1]{\textcolor{block title example.bg}{{}#1{}}}
\begin{document}
\begin{frame}{Green text}
\gn{This isn't working.}
\begin{example}[boring example]
nothing to see here.
\end{example}
\gn{This is green.}
This is black.
\end{frame}
\end{document}
さて、ビーマーが初めて色を使用する前にその色を使用しようとすると (「これは機能していません」のように)、次のエラーが発生します。
Package xcolor Error: Undefined color `block title example.bg'.
これを解決する方法はありますか?
答え1
\usebeamercolor[bg]{block title example}
色を使う
\documentclass[xcolor=dvipsnames]{beamer}
\usetheme{Madrid}
\newcommand{\gn}[1]{{\usebeamercolor[bg]{block title example}#1}}
\begin{document}
\begin{frame}{Green text}
\gn{This isn't working.}
\begin{example}[boring example]
nothing to see here.
\end{example}
\gn{This is green.}
This is black.
\end{frame}
\end{document}