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.

Much in the way that the tab key iterates over section levels:

Part -> Chapter -> Section -> Subsection -> Subsubsection -> Paragraph -> Subparagraph

I would like to do the same thing for my requirements, see code below. For example, pressing a key or key sequence on keyboard "Requirement1" would change the level to "Requirement2", and so on.

Is this possible?

Counter requirementCnt
    LabelString          "Requirement: \arabic{requirementCnt}."
End

Counter subrequirementCnt
    Within               requirementCnt
End

Counter subsubrequirementCnt
    Within               subrequirementCnt
End

Counter subsubsubrequirementCnt
    Within               subsubrequirementCnt
End

Style RequirementList
      Category              Requirement
      KeepEmpty             1
      Margin                Dynamic
      LatexType             Command
      LatexName             listofrequirement
      ParIndent             MM
      Align                 Block
      AlignPossible         Block
      LabelType             Static
      LabelString           "--- Requirement List ---"
      LabelFont
        Size                Normal
        Color               Blue
      EndFont
End

AddToPreamble
%%%
% Preamble
%%%
\usepackage{tocloft}
\usepackage{nameref}
\usepackage{refstyle}
\newcommand{\listrequirementname}{List of Requirements}

\newref{req}{%refcmd={#1~Requirement:~\ref{#1},~`\nameref{#1}'}
name = {Requirement~},
names = {Requirement~},
Name = {Requirement~},
Names = {Requirement~},
rngtxt = \RSrngtxt,
lsttwotxt = \RSlsttxt,
lsttxt = \RSlsttxt
}

\newlistof{requirement}{req}{\listrequirementname}
EndPreamble

Style Requirement1
        Category              Requirement
    RefPrefix             req
    TocLevel              0
    LatexType Command
    LatexName requirement
    LabelType Counter
    LabelCounter          requirementCnt
    LabelString           "Requirement \arabic{requirementCnt}: "
    OptionalArgs 1

    LabelSep              xxx
    ParSep                0.7
    Margin                Dynamic
    Font
        Series      Bold
    EndFont
    Preamble
\makeatletter
\newcommand{\requirement}[1]{%
 \def\@currentlabelname{#1}
 \refstepcounter{requirement}
 \par\noindent\textbf{Requirement \therequirement: #1}
 \addcontentsline{req}{requirement}{\protect\numberline{\therequirement}#1}
}
\makeatother

\setcounter{reqdepth}{1}
    EndPreamble
End

Style Requirement2
        Category              Requirement
    RefPrefix             req
    TocLevel              1
    LatexType Command
    LatexName subrequirement
    LabelType Counter

    LabelCounter          subrequirementCnt
    LabelString           "Requirement \arabic{requirementCnt}.\arabic{subrequirementCnt}: "
    OptionalArgs 1

    LabelSep              xxx
    ParSep                0.7
    Margin                Dynamic
    Font
        Series      Bold
    EndFont
    Preamble
\makeatletter
\newlistentry[requirement]{subrequirement}{req}{1}
\newcommand{\subrequirement}[1]{%
 \def\@currentlabelname{#1}
 \refstepcounter{subrequirement}
 \par\noindent\textbf{Requirement \thesubrequirement: #1}
 \addcontentsline{req}{subrequirement}{\protect\numberline{\thesubrequirement}#1}
}
\makeatother

\setcounter{reqdepth}{2}
    EndPreamble
End


Style Requirement3
        Category              Requirement
    RefPrefix             req
    TocLevel              2
    LatexType Command
    LatexName subsubrequirement
    LabelType Counter

    LabelCounter          subsubrequirementCnt
    LabelString           "Requirement \arabic{requirementCnt}.\arabic{subrequirementCnt}.\arabic{subsubrequirementCnt}: "
    OptionalArgs 1

    LabelSep              xxx
    ParSep                0.7
    Margin                Dynamic
    Font
        Series      Bold
    EndFont
    Preamble
\makeatletter
\newlistentry[subrequirement]{subsubrequirement}{req}{1}
\newcommand{\subsubrequirement}[1]{%
 \def\@currentlabelname{#1}
 \refstepcounter{subsubrequirement}
 \par\noindent\textbf{Requirement \thesubsubrequirement: #1}
 \addcontentsline{req}{subsubrequirement}{\protect\numberline{\thesubsubrequirement}#1}
}
\makeatother

\setcounter{reqdepth}{3}
    EndPreamble
End

Style Requirement4
        Category              Requirement
    RefPrefix             req
    TocLevel              3
    LatexType Command
    LatexName subsubsubrequirement
    LabelType Counter

    LabelCounter          subsubsubrequirementCnt
    LabelString           "Requirement \arabic{requirementCnt}.\arabic{subrequirementCnt}.\arabic{subsubrequirementCnt}.\arabic{subsubrequirementCnt}: "
    OptionalArgs 1

    LabelSep              xxx
    ParSep                0.7
    Margin                Dynamic
    Font
        Series      Bold
    EndFont
    Preamble
\makeatletter
\newlistentry[subsubrequirement]{subsubsubrequirement}{req}{1}
\cftsetindents{subsubsubrequirement}{1.5em}{3.0em}
\newcommand{\subsubsubrequirement}[1]{%
 \def\@currentlabelname{#1}
 \refstepcounter{subsubsubrequirement}
 \par\noindent\textbf{Requirement \thesubsubsubrequirement: #1}
 \addcontentsline{req}{subsubsubrequirement}{\protect\numberline{\thesubsubsubrequirement}#1}
}
\makeatother

\setcounter{reqdepth}{4}
    EndPreamble
End
share|improve this question

closed as too localized by lockstep, egreg, Joseph Wright Apr 14 '12 at 22:14

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
I would suggest sending an email to: lyx-users@lists.lyx.org –  scottkosty Mar 24 '12 at 18:28
add comment

Browse other questions tagged or ask your own question.