summaryrefslogtreecommitdiff
path: root/elpa/auctex-13.1.3/style/biblatex.el
blob: 43115becc6c00c6a60cd1309e26af856de504bd0 (plain)
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
;;; biblatex.el --- AUCTeX style for `biblatex.sty' version 2.8a.  -*- lexical-binding: t; -*-

;; Copyright (C) 2012-2021  Free Software Foundation, Inc.

;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2012-11-14
;; Keywords: tex

;; This file is part of AUCTeX.

;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING.  If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.

;;; Commentary:

;; This file adds support for `biblatex.sty' version 2.8a.

;;; Code:

(require 'tex)
(require 'latex)

;; Silence the compiler:
(declare-function font-latex-add-keywords
                  "font-latex"
                  (keywords class))

(defvar reftex-cite-format-builtin)

(defvar LaTeX-biblatex-entrytype
  '(;; Regular Types
    "article" "book" "mvbook" "inbook" "bookinbook" "suppbook" "booklet"
    "collection" "mvcollection" "incollection" "suppcollection" "manual" "misc"
    "online" "patent" "periodical" "suppperiodical" "proceedings"
    "mvproceedings" "inproceedings" "reference" "mvreference" "inreference"
    "report" "set" "thesis" "unpublished" "xdata" "customa" "customb" "customc"
    "customd" "custome" "customf"
    ;; Type Aliases
    "conference" "electronic" "masterthesis" "phdthesis" "techreport" "www"
    ;; Unsupported Types
    "artwork" "audio" "bibnote" "commentary" "image" "jurisdiction"
    "legislation" "legal" "letter" "movie" "music" "performance" "review"
    "software" "standard" "video")
  "List of biblatex entry types.")

(defvar LaTeX-biblatex-executebibliographyoptions-options
  '(;; General
    ("sorting" ("nty" "nyt" "nyvt" "anyt" "anyvt" "ynt" "ydnt" "none" "debug"))
    ("sortcase" ("true" "false"))
    ("sortupper" ("true" "false"))
    ("sortlocale")
    ("sortlos" ("bib" "los"))
    ("related" ("true" "false"))
    ("sortcites" ("true" "false"))
    ("maxnames")
    ("minnames")
    ("maxbibnames")
    ("minbibnames")
    ("maxcitenames")
    ("mincitenames")
    ("maxitems")
    ("minitems")
    ("autocite" ("plain" "inline" "footnote" "superscript"))
    ("autopunct" ("true" "false"))
    ("language" (append LaTeX-biblatex-language-list
                        '("autobib" "autocite" "auto")))
    ("clearlang" ("true" "false"))
    ("autolang" ("none" "hyphen" "other" "other*" "langname"))
    ("block" ("none" "space" "par" "nbpar" "ragged"))
    ("notetype" ("foot+end" "footonly" "endonly"))
    ("hyperref" ("true" "false" "auto"))
    ("backref" ("true" "false"))
    ("backrefstyle" ("none" "three" "two" "two+" "three+" "all+"))
    ("backrefsetstyle" ("setonly" "memonly" "setormem" "setandmem" "memandset"
                        "setplusmem"))
    ("indexing" ("true" "false" "cite" "bib"))
    ("loadfiles" ("true" "false"))
    ("refsection" ("none" "part" "chapter" "section" "subsection"))
    ("refsegment" ("none" "part" "chapter" "section" "subsection"))
    ("citereset" ("none" "part" "chapter" "section" "subsection"))
    ("abbreviate" ("true" "false"))
    ("date" ("short" "long" "terse" "comp" "iso8601"))
    ("datelabel" ("year" "short" "long" "terse" "comp" "iso8601"))
    ("origdate" ("short" "long" "terse" "comp" "iso8601"))
    ("eventdate" ("short" "long" "terse" "comp" "iso8601"))
    ("urldate" ("short" "long" "terse" "comp" "iso8601"))
    ("alldates" ("short" "long" "terse" "comp" "iso8601"))
    ("datezeros" ("true" "false"))
    ("dateabbrev" ("true" "false"))
    ("defernumbers" ("true" "false"))
    ("punctfont" ("true" "false"))
    ("arxiv" ("abs" "ps" "pdf" "format"))
    ("texencoding" ("auto"))
    ("bibencoding" ("auto"))
    ("safeinputenc" ("true" "false"))
    ("bibwarn" ("true" "false"))
    ("mincrossrefs")
    ;; Style-specific
    ("isbn" ("true" "false"))
    ("url" ("true" "false"))
    ("doi" ("true" "false"))
    ("eprint" ("true" "false"))
    ;; Internal
    ("pagetracker" ("true" "false" "page" "spread"))
    ("citecounter" ("true" "false" "context"))
    ("citetracker" ("true" "false" "context" "strict" "constrict"))
    ("ibidtracker" ("true" "false" "context" "strict" "constrict"))
    ("opcittracker" ("true" "false" "context" "strict" "constrict"))
    ("loccittracker" ("true" "false" "context" "strict" "constrict"))
    ("idemtracker" ("true" "false" "context" "strict" "constrict"))
    ("parentracker" ("true" "false"))
    ("maxparens")
    ("firstinits" ("true" "false"))
    ("sortfirstinits" ("true" "false"))
    ("terseinits" ("true" "false"))
    ("labelalpha" ("true" "false"))
    ("maxalphanames")
    ("minalphanames")
    ("labelnumber" ("true" "false"))
    ("labeltitle" ("true" "false"))
    ("labeltitleyear" ("true" "false"))
    ("labeldate" ("true" "false"))
    ("singletitle" ("true" "false"))
    ("uniquename" ("true" "false" "init" "full" "allinit" "allfull" "mininit"
                   "minfull"))
    ("uniquelist" ("true" "false" "minyear")))
  "Key=value options for ExecuteBibliographyOptions macro of the biblatex package.")

;; See table 2 of Biblatex reference manual.
(defvar LaTeX-biblatex-language-list
  '("catalan" "croatian" "czech" "danish" "dutch" "american" "british"
    "canadian" "australian" "newzealand" "finnish" "french" "german" "austrian"
    "ngernam" "naustrian" "greek" "italian" "norwegian" "polish" "brazilian"
    "portuguese" "russian" "spanish" "swedish")
  "List of languages supported by biblatex packages.")

(defvar LaTeX-biblatex-addbibresource-options
  '(("label")
    ("location" ("local" "remote"))
    ("type" ("file"))
    ("datatype" ("bibtex" "ris" "zoterordfxml" "endnotexml")))
  "Key=value options for addbibresource macro of the biblatex package.")

(defun LaTeX-arg-addbibresource (optional &optional prompt)
  "Prompt for a BibLaTeX database file.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one.  Use PROMPT as the prompt
string."
  (let (files inputs database)
    (if LaTeX-using-Biber
        (setq files 'TeX-Biber-global-files
              inputs 'biberinputs)
      (setq files 'BibTeX-global-files
            inputs 'bibinputs))
    (setq files 'TeX-Biber-global-files
          inputs 'biberinputs)
    (message "Searching for BibLaTeX files...")
    (or (symbol-value files)
        (set files (mapcar #'list (TeX-search-files-by-type
                                   'biberinputs 'global t nil))))
    (message "Searching for BibLaTeX files...done")
    (setq database (completing-read
                    (TeX-argument-prompt optional prompt "BibLaTeX files")
                    (append (mapcar #'list (TeX-search-files-by-type
                                            inputs 'local t nil))
                            (symbol-value files))))
    (LaTeX-add-bibliographies database)
    ;; Run style file associated to the bibliography database file in order to
    ;; immediately fill `LaTeX-bibitem-list'.  We need to strip the extension
    ;; because AUCTeX style files don't use it.
    (TeX-run-style-hooks (file-name-sans-extension database))
    (TeX-argument-insert database optional)))

;; Support for multicite commands, see § 3.7.3 of Biblatex reference manual.
(defun LaTeX-arg-biblatex-cites (optional &optional prompt)
  "Prompt for citations with completion until input is empty.
Prompt also for optional prenotes and postnotes.  If OPTIONAL is
non-nil, insert the citation key as an optional argument,
otherwise as a mandatory one.  Use PROMPT as the prompt string
for citation keys."
  ;; Prompt for global prenote and postnote.
  (and TeX-arg-cite-note-p (not current-prefix-arg)
       (let ((TeX-arg-opening-brace "(")
             (TeX-arg-closing-brace ")")
             (prenote (TeX-read-string
                       (TeX-argument-prompt t nil "Global prenote"))))
         (TeX-argument-insert prenote t)
         ;; If the prenote is empty the postnote is optional, otherwise it's
         ;; mandatory.
         (TeX-argument-insert
          (TeX-read-string (TeX-argument-prompt t nil "Global postnote"))
          (equal prenote ""))))
  (let ((items t) (noinsert nil))
    (while items
      ;; Prompt for prenote and postnote of the current keys.
      (and TeX-arg-cite-note-p (not current-prefix-arg)
           (let ((TeX-arg-opening-brace "[")
                 (TeX-arg-closing-brace "]")
                 (prenote (TeX-read-string
                           (TeX-argument-prompt t nil "Prenote"))))
             (TeX-argument-insert prenote t)
             ;; If the prenote is empty the postnote is optional, otherwise it's
             ;; mandatory.
             (TeX-argument-insert
              (TeX-read-string (TeX-argument-prompt t nil "Postnote"))
              (equal prenote ""))))
      (setq items (if (and (fboundp 'reftex-citation)
                           (fboundp 'reftex-plug-flag)
                           (reftex-plug-flag 3))
                      ;; Use RefTeX when enabled.
                      (reftex-citation t)
                    ;; Multiple citation keys in each argument are allowed.
                    (TeX-completing-read-multiple
                     (TeX-argument-prompt optional prompt "Key(s)")
                     (LaTeX-bibitem-list))))
      (apply #'LaTeX-add-bibitems items)
      ;; If input is empty, insert an empty group only the first time, when
      ;; `noinsert' flag is nil.
      (unless (and (not items) noinsert)
        (TeX-argument-insert (mapconcat #'identity items ",") optional))
      (setq noinsert t))))

(defun LaTeX-arg-biblatex-natbib-notes (optional)
  "Prompt for two note arguments of a natbib compat citation command."
  (when TeX-arg-cite-note-p
      (let ((pre (TeX-read-string
                  (TeX-argument-prompt optional nil "Prenote")))
            (post (TeX-read-string
                   (TeX-argument-prompt optional nil "Postnote"))))
        (TeX-argument-insert pre optional)
        (TeX-argument-insert post optional)
        ;; pre is given, post is empty: Make sure that we insert an
        ;; extra pair of `[]', otherwise pre becomes post
        (when (and pre (not (string= pre ""))
                   (string= post ""))
          (insert LaTeX-optop LaTeX-optcl)))))

(TeX-add-style-hook
 "biblatex"
 (lambda ()
   ;; Biblatex uses as default backend biber, run it unless biblatex `backend'
   ;; option value is one of `bibtex', `bibtex8', `bibtexu'.  Autodetection of
   ;; the backend can be overridden by setting `LaTeX-biblatex-use-Biber' as a
   ;; local variable.
   (setq LaTeX-using-Biber
         (if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer))
             LaTeX-biblatex-use-Biber
           (not (or (LaTeX-provided-package-options-member
                     "biblatex" "backend=bibtex")
                    (LaTeX-provided-package-options-member
                     "biblatex" "backend=bibtex8")
                    (LaTeX-provided-package-options-member
                     "biblatex" "backend=bibtexu")))))

   (TeX-run-style-hooks
    "keyval"
    "kvoptions"
    "logreq"
    "ifthen"
    "url")
   (TeX-add-symbols
    ;;; Global Customization
    ;; Setting Package Options
    '("ExecuteBibliographyOptions"
      [TeX-arg-eval  mapconcat #'identity
                     (TeX-completing-read-multiple
                      "Entry type: " LaTeX-biblatex-entrytype) ","]
      (TeX-arg-key-val LaTeX-biblatex-executebibliographyoptions-options))
    ;;; Bibliography Commands
    ;; Resources
    '("addbibresource" [TeX-arg-key-val LaTeX-biblatex-addbibresource-options]
      LaTeX-arg-addbibresource)
    '("addglobalbib" [TeX-arg-key-val LaTeX-biblatex-addbibresource-options]
      LaTeX-arg-addbibresource)
    '("addsectionbib" [TeX-arg-key-val LaTeX-biblatex-addbibresource-options]
      LaTeX-arg-addbibresource)
    ;; The Bibliography
    '("printbibliography"
      [TeX-arg-key-val (("env") ("heading") ("title") ("prenote") ("postnote")
                        ("section") ("segment") ("sorting") ("type") ("nottype")
                        ("subtype") ("notsubtype") ("keyword") ("notkeyword")
                        ("categoy") ("notcategory") ("filter") ("check")
                        ("prefixnumbers") ("resetnumbers" ("true" "false"))
                        ("omitnumbers" ("true" "false")))])
    '("bibbysection"
      [TeX-arg-key-val (("env") ("heading") ("prenote") ("postnote"))])
    '("bibbysegment"
      [TeX-arg-key-val (("env") ("heading") ("prenote") ("postnote"))])
    '("bibbycategory"
      [TeX-arg-key-val (("env") ("prenote") ("postnote") ("section"))])
    '("printbibheading"
      [TeX-arg-key-val (("heading") ("title"))])
    ;; The List of Shorthands
    '("printshorthands"
      [TeX-arg-key-val (("env") ("heading") ("title") ("prenote") ("postnote")
                        ("section") ("segment") ("sorting") ("type") ("nottype")
                        ("subtype") ("notsubtype") ("keyword") ("notkeyword")
                        ("categoy") ("notcategory") ("filter") ("check"))])
    ;; Bibliography Sections
    '("newrefsection" ["Resources"])
    "endrefsection"
    ;; Bibliography Segments
    "newrefsegment"
    "endrefsegment"
    ;; Bibliography Categories
    '("DeclareBibliographyCategory" "Category")
    '("addtocategory" "Category" TeX-arg-cite)
    ;; Bibliography Headings and Environments
    '("defbibenvironment" "Name" 3)
    '("defbibheading" "Name" ["Title"] t)
    ;; Bibliography Notes
    '("defbibnote" "Name" "Text")
    ;; Bibliography Filters and Checks
    '("defbibfilter" "Name" t)
    '("defbibcheck" "Name" t)
    ;; Dynamic Entry Sets
    '("defbibentryset" "Set"
      (TeX-arg-eval mapconcat #'identity (TeX-completing-read-multiple
                                          "Keys: " (LaTeX-bibitem-list)) ","))
    ;;; Citation Commands
    '("cite" (TeX-arg-conditional TeX-arg-cite-note-p
                                  (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("Cite" (TeX-arg-conditional TeX-arg-cite-note-p
                                  (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("parencite" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("Parencite" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("footcite" (TeX-arg-conditional TeX-arg-cite-note-p
                                      (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("footcitetext" (TeX-arg-conditional TeX-arg-cite-note-p
                                          (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    ;; Style-specific Commands
    '("textcite" (TeX-arg-conditional TeX-arg-cite-note-p
                                      (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("Textcite" (TeX-arg-conditional TeX-arg-cite-note-p
                                      (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("smartcite" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("Smartcite" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("cite*" (TeX-arg-conditional TeX-arg-cite-note-p
                                   (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("parencite*" (TeX-arg-conditional TeX-arg-cite-note-p
                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("supercite" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    ;; Qualified Citation Lists
    '("cites" LaTeX-arg-biblatex-cites)
    '("Cites" LaTeX-arg-biblatex-cites)
    '("parencites" LaTeX-arg-biblatex-cites)
    '("Parencites" LaTeX-arg-biblatex-cites)
    '("footcites" LaTeX-arg-biblatex-cites)
    '("footcitetexts" LaTeX-arg-biblatex-cites)
    '("smartcites" LaTeX-arg-biblatex-cites)
    '("Smartcites" LaTeX-arg-biblatex-cites)
    '("textcites" LaTeX-arg-biblatex-cites)
    '("Textcites" LaTeX-arg-biblatex-cites)
    '("supercites" LaTeX-arg-biblatex-cites)
    ;; Style-independent Commands
    '("autocite" (TeX-arg-conditional TeX-arg-cite-note-p
                                      (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("Autocite" (TeX-arg-conditional TeX-arg-cite-note-p
                                      (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("autocite*" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("Autocite*" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("autocites" LaTeX-arg-biblatex-cites)
    '("Autocites" LaTeX-arg-biblatex-cites)
    ;; Text Commands
    '("citeauthor" (TeX-arg-conditional TeX-arg-cite-note-p
                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("Citeauthor" (TeX-arg-conditional TeX-arg-cite-note-p
                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("citeauthor*" (TeX-arg-conditional TeX-arg-cite-note-p
                                         (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("Citeauthor*" (TeX-arg-conditional TeX-arg-cite-note-p
                                         (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("citetitle" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("citetitle*" (TeX-arg-conditional TeX-arg-cite-note-p
                                        (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("citeyear" (TeX-arg-conditional TeX-arg-cite-note-p
                                      (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("citeyear*" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("citedate" (TeX-arg-conditional TeX-arg-cite-note-p
                                      (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("citedate*" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("citeurl" (TeX-arg-conditional TeX-arg-cite-note-p
                                     (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("parentext" "Text")
    '("brackettext" "Text")
    ;; Special Commands
    '("fullcite" (TeX-arg-conditional TeX-arg-cite-note-p
                                      (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("footfullcite" (TeX-arg-conditional TeX-arg-cite-note-p
                                          (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("volcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("Volcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("Pvolcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("Pvolcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("fvolcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("ftolcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("svolcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("Svolcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("tvolcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("Tvolcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("avolcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("Avolcite"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
    '("notecite" (TeX-arg-conditional TeX-arg-cite-note-p
                                      (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("Notecite" (TeX-arg-conditional TeX-arg-cite-note-p
                                      (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("pnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("Pnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    '("fnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
                                       (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
    ;; Low-level Commands
    '("citename"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"] ["Postnote"]) ())
      TeX-arg-cite (TeX-arg-conditional TeX-arg-cite-note-p (["Format"]) ())
      "Name list")
    '("citelist"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"] ["Postnote"]) ())
      TeX-arg-cite (TeX-arg-conditional TeX-arg-cite-note-p (["Format"]) ())
      "Literal list")
    '("citefield"
      (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"] ["Postnote"]) ())
      TeX-arg-cite (TeX-arg-conditional TeX-arg-cite-note-p (["Format"]) ())
      "Field")
    ;; Miscellaneous Commands
    "citereset"
    "citereset*"
    "mancite"
    "pno"
    "ppno"
    "nopp"
    "psq"
    "psqq"
    '("RN" "Integer")
    '("Rn" "Integer")
    ;; Localization Commands
    '("DefineBibliographyStrings"
      (TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
    '("DefineBibliographyExtras"
      (TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
    '("UndefineBibliographyExtras"
      (TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
    '("DefineHyphenationExceptions"
      (TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
    "NewBibliographyString")

   ;; § 3.8.9 natbib Compatibility Commands
   (when (or (LaTeX-provided-package-options-member "biblatex" "natbib")
             (LaTeX-provided-package-options-member "biblatex" "natbib=true"))
     (let ((cmds '(("citet" . 1) ("citet*" . 1)
                   ("Citet" . 1) ("Citet*" . 1)
                   ("citep" . 2) ("citep*" . 2)
                   ("Citep" . 2) ("Citep*" . 2)
                   ("citealt" . 1) ("citealt*" . 1)
                   ("Citealt" . 1) ("Citealt*" . 1)
                   ("citealp" . 2) ("citealp*" . 2)
                   ("Citealp" . 2) ("Citealp*" . 2))))
       ;; Taken from natbib.el:
       (apply
        #'TeX-add-symbols
        (mapcar
         (lambda (cmd)
           (cond
            ((= (cdr cmd) 1)
             ;; Just one optional argument, the post note
             (list
              (car cmd)
              '(TeX-arg-conditional TeX-arg-cite-note-p (["Postnote"]) nil)
              #'TeX-arg-cite))
            ((= (cdr cmd) 2)
             ;; Pre and post notes
             (list
              (car cmd)
              '(TeX-arg-conditional TeX-arg-cite-note-p
                                    ([LaTeX-arg-biblatex-natbib-notes])
                                    nil)
              #'TeX-arg-cite))))
         cmds))

       ;; Fontification for compat macros does not go into `font-latex.el':
       (when (and (featurep 'font-latex)
                  (eq TeX-install-font-lock 'font-latex-setup))
         (font-latex-add-keywords '(("citet"        "*[[{")
                                    ("Citet"        "*[[{")
                                    ("citep"        "*[[{")
                                    ("Citep"        "*[[{")
                                    ("citealt"      "*[[{")
                                    ("Citealt"      "*[[{")
                                    ("citealp"      "*[[{")
                                    ("Citealp"      "*[[{"))
                                  'biblatex))))

   (LaTeX-add-environments
    ;;; Bibliography commands
    ;; Bibliography Sections
    '("refsection" ["Resources"])
    ;; Bibliography Segments
    "refsegment")

   ;; Declaring expert macros and environments.  Criterion: all macros and
   ;; environments to fine tune the bibliography, probably they will be used
   ;; only by expert users.
   (TeX-declare-expert-macros
    "biblatex"
    "ExecuteBibliographyOptions" "printshorthands" "newrefsection"
    "endrefsection" "newrefsegment" "endrefsegment"
    "DeclareBibliographyCategory" "addtocategory" "defbibenvironment"
    "defbibheading" "defbibnote" "defbibfilter" "defbibcheck" "defbibentryset"
    "citereset" "citereset*" "mancite" "pno" "ppno" "nopp" "psq" "psqq" "RN"
    "Rn" "DefineBibliographyStrings" "DefineBibliographyExtras"
    "UndefineBibliographyExtras" "DefineHyphenationExceptions"
    "NewBibliographyString")
   (LaTeX-declare-expert-environments
    "biblatex"
    "refsection" "refsegment")

   ;; Tell RefTeX: If package option `natbib' is given, activate that
   ;; format, otherwise stick with `biblatex':
   (when (and LaTeX-reftex-cite-format-auto-activate
              (fboundp 'reftex-set-cite-format))
     (if (or (LaTeX-provided-package-options-member "biblatex" "natbib")
             (LaTeX-provided-package-options-member "biblatex" "natbib=true"))
         (reftex-set-cite-format 'natbib)
       ;; The entry `biblatex' is defined in
       ;; `reftex-cite-format-builtin' in reftex-vars.el which will be
       ;; part of Emacs >= 25.3.  So check here if we find an entry,
       ;; otherwise do it manually for older Emacsen.
       (if (assoc 'biblatex reftex-cite-format-builtin)
           (reftex-set-cite-format 'biblatex)
         (reftex-set-cite-format
          '((?\C-m . "\\cite[][]{%l}")
            (?C    . "\\cite*[][]{%l}")
            (?t    . "\\textcite[][]{%l}")
            (?T    . "\\textcite*[][]{%l}")
            (?p    . "\\parencite[][]{%l}")
            (?P    . "\\parencite*[][]{%l}")
            (?f    . "\\footcite[][]{%l}")
            (?s    . "\\smartcite[][]{%l}")
            (?u    . "\\autocite[][]{%l}")
            (?U    . "\\autocite*[][]{%l}")
            (?a    . "\\citeauthor{%l}")
            (?A    . "\\citeauthor*{%l}")
            (?i    . "\\citetitle{%l}")
            (?I    . "\\citetitle*{%l}")
            (?y    . "\\citeyear{%l}")
            (?Y    . "\\citeyear*{%l}")
            (?n    . "\\nocite{%l}")))))))
 TeX-dialect)

(defvar LaTeX-biblatex-package-options-list
  (append
   ;;; Preamble Options
   LaTeX-biblatex-executebibliographyoptions-options
   '(;;; Load-time Options
    ("backend" ("biber" "bibtex" "bibtexu" "bibtex8"))
    ("style" BibLaTeX-global-style-files)
    ("bibstyle" BibLaTeX-global-style-files)
    ("citestyle" BibLaTeX-global-style-files)
    ("natbib" ("true" "false"))
    ("mcite" ("true" "false"))
    ;;; Entry Options
    ;; Preamble/Type/Entry Options
    ("useauthor" ("true" "false"))
    ("useeditor" ("true" "false"))
    ("usetranslator" ("true" "false"))
    ("useprefix" ("true" "false"))
    ("indexing" ("true" "false" "cite" "bib"))
    ;; Type/Entry Options are not available globally.
    ;; Legacy Options (deprecated)
    ("openbib")))
  "Package options for the biblatex package.")

(defun LaTeX-biblatex-package-options nil
  "Prompt for package options for the biblatex package."
  (unless BibLaTeX-global-style-files
    (if (if (eq TeX-arg-input-file-search 'ask)
            (not (y-or-n-p "Find BibLaTeX style yourself? "))
          TeX-arg-input-file-search)
        ;; ...then, search for BibLaTeX styles.
        (progn
          (message "Searching for BibLaTeX styles...")
          (setq BibLaTeX-global-style-files
                (TeX-search-files-by-type 'bbxinputs 'global t t))
          (message "Searching for BibLaTeX styles...done"))
      ;; ...else, use for completion only standard BibLaTeX styles (see §3.3 of
      ;; Biblatex reference manual).
      (setq BibLaTeX-global-style-files
            '("numeric" "numeric-comp" "numeric-verb" "alphabetic"
              "alphabetic-verb" "authoryear" "authoryear-comp" "authoryear-ibid"
              "authoryear-icomp" "authortitle" "authortitle-comp"
              "authortitle-ibid" "authortitle-icomp" "authortitle-terse"
              "authortitle-tcomp" "authortitle-ticomp" "verbose" "verbose-ibid"
              "verbose-note" "verbose-inote" "verbose-trad1" "verbose-trad2"
              "verbose-trad3" "reading" "draft" "debug"))))
  (TeX-read-key-val t LaTeX-biblatex-package-options-list))

;;; biblatex.el ends here