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 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

1 Answer 1

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.