Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
I can confirm that this is clearly not an artifact produced by the PDF viewer... –  Count Zero Jul 15 '13 at 13:54

1 Answer 1

up vote 11 down vote accepted

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.

share|improve this answer
    
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@subtitlebackgroundco‌​lor}} –  Marco Daniel Jul 15 '13 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 ;-) –  Gonzalo Medina Jul 15 '13 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. –  Marco Daniel Jul 15 '13 at 16:46
    
@MarcoDaniel great! I also updated my answer. Please let me know if you think it's OK now. –  Gonzalo Medina Jul 15 '13 at 17:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.