# mdframed: setting up a global environment

How do I set up a global mdframed environment?

Would I add something like this in the preamble:

\newtheorem{laws}
\mdfsetup{%
background = blue!30,%
roundcorner = 5pt
}
}


but then I want to be able to add the title by doing

\begin{mdframed}{title}
information
\end{mdframed}


The new environment would then look like:

-

I am not sure if this is what you need, but you could use \newmdtheoremenv and the optional argument for the defined structure:

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

\newmdtheoremenv[
backgroundcolor = blue!30,
roundcorner = 5pt,
]{laws}{Law}

\begin{document}

\begin{laws}[Newton's First Law]
Every body persists in its state of being at rest or of moving uniformly straight forward, except insofar as it is compelled to change its state by force impressed.
\end{laws}

\end{document}


If no numbering and no special treatment (as in theorem-like structure) is needed, then one could say something like:

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

\newmdenv[
backgroundcolor = blue!30,
roundcorner = 5pt,
]{lw}
\newenvironment{laws}[1]
{\begin{lw}[frametitle=#1]}
{\end{lw}}

\begin{document}

\begin{laws}{Newton's First Law}
Every body persists in its state of being at rest or of moving uniformly straight forward, except insofar as it is compelled to change its state by force impressed.
\end{laws}

\end{document}


-
Could the word law and the indexing be removed? –  dustin Jul 22 '13 at 18:21
I added a picture to demonstrate what I mean. –  dustin Jul 22 '13 at 18:26
@dustin please see my updated answer. –  Gonzalo Medina Jul 22 '13 at 18:27
That is great thanks. –  dustin Jul 22 '13 at 18:28
@dustin You're welcome! –  Gonzalo Medina Jul 22 '13 at 18:29