3

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 ;-)

3

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

0

You can use ntheorem as in

\documentclass[a4paper,12pt]{article}
\usepackage{framed} 
\usepackage[framed]{ntheorem}
\theoremstyle{nonumberplain}
\newtheorem{mytheo}{Remark}
\newframedtheorem{fmytheo}{Remark}
\begin{document}

\begin{mytheo}
This is a remark. It is not framed.
\end{mytheo}

\begin{fmytheo}
This is a remark. It is  framed.
\end{fmytheo}
\end{document} 

The type of frame can easily be redefined.

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.