Skip to content

Instantly share code, notes, and snippets.

@atnon
Created February 19, 2015 00:19
Show Gist options
  • Save atnon/5d19f288c9c1e2f1cdf5 to your computer and use it in GitHub Desktop.
Save atnon/5d19f288c9c1e2f1cdf5 to your computer and use it in GitHub Desktop.
LaTeX Commands to number requirements and requirement revisions according to the LIPS Project Model Requirements Specifications document template.
% Function to handle requirement and requirement revision numbers.
% Put code in LaTeX Preamble.
% Author: Anton Landberg
% Use: When assigning a new requirement, use \requirement.
% There is also a command for reviding requirements, \requirementRev.
% This will yield a number such as 1,2,3,etc. and will be unique in the doc.
% It also supports labels, so that requirements can be easily referenced.
%
% Usage - \requirement
% Referencing a requirement can be done like this:
% \requirement\label{req:labelname} Requirement Text
% Some text, referring to requirement \ref{req:labelname}.
% And will yield something like this:
% Req. 1 Requirement Text
% Some text, referring to requirement 1.
%
% Usage - \requirementRev
% If the need to add revisions to a requirement, this can be done through
% the use of the command \requirementRev. It can be used as follows:
% \requirement\label{req:labelname} Requirement Text
% \requirementRev\label{req:revlabelname} Revised Requirement Text
% Some text referring to the revised requirement \ref{req:revlabelname}.
% And will yield something like this:
% Req. 1 Requirement Text
% Req. 1A Revised Requirement Text
% Some text referring to the revised requirement 1A.
% Setup counters to handle requirements and requirement revsions.
\newcounter{reqCounter}
\newcounter{reqRevCounter}[reqCounter]
% Create command for adding a new requirement.
\newcommand{\requirement}{
\refstepcounter{reqCounter}
Req. \arabic{reqCounter}
}
% Create command for adding a requirement revsion.
\newcommand{\requirementRev}{
\refstepcounter{reqRevCounter}
Req. \arabic{reqCounter}\Alph{reqRevCounter}
}
% Make sure that the \ref command prints the correct text.
\renewcommand{\thereqRevCounter}{\arabic{reqCounter}\Alph{reqRevCounter}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment