Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
7  
Use \section, \subsection, etc.? See tex.stackexchange.com/questions/11/… –  Caramdir Sep 24 '11 at 22:10
    
Thanks, that is exactly what I was looking for, although the link you provided was a bit random. Why don't you post this as an answer to the question? –  jbranchaud Sep 24 '11 at 22:19
9  
Because it is generally assumed that people asking here read at least a basic introduction to LaTeX. –  Caramdir Sep 24 '11 at 22:21
    
How can Treebranch get 101 reputation just from this? –  Gopi Sep 24 '11 at 23:25
2  
By associating an existing SE account with over 200 reputation with the one on the site just joined, users get 100 reputation automatically on the new site. I certainly haven't done anything otherwise deserving of 100 rep on the bicycles site, for example. –  Mike Renfro Sep 24 '11 at 23:35
show 1 more comment

2 Answers

up vote 3 down vote accepted

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.

share|improve this answer
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 0:25
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.