重新定义 itemize 环境以进行更深的嵌套会导致编译冻结

重新定义 itemize 环境以进行更深的嵌套会导致编译冻结

itemize我正在尝试使用向标准环境添加一些嵌套级别enumitem。想法是将其添加到-H参数中,以便允许pandoc处理更深的逐项列表嵌套。以下是我迄今为止尝试过的:

\documentclass{article}

\usepackage{enumitem}


\setlistdepth{9}
\setlist[itemize, 1]{label=\labelitemi, itemindent=0.25em}
\setlist[itemize, 2]{label=\labelitemii, itemindent=0.25em}
\setlist[itemize, 3]{label=\labelitemiii, itemindent=0.25em}
\setlist[itemize, 4]{label=\diamond, itemindent=0.25em}
\setlist[itemize, 5]{label=\smallblacksquare, itemindent=0.75em}
\setlist[itemize, 6]{label=\smalltriangleup, itemindent=1.25em}
\setlist[itemize, 7]{label=\smallcircle, itemindent=1.75em}
\setlist[itemize, 8]{label=\smallsquare, itemindent=2.25em}
\setlist[itemize, 9]{label=\labelitemiv, itemindent=3em}

\renewlist{itemize}{itemize}{9}

\begin{document}

    \begin{itemize}
        \item test
        \begin{itemize}
            \item test
        \end{itemize}
    \end{itemize}

\end{document}

不幸的是,编译卡住了(./test.aux),我不知道为什么。有人知道我做错了什么吗?

答案1

正如 daleif 已经指出的那样,您会陷入循环,您可以通过首先保存原始标签项定义来防止这种情况:

\documentclass{article}

\usepackage{enumitem}

\let\oldlabelitemi\labelitemi
\let\oldlabelitemii\labelitemii
\let\oldlabelitemiii\labelitemiii
\let\oldlabelitemiv\labelitemiv

\setlistdepth{9}
\setlist[itemize, 1]{label=\oldlabelitemi, itemindent=0.25em}
\setlist[itemize, 2]{label=\oldlabelitemii, itemindent=0.25em}
\setlist[itemize, 3]{label=\oldlabelitemiii, itemindent=0.25em}
\setlist[itemize, 4]{label=\diamond, itemindent=0.25em}
\setlist[itemize, 5]{label=\smallblacksquare, itemindent=0.75em}
\setlist[itemize, 6]{label=\smalltriangleup, itemindent=1.25em}
\setlist[itemize, 7]{label=\smallcircle, itemindent=1.75em}
\setlist[itemize, 8]{label=\smallsquare, itemindent=2.25em}
\setlist[itemize, 9]{label=\oldlabelitemiv, itemindent=3em}

\renewlist{itemize}{itemize}{9}

\begin{document}

\begin{itemize}
    \item test
          \begin{itemize}
              \item test
          \end{itemize}
\end{itemize}

\end{document}

相关内容