Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I added a new list (requirements) but the short names do not appear in the List of Requirements (LOR). Instead, all that appears in the LOR is the initial '['

The setup code is:

\usepackage{subfig}
\usepackage[titles,subfigure]{tocloft}% to define requirements list for TOC,F,T
\newcommand{\listrequirementsname}{LIST OF REQUIREMENTS}
\newlistof[subsubsection]{requirement}{rqt}{\listrequirementsname}
\newcommand{\requirement}[1]{%
\refstepcounter{requirement}
\par\noindent\textbf{Rqt \therequirement. #1}
\addcontentsline{rqt}{requirement}{\protect\numberline{\therequirement}#1}\par}

The usage is:

\requirement[short name]{Interface 1 Connector hfjdkh jfdhf kjfd fjdjf jfd jfdj fjdfj fjda jfjdafih eiufhda fdaf fda oif}

The output in the LOR is:

3.2.1.1.1 [ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

And the output in the actual requirement is:

Rqt 3.2.1.1.1. [
short name]Interface 1 Connector hfjdkh jfdhf kjfd fjdjf jfd jfdj fjdfj fjda jfjdafih eiufhda fdaf fda oif

share|improve this question
add comment

1 Answer

The problem with your current definition of \requirement is that it only takes one mandatory argument, that is used for both the document and for the entry in the new list.

You need to define \requirement with one optional argument (that, if present, will be used for the list) and a mandatory one; something along these lines (I also increased the space reserved for the numbers in the new list):

\documentclass[titles,subfigure]{article}
\usepackage{tocloft}
\usepackage{subfig}
\usepackage{xifthen}

\newcommand{\listrequirementsname}{LIST OF REQUIREMENTS}
\newlistof[subsubsection]{requirement}{rqt}{\listrequirementsname}

\newcommand{\requirement}[2][]{%
\refstepcounter{requirement}
\par\noindent\textbf{Rqt \therequirement. #2}
\ifthenelse{\isempty{#1}{}}
  {\addcontentsline{rqt}{requirement}{\protect\numberline{\therequirement}#2}\par}
  {\addcontentsline{rqt}{requirement}{\protect\numberline{\therequirement}#1}\par}
}

\setlength\cftrequirementnumwidth{4em}

\begin{document}
\listofrequirement
\requirement[short name]{Interface 1 Connector}
\requirement{Interface 2 Connector}

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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