[Tex/LaTex] Redefine \emph inside theorem using \newshadedtheorem from ntheorem

emphasisframedntheoremtheorems

Using the ntheorem package, the definition of \newshadedtheorem overwrites the \theoremprework, which I wanted to use to redefine \emph inside a custom shaded theorem. The definition of \newshadedtheorem is:

\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}%
}

Minimal example of what I want to do:

\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}

Does anybody know how to achieve this?

Best Answer

Define an auxiliary environment:

\newshadedtheorem{definition*}{\color{blue}Definition}[section]
\newenvironment{definition}
  {\renewcommand{\emph}[1]{\oldEmph{{\color{blue}##1}}}%
   \begin{definition*}}
  {\end{definition*}}