与 Tab 键在各个部分级别上进行迭代的方式非常相似:
Part -> Chapter -> Section -> Subsection -> Subsubsection -> Paragraph -> Subparagraph
我想对我的需求做同样的事情,请参阅下面的代码。例如,按下键盘上的“Requirement1”键或按键序列会将级别更改为“Requirement2”,依此类推。
这可能吗?
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