6

I have a slight problem with the framed package when combined with the itemize environment:

\documentclass[parskip]{scrartcl}
\usepackage{fancybox}
\usepackage{framed}

\newenvironment{simpages}%
{\def\FrameCommand{\fboxsep=\FrameSep \shadowbox}\MakeFramed {\FrameRestore}}%
{\endMakeFramed}

\begin{document}
Some text

\begin{simpages}
\begin{itemize}
  \item Foo
  \item Bar
  \item Baz
\end{itemize}
\end{simpages}

Some more text

\end{document}

This leads to the following result:

framed example

As you can see, the vertical space above the items is much larger than the one below - this is what I would like to correct. I've tried to switch to the mdframed package as suggested here, but so far unsuccessfully:

\documentclass[parskip]{scrartcl}
\usepackage{mdframed}

\newmdenv{simpages}

\begin{document}
Some text

\begin{simpages}
\begin{itemize}
  \item Foo
  \item Bar
  \item Baz
\end{itemize}
\end{simpages}

Some more text

\end{document}

The result is pretty much the same, only now the shadow effect is missing...

Why is the vertical space above and below the contents of the environment different, and how do I adjust it?

mdframed example

3
  • You seem to be using an outdated version of mdframed; in my system (TeX Live2013) I use mdframed.sty 2013/07/01 1.9b: mdframed and the undesired space is not present. Jul 19, 2013 at 21:32
  • @GonzaloMedina: That might be the case, I'm still on TL 2012 here. However, is there an option to fix the issue with the framed package? I rather prefer the shadowed box :-)
    – vwegert
    Jul 19, 2013 at 21:36
  • Please see my updated answer; at the end there's one possible workaround using framed. Jul 19, 2013 at 22:11

1 Answer 1

5

Here there are two options to produce the shadowed box, one using mdframed, and the other one with tcolorbox:

\documentclass[parskip]{scrartcl}
\usepackage[most]{tcolorbox}
\usepackage[framemethod=tikz]{mdframed}
\usetikzlibrary{shadows}

\newmdenv[
shadow=true]
{simpages}
\newtcolorbox{tsimpages}{
enhanced,
breakable,
arc=0pt,
outer arc=0pt,
colback=white,
shadow={1mm}{-1mm}{0mm}{color=black!50,sharp corners},
}

\begin{document}
Some text

\begin{simpages}
\begin{itemize}
  \item Foo
  \item Bar
  \item Baz
\end{itemize}
\end{simpages}
Some more text
\begin{tsimpages}
\begin{itemize}
  \item Foo
  \item Bar
  \item Baz
\end{itemize}
\end{tsimpages}
Some more text

\end{document}

enter image description here

And with the framed package, making some adjustments so the parskip option doesn't interfere:

\documentclass[parskip]{scrartcl}
\usepackage{fancybox}
\usepackage{framed}
\usepackage{etoolbox}

\newenvironment{simpages}%
{\AtBeginEnvironment{itemize}{\parskip=0pt\parsep=0pt\partopsep=0pt}
\def\FrameCommand{\fboxsep=.5\FrameSep\shadowbox}\MakeFramed {\FrameRestore}}%
{\endMakeFramed}

\begin{document}
Some text
\begin{simpages}
\begin{itemize}
  \item Foo
  \item Bar
  \item Baz
\end{itemize}
\end{simpages}
Some more text

\end{document}

enter image description here

You must log in to answer this question.

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