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