Text FormattingNested enumeration with brackets

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ge0rg
Posts: 9
Joined: Sat Jul 25, 2015 7:00 am

Nested enumeration with brackets

Post by ge0rg »

Hello people of the internet,

I have the following question:

I would like to do the following (excerpt from my seminar paper):
(1) The Turing Test is decisive:
(1.1) If S passes the Turing Test, it has a mind.
(1.2) If S does not pass the Turing Test, it does not have a mind.

(2) The Turing Test is too strong:
(2.1) If S passes the Turing Test, it has a mind.
(2.2) If S does not pass the Turing Test, it may or may not have a mind.

(3) The Turing Test is too weak:
(3.1) If S passes the Turing Test, it may or may not have a mind.
(3.2) If S does not pass the Turing Test, it does not have a mind.

(4) The Turing Test does not correlate to having minds at all:
(4.1) If S passes the Turing Test, it may or may not have a mind.
(4.2) If S does not pass the Turing Test, it may or may not have a mind.
The subpoints should be tabbed but I can't seem to make that work here. Anyhow, I have managed to do this:

Code: Select all

\begin{enumerate}[label*=\arabic*.]
    \item
     The Turing Test is decisive:
    	\begin{enumerate}[label*=\arabic*]
     		\item If S passes the Turing Test, it has a mind.
     		\item If S does not pass the Turing Test, it does not have a mind.
     	\end{enumerate}
    \item 
    The Turing Test is too strong:
    	\begin{enumerate}[label*=\arabic*]
     		\item If S passes the Turing Test, it has a mind.
     		\item If S does not pass the Turing Test, it may or may not have a mind.
     	\end{enumerate}
     \item
     The Turing Test is too weak:
    	\begin{enumerate}[label*=\arabic*]
     		\item If S passes the Turing Test, it may or may not have a mind.
     		\item If S does not pass the Turing Test, it does not have a mind.
     	\end{enumerate}
     	\item
     The Turing Test does not correlate to having minds at all:
    	\begin{enumerate}[label*=\arabic*]
     		\item If S passes the Turing Test, it may or may not have a mind.
     		\item If S does not pass the Turing Test, it may or may not have a mind.
     	\end{enumerate}
\end{enumerate} 
Which yields a similar reslut, but insead of (1) and (1.1) and so on, I get 1 and 1.1.
How can I make this work with the parenthesis being where I want them to be? If I do something like \begin{enumerate}[label*=(\arabic*)], I will get something like 1.(1) or (1).(1) .

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

ge0rg
Posts: 9
Joined: Sat Jul 25, 2015 7:00 am

Nested enumeration with brackets

Post by ge0rg »

Problem solved. In case it interest someone:

Code: Select all

\begin{enumerate}[label=(\arabic*)]
    \item
     The Turing Test is decisive:
    	\begin{enumerate}[label=(\arabic{enumi}.\arabic*)]
     		\item If S passes the Turing Test, it has a mind.
     		\item If S does not pass the Turing Test, it does not have a mind.
     	\end{enumerate}
    \item 
    The Turing Test is too strong:
    	\begin{enumerate}[label=(\arabic{enumi}.\arabic*)]
     		\item If S passes the Turing Test, it has a mind.
     		\item If S does not pass the Turing Test, it may or may not have a mind.
     	\end{enumerate}
     \item
     The Turing Test is too weak:
    	\begin{enumerate}[label=(\arabic{enumi}.\arabic*)]
     		\item If S passes the Turing Test, it may or may not have a mind.
     		\item If S does not pass the Turing Test, it does not have a mind.
     	\end{enumerate}
     	\item
     The Turing Test does not correlate with having minds at all:
    	\begin{enumerate}[label=(\arabic{enumi}.\arabic*)]
     		\item If S passes the Turing Test, it may or may not have a mind.
     		\item If S does not pass the Turing Test, it may or may not have a mind.
     	\end{enumerate}
\end{enumerate} 
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Nested enumeration with brackets

Post by Stefan Kottwitz »

Thank you for telling us the solution! It could help other people who come here via google, with a similar problem, so it's useful to read it here.

Hopefully I can answer another question. Feel free to open a new topic about any LaTeX problem you see.

Stefan
LaTeX.org admin
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Nested enumeration with brackets

Post by cgnieder »

Just to add one information for users who find this thread: package enumitem is necessary for above examples to compile.

Regards
site moderator & package author
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Nested enumeration with brackets

Post by cgnieder »

BTW: instead of setting the label properties each time again you can also setup {enumerate} with enumitem's \setlist command:

Code: Select all

\setlist[enumerate,1]{label=(\arabic*),ref=\arabic*}
\setlist[enumerate,2]{label=(\theenumi.\arabic*),ref=\theenumi.\arabic*}
or maybe even

Code: Select all

\newcommand*\enparen[1]{(#1)}
\setlist[enumerate]{format=\enparen}
\setlist[enumerate,1]{label=\arabic*}
\setlist[enumerate,2]{label*=.\arabic*}
This would also set the parentheses when the items are referenced, while in the first examples references would have no parantheses.

A complete example:

Code: Select all

\documentclass{article}
\usepackage{enumitem}

\setlist[enumerate,1]{label=(\arabic*),ref=\arabic*}
\setlist[enumerate,2]{label=(\theenumi.\arabic*),ref=\theenumi.\arabic*}

\begin{document}

\begin{enumerate}
  \item The Turing Test is decisive:
    \begin{enumerate}
      \item If S passes the Turing Test, it has a mind.
      \item If S does not pass the Turing Test, it does not have a mind.
    \end{enumerate}
  \item The Turing Test is too strong:
    \begin{enumerate}
      \item If S passes the Turing Test, it has a mind.
      \item If S does not pass the Turing Test, it may or may not have a mind.
    \end{enumerate}
  \item The Turing Test is too weak:
    \begin{enumerate}
      \item If S passes the Turing Test, it may or may not have a mind.
      \item If S does not pass the Turing Test, it does not have a mind.
    \end{enumerate}
  \item The Turing Test does not correlate with having minds at all:
    \begin{enumerate}
      \item If S passes the Turing Test, it may or may not have a mind.
      \item If S does not pass the Turing Test, it may or may not have a mind.
    \end{enumerate}
\end{enumerate} 

\end{document}
Regards
site moderator & package author
Post Reply