1 ;;; natbib.el --- AUCTeX style for `natbib.sty' version 8.31b
3 ;; Copyright (C) 1997, 1998, 2004, 2007, 2014, 2016 Free Software Foundation, Inc.
5 ;; Authors: Berwin Turlach <statba@nus.edu.sg>
6 ;; Carsten Dominik <dominik@strw.leidenuniv.nl>
7 ;; Maintainer: auctex-devel@gnu.org
10 ;; This file is part of AUCTeX.
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)
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.
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
32 ;; The number in the cdr of the following list indicates how many
33 ;; optional note arguments we consider useful. Prompting for those
34 ;; arguments will still depend upon `TeX-arg-cite-note-p'.
37 ("citet" . 1) ("citet*" . 1) ("citealt" . 1) ("citealt*" . 1)
38 ("citep" . 2) ("citep*" . 2) ("citealp" . 2) ("citealp*" . 2)
39 ("citeauthor" . 0) ("citeauthor*" . 0) ("citefullauthor" . 0)
40 ("citeyear" . 0) ("citeyearpar" . 0)
42 ;; 2.4 Extended Citation Commands
44 ;; 2.5 Forcing Upper Cased Name
45 ("Citet" . 1) ("Citet*" . 1) ("Citealt" . 1) ("Citealt*" . 1)
46 ("Citep" . 2) ("Citep*" . 2) ("Citealp" . 2) ("Citealp*" . 2)
47 ;; 2.6 Citation Aliasing
48 ("citetalias" . 1) ("citepalias" . 2))))
57 ;; No optional arguments
58 (list (car cmd) 'TeX-arg-cite))
60 ;; Just one optional argument, the post note
63 '(TeX-arg-conditional TeX-arg-cite-note-p (["Post-note"]) nil)
69 '(TeX-arg-conditional TeX-arg-cite-note-p ([LaTeX-arg-natbib-notes]) nil)
73 ;; Make an entry in TeX-complete-list
78 (mapconcat (lambda (x) (regexp-quote (car x)))
80 "\\)\\(\\[[^]\n\r\\%]*\\]\\)*{\\([^{}\n\r\\%,]*,\\)*\\([^{}\n\r\\%,]*\\)")
81 4 'LaTeX-bibitem-list "}")))
83 ;; Add the other symbols
85 ;; 2.4 Extended Citation Commands
88 ;; 2.6 Citation Aliasing
89 '("defcitealias" TeX-arg-cite "Alias")
91 ;; 2.9 Selecting Citation Punctuation
92 '("setcitestyle" (TeX-arg-key-val
93 (;; Citation mode (fourth argument of \bibpunct):
94 ("authoryear") ("numbers") ("super")
95 ;; Braces (first and second arguments of \bibpunct):
96 ("round") ("square") ("open") ("close")
97 ;; Between citations (third argument of \bibpunct):
98 ("semicolon") ("comma") ("citesep")
99 ;; Between author and year (fifth argument of \bibpunct):
101 ;; Between years with common author (sixth argument of \bibpunct):
103 ;; Text before post-note (optional argument of \bibpunct):
105 '("bibpunct" ["Post note separator"]
108 "Punctuation between multiple citations"
109 "style [n]umeric [s]uperscript [a]uthor-year"
110 "Punctuation between author and year"
111 "Punctuation between years for common authors")
113 '("citestyle" (TeX-arg-eval completing-read
114 (TeX-argument-prompt optional nil "Style")
115 '("plain" "plainnat" "agu" "egu"
116 "agms" "dcu" "kluwer" "cospar" "nature")))
118 ;; 2.12 Other Formatting Options
125 ;; 2.13 Automatic Indexing of Citations
130 ;; 2.12 Other Formatting Options
131 (LaTeX-add-lengths "bibhang" "bibsep")
134 (when (and (fboundp 'font-latex-add-keywords)
135 (eq TeX-install-font-lock 'font-latex-setup))
136 (font-latex-add-keywords '(("cite" "*[[{")
141 ("citeauthor" "*[[{")
142 ("citefullauthor" "[[{")
144 ("citeyearpar" "[[{")
151 ("Citeauthor" "*[[{")
152 ("citetalias" "*[[{")
153 ("citepalias" "*[[{"))
155 (font-latex-add-keywords '(("defcitealias" "{{")
156 ("bibpunct" "[{{{{{{")
162 (when (and LaTeX-reftex-cite-format-auto-activate
163 (fboundp 'reftex-set-cite-format))
164 (reftex-set-cite-format 'natbib)))
167 (defun LaTeX-arg-natbib-notes (optional)
168 "Prompt for two note arguments a natbib citation command.
169 If OPTIONAL is non-nil, insert them in brackets, otherwise in
171 (let ((pre (TeX-read-string
172 (TeX-argument-prompt optional nil "Pre-note")))
173 (post (TeX-read-string
174 (TeX-argument-prompt optional nil "Post-note"))))
175 (TeX-argument-insert pre optional)
176 (TeX-argument-insert post optional)
177 ;; pre is given, post is empty: Make sure that we insert an
178 ;; extra pair of `[]', otherwise pre becomes post
179 (when (and pre (not (string= pre ""))
181 (insert LaTeX-optop LaTeX-optcl))))
183 (defvar LaTeX-natbib-package-options '("numbers" "super" "authoryear"
184 "round" "square" "angle" "curly"
185 "comma" "colon" "nobibstyle"
186 "bibstyle" "openbib" "sectionbib"
187 "sort" "sort&compress"
188 "longnamesfirst" "nonamebreak")
189 "Package options for the natbib package.")
191 ;; natbib.el ends here