]> git.lyx.org Git - lyx.git/blob - lib/citeengines/biblatex.citeengine
Adapt citengine to current layout format.
[lyx.git] / lib / citeengines / biblatex.citeengine
1 # \DeclareLyXCiteEngine[biblatex.sty]{Biblatex}
2 # DescriptionBegin
3 #   Biblatex supports many author-year and numerical styles. It is mainly
4 #   aimed at the Humanities. It is highly customizable, fully localized
5 #   and provides many features that are not possible with BibTeX.
6 #   The use of 'biber' as bibliography processor is advised.
7 # DescriptionEnd
8
9 # Author: Jürgen Spitzmüller <spitz@lyx.org>
10
11 Format 64
12
13 Requires biblatex
14
15 # The framework (biblatex|bibtex)
16 CiteFramework biblatex
17
18 # Cite style variants (default|authoryear|natbib)
19 # We provide both authoryear and numerical citations
20 CiteEngineType authoryear|numerical
21
22 # Default style files for either engine type
23 DefaultBiblio  authoryear:authoryear|numerical:numeric
24
25 # Maximum number of names before "et al." chimes in
26 MaxCiteNames 3
27
28
29 # The syntax of the cite command definitions below is:
30 # LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd
31
32 # * LyXName:  The LyX name as output in the LyX file. For
33 #             portability reasons, we try to use the same
34 #             name for same-formatted commands in the
35 #             different engines (thus many names stem from
36 #             natbib).
37 # * Alias:    A (comma-separated) list of commands that fall
38 #             back to the given LyX name in the current engine.
39 #             This is a bit like "ObsoletedBy" in the layouts.
40 # * latexcmd: The actual LaTeX command that is output.
41 #
42 # Alias and latexcmd are optional. If no latexcmd is given, the
43 # LyXName will be output to LaTeX.
44 #
45 # Note further:
46 #
47 # * The LyXName "keyonly" has a special meaning: only the citation key,
48 #   without any latex command, is output.
49 # * Capitalization indicates that the command also has a capitalized
50 #   form (\Latexcmd vs. \latexcmd). These usually enforce upcasing of
51 #   name prefixes (von Goethe => Von Goethe).
52 # * Brackets [] indicate the number of optional arguments (0, 1, 2).
53 # * The star * indicates there is a starred version of the command
54 #   (\latexcmd* vs. \latexcmd). By default, the starred version means:
55 #   Expand the author list even if the maxnames setting would cause
56 #   BibTeX/Biber to shorten it with "et al.".
57 #   If the star has a different meaning for a command, it can be
58 #   specified in angle brackets: <!_stardesc!_stardesctooltip>.
59 #   Maximal two translatable macro keywords, marked by the prefix '!_',
60 #   can be given. The first points to the string that replaces the
61 #   "Full aut&hor list" checkbox label in the Citation dialog, the
62 #   second one an optional tooltip for this checkbox. Note that these
63 #   two macros have to be defined in the CiteFormat section, dropping
64 #   the '!' from the prefix (see below), e.g.:
65 #   _stardesc Starred command label
66 #   _stardesctooltip Tooltip for the starred command checkbox.
67 # * A trailing $ indicates that a command features "qualified citation
68 #   lists" (a specific Biblatex feature)
69
70 #
71 # CITE COMMAND DEFINITIONS for either engine type
72 #
73 CiteEngine authoryear
74         Cite$|citealt,citealp[][]
75         Citet$[][]=textcite
76         Citep$[][]=parencite
77         Citeauthor*<!_citeauthorstar!_citeauthorstartooltip>[][]
78         citeyearpar[][]=parencite*
79         citeyear[][]=cite*
80         citebyear[][]=citeyear
81         Footcite$[][]=smartcite
82         Autocite$[][]
83         citetitle*<!_citetitlestar!_citetitlestartooltip>[][]
84         fullcite[][]
85         footfullcite[][]
86         nocite
87         keyonly
88 End
89
90 CiteEngine numerical
91         cite$|parencite,citep,citealt,citealp[][]
92         Citet$[][]=textcite
93         supercite
94         Footcite$[][]=smartcite
95         Autocite$[][]
96         Citeauthor*<!_citeauthorstar!_citeauthorstartooltip>[][]
97         citeyear|parencite*,citebyear[][]=citeyear*
98         citetitle*<!_citetitlestar!_citetitlestartooltip>[][]
99         fullcite[][]
100         footfullcite[][]
101         nocite
102         keyonly
103 End
104
105
106 #
107 # CITE FORMAT
108 #
109
110 # The following defines how the commands are represented in the GUI
111 # (inset button and citation dialog) as well as in XHTML, docbook and
112 # plain text output.
113 #
114 # There are common definitions (default) and specific definitions for
115 # either cite engine type (which overwrite existing defaults.
116 #
117
118 # Input standard format definitions for the bibliography
119 Input stdciteformats.inc
120
121 CiteFormat default
122         #
123         # MACROS
124         #
125         # 1. Translatable bits (need to be marked by _ prefix)
126         #    Note that preceding and trailing spaces matter.
127         #
128         _notcited not cited
129         _addtobib Add to bibliography only.
130         _keyonly Key only.
131         _key Key
132         _footnote Footnote
133         _foot Foot
134         _fullcite bibliography entry
135         _bibentry Full bibliography entry.
136         _autocite Autocite
137         _auto Auto
138         # GUI strings for the starred commands
139         _citeauthorstar S&horten author list[[Possible substitute to All aut&hors]]
140         _citeauthorstartooltip Force a short author list (using et al.)
141         _citetitlestar F&orce full title[[Possible substitute to All aut&hors]]
142         _citetitlestartooltip Use full title even if shorttitle exists
143         # The following are handled by BiblioInfo
144         _etal  et al.
145         _namesep , [[separate author names in citation, except for last name]]
146         _lastnamesep , and [[separate name of last author in citation]]
147         _pairnamesep  and [[separate two authors in citation]]
148
149         #
150         # 2. Macros re-used in the style definitions
151         #
152         # A link that lets us jump to the bibliography entry in LyXHTML
153         # %clean:key% will be substituted by the cite key to give a unique id
154         !startlink {!<a href='#LyXCite-%clean:key%'>!}
155         !endlink {!</a>!}
156
157         # Add " , and " before the last item (but " and " if there are only two), else ", "
158         !smartsep {%second%[[{%next%[[%_namesep%]][[%_pairnamesep%]]}]][[{%next%[[%_namesep%]][[%_lastnamesep%]]}]]}
159
160         # A dummy year modifier. This just indicates that a modifier might be output,
161         # to differentiate \cite* and \citeyear
162         !dummymod [a]
163
164         # "...; Nextauthor ..."
165         !nextauthor {%next%[[%!sep% %!startlink%%!abbrvciteauthor%%!endlink%%!nextauthor%]]}
166         # Handle starred command: abbr. or full author list
167         !makenextauthor {%next%[[%!sep% %!startlink%%!makeauthor%%!endlink%%!makenextauthor%]]}
168         # "...; [NextID] ..."
169         !nextkey {%next%[[%!sep% %key%%!nextkey%]]}
170         # "...; Nextyear ..." (including extra label, as in 2017a)
171         !nextyear {%next%[[%!sep% %!startlink%%!year%%!endlink%%!nextyear%]]}
172         # "...; Nextyear ..." (including emulated extra label, as in 2017[a])
173         !nextmyear {%next%[[%!sep% %!startlink%%!myear%%!endlink%%!nextmyear%]]}
174         # "...; Nextyear ..." (without any extra label)
175         !nextbyear {%next%[[%!sep% %!startlink%%!byear%%!endlink%%!nextbyear%]]}
176         # "...; Nexttitle ..." 
177         !makenexttitle {%next%[[%!sep% %!startlink%%!maketitle%%!endlink%%!makenexttitle%]]}
178         # "...; NextKey..."
179         !nextfullcite {%next%[[%!sep% %bibentry%%!nextfullcite%]]}
180
181         # "Author et al." (if > 3 authors) or "??"
182         !abbrvciteauthor {%abbrvciteauthor%[[%abbrvciteauthor%]][[??]]}
183         # "Author et al." (always) or "??"
184         !forceabbrvciteauthor {%forceabbrvciteauthor%[[%forceabbrvciteauthor%]][[??]]}
185         # Handle starred command: force of abbr. author list, independent of maxcitenames
186         !makeauthor {%ifstar%[[%!forceabbrvciteauthor%]][[%!abbrvciteauthor%]]}
187         # "prenote "
188         !textbefore {%textbefore%[[%textbefore% ]]}
189         # ", postnote"
190         !textafter {%textafter%[[, %textafter%]]}
191         # "prenote " (for qualified lists)
192         !ctextbefore {%curpretext%[[%curpretext% ]]}
193         # ", postnote" (for qualified lists)
194         !ctextafter {%curposttext%[[, %curposttext%]]}
195         # Add a year if it exists (else "??") and possibly a modifier (as in 2017a)
196         !year {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]]}
197         # Add a year if it exists (else "??") and indicate a possible modifier (as in 2017[a])
198         !myear {%year%[[%year%]][[??]]}{%modifier%[[%modifier%]][[{%export%[[]][[%!dummymod%]]}]]}
199         # Add a year if it exists (else "??") without any modifier at all
200         !byear {%year%[[%year%]][[??]]}
201         # Add a shorttitle or title if it exists (else "??")
202         !makeshorttitle {%shorttitle%[[%shorttitle%]][[{%title%[[%title%]][[??]]}]]}
203         # Add a title (or "??")
204         !maketitle {%ifstar%[[{%title%[[%title%]][[??]]}]][[%!makeshorttitle%]]}
205         # "cf. Key..."
206         !fullcite %!startlink%%bibentry%%!endlink%%!nextfullcite%
207
208         #
209         # ACTUAL STYLE DEFINITIONS
210         #
211         # (identical in authoryear and numerical)
212         #
213
214         # "cf. Author; Nextautor, p. xx"
215         citeauthor %!textbefore%%!startlink%%!makeauthor%%!endlink%%!makenextauthor%%!textafter%
216         # "cf. Year; Nextyear, p. xx" (including extra label, as in 2017a)
217         citeyear %!textbefore%%!startlink%%!myear%%!endlink%%!nextyear%%!textafter%
218         # "cf. Year; Nextyear, p. xx" (without any extra label)
219         citebyear %!textbefore%%!startlink%%!byear%%!endlink%%!nextbyear%%!textafter%
220         # "cf. Year; Nextyear, p. xx" (without any extra label)
221         citetitle %!textbefore%%!startlink%%!maketitle%%!endlink%%!makenexttitle%%!textafter%
222         # "Bibliography entry." (dialog) / "cf. Key; NextKey..., p. xx (bibliography entry)" (button)
223         fullcite {%dialog%[[%_bibentry%]][[%!textbefore%{%label%[[%!fullcite%]][[%key%%!nextkey% (%_fullcite%)]]}%!textafter%}]]}
224         # "Footnote: Full bibliography entry." (dialog) / "Foot: Key (bibliography entry)"
225         footfullcite {%dialog%[[%_footnote%]][[%_foot%]]}: {%dialog%[[%_bibentry%]][[{%label%[[%!fullcite%]][[%key%%!nextkey% (%_fullcite%)]]}]]}
226         # "Add to bibliography only." (dialog) / "[ID] (not cited)" (button)
227         nocite {%dialog%[[%_addtobib%]][[%key%%!nextkey% (%_notcited%)]]}
228         # Output only the key
229         keyonly {%dialog%[[%_keyonly%]][[%_key%: %key%%!nextkey%]]}
230 End
231
232 CiteFormat authoryear
233         #
234         # MACROS
235         #
236         !open (
237         !sep ;
238         !close )
239
240         # "cf. Author et. al Year..."
241         !makecite %!ctextbefore%%!startlink%%!abbrvciteauthor% %!year%%!endlink%%!ctextafter%%!nextcite%
242         # Author et al. (cf. Year...
243         !maketextcite {%ifqualified%[[%!textbefore%]]}%!startlink%%!abbrvciteauthor%%!endlink% %!open%{%ifqualified%[[%!ctextbefore%]][[%!textbefore%]]}%!year%%!ctextafter%%!nexttextcite%
244
245         # "...; Nextauthor Year..."
246         !nextcite {%next%[[%!sep% %!makecite%]]}
247         # "...); Nextauthor (Year..."
248         !nexttextcite {%next%[[%!close%%!smartsep%%!startlink%%!abbrvciteauthor%%!endlink% %!open%%!ctextbefore%%!year%%!ctextafter%%!nexttextcite%]]}
249
250         # Add a year if it exists (else title, else "??") and possibly a modifier (as in 2017a)
251         !yeartitle {%year%[[%year%{%modifier%[[%modifier%]][[{%export%[[]][[%!dummymod%]]}]]}]][[{%title%[[%title%]][[??]]}]]}
252         # "...; Nextyear ..." (including extra label, as in 2017a)
253         !nextyeartitle {%next%[[%!sep% %!startlink%%!yeartitle%%!endlink%%!nextyeartitle%]]}
254
255         #
256         # ACTUAL STYLE DEFINITIONS
257         #
258         # (additions and modifications to default)
259         #
260
261         # "cf. Author A Year; Author B Year, p. xx"
262         cite %!textbefore%%!makecite%%!textafter%
263         # "cf. Author A (Year),[ and] Author B (Year), p. xx"
264         citet %!maketextcite%%!close%%!textafter%
265         # "(cf. Author A Year; Author B Year, p. xx)"
266         citep %!open%%!textbefore%%!makecite%%!textafter%%!close%
267         # This prints year or title, if year is missing
268         citeyear %!textbefore%%!startlink%%!yeartitle%%!endlink%%!nextyeartitle%%!textafter%
269         # "(cf. Year; Nextyear, p. xx)"
270         citeyearpar %!open%%!textbefore%%!startlink%%!myear%%!endlink%%!nextmyear%%!textafter%%!close%
271         # "Footnote: cf. Author A Year; Author B Year, p. xx."
272         footcite {%dialog%[[%_footnote%]][[%_foot%]]}: %!textbefore%%!makecite%%!textafter%.
273         # "Auto: (cf. Author A Year; Author B Year, p. xx)"
274         autocite {%dialog%[[%_autocite%]][[%_auto%]]}: %!open%%!textbefore%%!makecite%%!textafter%%!close%
275 End
276
277 CiteFormat numerical
278         #
279         # MACROS
280         #
281         # 1. Translatable bits (need to be marked by _ prefix)
282         #
283         _super Super
284         _superscript Superscript
285
286         #
287         # 2. Macros re-used in the style definitions
288         #
289         !open [
290         !sep ,
291         !close ]
292
293         # "Author [cf. ID..."
294         !maketextcite %!abbrvciteauthor% %!open%%!textbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nexttextcite%
295         # "ID"
296         !makekey %!ctextbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!ctextafter%%!nextkey%
297
298         # "...); Nextauthor [ID..."
299         !nexttextcite {%next%[[%!close%%!smartsep%%!abbrvciteauthor% %!open%%!ctextbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!nexttextcite%]]}
300         # "..., NextID..."
301         !nextkey {%next%[[%!sep% %!ctextbefore%{%dialog%[[#ID]][[%!startlink%{%numericallabel%[[%numericallabel%]][[#%key%]]}%!endlink%]]}%!ctextafter%%!nextkey%]]}
302
303         #
304         # ACTUAL STYLE DEFINITIONS
305         #
306         # (additions and modifications to default)
307         #
308
309         # "[cf. ID, NextID, p. xx]"
310         cite %!open%%!textbefore%%!makekey%%!textafter%%!close%
311         # "Author [cf. ID],[ and] Nextauthor [NextID, p. xx]"
312         citet %!maketextcite%%!textafter%%!close%
313         # "Footnote: cf. ID, NextID, p. xx."
314         footcite {%dialog%[[%_footnote%]][[%_foot%]]}: %!textbefore%%!makekey%%!textafter%.
315         # "Auto: (cf. Author A Year; Author B Year, p. xx)"
316         autocite {%dialog%[[%_autocite%]][[%_auto%]]}: %!open%%!textbefore%%!makekey%%!textafter%%!close%
317         # "Superscript: ID" (dialog) / "Super: ID" (button) 
318         supercite {%dialog%[[%_superscript%]][[%_super%]]}: %!makekey%
319 End