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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a document where I want the subsections of a section to be self contained so I can have a structure like this:

Section heading

a

b

c

Section heading 2

a

b

c

At the moment I have a document structured like this:

\documentclass[12pt, titlepage]{article}
\begin{document}

\renewcommand\thesection{\arabic{section}}
\renewcommand\thesubsection{\alph{subsection}}
\renewcommand\thesubsubsection{\roman{subsubsection}}

\section*{Question 1}
\subsection{}
\subsection{}
\subsection{}
\section*{Question 2}
\subsection{}
\subsection{}
\subsection{}

\end{document}

Which results in the \subsections numbering carrying through to give something like

Question 1

a

b

c

Question 2

d

e

f

How can I prevent this from happening? Also is there a way to format the numbering at all so instead of it just being "a" make it "(a)"?

share|improve this question
up vote 6 down vote accepted

The second part of your question to change the number formatting just requires the addition of the braces in:

\renewcommand\thesubsection{(\alph{subsection})}

The reason the subsection numbers are not being reset is that you are using \section*. So, here is one not so automated way to fix that: Use \setcounter{subsection}{0} to reset the subsection counter:

\documentclass[12pt, titlepage]{article}
\begin{document}

\renewcommand\thesection{\arabic{section}}
\renewcommand\thesubsection{(\alph{subsection})}
\renewcommand\thesubsubsection{\roman{subsubsection}}

\section*{Question 1}
\subsection{}
\subsection{}
\subsection{}

\section*{Question 2}\setcounter{subsection}{0}
\subsection{}
\subsection{}
\subsection{}

\end{document}

Alternatively, you could simply use \section instead of \section*:

enter image description here

\documentclass[12pt, titlepage]{article}
\begin{document}

\renewcommand\thesection{Question \arabic{section}}
\renewcommand\thesubsection{(\alph{subsection})}
\renewcommand\thesubsubsection{\roman{subsubsection}}

\section{}
\subsection{}
\subsection{}
\subsection{}

\section{}
\subsection{}
\subsection{}
\subsection{}

\end{document}
share|improve this answer
    
If I were to use \section{} instead of \section*{Question one} then I would get output like: 1 Question one, which looks kind of weird? – Aesir Oct 18 '11 at 21:20
    
Then the first method would work for you. Or use \renewcommand\thesection{Question}. – Peter Grill Oct 18 '11 at 21:21
    
Variant 2 is beautiful -- as long as there's no need ever for section headers other than "Question x. :-) – Mico Oct 18 '11 at 21:22
    
Cool, thanks a lot for your help on this. – Aesir Oct 18 '11 at 21:28

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.
http://tex.stackexchange.com/questions/31967/how-can-i-contain-the-numbering-of-subsections-to-a-section/31968
tex.stackexchange.com
crawl=CC-MAIN-2016-22
75192
application/http; msgtype=response
sha1:IGPK6SR67R7L6VKNL4MAOJ3CZZVFX46H
<urn:uuid:509bdf5e-7262-4a25-ad43-149771cf3f9e>
2016-05-31T06:00:07Z
104.16.115.182
sha1:BEWBP3E6KTUNMEGNQHZQSSORVGCLBA5W
<urn:uuid:23078434-a7b6-44ed-820c-5259aedef342>
http://tex.stackexchange.com/questions/31967/how-can-i-contain-the-numbering-of-subsections-to-a-section/31968
response
<urn:uuid:a25cfb82-8d6a-4c72-940d-12be20d89df6>
robots: classic
hostname: ip-10-185-217-139.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2016-22
operator: CommonCrawl Admin
description: Wide crawl of the web for May 2016
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf