beamer中重定义AMSTHM定理环境—\renewtheorem的替代
重定义定理
只需将下列代码放到preamble, 注意beamer中需要放在CJK环境中. 就会实现重定义定理环境theorem(lemma等类似), 而且会自动编号.
1 2 3 4 5 |
\newtheorem*{inner}{\innerheader} \newcommand{\innerheader}{} \renewenvironment{theorem} {\renewcommand\innerheader{定理\,\stepcounter{theorem}\thetheorem}\begin{inner}} {\end{inner}} |
定理分页
1 2 3 4 5 6 7 8 9 10 |
\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 |
测试如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
\documentclass[CJK]{beamer} \usetheme{Warsaw} \usepackage{CJK} \usepackage{lipsum} \begin{document} \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*} \end{document} |
本作品采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载本站内容必须也遵循署名-非商业用途-保持一致的创作共用协议.
发表回复