Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

1 Answer 1

up vote 3 down vote accepted

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.