[Tex/LaTex] A framed theorem without numbering

mdframednumberingtheorems

Is it possible to draw a frame around a theorem-like environment ? If possible, I would like to use mdframed.

In the documentation, the general form of the command is given by

\newmdtheoremenv[<mdframedoptions>]{<envname>}
[<numberedlike>]{<caption>}[<within>]

I wonder if an appropriate <numberedlike> could do it.

Thanks for your help 😉

Best Answer

You have two options:

  1. You can define a structure using \mdtheorem which automatically generates a numbered version and an unnumbered one accessed using the starred version of the name (see the definition and use of mytheoi below).

  2. Use \newtheorem* (from amsthm or ntheorem) to define an unnumbered structure and then surround it with an mdframed (see mytheoii below).

The code:

\documentclass{article}
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}

\mdtheorem[backgroundcolor=cyan]{mytheoi}{Theorem}

\newtheorem*{mytheoii}{Theorem}
\surroundwithmdframed[backgroundcolor=orange]{mytheoii}

\begin{document}

\begin{mytheoi*}
test
\end{mytheoi*}

\begin{mytheoii}
test
\end{mytheoii}

\end{document}

enter image description here