Initial Commit
[packages] / xemacs-packages / auctex / style / biblatex.el
1 ;;; biblatex.el --- AUCTeX style for `biblatex.sty' version 2.8a.
2
3 ;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
4
5 ;; Author: Ralf Angeli <angeli@caeruleus.net>
6 ;; Maintainer: auctex-devel@gnu.org
7 ;; Created: 2012-11-14
8 ;; Keywords: tex
9
10 ;; This file is part of AUCTeX.
11
12 ;; AUCTeX is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; any later version.
16
17 ;; AUCTeX is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 ;; General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
24 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25 ;; 02110-1301, USA.
26
27 ;;; Commentary:
28
29 ;; This file adds support for `biblatex.sty' version 2.8a.
30
31 ;;; Code:
32
33 (defvar LaTeX-biblatex-entrytype
34   '(;; Regular Types
35     "article" "book" "mvbook" "inbook" "bookinbook" "suppbook" "booklet"
36     "collection" "mvcollection" "incollection" "suppcollection" "manual" "misc"
37     "online" "patent" "periodical" "suppperiodical" "proceedings"
38     "mvproceedings" "inproceedings" "reference" "mvreference" "inreference"
39     "report" "set" "thesis" "unpublished" "xdata" "customa" "customb" "customc"
40     "customd" "custome" "customf"
41     ;; Type Aliases
42     "conference" "electronic" "masterthesis" "phdthesis" "techreport" "www"
43     ;; Unsupported Types
44     "artwork" "audio" "bibnote" "commentary" "image" "jurisdiction"
45     "legislation" "legal" "letter" "movie" "music" "performance" "review"
46     "software" "standard" "video")
47   "List of biblatex entry types.")
48
49 (defvar LaTeX-biblatex-executebibliographyoptions-options
50   '(;; General
51     ("sorting" ("nty" "nyt" "nyvt" "anyt" "anyvt" "ynt" "ydnt" "none" "debug"))
52     ("sortcase" ("true" "false"))
53     ("sortupper" ("true" "false"))
54     ("sortlocale")
55     ("sortlos" ("bib" "los"))
56     ("related" ("true" "false"))
57     ("sortcites" ("true" "false"))
58     ("maxnames")
59     ("minnames")
60     ("maxbibnames")
61     ("minbibnames")
62     ("maxcitenames")
63     ("mincitenames")
64     ("maxitems")
65     ("minitems")
66     ("autocite" ("plain" "inline" "footnote" "superscript"))
67     ("autopunct" ("true" "false"))
68     ("language" (append LaTeX-biblatex-language-list
69                         '("autobib" "autocite" "auto")))
70     ("clearlang" ("true" "false"))
71     ("autolang" ("none" "hyphen" "other" "other*" "langname"))
72     ("block" ("none" "space" "par" "nbpar" "ragged"))
73     ("notetype" ("foot+end" "footonly" "endonly"))
74     ("hyperref" ("true" "false" "auto"))
75     ("backref" ("true" "false"))
76     ("backrefstyle" ("none" "three" "two" "two+" "three+" "all+"))
77     ("backrefsetstyle" ("setonly" "memonly" "setormem" "setandmem" "memandset"
78                         "setplusmem"))
79     ("indexing" ("true" "false" "cite" "bib"))
80     ("loadfiles" ("true" "false"))
81     ("refsection" ("none" "part" "chapter" "section" "subsection"))
82     ("refsegment" ("none" "part" "chapter" "section" "subsection"))
83     ("citereset" ("none" "part" "chapter" "section" "subsection"))
84     ("abbreviate" ("true" "false"))
85     ("date" ("short" "long" "terse" "comp" "iso8601"))
86     ("datelabel" ("year" "short" "long" "terse" "comp" "iso8601"))
87     ("origdate" ("short" "long" "terse" "comp" "iso8601"))
88     ("eventdate" ("short" "long" "terse" "comp" "iso8601"))
89     ("urldate" ("short" "long" "terse" "comp" "iso8601"))
90     ("alldates" ("short" "long" "terse" "comp" "iso8601"))
91     ("datezeros" ("true" "false"))
92     ("dateabbrev" ("true" "false"))
93     ("defernumbers" ("true" "false"))
94     ("punctfont" ("true" "false"))
95     ("arxiv" ("abs" "ps" "pdf" "format"))
96     ("texencoding" ("auto"))
97     ("bibencoding" ("auto"))
98     ("safeinputenc" ("true" "false"))
99     ("bibwarn" ("true" "false"))
100     ("mincrossrefs")
101     ;; Style-specific
102     ("isbn" ("true" "false"))
103     ("url" ("true" "false"))
104     ("doi" ("true" "false"))
105     ("eprint" ("true" "false"))
106     ;; Internal
107     ("pagetracker" ("true" "false" "page" "spread"))
108     ("citecounter" ("true" "false" "context"))
109     ("citetracker" ("true" "false" "context" "strict" "constrict"))
110     ("ibidtracker" ("true" "false" "context" "strict" "constrict"))
111     ("opcittracker" ("true" "false" "context" "strict" "constrict"))
112     ("loccittracker" ("true" "false" "context" "strict" "constrict"))
113     ("idemtracker" ("true" "false" "context" "strict" "constrict"))
114     ("parentracker" ("true" "false"))
115     ("maxparens")
116     ("firstinits" ("true" "false"))
117     ("sortfirstinits" ("true" "false"))
118     ("terseinits" ("true" "false"))
119     ("labelalpha" ("true" "false"))
120     ("maxalphanames")
121     ("minalphanames")
122     ("labelnumber" ("true" "false"))
123     ("labeltitle" ("true" "false"))
124     ("labeltitleyear" ("true" "false"))
125     ("labeldate" ("true" "false"))
126     ("singletitle" ("true" "false"))
127     ("uniquename" ("true" "false" "init" "full" "allinit" "allfull" "mininit"
128                    "minfull"))
129     ("uniquelist" ("true" "false" "minyear")))
130   "Key=value options for ExecuteBibliographyOptions macro of the biblatex package.")
131
132 ;; See table 2 of Biblatex reference manual.
133 (defvar LaTeX-biblatex-language-list
134   '("catalan" "croatian" "czech" "danish" "dutch" "american" "british"
135     "canadian" "australian" "newzealand" "finnish" "french" "german" "austrian"
136     "ngernam" "naustrian" "greek" "italian" "norwegian" "polish" "brazilian"
137     "portuguese" "russian" "spanish" "swedish")
138   "List of languages supported by biblatex packages.")
139
140 (defvar LaTeX-biblatex-addbibresource-options
141   '(("label")
142     ("location" ("local" "remote"))
143     ("type" ("file"))
144     ("datatype" ("bibtex" "ris" "zoterordfxml" "endnotexml")))
145   "Key=value options for addbibresource macro of the biblatex package.")
146
147 (defun LaTeX-arg-addbibresource (optional &optional prompt)
148   "Prompt for a BibLaTeX database file.
149 If OPTIONAL is non-nil, insert the resulting value as an optional
150 argument, otherwise as a mandatory one.  Use PROMPT as the prompt
151 string."
152   (let (files inputs database)
153     (if LaTeX-using-Biber
154         (setq files 'TeX-Biber-global-files
155               inputs 'biberinputs)
156       (setq files 'BibTeX-global-files
157             inputs 'bibinputs))
158     (setq files 'TeX-Biber-global-files
159           inputs 'biberinputs)
160     (message "Searching for BibLaTeX files...")
161     (or (symbol-value files)
162         (set files (mapcar 'list (TeX-search-files-by-type
163                                   'biberinputs 'global t nil))))
164     (setq database (completing-read
165                     (TeX-argument-prompt optional prompt "BibLaTeX files")
166                     (append (mapcar 'list (TeX-search-files-by-type
167                                            inputs 'local t nil))
168                             (symbol-value files))))
169     (LaTeX-add-bibliographies database)
170     ;; Run style file associated to the bibliography database file in order to
171     ;; immediately fill `LaTeX-bibitem-list'.  We need to strip the extension
172     ;; because AUCTeX style files don't use it.
173     (TeX-run-style-hooks (file-name-sans-extension database))
174     (TeX-argument-insert database optional)))
175
176 ;; Support for multicite commands, see § 3.7.3 of Biblatex reference manual.
177 (defun LaTeX-arg-biblatex-cites (optional &optional prompt)
178   "Prompt for citations with completion until input is empty.
179 Prompt also for optional prenotes and postnotes.  If OPTIONAL is
180 non-nil, insert the citation key as an optional argument,
181 otherwise as a mandatory one.  Use PROMPT as the prompt string
182 for citation keys."
183   ;; Prompt for global prenote and postnote.
184   (and TeX-arg-cite-note-p (not current-prefix-arg)
185        (let ((TeX-arg-opening-brace "(")
186              (TeX-arg-closing-brace ")")
187              (prenote (TeX-read-string
188                        (TeX-argument-prompt t nil "Global prenote"))))
189          (TeX-argument-insert prenote t)
190          ;; If the prenote is empty the postnote is optional, otherwise it's
191          ;; mandatory.
192          (TeX-argument-insert
193           (TeX-read-string (TeX-argument-prompt t nil "Global postnote"))
194           (equal prenote ""))))
195   (let ((items t) (noinsert nil))
196     (while items
197       ;; Prompt for prenote and postnote of the current keys.
198       (and TeX-arg-cite-note-p (not current-prefix-arg)
199            (let ((TeX-arg-opening-brace "[")
200                  (TeX-arg-closing-brace "]")
201                  (prenote (TeX-read-string
202                            (TeX-argument-prompt t nil "Prenote"))))
203              (TeX-argument-insert prenote t)
204              ;; If the prenote is empty the postnote is optional, otherwise it's
205              ;; mandatory.
206              (TeX-argument-insert
207               (TeX-read-string (TeX-argument-prompt t nil "Postnote"))
208               (equal prenote ""))))
209       (setq items (TeX-completing-read-multiple
210                    (TeX-argument-prompt optional prompt "Key")
211                    (LaTeX-bibitem-list)))
212       (apply 'LaTeX-add-bibitems items)
213       ;; If input is empty, insert an empty group only the first time, when
214       ;; `noinsert' flag is nil.
215       (unless (and (not items) noinsert)
216         (TeX-argument-insert (mapconcat 'identity items ",") optional))
217       (setq noinsert t))))
218
219 (TeX-add-style-hook
220  "biblatex"
221  (lambda ()
222    ;; Biblatex uses as default backend biber, run it unless biblatex `backend'
223    ;; option value is one of `bibtex', `bibtex8', `bibtexu'.  Autodetection of
224    ;; the backend can be overridden by setting `LaTeX-biblatex-use-Biber' as a
225    ;; local variable.
226    (setq LaTeX-using-Biber
227          (if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer))
228              LaTeX-biblatex-use-Biber
229            (not (or (LaTeX-provided-package-options-member
230                      "biblatex" "backend=bibtex")
231                     (LaTeX-provided-package-options-member
232                      "biblatex" "backend=bibtex8")
233                     (LaTeX-provided-package-options-member
234                      "biblatex" "backend=bibtexu")))))
235
236    (TeX-run-style-hooks
237     "etoolbox"
238     "keyval"
239     "kvoptions"
240     "logreq"
241     "ifthen"
242     "url")
243    (TeX-add-symbols
244     ;;; Global Customization
245     ;; Setting Package Options
246     '("ExecuteBibliographyOptions"
247       [TeX-arg-eval  mapconcat 'identity
248                      (TeX-completing-read-multiple
249                       "Entry type: " LaTeX-biblatex-entrytype) ","]
250       (TeX-arg-key-val LaTeX-biblatex-executebibliographyoptions-options))
251     ;;; Bibliography Commands
252     ;; Resources
253     '("addbibresource" [TeX-arg-key-val LaTeX-biblatex-addbibresource-options]
254       LaTeX-arg-addbibresource)
255     '("addglobalbib" [TeX-arg-key-val LaTeX-biblatex-addbibresource-options]
256       LaTeX-arg-addbibresource)
257     '("addsectionbib" [TeX-arg-key-val LaTeX-biblatex-addbibresource-options]
258       LaTeX-arg-addbibresource)
259     ;; The Bibliography
260     '("printbibliography"
261       [TeX-arg-key-val (("env") ("heading") ("title") ("prenote") ("postnote")
262                         ("section") ("segment") ("sorting") ("type") ("nottype")
263                         ("subtype") ("notsubtype") ("keyword") ("notkeyword")
264                         ("categoy") ("notcategory") ("filter") ("check")
265                         ("prefixnumbers") ("resetnumbers" ("true" "false"))
266                         ("omitnumbers" ("true" "false")))])
267     '("bibbysection"
268       [TeX-arg-key-val (("env") ("heading") ("prenote") ("postnote"))])
269     '("bibbysegment"
270       [TeX-arg-key-val (("env") ("heading") ("prenote") ("postnote"))])
271     '("bibbycategory"
272       [TeX-arg-key-val (("env") ("prenote") ("postnote") ("section"))])
273     '("printbibheading"
274       [TeX-arg-key-val (("heading") ("title"))])
275     ;; The List of Shorthands
276     '("printshorthands"
277       [TeX-arg-key-val (("env") ("heading") ("title") ("prenote") ("postnote")
278                         ("section") ("segment") ("sorting") ("type") ("nottype")
279                         ("subtype") ("notsubtype") ("keyword") ("notkeyword")
280                         ("categoy") ("notcategory") ("filter") ("check"))])
281     ;; Bibliography Sections
282     '("newrefsection" ["Resources"])
283     "endrefsection"
284     ;; Bibliography Segments
285     "newrefsegment"
286     "endrefsegment"
287     ;; Bibliography Categories
288     '("DeclareBibliographyCategory" "Category")
289     '("addtocategory" "Category" TeX-arg-cite)
290     ;; Bibliography Headings and Environments
291     '("defbibenvironment" "Name" 3)
292     '("defbibheading" "Name" ["Title"] t)
293     ;; Bibliography Notes
294     '("defbibnote" "Name" "Text")
295     ;; Bibliography Filters and Checks
296     '("defbibfilter" "Name" t)
297     '("defbibcheck" "Name" t)
298     ;; Dynamic Entry Sets
299     '("defbibentryset" "Set"
300       (TeX-arg-eval mapconcat 'identity (TeX-completing-read-multiple
301                                          "Keys: " (LaTeX-bibitem-list)) ","))
302     ;;; Citation Commands
303     '("cite" (TeX-arg-conditional TeX-arg-cite-note-p
304                                   (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
305     '("Cite" (TeX-arg-conditional TeX-arg-cite-note-p
306                                   (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
307     '("parencite" (TeX-arg-conditional TeX-arg-cite-note-p
308                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
309     '("Parencite" (TeX-arg-conditional TeX-arg-cite-note-p
310                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
311     '("footcite" (TeX-arg-conditional TeX-arg-cite-note-p
312                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
313     '("footcitetext" (TeX-arg-conditional TeX-arg-cite-note-p
314                                           (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
315     ;; Style-specific Commands
316     '("textcite" (TeX-arg-conditional TeX-arg-cite-note-p
317                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
318     '("Textcite" (TeX-arg-conditional TeX-arg-cite-note-p
319                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
320     '("smartcite" (TeX-arg-conditional TeX-arg-cite-note-p
321                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
322     '("Smartcite" (TeX-arg-conditional TeX-arg-cite-note-p
323                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
324     '("cite*" (TeX-arg-conditional TeX-arg-cite-note-p
325                                    (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
326     '("parencite*" (TeX-arg-conditional TeX-arg-cite-note-p
327                                         (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
328     '("supercite" (TeX-arg-conditional TeX-arg-cite-note-p
329                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
330     ;; Qualified Citation Lists
331     '("cites" LaTeX-arg-biblatex-cites)
332     '("Cites" LaTeX-arg-biblatex-cites)
333     '("parencites" LaTeX-arg-biblatex-cites)
334     '("Parencites" LaTeX-arg-biblatex-cites)
335     '("footcites" LaTeX-arg-biblatex-cites)
336     '("footcitetexts" LaTeX-arg-biblatex-cites)
337     '("smartcites" LaTeX-arg-biblatex-cites)
338     '("Smartcites" LaTeX-arg-biblatex-cites)
339     '("textcites" LaTeX-arg-biblatex-cites)
340     '("Textcites" LaTeX-arg-biblatex-cites)
341     '("supercites" LaTeX-arg-biblatex-cites)
342     ;; Style-independent Commands
343     '("autocite" (TeX-arg-conditional TeX-arg-cite-note-p
344                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
345     '("Autocite" (TeX-arg-conditional TeX-arg-cite-note-p
346                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
347     '("autocite*" (TeX-arg-conditional TeX-arg-cite-note-p
348                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
349     '("Autocite*" (TeX-arg-conditional TeX-arg-cite-note-p
350                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
351     '("autocites" LaTeX-arg-biblatex-cites)
352     '("Autocites" LaTeX-arg-biblatex-cites)
353     ;; Text Commands
354     '("citeauthor" (TeX-arg-conditional TeX-arg-cite-note-p
355                                         (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
356     '("Citeauthor" (TeX-arg-conditional TeX-arg-cite-note-p
357                                         (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
358     '("citetitle" (TeX-arg-conditional TeX-arg-cite-note-p
359                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
360     '("citetitle*" (TeX-arg-conditional TeX-arg-cite-note-p
361                                         (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
362     '("citeyear" (TeX-arg-conditional TeX-arg-cite-note-p
363                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
364     '("citeyear*" (TeX-arg-conditional TeX-arg-cite-note-p
365                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
366     '("citedate" (TeX-arg-conditional TeX-arg-cite-note-p
367                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
368     '("citedate*" (TeX-arg-conditional TeX-arg-cite-note-p
369                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
370     '("citeurl" (TeX-arg-conditional TeX-arg-cite-note-p
371                                      (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
372     '("parentext" "Text")
373     '("brackettext" "Text")
374     ;; Special Commands
375     '("fullcite" (TeX-arg-conditional TeX-arg-cite-note-p
376                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
377     '("footfullcite" (TeX-arg-conditional TeX-arg-cite-note-p
378                                           (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
379     '("volcite"
380       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
381       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
382     '("Volcite"
383       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
384       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
385     '("Pvolcite"
386       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
387       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
388     '("Pvolcite"
389       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
390       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
391     '("fvolcite"
392       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
393       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
394     '("ftolcite"
395       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
396       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
397     '("svolcite"
398       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
399       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
400     '("Svolcite"
401       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
402       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
403     '("tvolcite"
404       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
405       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
406     '("Tvolcite"
407       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
408       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
409     '("avolcite"
410       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
411       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
412     '("Avolcite"
413       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
414       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
415     '("notecite" (TeX-arg-conditional TeX-arg-cite-note-p
416                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
417     '("Notecite" (TeX-arg-conditional TeX-arg-cite-note-p
418                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
419     '("pnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
420                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
421     '("Pnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
422                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
423     '("fnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
424                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
425     ;; Low-level Commands
426     '("citename"
427       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"] ["Postnote"]) ())
428       TeX-arg-cite (TeX-arg-conditional TeX-arg-cite-note-p (["Format"]) ())
429       "Name list")
430     '("citelist"
431       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"] ["Postnote"]) ())
432       TeX-arg-cite (TeX-arg-conditional TeX-arg-cite-note-p (["Format"]) ())
433       "Literal list")
434     '("citefield"
435       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"] ["Postnote"]) ())
436       TeX-arg-cite (TeX-arg-conditional TeX-arg-cite-note-p (["Format"]) ())
437       "Field")
438     ;; Miscellaneous Commands
439     "citereset"
440     "citereset*"
441     "mancite"
442     "pno"
443     "ppno"
444     "nopp"
445     "psq"
446     "psqq"
447     '("RN" "Integer")
448     '("Rn" "Integer")
449     ;; Localization Commands
450     '("DefineBibliographyStrings"
451       (TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
452     '("DefineBibliographyExtras"
453       (TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
454     '("UndefineBibliographyExtras"
455       (TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
456     '("DefineHyphenationExceptions"
457       (TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
458     "NewBibliographyString")
459    (LaTeX-add-environments
460     ;;; Bibliography commands
461     ;; Bibliography Sections
462     '("refsection" ["Resources"])
463     ;; Bibliography Segments
464     "refsegment")
465
466    ;; Declaring expert macros and environments.  Criterion: all macros and
467    ;; environments to fine tune the bibliography, probably they will be used
468    ;; only by expert users.
469    (TeX-declare-expert-macros
470     "biblatex"
471     "ExecuteBibliographyOptions" "printshorthands" "newrefsection"
472     "endrefsection" "newrefsegment" "endrefsegment"
473     "DeclareBibliographyCategory" "addtocategory" "defbibenvironment"
474     "defbibheading" "defbibnote" "defbibfilter" "defbibcheck" "defbibentryset"
475     "citereset" "citereset*" "mancite" "pno" "ppno" "nopp" "psq" "psqq" "RN"
476     "Rn" "DefineBibliographyStrings" "DefineBibliographyExtras"
477     "UndefineBibliographyExtras" "DefineHyphenationExceptions"
478     "NewBibliographyString")
479    (LaTeX-declare-expert-environments
480     "biblatex"
481     "refsection" "refsegment"))
482  LaTeX-dialect)
483
484 (defvar LaTeX-biblatex-package-options-list
485   (append
486    ;;; Preamble Options
487    LaTeX-biblatex-executebibliographyoptions-options
488    '(;;; Load-time Options
489     ("backend" ("biber" "bibtex" "bibtexu" "bibtex8"))
490     ("style" BibLaTeX-global-style-files)
491     ("bibstyle" BibLaTeX-global-style-files)
492     ("citestyle" BibLaTeX-global-style-files)
493     ("natbib" ("true" "false"))
494     ("mcite" ("true" "false"))
495     ;;; Entry Options
496     ;; Preamble/Type/Entry Options
497     ("useauthor" ("true" "false"))
498     ("useeditor" ("true" "false"))
499     ("usetranslator" ("true" "false"))
500     ("useprefix" ("true" "false"))
501     ("indexing" ("true" "false" "cite" "bib"))
502     ;; Type/Entry Options are not available globally.
503     ;; Legacy Options (deprecated)
504     ("openbib")))
505   "Package options for the biblatex package.")
506
507 (defun LaTeX-biblatex-package-options nil
508   "Prompt for package options for the biblatex package."
509   (unless BibLaTeX-global-style-files
510     (if (if (eq TeX-arg-input-file-search 'ask)
511             (not (y-or-n-p "Find BibLaTeX style yourself? "))
512           TeX-arg-input-file-search)
513         ;; ...then, search for BibLaTeX styles.
514         (progn
515           (message "Searching for BibLaTeX styles...")
516           (setq BibLaTeX-global-style-files
517                 (mapcar 'identity (TeX-search-files-by-type 'bbxinputs 'global t t))))
518       ;; ...else, use for completion only standard BibLaTeX styles (see §3.3 of
519       ;; Biblatex reference manual).
520       (setq BibLaTeX-global-style-files
521             '("numeric" "numeric-comp" "numeric-verb" "alphabetic"
522               "alphabetic-verb" "authoryear" "authoryear-comp" "authoryear-ibid"
523               "authoryear-icomp" "authortitle" "authortitle-comp"
524               "authortitle-ibid" "authortitle-icomp" "authortitle-terse"
525               "authortitle-tcomp" "authortitle-ticomp" "verbose" "verbose-ibid"
526               "verbose-note" "verbose-inote" "verbose-trad1" "verbose-trad2"
527               "verbose-trad3" "reading" "draft" "debug"))))
528   (TeX-read-key-val t LaTeX-biblatex-package-options-list))
529
530 ;;; biblatex.el ends here