]> code.delx.au - gnu-emacs-elpa/blob - packages/auctex/style/fancyref.el
Remove version numbers in packages/ directory
[gnu-emacs-elpa] / packages / auctex / style / fancyref.el
1 ;;; fancyref.el --- AUCTeX style file with support for fancyref.sty
2
3 ;; Copyright (C) 1999 Free Software Foundation, Inc.
4
5 ;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
6 ;; Maintainer: auctex-devel@gnu.org
7
8 ;; This file is part of AUCTeX.
9
10 ;; AUCTeX is free software; you can redistribute it and/or modify it
11 ;; under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 3, or (at your option)
13 ;; any later version.
14
15 ;; AUCTeX is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with AUCTeX; see the file COPYING. If not, write to the Free
22 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 ;; 02110-1301, USA.
24
25 ;;; Code:
26
27 (TeX-add-style-hook "fancyref"
28 (lambda ()
29
30 (TeX-add-symbols
31
32 ;; The macros with label arguments
33 '("fref" [ TeX-arg-fancyref-format ] TeX-arg-label)
34 '("Fref" [ TeX-arg-fancyref-format ] TeX-arg-label)
35
36 ;; The macros which define new prefixes and formats
37 '("fancyrefchangeprefix" TeX-arg-macro "Prefix")
38 '("Frefformat" TeX-arg-fancyref-format TeX-arg-macro "Output")
39 '("frefformat" TeX-arg-fancyref-format TeX-arg-macro "Output")
40
41 ;; The delimiter
42 "fancyrefargdelim"
43
44 ;; All those names and abbreviations.
45 ;; Part
46 "fancyrefpartlabelprefix"
47 "Frefpartname" "frefpartname"
48 ;; Chapter
49 "fancyrefchalabelprefix"
50 "Frefchaname" "frefchaname"
51 ;; Section
52 "fancyrefseclabelprefix"
53 "Frefsecname" "frefsecname"
54 ;; Equation
55 "fancyrefeqlabelprefix"
56 "Frefeqname" "frefeqname"
57 ;; Figure
58 "fancyreffiglabelprefix"
59 "Freffigname" "freffigname" "Freffigshortname"
60 ;; Footnote
61 "fancyreffnlabelprefix"
62 "Freffnname" "freffnname"
63 ;; Item
64 "fancyrefitemlabelprefix"
65 "Frefitemname" "frefitemname"
66 ;; Table
67 "fancyreftablabelprefix"
68 "Freftabname" "freftabname" "Freftabshortname"
69 ;; Page
70 "Frefpgname" "frefpgname" "Frefpgshortname"
71 ;; On
72 "Frefonname" "frefonname"
73 ;; See
74 "Frefseename" "frefseename"
75
76 ;; The spacing macros
77 "fancyrefloosespacing" "fancyreftightspacing" "fancyrefdefaultspacing"
78
79 ;; And the hook
80 "fancyrefhook")
81
82 ;; Insatall completion for labels and formats
83 (setq TeX-complete-list
84 (append
85 '(("\\\\[fF]ref\\(\\[[^]]*\\]\\)?{\\([^{}\n\r\\%,]*\\)"
86 2 LaTeX-label-list "}")
87 ("\\\\[fF]ref\\[\\([^{}\n\r\\%,]*\\)"
88 1 LaTeX-fancyref-formats "]")
89 ("\\\\[fF]refformat{\\([^{}\n\r\\%,]*\\)"
90 1 LaTeX-fancyref-formats "}"))
91 TeX-complete-list))
92 ;; Fontification
93 (when (and (featurep 'font-latex)
94 (eq TeX-install-font-lock 'font-latex-setup))
95 (font-latex-add-keywords '(("fref" "[{") ("Fref" "[{")) 'reference))))
96
97 ;; The following list keeps a list of available format names
98 ;; Note that this list is only updated when a format is used, not
99 ;; during buffer parsing. We could install a regexp to look for
100 ;; formats, but this would not work in multifile documents since the
101 ;; formats are not written out to the auto files.
102 ;; For now, we just leave it at that.
103 (defvar LaTeX-fancyref-formats '(("plain") ("vario") ("margin") ("main"))
104 "List of formats for fancyref.")
105
106 (defun LaTeX-fancyref-formats () LaTeX-fancyref-formats)
107
108 (defun TeX-arg-fancyref-format (optional &optional prompt definition)
109 "Prompt for a fancyref format name.
110 If the user gives an unknown name, add it to the list."
111 (let ((format (completing-read (TeX-argument-prompt optional prompt "Format")
112 LaTeX-fancyref-formats)))
113 (if (not (string-equal "" format))
114 (add-to-list 'LaTeX-fancyref-formats (list format)))
115 (TeX-argument-insert format optional)))
116
117 (defvar LaTeX-fancyref-package-options '("english" "german" "loose"
118 "margin" "paren" "plain" "tight"
119 "vario")
120 "Package options for the fancyref package.")
121
122 ;;; fancyref.el ends here