Text Formatting ⇒ advanced use of enumerate
Re: advanced use of enumerate
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
advanced use of enumerate
Code: Select all
\documentclass{article}
\newcommand\itemone{\stepcounter{enumi}\item[$\ast$\, \theenumi.]}
\newcommand\itemtwo{\stepcounter{enumi}\item[$\ast\ast$\, \theenumi.]}
\newcommand\itemthree{\stepcounter{enumi}\item[$\ast\ast\ast$\, \theenumi.]}
\begin{document}
\begin{enumerate} \item Consider the following items
\begin{enumerate}
\itemone first item.
\item second item.
\itemone third item.
\itemtwo fourth item.
\itemthree fifth item.
\itemone sixth item.
\end{enumerate}
\item This is the second item of the main list
\end{enumerate}
\end{document}
-
- Posts: 133
- Joined: Sat Feb 25, 2012 6:12 pm
advanced use of enumerate
enumi
to enumii
, this is the counter for the second level. This makes sure the second item of the nested list also gets the correct number. Since this counter is by default setup with an alphabetic counter between brackets I changed that as well for consistency. A code snippet showing the new \newcommands
:
Code: Select all
\newcommand\itemone{\stepcounter{enumii}\item[$\ast$\, (\theenumii)]}
\newcommand\itemtwo{\stepcounter{enumii}\item[$\ast\ast$\, (\theenumii)]}
\newcommand\itemthree{\stepcounter{enumii}\item[$\ast\ast\ast$\, (\theenumii)]}