0

Consider the following MWE:

\documentclass{article}

\usepackage[framemethod=TikZ]{mdframed} % noteboxes, boxes, etc.
\usepackage{calc}

\newcommand{\definebox}[2]{%
    \newcounter{#1}
    \newenvironment{#1}[1][]{%
        \stepcounter{#1}%
        \mdfsetup{%
            frametitle={%
                \tikz[]
                \node[rectangle,fill=white]
                {\strut \MakeUppercase#1~\csname the #1\endcsname\ifstrempty{##1}{}{:~##1}};}}%
        \mdfsetup{innertopmargin=1pt,linecolor=#2,%
            linewidth=2pt,topline=true,
            frametitleaboveskip={\dimexpr (\ht\strutbox)*-1\relax},}%
        \begin{mdframed}[]\relax%
        }{\end{mdframed}}%
}

\definebox{definition}{}

\begin{document}
    \section{Cats}
        Warm kitty, sweet kitty, little ball of fur. Warm kitty, sweet kitty, purr, purr, purr.

    \begin{definition}[Kitten.]
        A kitten is a baby cat.
    \end{definition}
\end{document}

It produces this as output:

enter image description here

If I change frametitleaboveskip={\dimexpr (\ht\strutbox)*-1\relax} to frametitleaboveskip={\dimexpr (\ht\strutbox)*-2\relax}, the output will look like:

enter image description here

But if change it to frametitleaboveskip={\dimexpr (\ht\strutbox)*-1.99\relax}, the output seems to be the same as frametitleaboveskip={\dimexpr (\ht\strutbox)*-1\relax} except for a mysterious pt that appears:

enter image description here

How can I move the frametitle box up by a real amount?

ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
bzm3r
  • 3,196

1 Answers1

1

See this explanation: https://tex.stackexchange.com/a/126359/47927

So, in short, you have to reorder

\dimexpr (\ht\strutbox)*-1.99\relax

to

\dimexpr -1.99\ht\strutbox\relax