11

I am having a small problem with mdframed.sty. The subtitle block seems to have a 0.4pt frame with the same color of the subtitle background. This causes the left and right ends of the subtitle frame to intrude a bit into the overall linewidth of the frame:

mdframed subtitle frame problem

This is directly from the code in the users guide:

\documentclass{amsart}

\usepackage[tikz]{mdframed}

\usepackage{xcolor}

\newmdenv[%
    roundcorner=5pt,
    subtitlebelowline=true,subtitleaboveline=true,
    subtitlebackgroundcolor=yellow!70!white,
    backgroundcolor=blue!20!white,
    frametitle={Theorem},frametitlerule=true,
    frametitlebackgroundcolor=yellow!70!white,
]{subtitleenv}


\begin{document}

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

\end{document}

I looked at the code (and very lucid it is) but can find no incantation that addresses the linewidth of subtitle frame as a whole.

Suggestions?

1
  • I can confirm that this is clearly not an artifact produced by the PDF viewer...
    – Count Zero
    Commented Jul 15, 2013 at 13:54

1 Answer 1

10

The problem is that the mdfsubtitlebackground style (found in the file md-frame-1.mdf which provides the style for mdframed with the option framemethod=tikz) uses draws using the background color; the definition:

\tikzset{mdfsubtitlebackground/.style={%
   draw=\mdf@subtitlebackgroundcolor,
   fill=\mdf@subtitlebackgroundcolor,
  }%
}

A simple fix is to set this style using draw=none:

\documentclass{amsart}
\usepackage[tikz]{mdframed}
\usepackage{xcolor}

\makeatletter
\tikzset{
mdfsubtitlebackground/.style={
  draw=none,
  fill=\mdf@subtitlebackgroundcolor}
}
\makeatother

\newmdenv[%
    innerlinewidth=0.2pt,
    roundcorner=5pt,
    subtitlebelowline=true,subtitleaboveline=true,
    subtitlebackgroundcolor=yellow!70!white,
    backgroundcolor=blue!20!white,
    frametitle={Theorem},frametitlerule=true,
    frametitlebackgroundcolor=yellow!70!white,
]{subtitleenv}

\begin{document}

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

\end{document}

enter image description here

enter image description here

As the package author has commented, this issue has been now fixed and it will be corrected in a new version of the package.

4
  • I didn't missed the space. I missed the correct definition. Instead of draw I wanted to use path. However a small fix is: \tikzset{mdfsubtitlebackground/.style={draw=none,fill=\mdf@subtitlebackgroundcolor}} Commented Jul 15, 2013 at 16:38
  • @MarcoDaniel I also considered this, but I wasn't sure if the idea was to also have the possibility (at some point) to draw a frame for the subtitle. I have to leave now, but I'll edit my answer later... or, if you can, feel free to add your own answer, or edit mine ;-) Commented Jul 15, 2013 at 16:45
  • Fixed: github.com/marcodaniel/mdframed/commit/… ;-) -- The lines are drawn by an extra tikz style so I think that path is a good choice. Commented Jul 15, 2013 at 16:46
  • @MarcoDaniel great! I also updated my answer. Please let me know if you think it's OK now. Commented Jul 15, 2013 at 17:55

You must log in to answer this question.

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