8

How do I get the number of the current subsection in a report, without the chapter number? What I'm wanting to do is produce a requirements list as follows using the enumitem package:

\documentclass[a4paper, 11pt]{report}

\usepackage{enumitem}

\newlist{requirements}{enumerate}{1}
\setlist[requirements]{label=\textbf{R\thesubsection.\arabic*}}

\begin{document}
\chapter{Requirements}
\section{Functional Requirements}
\subsection{Requirements Category}
Some information about ``requirements category'' goes here.
\begin{requirements}
    \item First Requirement
    \item Second Requirement
\end{requirements}
\subsection{Different Requirements Category}
Foo bar baz. Herpeddy Derpeddy.
\begin{requirements}
    \item This is a first requirement
    \item This is a second requirement
\end{requirements}
\section{Non-functional Requirements}
\subsection{Category}
Category category category.
\begin{requirements}
    \item First NFR
    \item Another NF-Requirement
\end{requirements}
\end{document}

This produces lists of the R1.1.1.1, R1.1.1.2, etc.

What I'd like is lists of the form R1.1.1, R1.1.2, with the list in the next subsection being R1.2.1, R1.2.2 and so on.

lockstep
  • 250,273
Edd
  • 1,122
  • Is it worth me generalising this question a bit and removing my particular example of wanting to use the value in a list, or should I leave the question as is? – Edd Apr 29 '12 at 12:05

1 Answers1

12

Change \thesubsection to \arabic{section}.\arabic{subsection} .

David Carlisle
  • 757,742
  • Perfect, thanks. I knew it'd be something obvious, I just didn't know how to search for it! – Edd Apr 29 '12 at 12:05