parskip 包导致 parbox itemize 内容出现一些问题

parskip 包导致 parbox itemize 内容出现一些问题

以下是一些简化的内容来描述我的问题

\documentclass[12pt]{article}
\usepackage[margin = 0.7 in]{geometry}
\usepackage{parskip}


\begin{document}

Some notational items:
\begin{itemize}
    \item Infinite series are referred to only as series.
    \item Dropping the index and infinity symbol from the summation symbol is also possible. i.e $\sum_{n=1}^\infty a_n = \sum a_n$. It also implies starting point of the series is not important. It can begin with $0$, $1$, $3$ or any other number...
    \item Not dropping the index from the summation symbol will occur when the index really does need to be there and cannot be changed

\end{itemize}

\fbox{
\parbox{\textwidth}{
If $\sum a_n$ and $\sum b_n$ are both convergent series then:

\begin{itemize}
    \item sadsads
    \item sdafsdf
\end{itemize}
}
}

\end{document}

我想将 的内容装箱\parbox,但我意识到每个项目符号后的文本之间的间距以及普通文本和项目符号列表之间的间距对于内部内容\parbox和外部内容是不同的。

摆脱这个问题的一个方法是不是导入parskip包。所以我知道导入它是导致 内部奇怪的重新间距的原因\parbox。但是我需要导入parskip其他原因,即因为我不想在此特定文档中缩进段落。

我怎样才能防止这种行为,并保持段落不缩进?也许有一种不导入的方法parskip

答案1

\parbox自动将 重置parskip0pt。如果你不想这样,你可以修补内部宏以避免\parskip使用\patchcmdfrom进行更改etoolbox

\documentclass[12pt]{article}
\usepackage[margin = 0.7 in]{geometry}
\usepackage{etoolbox}
\usepackage{parskip}
\makeatletter
\patchcmd\@arrayparboxrestore{\parskip}{\@gobble}{}{\undefined}
\makeatother

\begin{document}

Some notational items:
\begin{itemize}
    \item Infinite series are referred to only as series.
    \item Dropping the index and infinity symbol from the summation symbol is also possible. i.e $\sum_{n=1}^\infty a_n = \sum a_n$. It also implies starting point of the series is not important. It can begin with $0$, $1$, $3$ or any other number...
    \item Not dropping the index from the summation symbol will occur when the index really does need to be there and cannot be changed
\end{itemize}

\fbox{
\parbox{\textwidth}{
If $\sum a_n$ and $\sum b_n$ are both convergent series then:

\begin{itemize}
    \item sadsads
    \item sdafsdf
\end{itemize}
}
}

\end{document}

在此处输入图片描述

答案2

更改包中的某些代码以恢复\parskip列表内部的内容。

\documentclass[12pt]{article}
\usepackage[margin = 0.7 in]{geometry}
\usepackage{parskip}
\makeatletter

\edef\svparskip{\the\parskip}
\def\@listI{\parskip=\svparskip\relax\leftmargin\leftmargini
   \topsep\z@ \parsep\parskip \itemsep\z@}
\let\@listi\@listI
\@listi

\makeatother
\begin{document}

Some notational items:
\begin{itemize}
    \item Infinite series are referred to only as series.
    \item Dropping the index and infinity symbol from the summation symbol is also possible. i.e $\sum_{n=1}^\infty a_n = \sum a_n$. It also implies starting point of the series is not important. It can begin with $0$, $1$, $3$ or any other number...
    \item Not dropping the index from the summation symbol will occur when the index really does need to be there and cannot be changed

\end{itemize}

\fbox{
\parbox{\textwidth}{
If $\sum a_n$ and $\sum b_n$ are both convergent series then:

\begin{itemize}
    \item sadsads
    \item sdafsdf
\end{itemize}
}
}

\end{document}

在此处输入图片描述

相关内容