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


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


Redefine the environment to use the shaded block

{\bfseries Theorem \thethm: }\\

Then use the newly-created environemnt

 This is my theorem

enter image description here

  • 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.