使用ntheorem
包, 的定义\newshadedtheorem
会覆盖\theoremprework
,我想用它\emph
在自定义阴影定理中重新定义。 的定义\newshadedtheorem
是:
\def\newshadedtheorem#1{%
\expandafter\global\expandafter\xdef\csname#1@shadecolor\endcsname{%
\the\shadecolor}%
\ifx\theoremframecommand\relax
\expandafter\global\expandafter\xdef\csname#1@framecommand\endcsname{%
\noexpand\psframebox[fillstyle=solid,
fillcolor=\csname#1@shadecolor\endcsname,
linecolor=\csname#1@shadecolor\endcsname]}%
\else
\expandafter\global\expandafter\let\csname#1@framecommand\endcsname%
\theoremframecommand%
\fi
\theoremprework{%
\def\FrameCommand{\csname#1@framecommand\endcsname}%
\vskip\theoremframepreskipamount\framed}%
\theorempostwork{\endframed\vskip\theoremframepostskipamount}%
\newtheorem@i{#1}%
}
我想要做的最简单的例子:
\documentclass[a4paper]{scrartcl}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{framed}
\usepackage[amsmath,hyperref,noconfig,framed]{ntheorem}
\usepackage{hyperref}
% bakup old emph
\let\oldEmph=\emph
\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremprework{\renewcommand{\emph}[1]{\oldEmph{{\color{blue}##1}}}}
\theorempostwork{\renewcommand{\emph}[1]{\oldEmph{##1}}}
\def\theoremframecommand{\colorbox{blue!10}}
\newshadedtheorem{definition}{\color{blue}Definition}[section]
\begin{document}
\begin{definition}
Test of \emph{emph} inside Definiton.
\end{definition}
\end{document}
有人知道如何实现这一点吗?
答案1
定义辅助环境:
\newshadedtheorem{definition*}{\color{blue}Definition}[section]
\newenvironment{definition}
{\renewcommand{\emph}[1]{\oldEmph{{\color{blue}##1}}}%
\begin{definition*}}
{\end{definition*}}