mdframed icon indicating copy to clipboard operation
mdframed copied to clipboard

vertical space change between version 1.6 and 1.8

Open nignasi opened this issue 12 years ago • 2 comments

I've been using mdframed with thmtools to type exams and problems lists with next code:

%-----------------------------------------------------------------
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage[catalan]{babel}
\usepackage{lmodern}
\usepackage{amsmath,amsthm}
\usepackage{thmtools}
\usepackage{xcolor}
\usepackage{comment}
\usepackage{mdframed}
\usepackage{enumitem}

\mdfdefinestyle{stylesolucio}{%
    backgroundcolor=gray!20,%
    innertopmargin=4pt,%
    innerbottommargin=4pt,%
    skipbelow=6pt,%
    skipabove=6pt,%
    hidealllines=true}

\declaretheoremstyle[%
    spaceabove=6pt,%
    spacebelow=6pt,%
    headfont=\normalfont\bfseries,%
    notefont=\mdseries,% 
    notebraces={(}{)},%
    bodyfont=\normalfont,%
    postheadspace=1em]{estilexercici}

\declaretheoremstyle[%
    spaceabove=3pt,%
    spacebelow=3pt,%
    headfont=\normalfont\bfseries,%
    notefont=\mdseries,%
    notebraces={(}{)},%
    bodyfont=\normalfont,%
    numbered=no,%
   name=Solució,%
    preheadhook={\begin{mdframed}[style=stylesolucio]},%
    postfoothook={\end{mdframed}}]{estilsolucio}

\declaretheorem[style=estilexercici]{exercici}
\declaretheorem[style=estilsolucio]{solucio}

%\excludecomment{solucio}
%\let\endsolucio\relax

\setlist{noitemsep}
\setlist[1]{labelindent=\parindent}
\setenumerate[1]{label=\emph{\alph*})}
\setenumerate[2]{label=\roman*)}

\title{Problems with\\
Package: mdframed 2012/06/02 v1.6b: mdframed}
%\author{Me}
%\date{March 2013}

\begin{document}
\maketitle

\begin{exercici}
This is the first exercice.
\begin{enumerate}
  \item Firts item
\begin{solucio}
    Solution of first item
\end{solucio}
    \item Second item
\begin{solucio}
\end{solucio}
    \item Second item's solution
\begin{solucio}
\end{solucio}
\end{enumerate}
\end{exercici}

\begin{exercici}
This is the first exercice.
\begin{enumerate}
  \item Firts item
\begin{solucio}
    Solution of first item
\end{solucio}
    \item Second item
\begin{solucio}
\end{solucio}
    \item Second item's solution
\begin{solucio}
\end{solucio}
\end{enumerate}
\end{exercici}
\end{document}
%--------------------------------------------------------

The result with version 1.6 produced: dibujo

while version 1.8 produces dibujo2

I hope you could appreciate a different separation between "solution" frame and previous paragraph. I've not changed anything into the code, just updated mdframed with miktex. Is it a known behavior? If not, what should I change in my code to have original (1.6) separation?

nignasi avatar Mar 13 '13 17:03 nignasi

Hi,

thanks for the report. Finally I found the error. In the previous version I used the the following definition for \mdf@trivlist:

\def\mdf@trivlist#1{%
  \setlength{\topsep}{#1}%
  \partopsep\z@%
  \parsep\z@%
  \@nmbrlistfalse%
  \@trivlist%
  \labelwidth\z@%
  \leftmargin\z@%
  \itemindent\z@%
  \let\@itemlabel\@empty%
  \def\makelabel##1{##1}%
%%  \item\leavevmode\hrule \@height\z@ \@width\linewidth\relax%
%%  \item\mbox{}\relax% second version
  \item\relax% first Version
}

The new version has the following syntax:

\def\mdf@trivlist#1{%
  \edef\x{\topsep=\the\topsep\relax\partopsep=\the\partopsep\relax\parsep=\the\parsep\relax}
  \setlength{\topsep}{#1}%
  \partopsep\z@%
  \parsep\z@%
  \@nmbrlistfalse%
  \@trivlist%
  \labelwidth\z@%
  \leftmargin\z@%
  \itemindent\z@%
  \let\@itemlabel\@empty%
  \def\makelabel##1{##1}%
  \item\relax\x\relax\leavevmode\hrule \@height\z@ \@width\linewidth\relax%
%%  \item\mbox{}\relax% second version
%%  \item\relax\x% first Version
}

By fixing one issue I produced a new one. Sorry. First you can use the original definition without any problems.

best regards Marco

marcodaniel avatar Mar 17 '13 06:03 marcodaniel

Thank you. It worked.

nignasi avatar Mar 17 '13 10:03 nignasi