mdframed icon indicating copy to clipboard operation
mdframed copied to clipboard

subtitleabovelinecolor and subtitlebelowlinecolor not recognized with framemethod=TikZ option

Open Sonja-K opened this issue 6 years ago • 0 comments

When using the package option framemethod=TikZ, the options subtitleabovelinecolor and subtitlebelowlinecolor are not correctly recognized.

This has also been posted on tex.stackexchange: subtitleabovelinecolor option not taken into account

From the following MWE we would expect all lines to be red. However, we recieve the following output with the before mentioned lines still having their default color (black):

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

    \newmdenv[
        outerlinewidth=1.5pt,
          linecolor=red,
        subtitleaboveline=true,
          subtitleabovelinecolor=red,
          subtitleabovelinewidth=1.5pt,
        subtitlebelowline=true,
          subtitlebelowlinecolor=blue,
          subtitlebelowlinewidth=1.5pt,
        frametitle={Theorem},]{subtitleenv}
        
\begin{document}
    \begin{subtitleenv}
        Some Text\ldots
        \mdfsubtitle{Notes}
            Some Text\ldots
    \end{subtitleenv}
\end{document}

Looking through the definitions in md-frame-1.mdf we can find the following code in lines 681-694:

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

According to these lines drawsubtitleaboveline flasely inherits its color from mdfsubsubtitleaboverule and drawsubtitlebelowline inherits its color from mdfsubsubtitleaboverule. To fix this, the above quoted code should be replaced by the following lines:

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

Sonja-K avatar Dec 23 '19 10:12 Sonja-K