1

I want a list that looks like the following:

1. Introduction

Blaha blah albhalbhalbhalb

1.1. Purpose

Blaha bl ah blah blhab albhalbhalb

1.2. Another Subsection

More text for this section blah blahblalh

...

2. A Whole New Section

2.1. A Subsection in 2

Bunch more text... blah blah..

2.2. Blah

and so forth...

I don't need any special indentation for the subsections, I just want to be able to have the main section title (possibly with some text below) and then some subsections for that main section (also with text below each of them). Does it make sense what I am trying to achieve?

I realize that one approach would be to do something like the following:

\begin{description}
\item[1. Introduction]
...
\item[1.1. Purpose]
...
\item[1.2. Another subsection]
...
\item[2. Main Section]
... 
and so forth
\end{description}

However, I would like to avoid this approach because it would mean that anytime I inserted a list item in the middle, I would have to manually go through and update the subsequent list items.

Caramdir
  • 89,023
  • 26
  • 255
  • 291

2 Answers2

5

The sectioning commands \section, \subsection, etc. are provided for that purpose. See any basic introduction to LaTeX.

Caramdir
  • 89,023
  • 26
  • 255
  • 291
3

Assuming that you need this for writing a commented summary of your document, the code

\newcounter{dsection}
\newcounter{dsubsection}[dsection]
\newcommand\dsection[1]{%
  \refstepcounter{dsection}\item[\thedsection~#1]}
\newcommand\dsubsection[1]{%
  \refstepcounter{dsubsection}\item[\thedsubsection~#1]}

will allow you to say

\begin{description}
\dsection{Introduction}
...
\dsubsection{Purpose}
...
\dsubsection{Another subsection}
...
\dsection{Main Section}
... 
and so forth
\end{description}

You'd probably want also a personalized description environment; look at the documentation of enumitem that has several examples.

For the normal writing of a document, \section and \subsection are exactly what you're looking for.

egreg
  • 1,121,712
  • 1
    Thanks, this is an interesting approach, I like the \section and \subsection solution better though. – jbranchaud Sep 24 '11 at 22:21
  • 2
    @Treebranch: Well egreg literally answered your question (assuming that you knew about \section etc.) – Caramdir Sep 24 '11 at 22:24
  • @Caramdir, you would think if I had known about \section, etc. that I wouldn't have asked this question. Your facetiousness throughout this post has been wonderful and I look forward to asking many more questions on the Tex SE in the future. – jbranchaud Sep 25 '11 at 00:25