%Copyright 2021 Jean-Michel Bruel
%This program is free template, under the terms of the attached License of this repo. 
%Based on https://github.com/jpeisenbarth/SRS-Tex
%Itself based on the code of Yiannis Lazarides
%http://tex.stackexchange.com/questions/42602/software-requirements-specification-with-latex
%http://tex.stackexchange.com/users/963/yiannis-lazarides
%Also based on the template of Karl E. Wiegers
%http://www.se.rit.edu/~emad/teaching/slides/srs_template_sep14.pdf
%http://karlwiegers.com
\documentclass{scrreprt}
\usepackage{method}		% Specific command from Handbook
\usepackage{minitoc}	% For table of content in chapters
\usepackage{listings}
\usepackage{underscore}
\usepackage[bookmarks=true]{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\hypersetup{
    bookmarks=false,    % show bookmarks bar?
    pdftitle={Software Requirement Specification},    % title
    pdfauthor={Jean-Philippe Eisenbarth},                     % author
    pdfsubject={TeX and LaTeX},                        % subject of the document
    pdfkeywords={TeX, LaTeX, graphics, images}, % list of keywords
    colorlinks=true,       % false: boxed links; true: colored links
    linkcolor=blue,       % color of internal links
    citecolor=black,       % color of links to bibliography
    filecolor=black,        % color of file links
    urlcolor=purple,        % color of external links
    linktoc=page            % only page is linked
}%
\def\myversion{1.24.8 }
\date{}
%\title{%

%}
\usepackage{hyperref}
\newcommand*{\nsection}[1]{
    \section*{#1}
    \addcontentsline{toc}{section}{#1}
}
%--------------------- Numbering ---------------
\usepackage{amsthm}
\usepackage{xassoccnt}
%\newtheorem{req}{Requirement}[section]        
\newtheorem{req}{Requirement}        
\theoremstyle{definition}        
\newtheorem{constraint}{Constraint}
\newtheorem{goal}{Goal}
\DeclareCoupledCountersGroup{theorems}
\DeclareCoupledCounters[name=theorems]{req,constraint,goal}
\setcounter{goal}{0}
%--------------------- Comments ---------------
\newcommand{\mynote}[3][black]{\textcolor{#1}{\fbox{\bfseries\sffamily\scriptsize{#2}}
{\small\textsf{\emph{#3}}}}}
\newcommand{\comment}[1]{\mynote[red]{Comment:}{#1}}
%\newcommand{\comment}[1]{}
\newcommand{\notEmpty}{\comment{This chapter should not be empty!}}

\begin{document}

\begin{flushright}
    \rule{16cm}{5pt}\vskip1cm
    \begin{bfseries}
        \Huge{SOFTWARE REQUIREMENTS\\ SPECIFICATION}\\
        \vspace{1.9cm}
        for\\
        \vspace{1.9cm}
        $<$Project$>$\\
        \vspace{1.9cm}
        \LARGE{Version \myversion approved}\\
        \vspace{1.9cm}
        Prepared by $<$author$>$\\
        \vspace{1.9cm}
        $<$Organization$>$\\
        \vspace{1.9cm}
        \today\\
    \end{bfseries}
\end{flushright}

%===============================================================
\chapter*{Revision History}
%===============================================================

\begin{center}
    \begin{tabular}{|c|c|c|c|}
        \hline
	    Name        & Date          & Reason For Changes & Version\\
        \hline
        \hline
	    J.-M. Bruel & 2021-01-22    & First Draft & 1.0\\
        \hline
	    J.-M. Bruel & 2023-01-28    & Check after publication of the Handbook & 1.23\\
        \hline
	    J.-M. Bruel & 2023-06-12    & Add reqs automated numbering & 1.23.1 \\
        \hline
	    J.-M. Bruel & 2023-08-25    & Add Minimum Requirements Outcome Principle & 1.23.8 \\
        \hline
	    J.-M. Bruel & 2023-12-22    & Remove section numbers & 1.23.12 \\
        \hline
	    J.-M. Bruel & 2024-08-01    & Add warning about non empty chapters  & \myversion \\
        \hline
    \end{tabular}
\end{center}

This document follows the requirements documentation structure presented in the \href{ https://link.springer.com/content/pdf/10.1007/978-3-031-06739-6.pdf}{Handbook of requirements and business analysis}, by Bertrand Meyer.

%===============================================================
\dominitoc% Initialization
\tableofcontents
\adjustmtc
%===============================================================

%===============================================================
\addcontentsline{toc}{chapter}{Goals book}
\chapter*{Goals}

\minitoc% Creating an actual minitoc
%===============================================================

\comment{Goals are "needs of the target organization, which the system will address". While the development team is the principal user of the other books, the Goals book addresses a wider audience: essentially, all stakeholders.}

\nsection{G.1 Context and overall objective}
\comment{High-level view of the project: organizational context and reason for building a system.} 
%---------------------------------
\notEmpty{}
%---------------------------------

\begin{goal}\label{goal:first}
This is a goal example. If you need explicit (and automatic) numbering, you can use the definitions in the \texttt{.tex} template.
Is is refined by \ref{req:memo}
\end{goal}

\begin{req}\label{req:cross}
This is a requirement example. It illustrates how numbering is continuous and cross-types (if this is what you need).
\end{req}
    
\nsection{G.2 Current situation}
\comment{Current state of processes to be addressed by the project and the resulting system.}

\begin{req}\label{req:memo}
This is a requirement example. 
It refines \ref{goal:first}
\end{req}
    
\nsection{G.3 Expected benefits}
\comment{New processes, or improvement to existing processes, made possible by the project’s results.}
%---------------------------------
\notEmpty{}
%---------------------------------

\nsection{G.4 Functionality overview}
\comment{Overview of the functions (behavior) of the system. Principal properties only (details are in the System book).}

\nsection{G.5 High-level usage scenarios}
\comment{Fundamental usage paths through the system.}

\nsection{G.6 Limitations and exclusions}
\comment{Aspects that the system need not address.}

\nsection{G.7 Stakeholders and requirements sources}
\comment{Groups of people who can affect the project or be affected by it, and other places to consider for information about the project and system.}
%---------------------------------
\notEmpty{}
%---------------------------------

%===============================================================
\chapter*{Environment}
\addcontentsline{toc}{chapter}{Environment book}
\minitoc% Creating an actual minitoc
%===============================================================

\comment{The Environment book describes the application domain and external context, physical or virtual (or a mix), in which the system will operate.}

\nsection{E.1 Glossary}
\comment{Clear and precise definitions of all the vocabulary specific to the application domain, including technical terms, words from ordinary language used in a special meaning, and acronyms.
This chapter should not be empty!}

\nsection{E.2 Components}
\comment{List of elements of the environment that may affect or be affected by the system and project. Includes other systems to which the system must be interfaced.}

\nsection{E.3 Constraints}
\comment{Obligations and limits imposed on the project and system by the environment.}
%---------------------------------
\notEmpty{}
%---------------------------------


\nsection{E.4 Assumptions}
\comment{Properties of the environment that may be assumed, with the goal of facilitating the project and simplifying the system.}

\nsection{E.5 Effects}
\comment{Elements and properties of the environment that the system will affect.}

\nsection{E.6 Invariants}
\comment{Properties of the environment that the system’s operation must preserve.}

%===============================================================
\chapter*{System}
\addcontentsline{toc}{chapter}{System book}
\minitoc% Creating an actual minitoc
%===============================================================

\comment{The System book refines the Goal one by focusing on more detailed requirements about the system under development, mainly its constituents, behaviors and properties.}

\nsection{S.1 Components}
\comment{Overall structure expressed by the list of major software and, if applicable, hardware parts.}
%---------------------------------
\notEmpty{}
%---------------------------------

\nsection{S.2 Functionality}
\comment{One section, S.2.n, for each of the components identified in S.2, describing the corresponding behaviors (functional and non-functional properties).}
%---------------------------------
\notEmpty{}
%---------------------------------

\nsection{S.3 Interfaces}
\comment{How the system makes the functionality of S.2 available to the rest of the world, particularly user interfaces and program interfaces (APIs).}

\nsection{S.4 Detailed usage scenarios}
\comment{Examples of interaction between the environment (or human users) and the system: use cases, user stories.}

\nsection{S.5 Prioritization}
\comment{Classification of the behaviors, interfaces and scenarios (S.2, S.3 and S.4) by their degree of criticality.}

\nsection{S.6 Verification and acceptance criteria}
\comment{Specification of the conditions under which an implementation will be deemed satisfactory.}

%===============================================================
\chapter*{Project}
\addcontentsline{toc}{chapter}{Project book}
\minitoc% Creating an actual minitoc
%===============================================================

\comment{The Project book describes all the constraints and expectations not about the system itself, but about how to develop and produce it.}

\nsection{P.1 Roles and personnel}
\comment{Main responsibilities in the project; required project staff and their needed qualifications.}

\nsection{P.2 Imposed technical choices}
\comment{Any a priori choices binding the project to specific tools, hardware, languages or other technical parameters.}

\nsection{P.3 Schedule and milestones}
\comment{List of tasks to be carried out and their scheduling.}
%---------------------------------
\notEmpty{}
%---------------------------------

\nsection{P.4 Tasks and deliverables}
\comment{Details of individual tasks listed under P.3 and their expected outcomes.}
%---------------------------------
\notEmpty{}
%---------------------------------

\nsection{P.5 Required technology elements}
\comment{External systems, hardware and software, expected to be necessary for building the system.}

\nsection{P.6 Risks and mitigation analysis}
\comment{Potential obstacles to meeting the schedule of P.4, and measures for adapting the plan if they do arise.}

\nsection{P.7 Requirements process and report}
\comment{Initially, description of what the requirements process will be; later, report on its steps.}


%===============================================================
\end{document}
%===============================================================
