4

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)"?

1 Answer 1

6

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}
3
  • 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, 2011 at 21:20
  • Then the first method would work for you. Or use \renewcommand\thesection{Question}. Oct 18, 2011 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, 2011 at 21:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .