parbox + itemize = 空格

parbox + itemize = 空格

考虑以下 MWE

\documentclass[12pt,a4paper]{article}
\begin{document}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text:

\parbox[t][][t]{\textwidth}{

\begin{itemize}
 \item More Text More Text More Text More Text More Text More Text More Text More Text More Text 
\item  More Text More Text More Text More Text More Text More Text More Text More Text More Text 
 \end{itemize}}

 \vspace{2cm}

 Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text:


\begin{itemize}
 \item More Text More Text More Text More Text More Text More Text More Text More Text More Text 
\item  More Text More Text More Text More Text More Text More Text More Text More Text More Text 
 \end{itemize}
\end{document}

使用时,如何删除“文本文本......”和第一个包含“更多文本......”的项目符号之间的空格parbox itemize这样使用时看起来就像下面这样仅有的 itemize

(我有充分的理由使用parbox此 MWE 未说明的内容,因此告诉我仅使用来itemize解决我的问题并不是解决方案:)

答案1

段落缩进添加到 的左侧\parbox。可以使用 来取消缩进\noindent。可以纠正垂直间距:

  • \nointerlineskip1pt删除由于较大\parbox(没有)而添加的行跳过(默认值:)t

  • \prevdepth这表明前一个框的深度在开始时被保存和恢复\parbox。然后环境在两种情况下itemize看到的内容相同。\prevdepth

\documentclass[12pt,a4paper]{article}
\newdimen\savedprevdepth

\begin{document}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text:

\setlength{\savedprevdepth}{\prevdepth}
\nointerlineskip
\noindent
\parbox{\textwidth}{
  \setlength{\prevdepth}{\savedprevdepth}
  \begin{itemize}
    \item More Text More Text More Text More Text More Text More Text More Text More Text More Text 
    \item  More Text More Text More Text More Text More Text More Text More Text More Text More Text 
  \end{itemize}%
  \global\savedprevdepth\prevdepth
}

\prevdepth=\savedprevdepth

Some Text

\vspace{2cm}

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text:

\begin{itemize}
  \item More Text More Text More Text More Text More Text More Text More Text More Text More Text 
  \item  More Text More Text More Text More Text More Text More Text More Text More Text More Text 
\end{itemize}

Some Text
\end{document}

结果

答案2

使用 aminipage代替 a \parbox

\documentclass[12pt,a4paper]{article}
\begin{document}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text:

\noindent
\begin{minipage}[t][][t]{\textwidth}\vspace{0pt}%%% Without \vspace no additional space
\begin{itemize}
 \item More Text More Text More Text More Text More Text More Text More Text More Text More Text 
\item  More Text More Text More Text More Text More Text More Text More Text More Text More Text 
 \end{itemize}
 \end{minipage}

 \vspace{2cm}

 Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text:

\begin{itemize}
 \item More Text More Text More Text More Text More Text More Text More Text More Text More Text 
\item  More Text More Text More Text More Text More Text More Text More Text More Text More Text 
 \end{itemize}
\end{document}

答案3

只需隐藏 parbox 的可选参数,并在 parbox 内的空白行前添加一个空的 \mbox。以下是示例,根据 \parbox 前的内容变化,垂直间距略有不同:

        \documentclass[12pt,a4paper]{article}
        \begin{document}
        Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text:

        \noindent\parbox{\textwidth}{
        \mbox{}

        \begin{itemize}
         \item More Text More Text More Text More Text More Text More Text More Text More Text More Text
        \item  More Text More Text More Text More Text More Text More Text More Text More Text More Text
         \end{itemize}}

         \vskip15mm
        Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text:

        \noindent\parbox{\textwidth}{
        \mbox{}
        \begin{itemize}
         \item More Text More Text More Text More Text More Text More Text More Text More Text More Text
        \item  More Text More Text More Text More Text More Text More Text More Text More Text More Text
         \end{itemize}}

         \vskip15mm
        Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text:

        \noindent\parbox{\textwidth}{
        \begin{itemize}
         \item More Text More Text More Text More Text More Text More Text More Text More Text More Text
        \item  More Text More Text More Text More Text More Text More Text More Text More Text More Text
         \end{itemize}}

         \vskip15mm
         Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text:

        \begin{itemize}
         \item More Text More Text More Text More Text More Text More Text More Text More Text More Text
        \item  More Text More Text More Text More Text More Text More Text More Text More Text More Text
         \end{itemize}
        \end{document} 

在此处输入图片描述

相关内容