Text Formattingsublist in a list

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

sublist in a list

Post by ghostanime2001 »

How do you create a list such as 1. a) ..2. a) ..etc.. where the letter and the number are perfectly aligned relative to each other?

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

sublist in a list

Post by Stefan Kottwitz »

I recommend using the enumitem package. Follow the link to see the documentation for alignment/margin/indentation options.

Stefan
LaTeX.org admin
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: sublist in a list

Post by ghostanime2001 »

I still don't understand how to apply the code
torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

sublist in a list

Post by torbjorn t. »

Is this what you want?

Code: Select all

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}
  \item Item
    \begin{enumerate}[label=\alph*)]
      \item Subitem
      \item Subitem
    \end{enumerate}
  \item Item
    \begin{enumerate}[label=\alph*)]
      \item Subitem
      \item Subitem
    \end{enumerate}
\end{enumerate}

\end{document}
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: sublist in a list

Post by ghostanime2001 »

the a) should be aligned with the number and not have so much horizontal spacing between the number and the letter.
torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

sublist in a list

Post by torbjorn t. »

It's quite easy to figure out how to do that from the manual.

Code: Select all

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}
  \item Item
    \begin{enumerate}[label=\alph*),leftmargin=0pt,topsep=0pt]
      \item Subitem
      \item Subitem
    \end{enumerate}
  \item Item
    \begin{enumerate}[label=\alph*)]
      \item Subitem
      \item Subitem
    \end{enumerate}
\end{enumerate}

\end{document}
I added the necessary parameters for the first sublist only. You can define a new list type with these features, see section 2.2 of the manual.
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: sublist in a list

Post by ghostanime2001 »

I did not mean it vertically spaced. I meant that a) and 1. should be aligned horizontally looking literally like "1. a)" as if you are doing a math problem.
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: sublist in a list

Post by ghostanime2001 »

And the manual just says "These are equivalent to the well known list parameters," after those commands above. It does not say anything about what they do! Maybe those commands are explained in detail in another package. I don't know..
torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

sublist in a list

Post by torbjorn t. »

ghostanime2001 wrote:I did not mean it vertically spaced. I meant that a) and 1. should be aligned horizontally looking literally like "1. a)" as if you are doing a math problem.
Sorry, that wasn't entirely obvious from what you wrote. I can't really think of a good way of doing that right now, perhaps someone else has a suggestion.
Post Reply