在新的 \newenviroment 中使用 \begin{collect*}

在新的 \newenviroment 中使用 \begin{collect*}

我對乳膠的經驗並不豐富,我試圖用一些在自己的環境中使用的常見參數來包裝 \begin{collect*} 命令,但我在讓整個事情正常工作時遇到了麻煩。該問題僅在自訂環境中出現。顯示此範例的最小範例是:

\documentclass[11pt,english]{article}

\usepackage{xparse}
\usepackage{collect}


\DeclareDocumentEnvironment{dup}{ m }
  {  \begin{collect*}{#1dupcollection}{}{}{}{}
  }
  {
  \end{collect*}
  }

\begin{document}

\begin{dup}{atest}
content...
\end{dup}

\end{document}

我收到的錯誤是:文件在掃描使用 \@tempa 時結束

我嘗試尋找解決方案,但沒有找到解決方案。我確信這裡有人可以提供幫助。

答案1

軟體包文件 (PDF)

\documentclass[11pt,english]{article}

\usepackage{collect}

\makeatletter
\newenvironment{dup}[1]{%
  \definecollection{#1dupcollection}%
  \@nameuse{collect*}{#1dupcollection}{}{}{}{}%
}{%
  \@nameuse{endcollect*}%
}
\makeatother

\begin{document}

\begin{dup}{atest}
content...
\end{dup}

\end{document}

相關內容