具有更多嵌套深度和不同标签的自定义项目

具有更多嵌套深度和不同标签的自定义项目

我想用它enumitem定义itemize一个深度超过 4 的环境。我可以想到以下方法:

\documentclass{article}
\usepackage{enumitem}

\newlist{myItemize}{itemize}{9}
\setlist[myItemize]{label=\textbullet}
\setlistdepth{9}

\begin{document}

\begin{itemize}
    \item 1st level
    \begin{itemize}
        \item 2nd level
        \begin{itemize}
            \item 3rd level
            \begin{itemize}
                \item 4th level
            \end{itemize}
        \end{itemize}
    \end{itemize}
\end{itemize}

\begin{myItemize}
\item 1st level
    \begin{myItemize}
    \item 2nd level
        \begin{myItemize}
        \item 3rd level
            \begin{myItemize}
            \item 4th level
                \begin{myItemize}
                \item 5th level
                    \begin{myItemize}
                    \item 6th level
                        \begin{myItemize}
                        \item 7th level
                            \begin{myItemize}
                            \item 8th level
                                \begin{myItemize}
                                \item 9th level
                                \end{myItemize}
                            \end{myItemize}
                        \end{myItemize}
                    \end{myItemize}
                \end{myItemize}
            \end{myItemize}
        \end{myItemize}
    \end{myItemize}
\end{myItemize}
\end{document}

其呈现效果如下:

在此处输入图片描述

我还有两个问题:

  1. 自定义项目myItemize符号列表的间距不一致。第 4 级之后,后续项目符号在水平(和垂直?)方向上的间距更近
  2. 自定义项目myItemize符号列表对所有深度使用相同的标签。我希望它使用与默认itemize环境相同的标签。除了默认的最大深度 4 之外,我只想让它重复项目符号标签的循环。即项目符号、破折号、星号、点、项目符号、破折号、星号、点等等。

我浏览了 enumitem.pdf 和 layman.pdf,但不太确定从哪里开始。有人能帮忙吗?谢谢。

答案1

调整数值后手动解决:

\documentclass{article}
\usepackage{enumitem}
\usepackage{tikz}

\newlist{myItemize}{itemize}{9}

\setlist[myItemize,1]{label=\labelitemi,itemindent=0.25em}
\setlist[myItemize,2]{label=\labelitemii,itemindent=0.25em}
\setlist[myItemize,3]{label=\labelitemiii,itemindent=0.25em}
\setlist[myItemize,4]{label=\labelitemiv,itemindent=0.25em}
\setlist[myItemize,5]{label=\labelitemi,itemindent=0.75em}
\setlist[myItemize,6]{label=\labelitemii,itemindent=1.25em}
\setlist[myItemize,7]{label=\labelitemiii,itemindent=1.75em}
\setlist[myItemize,8]{label=\labelitemiv,itemindent=2.25em}
\setlist[myItemize,9]{label=\labelitemi,itemindent=3em}

\setlistdepth{9}

\begin{document}

\begin{itemize}
    \item 1st level
    \begin{itemize}
        \item 2nd level
        \begin{itemize}
            \item 3rd level
            \begin{itemize}
                \item 4th level
            \end{itemize}
        \end{itemize}
    \end{itemize}
\end{itemize}

\begin{myItemize}
\item\begin{tikzpicture}[remember picture]\coordinate(A);\end{tikzpicture} 1st level
    \begin{myItemize}
    \item 2nd level
        \begin{myItemize}
        \item 3rd level
            \begin{myItemize}
            \item 4th level
                \begin{myItemize}
                \item 5th level
                    \begin{myItemize}
                    \item 6th level
                        \begin{myItemize}
                        \item 7th level
                            \begin{myItemize}
                            \item 8th level
                                \begin{myItemize}
                                \item\begin{tikzpicture}[remember picture]\coordinate(B);\end{tikzpicture} 9th level
                                \end{myItemize}
                            \end{myItemize}
                        \end{myItemize}
                    \end{myItemize}
                \end{myItemize}
            \end{myItemize}
        \end{myItemize}
    \end{myItemize}
\end{myItemize}

\begin{tikzpicture}[overlay,remember picture]
\draw[opacity=0.5](A)--(B);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容