![从框架环境中移除多余的空间](https://linux22.com/image/273077/%E4%BB%8E%E6%A1%86%E6%9E%B6%E7%8E%AF%E5%A2%83%E4%B8%AD%E7%A7%BB%E9%99%A4%E5%A4%9A%E4%BD%99%E7%9A%84%E7%A9%BA%E9%97%B4.png)
我想删除或更好地说让框架环境(框)与描述中的内容对齐。请注意下面的框如何不对齐并与边距对齐。参见 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
framed
在mdframed
WME 中搜索并替换:
\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}