[Tex/LaTex] LaTeX template for use cases

macrostablestemplates

Currently I am trying to create a template in LaTeX for my team members in order to create a set of use cases. I thought of using tabular to create something like the picture below 2 (without colors). No problem so far.

However, I hoped there is a nice way to structure the document a way, only commands have to be used, for instance \actor{1}{System user}, where 1 is use case #1.

I don't know how to approach this for sure, especially when more then one line of text is included, for instance Main path (M) (at the picture).

Has anyone an idea what would be a good way to structure such a template or could point me out the right documentation to look up this topic?

Best Answer

You should try and keep you author's interface as simple as possible. I would create an environment to simplify this and add complexity and presentational aspects on the setup.

\newenvironment{usecase}
  \addheading{}{}
  \addrow{}{}
  \addmulrow{}{}
\end{usecase}

Here is a minimal example to implement this:

\documentclass{article}
\usepackage{booktabs}

\newcommand\addrow[2]{#1 &#2\\ }

\newcommand\addheading[2]{#1 &#2\\ \hline}
\newcommand\tabularhead{\begin{tabular}{lp{8cm}}
\hline
}

\newcommand\addmulrow[2]{ \begin{minipage}[t][][t]{2.5cm}#1\end{minipage}% 
   &\begin{minipage}[t][][t]{8cm}
    \begin{enumerate} #2   \end{enumerate}
    \end{minipage}\\ }

\newenvironment{usecase}{\tabularhead}
{\hline\end{tabular}}
\begin{document}
\begin{usecase}
  \addheading{Actor}{System user} 
  \addrow{Precondition}{The system, shows, in the form part of an object type, the number   indication.}
  \addrow{Postcondition}{A disconnected number indicating the type of `other constructed object'.}
  \addmulrow{Main path (M)}{\item User selects \ldots
                                   \item System demands \ldots}
\end{usecase}

\end{document}

You can add counters to automatically increment numbering, if you want. I couldn't understand your numbering scheme and hence left that out of the example.

To summarize, keep the author's commands simple (they only need to deal with the semantics) and place your presentational aspects in separate commands.

Related Question