I would like to define objects all over my document and later evaluate certain components from these objects.


\newcommand{\requirement}[3]{#1, #2, #3}

\requirement{Uwe}{2013-10-12}{Remove window}

\requirement{John}{2013-10-13}{Clean window}


How can I generate a table of all \requirements where each given argument of the requirement generates one column? How can I generate an list of all persons.

Background: I'd like to use LaTeX to write Business Requirements Documents, where I need to define objects such as stakeholders, business requirements and functional requirements that are connected to each other. I might be able to parse the document with Perl/Python etc. but I'd like to develop a TeX-only solution.

  • I'd suggest looking at Nicola Talbot's datatool package, which I think will help you with almost all the heavy lifting required to do this. – Brent.Longborough Oct 12 '13 at 10:53
  • Do you (1) need to externalize the data (e.g., as CSV) or do you (2) just want to collect them for some LaTeX tables within the document. Are these tables (a) printed behind all data acquisition commands in the document or may they (b) also have to be printed beforehand? Inside the tables, shall the data be sorted (I) in the order of definition or (II) by some other sorting criteria (e.g., alphabetically)? – Daniel Oct 12 '13 at 18:30
  • My intention at this stage is just to collect them in the document, it should be sufficient to print them after the aquisition. Following Brent's advice I managed to put something together that I'll post tomorrow as an update to my question. Looks pretty promising at the moment. Sorting is definitely a requirement, I guess I can easily add this to my code. – Uwe Ziegenhagen Oct 12 '13 at 18:44

Based on Brent's hint here is what I have come up so far.




    \par Stakeholder #2 defined!


    \par BR #3 defined  

% http://tex.stackexchange.com/questions/40901/datatool-getting-a-specific-value-given-the-value-of-another-column


\section{Stakeholder Definition}

\stakeholder{dag}{Dagobert Duck}

\stakeholder{don}{Donald Duck}

\stakeholder{mic}{Mickey Mouse}

\section{Definition of Business Requirements}

\breq{seca}{dag}{Security}{The system must be secured against internal attacks.}{high}

\breq{secb}{don}{Security}{The system must be secured against external attacks.}{medium}

\breq{secc}{mic}{Security}{The system must be secured against internal and external attacks.}{low}

\section{Query the databases}

The stakeholders DB contains \DTLrowcount{stakeholders} stakeholders.


The Business Requirements database contains \DTLrowcount{businessreq} BRs.



\section{For-loop with query ID$\rightarrow$Name}

\begin{tabular}{cllp{8cm}l} \toprule
 ID &  Initiator &  Name &  Description &  Priority \\ \midrule
\ID & \getstakeholder{\Initiator} & \Name & \Description & \Priority } \\ \bottomrule


enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.