0

How do I define \newtheorem{thm}{Theorem}[section] inside the shaded box \newcommand{\resheading}[1]{{\small \colorbox{lightgray}{\begin{minipage}{0.975\textwidth}{\textbf{#1 \vphantom{p\^{E}}}}\end{minipage}}}}

I know I can just call the resheading command every time I write a theorem, but it'd be more convenient if that process itself were automated.

1 Answer 1

1

I don't know exactly if this is what you want, but you can try the following:

Define a new theorem to get the counter

\newtheorem{thm}{Theorem}[section]

Redefine the environment to use the shaded block

\renewenvironment{thm}{
\stepcounter{thm}
\begin{center}
\begin{minipage}{12cm}
\colorlet{shadecolor}{lightgray}
\begin{shaded}
{\bfseries Theorem \thethm: }\\
}
{
\end{shaded}
\end{minipage}
\end{center}
}

Then use the newly-created environemnt

\begin{thm}
 This is my theorem
\end{thm}

enter image description here

1
  • this was just top of the mind for a simple use, but you can always increment it
    – Accácio
    Feb 28 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.