File: natbib.citeengine

package info (click to toggle)
lyx 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 138,444 kB
  • sloc: cpp: 244,268; ansic: 106,398; xml: 72,791; python: 39,384; sh: 7,666; makefile: 6,584; pascal: 2,143; perl: 2,101; objc: 1,084; tcl: 163; sed: 16
file content (263 lines) | stat: -rw-r--r-- 9,126 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# \DeclareLyXCiteEngine[natbib.sty]{Natbib (BibTeX)}
# DescriptionBegin
#   Natbib supports a range of both author-year and numerical styles mainly
#   aimed at the Humanities. It features automatic sorting and merging of
#   numerical citations, annotations, capitalization of the `van' part of
#   author names, shortened and full author lists, and more.
# DescriptionEnd

# Author: Julien Rioux <jrioux@lyx.org>

Format 111

Requires natbib

# The framework (biblatex|bibtex)
CiteFramework bibtex

# Cite style variants (default|authoryear|natbib)
# We provide both authoryear and numerical citations
CiteEngineType authoryear|numerical

# Default style files for either engine type
DefaultBiblio  authoryear:plainnat|numerical:plainnat

# Maximum number of names before "et al." chimes in
MaxCiteNames 2


# The syntax of the cite command definitions below is:
# LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd
# 
# * LyXName:  The LyX name as output in the LyX file. For
#             portability reasons, we try to use the same
#             name for same-formatted commands in the
#             different engines (thus many names stem from
#             natbib).
# * Alias:    A (comma-separated) list of commands that fall
#             back to the given LyX name in the current engine.
#             This is a bit like "ObsoletedBy" in the layouts.
# * latexcmd: The actual LaTeX command that is output.
#
# Alias and latexcmd are optional. If no latexcmd is given, the
# LyXName will be output to LaTeX.
#
# Note further:
#
# * The LyXName "keyonly" has a special meaning: only the citation key,
#   without any latex command, is output.
# * Capitalization indicates that the command also has a capitalized
#   form (\Latexcmd vs. \latexcmd). These usually enforce upcasing of
#   name prefixes (von Goethe => Von Goethe).
# * Brackets [] indicate the number of optional arguments (0, 1, 2).
# * The star * indicates there is a starred version of the command
#   (\latexcmd* vs. \latexcmd). By default, the starred version means:
#   Expand the author list even if the maxnames setting would cause
#   BibTeX/Biber to shorten it with "et al.".
#   If the star has a different meaning for a command, it can be
#   specified in angle brackets: <!_stardesc!_stardesctooltip>.
#   Maximal two translatable macro keywords, marked by the prefix '!_',
#   can be given. The first points to the string that replaces the
#   "Full aut&hor list" checkbox label in the Citation dialog, the
#   second one an optional tooltip for this checkbox. Note that these
#   two macros have to be defined in the CiteFormat section (see below),
#   dropping the '!' from the prefix (see below), e.g.:
#   _stardesc Starred command label
#   _stardesctooltip Tooltip for the starred command checkbox.

#
# CITE COMMAND DEFINITIONS for either engine type
#
CiteEngine authoryear
	Citet*[][]
	Citep*[][]
	Citealt*[][]
	Citealp*[][]
	Citeauthor*[]
	citeyear[]
	citeyearpar[][]
	nocite
	keyonly
End

CiteEngine numerical
	Citep*[][]
	Citealp*[][]
	Citet*[][]
	Citealt*[][]
	Citeauthor*
	citeyearpar[][]
	citeyear
	nocite
	keyonly
End


#
# CITE FORMAT
#

# The following defines how the commands are represented in the GUI
# (inset button and citation dialog) as well as in XHTML, docbook and
# plain text output.
#
# There are common definitions (default) and specific definitions for
# either cite engine type (which overwrite existing defaults.
#

# Input standard format definitions for the bibliography
Input stdciteformats.inc

CiteFormat default
	#
	# MACROS
	#
	# 1. Translatable bits (need to be marked by _ prefix, if translated to the GUI language,
	#    or B_, if translated to the buffer language)
	#    Note that preceding and trailing spaces matter.
	#
	_notcited not cited
	_addtobib Add to bibliography only.
	_keyonly Key only.
	_key Key
	# The following are handled by BiblioInfo
	B_etal  et al.
	B_namesep , [[separate author names in citation, except for last name]]
	B_lastnamesep , and [[separate name of last author in citation]]
	B_pairnamesep  and [[separate two authors in citation]]

	#
	# 2. Macros re-used in the style definitions
	#
	# A link that lets us jump to the bibliography entry in LyXHTML
	# %clean:key% will be substituted by the cite key to give a unique id
	!startlink {!<a href='#LyXCite-%clean:key%'>!}
	!endlink {!</a>!}

	# "Author et al." or "??"
	!abbrvciteauthor {%abbrvciteauthor%[[%abbrvciteauthor%]][[??]]}
	# "Author, ..." or "??"
	!fullciteauthor {%fullciteauthor%[[%fullciteauthor%]][[??]]}
	# Handle starred command: abbr. or full author list
	!makeauthor {%ifstar%[[%!fullciteauthor%]][[%!abbrvciteauthor%]]}
	# "prenote "
	!textbefore {%textbefore%[[%textbefore% ]]}
	# ", postnote"
	!textafter {%textafter%[[, %textafter%]]}
	# Add a year if it exists (else "??") and possibly a modifier (as in 2017a)
	!year {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]]}

	# "...; Author..."
	!nextauthor {%next%[[%!sep% %!startlink%%!abbrvauthor%%!endlink%%!nextauthor%]]}
	# Handle starred command: abbr. or full author list
	!makenextauthor {%next%[[%!sep% %!startlink%%!makeauthor%%!endlink%%!makenextauthor%]]}
	# "..., CiteKey..."
	!nextkey {%next%[[%!sep% %key%%!nextkey%]]}
	# "..., Year..."
	!nextyear {%next%[[%!sep% %!startlink%%!year%%!endlink%%!nextyear%]]}

	#
	# ACTUAL STYLE DEFINITIONS
	#
	# (identical in authoryear and numerical)
	#

	# "(cf. Year; NextYear, p. xx)" [Authoryear] / "(cf. Year, NextYear, p. xx)" [Numerical]
	citeyearpar %!open%%!textbefore%%!startlink%%!year%%!endlink%%!nextyear%%!textafter%%!close%
	# "Add to bibliography only." (dialog) / "[ID] (not cited)" (button)
	nocite {%dialog%[[%_addtobib%]][[%key%%!nextkey% (%_notcited%)]]}
	# Output only the key
	keyonly {%dialog%[[%_keyonly%]][[%_key%: %key%%!nextkey%]]}
End

CiteFormat authoryear
	#
	# MACROS
	#
	!open (
	!sep ;
	!close )

	# "Author et al. (cf. Year..."
	!makecitet %!startlink%%!makeauthor%%!endlink% %!open%%!textbefore%%!year%%!nextcitet%
	# "Author et al. cf. Year..." [sic!]
	!makecitealt %!startlink%%!makeauthor% %!textbefore%%!year%%!endlink%%!nextcitealt%
	# "Author et al., Year..."
	!makecitealp %!startlink%%!makeauthor%, %!year%%!endlink%%!nextcitealp%

	# "...); Nextauthor (Year..."
	!nextcitet {%next%[[%!close%%!sep% %!startlink%%!makeauthor%%!endlink% %!open%%!year%%!nextcitet%]]}
	# "...; NextAuthor et al. Year..."
	!nextcitealt {%next%[[%!sep% %!makecitealt%]]}
	# "...; NextAuthor et al., Year..."
	!nextcitealp {%next%[[%!sep% %!makecitealp%]]}

	#
	# ACTUAL STYLE DEFINITIONS
	#
	# (additions and modifications to default)
	#

	# "Author (cf. Year); NextAuthor (Year, p. xx)"
	citet %!makecitet%%!textafter%%!close%
	# "(cf. Author et al., Year; NextAuthor et al., Year, p. xx)"
	citep %!open%%!textbefore%%!makecitealp%%!textafter%%!close%
	# "cf. Author et al., Year; NextAuthor et al., Year, p. xx"
	citealp %!textbefore%%!makecitealp%%!textafter%
	# "Author cf. Year; NextAuthor Year, p. xx" [sic!]
	citealt %!makecitealt%%!textafter%
	# "Author; NextAuthor, p. xx"
	citeauthor %!startlink%%!makeauthor%%!endlink%%!makenextauthor%%!textafter%
	# "Year; NextYear, p. xx"
	citeyear %!startlink%%!year%%!endlink%%!nextyear%%!textafter%

	# Fallback style: "Author (cf. Year); NextAuthor (Year, p. xx)"
	cite %!makecitet%%!textafter%%!close%
End

CiteFormat numerical
	#
	# MACROS
	#
	!open [
	!sep ,
	!close ]

	# "Author [cf. ID..."
	!makecitet %!makeauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%
	# "Author cf. ID..."
	!makecitealt %!makeauthor% %!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitealt%
	# "ID..."
	!hashkey {%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}

	# "...], NextAuthor [ID..."
	!nextcitet {%next%[[%!close%%!sep% %!makeauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitet%]]}
	# "..., NextAuthor ID..."
	!nextcitealt {%next%[[%!sep% %!makeauthor% {%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nextcitealt%]]}
	# FIXME: What is this?
	!nexthashid {%next%[[%!sep% #ID%!nexthashid%]]}
	# "..., NextID..."
	!nexthashkey {%next%[[%!sep% %!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%%!nexthashkey%]]}

	#
	# ACTUAL STYLE DEFINITIONS
	#
	# (additions and modifications to default)
	#

	# "[cf. ID, NextID, p. xx]"
	citep %!open%%!textbefore%%!hashkey%%!textafter%%!close%
	# "Author [cf. ID], Nextauthor [NextID, p. xx]"
	citet %!makecitet%%!textafter%%!close%
	# "cf. ID, NextID, p. xx"
	citealp %!textbefore%%!hashkey%%!textafter%
	# "Author cf. ID, NextAuthor ID, p. xx"
	citealt %!makecitealt%%!textafter%
	# "Author, NextAuthor"
	citeauthor %!startlink%%!makeauthor%%!endlink%%!makenextauthor%
	# "Year, NextYear"
	citeyear %!startlink%%!year%%!endlink%%!nextyear%

	# Fallback style: "[cf. ID, NextID, p. xx]"
	cite %!open%%!textbefore%%!hashkey%%!textafter%%!close%
End