6

I would like to remove or better said have the framed environment (box) aligned with the content in the description. Notice below how the box is out of alignment and aligns with the margin. See a MWE:

enter image description here

\documentclass[letterpaper]{article}
\usepackage{framed}
\usepackage{enumitem}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
    \begin{description}
    \item[Test] \lipsum[1]
    \begin{framed}
        \textbf{Understanding the Problem}
    \begin{enumerate}
        \item[0:] Complete misunderstanding of the problem
        \item[5:] Part of the problem misunderstood or misinterpreted
        \item[10:] Complete understanding of the problem
    \end{enumerate}
    \end{framed}
    \end{description}
\lipsum[1]
\end{document}
3

Here's one possibility, using the framed environment from the framed package as requested:

\documentclass[letterpaper]{article}
\usepackage{framed}
\usepackage{enumitem}
\usepackage{lipsum}

\makeatletter
\renewenvironment{framed}{%
 \def\FrameCommand##1{\hskip\@totalleftmargin
 \fboxsep=\FrameSep\fbox{##1}
     \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
 \MakeFramed {\advance\hsize-\width
   \@totalleftmargin\z@ \linewidth\hsize
   \@setminipage}}%
 {\par\unskip\endMakeFramed}
\makeatother

\begin{document}
\lipsum[4]
    \begin{description}
    \item[Test] \lipsum*[1]
    \begin{framed}
        \textbf{Understanding the Problem}
    \begin{enumerate}
        \item[0:] Complete misunderstanding of the problem
        \item[5:] Part of the problem misunderstood or misinterpreted
        \item[10:] Complete understanding of the problem
    \end{enumerate}
    \end{framed}
    \end{description}
\lipsum[4]
    \begin{framed}
        \textbf{Understanding the Problem}
    \begin{enumerate}
        \item[0:] Complete misunderstanding of the problem
        \item[5:] Part of the problem misunderstood or misinterpreted
        \item[10:] Complete understanding of the problem
    \end{enumerate}
    \end{framed}
\end{document}

enter image description here

  • Can the padding(FrameSep) be retained globally? I ask because I am using the framed environment somewhere else and the code above is also affecting it. – azetina Aug 5 '13 at 22:21
  • @azetina please see my updated answer. – Gonzalo Medina Aug 5 '13 at 23:27
4

Search and replace framed by mdframed in your WME:

MWE

\documentclass[letterpaper]{article}
\usepackage{mdframed}
\usepackage{enumitem}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
    \begin{description}
    \item[Test] \lipsum[1]
    \begin{mdframed}
        \textbf{Understanding the Problem}
    \begin{enumerate}
        \item[0:] Complete misunderstanding of the problem
        \item[5:] Part of the problem misunderstood or misinterpreted
        \item[10:] Complete understanding of the problem
    \end{enumerate}
    \end{mdframed}
    \end{description}
\lipsum[1]
\end{document}
  • This didn't helped :( – alper Aug 12 '18 at 16:41
  • 1
    @alper This is a very old post, but both my TeX Live 2018 as well as Overleaf produce exactly the same output that is showed with the MWE posted. Tha is, with the frame aligned as demanded in the question. So, the solution is correct for an article class with the enumitem package, in a description environment. Of course, I cannot guarantee that it will work in any other scenario, but if this not help, chances are that you are doing something wrong, aside of using some weird class, some incompatible package, or an outdated installation. – Fran Aug 13 '18 at 4:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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