# subtitleabovelinecolor option not taken into account

I'm using the mdframed package to draw a theorem command.

However, the option subtitleabovelinecolor of the subtitle frame is not taken into account, while the command subtitleabovelinewidth is.

Here is a MWE with the problem :

\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage[framemethod=TikZ,xcolor]{mdframed}
\begin{document}
\newmdenv[
roundcorner=5pt,
outerlinewidth=1.5pt,
linecolor=red,
subtitleabovelinecolor=red,
subtitleabovelinewidth=1.5pt,
subtitleaboveline=true,
frametitle={Theorem},]{subtitleenv}
\begin{subtitleenv}
Some Text\ldots
\mdfsubtitle{Notes}
Some Text\ldots
\end{subtitleenv}
\end{document}


Which produces this :

I'm following the guidelines explained in the manual at page 11.

Any ideas where I'd be wrong ? I've tried modifying the order of the options, without success.

• use tcolorbox instead of mdframed - it is much better. Dec 23 '19 at 9:51

This seems like a bug in the file md-frame-1.mdf.

The following MWE contains a locally usable fix that corrects the incorrect definitions for both the framesubtitleabove and the framesubtitlebelow lines of the framemethod=tikz. I have added annotations to the code showing what I replaced.

\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage[framemethod=TikZ,xcolor]{mdframed}

\makeatletter

\def\mdf@drawsubtitleaboveline{%
\rlap{%
\hspace*{-\mdf@innerleftmargin@length}%
\tikz\draw[mdfsubtitleaboverule](0,0) rectangle         %<----- replaced mdfsubsubtitleaboverule with mdfsubtitleaboverule
(\mdf@templength,\mdf@subtitleabovelinewidth@length);%
}%
}
\def\mdf@drawsubtitlebelowline{%
\rlap{%
\hspace*{-\mdf@innerleftmargin@length}%
\tikz\draw[mdfsubtitlebelowrule](0,0) rectangle      %<------ replaced mdfsubsubtitleaboverule with mdfsubtitlebelowrule
(\mdf@templength,\mdf@subtitlebelowlinewidth@length);%
}%
}

\makeatother

\newmdenv[
roundcorner=5pt,
outerlinewidth=1.5pt,
linecolor=red,
subtitleaboveline=true,
subtitleabovelinecolor=red,
subtitleabovelinewidth=1.5pt,
subtitlebelowlinecolor=blue,
subtitlebelowlinewidth=1.5pt,
subtitlebelowline=true,
frametitle={Theorem},]{subtitleenv}

\begin{document}

\begin{subtitleenv}
Some Text\ldots
\mdfsubtitle{Notes}
Some Text\ldots
\end{subtitleenv}
\end{document}

• Thanks for the solution and the issue on GH. However, this package is quite deprecated (latest commit in 2014) so I've jumped to tcolorbox instead. Dec 23 '19 at 15:18

As suggested by @ulrike-fischer, a solution can be achieved by using the tcolorbox package.

Here is a MWE :

\documentclass[]{article}
\usepackage[table,dvipsnames]{xcolor}
\usepackage[breakable,skins,xparse]{tcolorbox}

\begin{document}

\tcbset{colback=white,
colframe=red!75!black,
fonttitle=\bfseries,
}
\begin{tcolorbox}[title=Theorem,enhanced,breakable]
Some Text \dots
\tcbsubtitle[before skip=\baselineskip]{Notes}
Some Text\dots
\end{tcolorbox}

\end{document}


And the output is this :