如何实现列表中的深度嵌套

如何实现列表中的深度嵌套

有没有办法在列表环境中获得超过 4 级的嵌套?

我在找

I.
 A.
  1.
   a.
    (i)

答案1

这是enumitem执行此操作的方法,\newlist{...}{enumerate}{5} 使用\setlist针对各个级别的特定命令:

\documentclass{article}

\usepackage{enumitem}

\newlist{mylist}{enumerate}{5}  % Specify 5 Levels as clone of enumerate
\setlist[mylist,1]{label={\Roman*.}}  % Roman uppercase numbers I.
\setlist[mylist,2]{label={\Alph*.}}   % Latin uppercase letters A.
\setlist[mylist,3]{label={\arabic*.}} % arabic numbers 1.
\setlist[mylist,4]{label={\alph*.}}   % Latin lowercase letters a.
\setlist[mylist,5]{label={(\roman*)}} % roman lowercase letters in ()

\begin{document}

\begin{mylist}
\item Level 1
\begin{mylist}
  \item Level 2
\begin{mylist}
  \item Level 3
\begin{mylist}
  \item Level 4
\begin{mylist}
  \item Level 5
\end{mylist}    
\end{mylist}   
\end{mylist}    
\end{mylist}
\end{mylist}

\end{document}

在此处输入图片描述

答案2

找到答案了。

在此处输入图片描述

\documentclass{article}

\usepackage{enumitem}

\newlist{longenum}{enumerate}{5}
\setlist[longenum,1]{label=\Roman*.}
\setlist[longenum,2]{label=\Alph*.}
\setlist[longenum,3]{label=\arabic*.}
\setlist[longenum,4]{label=\alph*.}
\setlist[longenum,5]{label=(\roman*)}

\begin{document}

\section*{Enumerated list with 5 levels}

\begin{longenum}
  \item Level 1 first
  \item Level 1 second
  \begin{longenum}
    \item Level 2 first
    \item Level 2 second
    \begin{longenum}
      \item Level 3 first
      \item Level 3 second
      \begin{longenum}
        \item Level 4 first
        \item Level 4 second
        \begin{longenum}
          \item Level 5 first
          \item Level 5 second
        \end{longenum}
      \end{longenum}
    \end{longenum}
  \end{longenum}
\end{longenum}

\end{document}

来源:http://texblog.org/2011/10/10/increase-enumerate-itemize-depth-with-enumitem/

相关内容