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