在投影机有一些预定义的(颜色)样式,例如清楚的,定理,定义和评论.我的第一个问题是在哪里可以找到这些样式的列表?第二个是我怎样才能创造自己的风格?例如,我想申请橙子颜色用于备注。
答案1
下面介绍了如何轻松定义新的自定义类定理块;我们的想法是使用自定义设置定义一种新样式,然后将这种新样式用于您的结构:
\documentclass{beamer}
\usetheme{Warsaw}
\makeatletter
\def\th@mystyle{%
\normalfont % body font
\setbeamercolor{block title example}{bg=orange,fg=white}
\setbeamercolor{block body example}{bg=orange!20,fg=black}
\def\inserttheoremblockenv{exampleblock}
}
\makeatother
\theoremstyle{mystyle}
\newtheorem*{remark}{Remark}
\begin{document}
\begin{frame}
\begin{theorem}[An important theorem]
Some text
\end{theorem}
\begin{remark}[Some important remark]
Some text
\end{remark}
\end{frame}
\end{document}
类定理结构定义的相关设置:
在文件中beamerbasetheorems.sty
找到:
\def\th@example{\th@remark}
和
\ifbeamer@countsect
\newtheorem{theorem}{\translate{Theorem}}[section]
\else
\newtheorem{theorem}{\translate{Theorem}}
\fi
\newtheorem{corollary}[theorem]{\translate{Corollary}}
\newtheorem{fact}[theorem]{\translate{Fact}}
\newtheorem{lemma}[theorem]{\translate{Lemma}}
\newtheorem{problem}[theorem]{\translate{Problem}}
\newtheorem{solution}[theorem]{\translate{Solution}}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{\translate{Definition}}
\newtheorem{definitions}[theorem]{\translate{Definitions}}
\theoremstyle{example}
\newtheorem{example}[theorem]{\translate{Example}}
\newtheorem{examples}[theorem]{\translate{Examples}}
这意味着该example
风格与注释风格相同;该plain
风格用于定理、推论、引理、问题、解决方案。该definition
风格适用于定义,而该example
风格适用于示例。
也可能相关的是
\def\inserttheoremheadfont{\the\thm@headfont}
\def\inserttheoremblockenv{block}
\def\th@example{%
\normalfont % body font
\def\inserttheoremblockenv{exampleblock}
}
这基本上表明,对于示例样式,exampleblock
使用,但对于所有其他类定理结构,block
使用。
其中beamerbaseauxtemplates.sty
一项发现:
\defbeamertemplate{theorem begin}{ams style}
{%
\begin{\inserttheoremblockenv}
{%
\inserttheoremheadfont
\inserttheoremname
\inserttheoremnumber
\ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
\inserttheorempunctuation
}%
}
\defbeamertemplate{theorem end}{ams style}
{\end{\inserttheoremblockenv}}
\defbeamertemplate{theorem begin}{numbered}
{%
\begin{\inserttheoremblockenv}
{%
\inserttheoremname
\inserttheoremnumber
\ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
}%
}
\defbeamertemplate{theorem end}{numbered}
{\end{\inserttheoremblockenv}}
\defbeamertemplate{theorem begin}{normal font}
{
\normalfont
\begin{\inserttheoremblockenv}
{%
\inserttheoremname
\ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
}%
}
\defbeamertemplate{theorem end}{normal font}
{\end{\inserttheoremblockenv}}