# A working example of mdframed

I tried to make the basic examples of mdframed given in the corresponding documentation, but I get an error stating

! You can't use a prefix with \begingroup'.


The example is

\documentclass{article}
\usepackage[framemethod=default]{mdframed}
\usepackage{showexpl}

\global\mdfapptodefinestyle{exampledefault}{%
rightline=true,innerleftmargin=10,innerrightmargin=10,
frametitlerule=true,frametitlerulecolor=green,
frametitlebackgroundcolor=yellow,
frametitlerulewidth=2pt}

\begin{document}
\begin{mdframed}[style=exampledefault,frametitle={Inhomogeneous linear}]
\ExampleText
\end{mdframed}
\end{document}


Where did I do wrong?

-
I do not see the \ExampleText being defined in your example. Erase that and insert a sample text, for example, use the lipsum package. –  azetina Apr 17 '12 at 18:16

You have some mistakes in your code:

• You are using \mdfapptodefinestyle. But the style exampledefault isn't defined here. So the command fails. To define a style use \mdfdefinestyle.
• The command \ExampleText is defined in my example files but not in your example. So run:

Here are some comments copied from the example file:

• Every \global inside the examples is necessary to work with the package showexpl.
• All examples have the following settings:

\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
An \textit{inhomogeneous linear} differential equation
has the form
\begin{align}
L[v ] = f,
\end{align}
where $L$ is a linear differential operator, $v$ is
the dependent variable, and $f$ is a given non−zero
function of the independent variables alone.
}


Here an example

\documentclass{article}
\usepackage[framemethod=default]{mdframed}
\usepackage{showexpl}

\mdfdefinestyle{exampledefault}{%
rightline=true,innerleftmargin=10,innerrightmargin=10,
frametitlerule=true,frametitlerulecolor=green,
frametitlebackgroundcolor=yellow,
frametitlerulewidth=2pt}

\begin{document}
\begin{mdframed}[style=exampledefault,frametitle={Inhomogeneous linear}]
Some Text
\end{mdframed}
\end{document}
`
-