Wednesday, March 18, 2015

HowTo : LaTeX - Create complex nested item list easily

Hi, ever wonder to create a complex nested item list such 1.1, 2.1, 3.1, 3.1.2, 3.2 and more with LaTeX syntax? Basicaly, i use /section for auto numbering the list but it does not auto indent my long nested list.

So, that bring problem to me. Now, i'm use package enumitem to solve the problem without using /section but using /item tags to solve the problem.

LaTeX source code:
\documentclass{article}
\usepackage{enumitem} % <-- import this package
\begin{document}
  \begin{enumerate}
    \item My favourite food
    \begin{enumerate}[label*=\arabic*.] % <-- Keyword
      \item Pizza
      \begin{enumerate}[label*=\arabic*.]
        \item Pizza Hut
        \begin{enumerate}[label*=\arabic*.]
          \item Ocean Tuna
          \item chicken BBQ
        \end{enumerate}
        \item Domino
      \end{enumerate}
      \item Curry
      \begin{enumerate}[label*=\arabic*.]
        \item Spicy chicken curry
        \item Traditional curry 
      \end{enumerate}
      \item Maggi
    \end{enumerate}
  \end{enumerate}
\end{document}

PDF built result :


Yeah..nice!

No comments:

Post a Comment