阻止文本在阴影环境中变为斜体

阻止文本在阴影环境中变为斜体

我无法让阴影环境中的文本正常显示而不显示斜体。我在下面提供了 MWE。

\documentclass[11pt, oneside]{article}
\usepackage{geometry}
\geometry{letterpaper}
\usepackage{amssymb}
\usepackage{mdframed}

\definecolor{shade}{rgb}{0.9,0.9,0.9}
    \newmdtheoremenv [backgroundcolor=shade,
    innertopmargin =12pt, innerbottommargin =12pt,
    splittopskip = \topskip, skipbelow= 6pt, skipabove=6pt,
    topline=true,bottomline=false,leftline=false,rightline=false,]{shaded}{}
    \renewcommand\theshaded{}

\begin{document}
    \begin{shaded} text \end{shaded}
\end{document}

提前感谢关于如何解决此问题的任何建议!

答案1

如果您使用该包,ntheorem您可以声明它。

\documentclass[11pt, oneside]{article}
 \usepackage{geometry}
 \geometry{letterpaper}
 \usepackage{amssymb}
 \usepackage{mdframed}
\usepackage{ntheorem}
\theorembodyfont{\normalfont}
\definecolor{shade}{rgb}{0.9,0.9,0.9}
      \newmdtheoremenv [backgroundcolor=shade,
      ntheorem,
      innertopmargin =12pt, innerbottommargin =12pt,
      splittopskip = \topskip, skipbelow= 6pt, skipabove=6pt,
      topline=true,bottomline=false,leftline=false,rightline=false,]{shaded}{}
      \renewcommand\theshaded{}

\begin{document}
      \begin{shaded} text \end{shaded}
\end{document}

在此处输入图片描述

答案2

使用 和 来实现这一目的的方法thmtoolsamsthm尽管我没有看到它与mdframed具有用户定义样式的普通环境之间的区别:

\documentclass[11pt, oneside]{article}
\usepackage{geometry}
\geometry{letterpaper}
\usepackage{amsthm, amssymb}%
\usepackage{mdframed, thmtools}
\usepackage{lipsum}
\definecolor{shade}{rgb}{0.9,0.9,0.9}
\mdfdefinestyle{myshadestyle}{backgroundcolor=shade,
innertopmargin=12pt, innerbottommargin=12pt,
splittopskip=\topskip, skipbelow= 6pt, skipabove=6pt,
topline=true,bottomline=false,leftline=false,rightline=false,}
\mdfsetup{style=myshadestyle}   

   \makeatletter
   \def\thmt@headstyle@empty{%
   \relax}
    \makeatother 
    \declaretheoremstyle[
    headstyle=empty,
    notefont=\mdseries, notebraces={(}{)},
    headpunct={\leavevmode\hspace{-0.9\fontdimen2\font}},
    bodyfont=\normalfont,
    ]{mystyle}

\declaretheorem[style=mystyle, mdframed]{shaded}

\begin{document}

\begin{mdframed}[style=myshadestyle] 
  \lipsum[11]
\end{mdframed}

\begin{shaded}%[style=myshadestyle]
  \lipsum[11]
\end{shaded}

\end{document}

在此处输入图片描述

相关内容