3

I want to do this mdframed model:

theo

Which is the example 6 of the page 21 and 22 of this pdf: http://texdoc.net/texmf-dist/doc/latex/mdframed/mdframed.pdf

My question is if it is correct or not, and if it's correct, which packages are the ones that I need, because I copy it with the blankspaces, putting all packages in the pdf, and it doesn't work (I copied the ExampleText too).

The mistakes that are shown when I compile says:

-Missing number, treated as zero \protect -Illegal unit of measure (pt inserted)

1
  • 2
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – onewhaleid
    Feb 13, 2015 at 6:21

1 Answer 1

5

Here is the compilable code:

\documentclass{article}
\usepackage{amsmath}
\usepackage[framemethod=TikZ]{mdframed}
%% the following is commaon for all examples in mdframed manual
\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.
}
%%% upto here
\newcounter{theo}[section]
\newenvironment{theo}[1][]{%
\stepcounter{theo}%
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!20]
{\strut Theorem~\thetheo};}}
}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!20]
{\strut Theorem~\thetheo:~#1};}}%
}%
\mdfsetup{innertopmargin=10pt,linecolor=blue!20,%
linewidth=2pt,topline=true,
frametitleaboveskip=\dimexpr-\ht\strutbox\relax,}
\begin{mdframed}[]\relax%
}{\end{mdframed}}


\begin{document}
    \begin{theo}[Inhomogeneous Linear]
        \ExampleText
    \end{theo}
    \begin{theo}
        \ExampleText
    \end{theo}
\end{document}

enter image description here

Compare it with the code you have assembled to see what is missing.

One thing which I forgot to mention and reminded by Karl, is the in −\ht (frametitleaboveskip=\dimexpr−\ht\strutbox\relax to be precise) which is a unicode symbol (U+2212 char, thanks to Karl for the code) which should be minus sign.

6
  • 2
    Copying and pasting from the manual, there is a \dimexpr−\ht\strutbox\relax with a U+2212 char instead of the minus sign as in the correct \dimexpr-\ht\strutbox\relax. Feb 13, 2015 at 6:37
  • @karlkoeller Err. I totally forgot to mention it after having corrected it. I will add thanks. :-)
    – user11232
    Feb 13, 2015 at 6:48
  • sigh. another one-line align. not recommended -- equation is what is recommended here. Feb 13, 2015 at 13:49
  • @barbarabeeton Thank you but it is directed straight to Marco Daniel as it exists that way in mdframed manual. I was just reprodiucing it as OP wants it so. :-)
    – user11232
    Feb 13, 2015 at 13:57
  • I have found the mistake: The package [utf8]{inputenc} creates an error with the code. How can I solve this?
    – iam_agf
    Feb 14, 2015 at 19:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .