[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 3ddc9b3 1/6: Add support for natbib macros to st
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 3ddc9b3 1/6: Add support for natbib macros to style/biblatex |
Date: |
Mon, 17 Oct 2016 16:25:43 +0000 (UTC) |
branch: externals/auctex
commit 3ddc9b3fea146c516cb7cae68a329dec42ebb22c
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>
Add support for natbib macros to style/biblatex
* style/biblatex.el (LaTeX-arg-biblatex-natbib-notes): New
function.
("biblatex"): Add completion and fontification support for natbib
compatibility macros.
---
style/biblatex.el | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/style/biblatex.el b/style/biblatex.el
index 06cd57a..5a9d373 100644
--- a/style/biblatex.el
+++ b/style/biblatex.el
@@ -216,6 +216,32 @@ for citation keys."
(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"))))
+ (cond
+ (;; Both optional args are given
+ (and pre (not (string= pre ""))
+ post (not (string= post "")))
+ (insert LaTeX-optop pre LaTeX-optcl
+ LaTeX-optop post LaTeX-optcl))
+ (;; pre is given, post is empty: Make sure that we insert an
+ ;; extra pair of `[]', otherwise pre becomes post
+ (and pre (not (string= pre ""))
+ (string= post ""))
+ (insert LaTeX-optop pre LaTeX-optcl
+ LaTeX-optop LaTeX-optcl))
+ (;; pre is empty, post is given
+ (and (string= pre "")
+ post (not (string= post "")))
+ (insert LaTeX-optop post LaTeX-optcl))
+ (;; both empty
+ t (ignore))))))
+
(TeX-add-style-hook
"biblatex"
(lambda ()
@@ -456,6 +482,53 @@ for citation keys."
'("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
- [elpa] externals/auctex updated (99df5e2 -> 3242bb7), Tassilo Horn, 2016/10/17
- [elpa] externals/auctex d5e8b7d 2/6: Use `TeX-argument-insert' instead of conditional `insert', Tassilo Horn, 2016/10/17
- [elpa] externals/auctex 3153601 3/6: Do not insert unnecessary brackets for citation macros, Tassilo Horn, 2016/10/17
- [elpa] externals/auctex d833e0e 4/6: Make Copyright headers conforming to convention, Tassilo Horn, 2016/10/17
- [elpa] externals/auctex f47a6a7 5/6: Merge branch 'master' into externals/auctex, Tassilo Horn, 2016/10/17
- [elpa] externals/auctex 3ddc9b3 1/6: Add support for natbib macros to style/biblatex,
Tassilo Horn <=
- [elpa] externals/auctex 3242bb7 6/6: Release GNU AUCTeX 11.89.6 (now for real), Tassilo Horn, 2016/10/17