1

I just copied a style from the mdframed Documentation.

p4 p5

I cannot find what is wrong with me as "pt" appears above the Theo.

  1. I did modify the color blue to gray.
  2. I use Xetex to compile for my unicode tex.
  3. I have tried putting both in preamble and after.
  4. I altered \frametitleaboveskip-> -15pt [ as the original one didnt work out for me]

    \documentclass[showframe,10pt,a5paper]{article}
    \usepackage[utf8]{inputenc}
    \usepackage{amsmath}
    \usepackage{amsfonts}
    \usepackage{amssymb}
     \usepackage[framemethod=tikz]{mdframed}
    
    
    \begin{document}
      \newcounter{theo}
        \newenvironment{theo}[1][]{%
    \stepcounter{theo}%
    \ifstrempty{#1}%
    {\mdfsetup{%
            frametitle={%
                \tikz[baseline=(current bounding box.east),outer sep=0]\node[anchor=east,rectangle,fill=gray]
                { Theorem~\thetheo};}}
    }%
    {\mdfsetup{%
            frametitle={%
                \tikz[baseline=(current bounding box.east),outer sep=0]
                \node[anchor=east,rectangle,fill=gray]
                { Theorem~\thetheo:~#1};}}%
    }%
    \mdfsetup{innertopmargin=7pt,linecolor=gray!20,linewidth=2pt,topline=true,
        frametitleaboveskip=-15pt\relax,}
    \begin{mdframed}[]\relax%
    }{\end{mdframed}}
    
    
     %Where I start.
    
    \begin{theo}
     hi\end{theo}
     \end{document}
    

pt above it!!!

I cant understand why "pt" is there. Where should I omit it?

Thanks!

3
  • The optional argument #1 is not used other than for the \ifstrempty test? – user31729 Apr 2 '17 at 7:39
  • 1
    Additionally: You're using xelatex, but the document says \usepackage[utf8]{inputenc} -- that does not match, actually – user31729 Apr 2 '17 at 7:52
  • @ChristianHupfer You are right. I removed it n still it works. Never noticed that. Thanks. – Panha Apr 3 '17 at 13:39
4

Using frametitleaboveskip=-15pt\relax this way isn't recognized as dimension value any longer, i.e. -15pt but breaks apart into -15 and pt, which is left in the input then.

Also \stepcounter should be \refstepcounter rather to enable cross-referencing.

showframe isn't used here therefore I removed it.

I also suggest to define the new environment before \begin{document}...

\documentclass[10pt,a5paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[framemethod=tikz]{mdframed}


\newcounter{theo}
\newenvironment{theo}[1][]{%
  \refstepcounter{theo}%
  \ifstrempty{#1}%
  {\mdfsetup{%
      frametitle={%
        \tikz[baseline=(current bounding box.east),outer sep=0]
        \node[anchor=east,rectangle,fill=gray]
        { Theorem~\thetheo};}}
  }%
  {\mdfsetup{%
      frametitle={%
        \tikz[baseline=(current bounding box.east),outer sep=0]
        \node[anchor=east,rectangle,fill=gray]
        { Theorem~\thetheo:~#1};}}%
  }%
  \mdfsetup{innertopmargin=7pt,linecolor=gray!20,linewidth=2pt,topline=true,
    frametitleaboveskip=-15pt}
  \begin{mdframed}[]\relax%
  }{%
\end{mdframed}%
}


% Where I start.

\begin{document}
\begin{theo}
  hi
\end{theo}
\end{document}

enter image description here

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.