Using the report class (no option to change this), I'm trying to accomplish this format: Chapter > Scenario (section) > ScenarioTask (section) where each chapter starts with a Scenario that is a \section*
. To maintain the same formatting, I also use \section for the ScenarioTask.
Example:
\chapter{ChapterTitle} %to be numbered normally
\section*{Scenario #} scenario text here %to be numbered according to scenario # so Scenario 1 would be 1.0
\section{ScenarioTask} scenario tasks here in enumerated lists %to be numbered Scenario#.Task#
I have the following command that renumbers \thesection
, labels a section without numbering it and then adds the entry to the toc. I do this so that the entry is in the TOC but it does not have section number. The problem is that all the TOC entries are the same.
\documentclass[twoside,openright,12pt]{report}
\newcounter{ScenarioNo} \stepcounter{ScenarioNo}
\newcommand{\scenario}{%
\renewcommand\thesection{\arabic{ScenarioNo}.\arabic{TaskNo}}
\section*{Scenario \theScenarioNo}\label{sec:scenario \theScenarioNo}
\addcontentsline{toc}{section}{\nameref{sec:scenario \theScenarioNo}}
\setcounter{TaskNo}{0}
}
\renewcommand\thetable{\arabic{ScenarioNo}.\arabic{table}}
\preto{\section}{\stepcounter{TaskNo}}
When the command first runs, ScenarioNo is 1. Each time I issue the \scenario
command, the ScenarioNo is incremented by one because I \stepcounter{ScenarioNo}
prior to \scenario
. This is not working for the TOC entries. I have to be making this more complicated than necessary.
\chapter{Chapter1Title}
\scenario
\renewcommand\thesection{\arabic{ScenarioNo}.\arabic{TaskNo}}
\section{ScenarioTask1}
\section{ScenarioTask2}
\stepcounter{ScenarioNo} \scenario
\section{ScenarioTask1}
\section{ScenarioTask2}
\stepcounter{ScenarioNo} \scenario
\section{ScenarioTask1}
\section{ScenarioTask2}
Best Answer
This is just a guess of what you're after. Perhaps refinements are needed: