![使用 ntheorem 中的 \newshadedtheorem 在定理中重新定义 \emph](https://linux22.com/image/248014/%E4%BD%BF%E7%94%A8%20ntheorem%20%E4%B8%AD%E7%9A%84%20%5Cnewshadedtheorem%20%E5%9C%A8%E5%AE%9A%E7%90%86%E4%B8%AD%E9%87%8D%E6%96%B0%E5%AE%9A%E4%B9%89%20%5Cemph.png)
使用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*}}