# mdframed behaves differently in TeXlive 2011 and TeXlive 2012

I've noted some inconsistencies between TeXlive 2011 and TeXlive 2012. I'm maintaining a documentclass which I suddenly realized was not working perfectly after updating to TeXlive 2012.

The problem was a conflict bewteen amsthm and thmtools (although I wasn't able to get a reasonably sized MWE illustrating that particular problem).I opted to rewrite the theorem environments in my documentclass, using ntheorem instead and bypassing thmtools. Everything looked fine until I noticed that my framed (mdframed-style) theorems have the wrong margins in TL2012. (This problem is completely independent of the first one I ran into.)

Consider the following code:

\documentclass[twoside]{article}
\usepackage{lipsum}
\usepackage[framemethod=TikZ]{mdframed}

\mdfdefinestyle{mdtheoremstyle}{%
linewidth=1pt,
roundcorner=4pt,
frametitlerule=false,%
apptotikzsetting={
\tikzset{mdfframetitlebackground/.append style={fill=black!25}}
\tikzset{mdfbackground/.append style={fill=black!10}}
},
frametitlefont={\sffamily\bfseries\small},
theoremtitlefont={\sffamily\small},
font=\itshape,
frametitleaboveskip=3pt plus 1pt,
frametitlebelowskip=2pt plus 1pt,
innertopmargin=7pt plus 1pt minus 1pt,
innerbottommargin=8pt plus 1pt minus 1pt,
usetwoside=false,
leftmargin=0pt,
rightmargin=0pt,
skipabove=14pt plus 2pt minus 6pt,
skipbelow=14pt plus 2pt minus 6pt
}
\mdtheorem[style=mdtheoremstyle]{fancytheorem}{Theorem}

\begin{document}

\lipsum[1]
\begin{fancytheorem}
Deep and significant result.
\end{fancytheorem}
\lipsum[2]

\end{document}


Compiling this with (pdflatex and) TL2011, I get the expected result:

but running the same file through TL2012, I get:

Notice that the entire frame is shoved to the right, roughly 10pt.

Of course, I could hack the margins to make the 2012 version look the same, but I'd like the documentclass to work equally, regardless of the TL version. Any suggestions?

-

you have a lot of trailing spaces. Look for the %%%:

\mdfdefinestyle{mdtheoremstyle}{%%%
linewidth=1pt,
roundcorner=4pt,
frametitlerule=false,
apptotikzsetting={%%%
\tikzset{mdfframetitlebackground/.append style={fill=black!25}}%%%
\tikzset{mdfbackground/.append style={fill=black!10}}%%%
},
[...]


insert them into your example and it should work.

-
Oops, you're right. I was under the impression that keyval didn't care about the trailing spaces, but I guess it makes sense in that particular option. The entire code block is probably inserted and the spaces will show up. Still doesn't explain the difference between TL2011 and TL2012 though. – mrf Sep 18 '12 at 10:04
In your 2011 example is also a trailing space. However, I suppose that one of the TikZ commands changes internally in a way that it now do not remove trailing spaces. – Herbert Sep 18 '12 at 10:12