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, 2022 at 10:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .