2010-04-08 196 views
3

amsthm定理环境(定理,例子,证明,解决方案......)可以在投影仪幻灯片上创建块。默认情况是示例环境使用与定理或解或证明(块)不同的模板(块示例)。如何更改特定定理环境下的块模板(LaTeX投影仪)

我该如何使解决方案使用不同的模板,如我可以定义的“块解决方案”?

编辑:感谢那些回答。我还没有实现一种解决方法还没有,但它好像有两个想法:

  • 重新定义名为foo定理般的环境中\[email protected]命令。新命令应该将\inserttheoremblockenv重新定义为所需的块环境。请参见beamerbasetheorems.sty(在第63行左右),了解如何针对example专门进行此操作。

  • 重新定义theorem begintheorem end模板来查找基于全局变量\inserttheoremname(见beamerinnerthemedefault.sty)正确的定理块环境。查找表可以保存在pgfkeys注册表中。这种方法会更高一些,不会涉及任何带有@的命令;然而,YAGNI想到。

回答

1

beamerbasetheorems.sty看出:

\documentclass[notheorems]{beamer} 

\theoremstyle{plain} 
\newtheorem{theorem}{\translate{Theorem}} 
\newtheorem{example}[theorem]{\translate{Example}} 

% or 

\theoremstyle{definition} 
\newtheorem{theorem}{\translate{Theorem}} 
\newtheorem{example}[theorem]{\translate{Example}} 

% or 

\theoremstyle{example} 
\newtheorem{theorem}{\translate{Theorem}} 
\newtheorem{example}[theorem]{\translate{Example}} 

无论风格你喜欢。您也可以更改[警示|示例]的外观块:

\setbeamercolor{block body}{fg=blue,bg=white} 
\setbeamercolor{block body alerted}{fg=blue,bg=white} 
\setbeamercolor{block body example}{fg=blue,bg=white} 

(没试过,只是看着到投影仪光源)

编辑:还没确定要你想做的事,但你可以定义自己的风格定理:

\makeatletter 
\def\[email protected]{% 
    \normalfont % body font 
    \def\inserttheoremblockenv{alertblock} 
} 
\theoremstyle{something} 
\newtheorem{warn}[theorem]{WARNING} 
\makeatother 

\begin{warn}[Attention please] 
This is dangerous 
\end{warn} 

(这工作,我测试了它)

你有3个预定义的块,并且可以使用\ defbeamertemplate进行自定义。查看有关如何执行此操作的来源和文档。如果您需要更多块的环境,看到basebeamerlocalstructure.sty

\newenvironment<>{alertblock}[1]{% 
    \begin{actionenv}#2% 
     \def\insertblocktitle{#1}% 
     \par% 
     \mode<presentation>{%\usebeamerfont{block}% 
     \setbeamercolor{local structure}{parent=alerted text}}% 
     \usebeamertemplate{block alerted begin}} 
    {\par% 
     \usebeamertemplate{block alerted end}% 
    \end{actionenv}} 

希望帮助

+0

我真正想要做的是创造定理/例子/警报块一个新的选择。 beamerbasetheorems.sty覆盖了amsthm的内部结构,以便在定理类环境开始时使用“定理开始”模板。该模板启动名为'\ insertblockenv'的块环境。这个宏在beamerbasetheorems.sty中被定义为“block”,并且只有在内部'\ th @ example'的重写中,'\ insertblockenv'宏被重新定义为“exampleblock”。所以这些都是你的选择:如果定理样式是例子,block o/w,那么exampleblock。 也许模板可以改编? – 2010-04-09 12:25:33

+0

是否要更改现有的块环境或定义新的块环境? – Meinersbur 2010-04-09 21:07:50

+0

我想更改现有的块环境。我不希望“定理”和“解决方案”(例如)在同一个beamercolorbox中。 我不会再有机会再回到这一两天,但我认为可以在'theorem begin'模板中使用PGF的关键注册表来完成某些事情。 – 2010-04-10 11:27:03

相关问题