I created new section (i.e., "Workpackage") and subsection (i.e., "Task") headings using titlesec
package. The definitions for both headings are as follows.
% Workpackage section
\titleclass{\WP}{straight}[\section]
\titleformat{\WP}{\normalfont\normalsize\bfseries}{}{0em}{Work Package \theWP :\,}
\titlespacing*{\WP}{0pt}{2.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\newcounter{WP}
\renewcommand\theWP{\arabic{WP}}
% Task subsection
\newcounter{Taskr}
\renewcommand\theTaskr{\theWP.\arabic{Taskr}}
\titleclass{\Taskr}{straight}[\WP]
\titleformat{\Taskr}[runin]{\normalfont\normalsize\itshape}{}{0em}{Task \theTaskr :\,}
\titlespacing*{\Taskr}{0pt}{2.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\numberwithin{Taskr}{WP}
However, when I compiled the document the ordinary subsection headings are without heading numbers, e.g.:
1. Section
Subsection
Subsection
2. Section
Subsection
Workpackage 1
Task 1.1
instead of
1. Section
1.1 Subsection
1.2 Subsection
2. Section
2.2 Subsection
Workpackage 1
Task 1.1
Any how to modify my definitions? The MWE is pasted below.
\documentclass{article}
\usepackage{amsmath}
\usepackage{titlesec}
% Workpackage section
\titleclass{\WP}{straight}[\section]
\titleformat{\WP}{\normalfont\normalsize\bfseries}{}{0em}{Work Package \theWP :\,}
\titlespacing*{\WP}{0pt}{2.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\newcounter{WP}
\renewcommand\theWP{\arabic{WP}}
% Task subsection
\newcounter{Taskr}
\renewcommand\theTaskr{\theWP.\arabic{Taskr}}
\titleclass{\Taskr}{straight}[\WP]
\titleformat{\Taskr}[runin]{\normalfont\normalsize\itshape}{}{0em}{Task \theTaskr :\,}
\titlespacing*{\Taskr}{0pt}{2.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\numberwithin{Taskr}{WP}
% Don't want to include WP and Tasks into bookmarks and TOC
\makeatletter
\def\toclevel@WP{6}
\def\toclevel@Taskr{5}
\makeatother
\begin{document}
\section{Introduction}
\subsection{Problem definition}
\WP{Project management}
\Taskr{Project advisory board}
\end{document}