恢复 paralist 包中与 enumitem 包类似的选项

恢复 paralist 包中与 enumitem 包类似的选项

我想知道是否可以为 paralist 包生成resume类似于enumitem包中的选项。请注意,无法将类似[resume]或的内容添加[start]到包中定义的环境中paralist。请参阅下面的 MWE:

\documentclass{article}

\setlength{\parindent}{0mm}

\usepackage{paralist}
\usepackage{tabto}
\usepackage{multicol}
\usepackage{amssymb,amsmath}

\newenvironment{tabbedenum}[1]
 {\NumTabs{#1}\inparaenum\let\latexitem\item
  \def\item{\def\item{\tab\latexitem}\latexitem}}
 {\endinparaenum}

\begin{document}
\begin{multicols}{2}
Some long text to be used for sampling.
\begin{tabbedenum}{2}
\item text
\item text
\item text
\item text
\item text
\item text
\end{tabbedenum}\\[1cm]
Some long text to be used for sampling.
\begin{tabbedenum}{1}
    \item Some long text to be used for sampling.
\end{tabbedenum}\\[1cm]
Some long text to be used for sampling.
\begin{tabbedenum}{3}
\item text 
\item text
\item text
\item text
\item text
\item text 
\end{tabbedenum}
\bigskip
Some long text to be used for sampling.
\NumTabs{3}
\begin{inparaenum}
\item text
\tab\item text
\tab\item text
\tab\item text
\tab\item text
\tab\item text   
\end{inparaenum}
\end{multicols}
\end{document}

在此处输入图片描述

答案1

添加记住计数器末尾值的代码tabbedenum并定义一个tabbedenum*使用先前值的新环境:

\documentclass{article}

\setlength{\parindent}{0mm}

\usepackage{paralist}
\usepackage{tabto}
\usepackage{multicol}
\usepackage{amssymb,amsmath}

\newenvironment{tabbedenum}[1]
 {\NumTabs{#1}\inparaenum\let\latexitem\item
  \def\item{\def\item{\tab\latexitem}\latexitem}}
 {\xdef\lastparaenum{\the\value{enumi}}\endinparaenum}
\newenvironment{tabbedenum*}[1]
 {\NumTabs{#1}\inparaenum\let\latexitem\item
  \def\item{\def\item{\tab\latexitem}\latexitem}%
  \setcounter{enumi}{\lastparaenum}}
 {\xdef\lastparaenum{\the\value{enumi}}\endinparaenum}
\def\lastparaenum{0}

\begin{document}
\begin{multicols}{2}
Some long text to be used for sampling.
\begin{tabbedenum}{2}
\item text
\item text
\item text
\item text
\item text
\item text
\end{tabbedenum}

Some long text to be used for sampling.
\begin{tabbedenum*}{1}
    \item Some long text to be used for sampling.
\end{tabbedenum*}

\bigskip

Some long text to be used for sampling.
\begin{tabbedenum*}{3}
\item text 
\item text
\item text
\item text
\item text
\item text 
\end{tabbedenum*}

\bigskip

Some long text to be used for sampling.
\begin{tabbedenum}{3}
\item text
\item text
\item text
\item text
\item text
\item text   
\end{tabbedenum}
\end{multicols}
\end{document}

在此处输入图片描述

您可以看到使用tabbedenum重置编号。

相关内容