beamer中重定义AMSTHM定理环境—\renewtheorem的替代
重定义定理
只需将下列代码放到preamble, 注意beamer中需要放在CJK环境中. 就会实现重定义定理环境theorem(lemma等类似), 而且会自动编号.
\newtheorem*{inner}{\innerheader} \newcommand{\innerheader}{} \renewenvironment{theorem} {\renewcommand\innerheader{定理\,\stepcounter{theorem}\thetheorem}\begin{inner}} {\end{inner}}
定理分页
\newcounter{thmc} \renewcommand{\thmhead}{定理\,\stepcounter{theorem}\thetheorem\setcounter{thmc}{0}} \newcommand{\thmheadc}{定理\,\thetheorem\,续\,\stepcounter{thmc}\Roman{thmc}} \makeatletter \newenvironment<>{theorem}[1][\thmhead]{% \par \def\insertproofname{#1\@addpunct{.}}% \usebeamertemplate{proof begin}#2} {\usebeamertemplate{proof end}} \makeatother
测试如下:
\usetheme{Warsaw} \begin{CJK*}{GBK}{song} \newcounter{thmc} \renewcommand{\thmhead}{定理\,\stepcounter{theorem}\thetheorem\setcounter{thmc}{0}} \newcommand{\thmheadc}{定理\,\thetheorem\,续\,\stepcounter{thmc}\Roman{thmc}} \makeatletter \newenvironment<>{theorem}[1][\thmhead]{% \par \def\insertproofname{#1\@addpunct{.}}% \usebeamertemplate{proof begin}#2} {\usebeamertemplate{proof end}} \makeatother \begin{frame} \begin{theorem} \lipsum[1] \end{theorem} \end{frame} \begin{frame} \begin{theorem}[\thmheadc] \lipsum[1] \end{theorem} \end{frame} \begin{frame} \begin{theorem}[\thmheadc] \lipsum[1] \end{theorem} \end{frame} \begin{frame} \begin{theorem} \lipsum[1] \end{theorem} \end{frame} \begin{frame} \begin{theorem}[\thmheadc] \lipsum[1] \end{theorem} \end{frame} \end{CJK*}