从框架环境中移除多余的空间

从框架环境中移除多余的空间

我想删除或更好地说让框架环境(框)与描述中的内容对齐。请注意下面的框如何不对齐并与边距对齐。参见 MWE:

在此处输入图片描述

\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}

答案1

这是一种可能性,按照要求使用包framed中的环境framed

\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}

在此处输入图片描述

答案2

framedmdframedWME 中搜索并替换:

平均能量损失

\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}

相关内容