118
|
1 ;; harvard.el --- Support for Harvard Citation style package for AUC-TeX
|
|
2
|
|
3 ;; Copyright (C) 1994 Berwin Turlach <berwin@core.ucl.ac.be>
|
|
4
|
|
5 ;; Version: $Id: harvard.el,v 1.1 1997/04/05 17:56:46 steve Exp $
|
|
6
|
|
7 ;; This program is free software; you can redistribute it and/or modify
|
|
8 ;; it under the terms of the GNU General Public License as published by
|
|
9 ;; the Free Software Foundation; either version 1, or (at your option)
|
|
10 ;; any later version.
|
|
11 ;;
|
|
12 ;; This program is distributed in the hope that it will be useful,
|
|
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 ;; GNU General Public License for more details.
|
|
16 ;;
|
|
17 ;; You should have received a copy of the GNU General Public License
|
|
18 ;; along with this program; if not, write to the Free Software
|
|
19 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
20
|
|
21 ;;; Commentary:
|
|
22
|
|
23 ;; Harvard citation style is from Peter Williams available on the CTAN
|
|
24 ;; servers
|
|
25
|
|
26 ;;; Code:
|
|
27
|
|
28 (require 'latex)
|
|
29
|
|
30 (TeX-add-style-hook "harvard"
|
|
31 (function
|
|
32 (lambda ()
|
|
33
|
|
34 (LaTeX-add-environments
|
|
35 '("thebibliography" LaTeX-env-harvardbib ignore))
|
|
36
|
|
37 (TeX-add-symbols
|
|
38 "harvardand"
|
|
39 '("citeasnoun"
|
|
40 (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil)
|
|
41 TeX-arg-cite)
|
|
42 '("possessivecite"
|
|
43 (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil)
|
|
44 TeX-arg-cite)
|
|
45 '("citeaffixed"
|
|
46 (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil)
|
|
47 TeX-arg-cite "Affix")
|
|
48 '("citeyear"
|
|
49 (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil)
|
|
50 TeX-arg-cite)
|
|
51 '("citename"
|
|
52 (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil)
|
|
53 TeX-arg-cite)
|
|
54 '("citationstyle"
|
|
55 (TeX-arg-eval completing-read "Citation style: " '(("agsm") ("dcu"))))
|
|
56 '("citationmode"
|
|
57 (TeX-arg-eval completing-read "Citation mode: "
|
|
58 '(("full") ("abbr") ("default"))))
|
|
59 '("harvardparenthesis"
|
|
60 (TeX-arg-eval completing-read "Harvardparenthesis: "
|
|
61 '(("round") ("curly") ("angle") ("square"))))
|
|
62 '("bibliographystyle"
|
|
63 (TeX-arg-eval
|
|
64 completing-read "Bibliography style: "
|
|
65 '(("agsm") ("dcu") ("jmr") ("jphysicsB") ("kluwer") ("nederlands")))
|
|
66 ignore)
|
|
67 '("harvarditem" [ "Short citation" ]
|
|
68 "Complete citation" "Year" TeX-arg-define-cite))
|
|
69
|
|
70 (setq TeX-complete-list
|
|
71 (append '(("\\\\citeasnoun{\\([^{}\n\m\\%]*\\)"
|
|
72 1 LaTeX-bibitem-list "}")
|
|
73 ("\\\\citeyear{\\([^{}\n\m\\%]*\\)"
|
|
74 1 LaTeX-bibitem-list "}")
|
|
75 ("\\\\citename{\\([^{}\n\m\\%]*\\)"
|
|
76 1 LaTeX-bibitem-list "}"))
|
|
77 TeX-complete-list))
|
|
78
|
|
79 (setq LaTeX-item-list
|
|
80 (cons '("thebibliography" . LaTeX-item-harvardbib)
|
|
81 LaTeX-item-list)))))
|
|
82
|
|
83 (defun LaTeX-env-harvardbib (environment &optional ignore)
|
|
84 "Insert ENVIRONMENT with label for harvarditem."
|
|
85 (LaTeX-insert-environment environment
|
|
86 (concat TeX-grop "xx" TeX-grcl))
|
|
87 (end-of-line 0)
|
|
88 (delete-char 1)
|
|
89 (delete-horizontal-space)
|
|
90 (LaTeX-insert-item))
|
|
91
|
|
92 ;; Analog to LaTeX-item-bib from latex.el
|
|
93 (defun LaTeX-item-harvardbib ()
|
|
94 "Insert a new harvarditem."
|
|
95 (TeX-insert-macro "harvarditem"))
|
|
96
|
|
97 ;; harvard.el ends here
|