我需要排版一本给定了 定义的书{itemize}
,我{framed}
使用 添加了环境mdframed
。如果里面的第一行{framed}
是普通文本,那么一切都很好
但如果它从环境开始,{itemize}
就会有一些我无法删除的额外空间。
在两种情况下,帧结束前的跳过都是可以的。如果我注释掉{itemize}
跳过的重新定义也是可以的。
代码
\documentclass{scrartcl}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\makeatletter
\renewenvironment{itemize}{%
\begin{list}{\labelitemi}{%
\setlength{\itemsep}{\z@}%
\setlength{\parsep}{\z@}%
\setlength{\parindent}{1em}%
\setlength{\labelwidth}{\parindent}
\setlength{\labelsep}{0pt}
\setlength{\leftmargin}{\labelwidth+\labelsep}%
\def\makelabel##1{\rlap{\normalfont\nobreak ##1}\hss}
}%
}{%
\end{list}
}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{xparse}% doesn't work without this package ... ???
\newenvironment{framed}{%
\begin{mdframed}[%
skipabove=\baselineskip plus 2pt minus 1pt,
skipbelow=\baselineskip plus 2pt minus 1pt,
middlelinewidth=0.5pt,
splittopskip=8pt,
splitbottomskip=2pt,
innertopmargin=9.39749pt,
innerbottommargin=9.39749pt,
innerleftmargin=9.39749pt,
innerrightmargin=9.39749pt,
]%
}{%
\end{mdframed}
}
\makeatother
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{framed}
\blindtext
\end{framed}
\blindtext
\begin{framed}
\blinditemize
\end{framed}
\end{document}
我尝试将新定义与以前的定义进行比较source2e
,但没有发现导致额外空间的差异。我发现\@minipagetrue
诡计但这没有帮助。
问题
如果它开始一个框架,我怎样才能知道{itemize}
不要插入空格?
答案1
缺少两个注释符号,从而产生了虚假空格。
\documentclass{scrartcl}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\makeatletter
\renewenvironment{itemize}{%
\begin{list}{\labelitemi}{%
\setlength{\itemsep}{\z@}%
\setlength{\parsep}{\z@}%
\setlength{\parindent}{1em}%
\setlength{\labelwidth}{\parindent}% <-- THIS ONE WAS MISSING
\setlength{\labelsep}{0pt}% <-- AND THIS ONE, TOO
\setlength{\leftmargin}{\labelwidth+\labelsep}%
\def\makelabel##1{\rlap{\normalfont\nobreak ##1}\hss}% <-- Shouldn't harm
}%
}{%
\end{list}
}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{xparse}% doesn't work without this package ... ???
\newenvironment{framed}{%
\begin{mdframed}[%
skipabove=\baselineskip plus 2pt minus 1pt,
skipbelow=\baselineskip plus 2pt minus 1pt,
middlelinewidth=0.5pt,
splittopskip=8pt,
splitbottomskip=2pt,
innertopmargin=9.39749pt,
innerbottommargin=9.39749pt,
innerleftmargin=9.39749pt,
innerrightmargin=9.39749pt,
]%
}{%
\end{mdframed}
}
\makeatother
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{framed}
\blindtext
\end{framed}
\blindtext
\begin{framed}
\blinditemize
\end{framed}
\end{document}