lyx在自定义布局中创建标签

时间:2015-10-25 12:28:59

标签: layout lyx

我有一个自定义布局,为LyX添加了“字段”样式。每次创建“字段”时,我还希望在LyX中的“字段”中附加相应的标签。有没有办法在LyX中以编程方式执行此操作?

Counter fieldCnt
LabelString          "Field: \arabic{fieldCnt}."
PrettyFormat         "Field: ##"
End

AddToPreamble

\usepackage{tocloft}
\usepackage{ifthen}
\usepackage{nameref}%
\usepackage{hyperref}%
%\usepackage{refstyle}
\newcommand{\listfieldname}{List of Fields}

\newref{field}{ %
%refcmd = {\ref{#1}, `\nameref{#1}'},
name = {Field~},
names = {Field~},
Name = {Field~},
Names = {Field~},
rngtxt = \RSrngtxt,
lsttxt = \RSlsttxt
}

EndPreamble

Style Field1
Category              Field
RefPrefix field
LatexType Command
LatexName field
LabelType Counter
LabelCounter          fieldCnt
LabelString           "Field \arabic{fieldCnt}: "
OptionalArgs 1

LabelSep              xxx
ParSep                0.7
Margin                Dynamic
Font
Series      Bold
EndFont
Preamble
\newlistof{field}{field}{\listfieldname}
\newcommand{\field}[1]{%
 \refstepcounter{field}
 \par\noindent\textbf{Field \thefield: #1}
 \addcontentsline{field}{field}{\protect\numberline{\thefield}#1}\par}

\setcounter{fielddepth}{1}
EndPreamble
End

1 个答案:

答案 0 :(得分:0)

没有办法在布局文件的样式部分添加LyX代码。