1 ;;; fancyref.el --- AUCTeX style file with support for fancyref.sty
3 ;; Copyright (C) 1999 Free Software Foundation, Inc.
5 ;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
6 ;; Maintainer: auctex-devel@gnu.org
8 ;; This file is part of AUCTeX.
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)
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.
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
27 (TeX-add-style-hook "fancyref"
32 ;; The macros with label arguments
33 '("fref" [ TeX-arg-fancyref-format ] TeX-arg-label)
34 '("Fref" [ TeX-arg-fancyref-format ] TeX-arg-label)
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")
44 ;; All those names and abbreviations.
46 "fancyrefpartlabelprefix"
47 "Frefpartname" "frefpartname"
49 "fancyrefchalabelprefix"
50 "Frefchaname" "frefchaname"
52 "fancyrefseclabelprefix"
53 "Frefsecname" "frefsecname"
55 "fancyrefeqlabelprefix"
56 "Frefeqname" "frefeqname"
58 "fancyreffiglabelprefix"
59 "Freffigname" "freffigname" "Freffigshortname"
61 "fancyreffnlabelprefix"
62 "Freffnname" "freffnname"
64 "fancyrefitemlabelprefix"
65 "Frefitemname" "frefitemname"
67 "fancyreftablabelprefix"
68 "Freftabname" "freftabname" "Freftabshortname"
70 "Frefpgname" "frefpgname" "Frefpgshortname"
72 "Frefonname" "frefonname"
74 "Frefseename" "frefseename"
77 "fancyrefloosespacing" "fancyreftightspacing" "fancyrefdefaultspacing"
82 ;; Insatall completion for labels and formats
83 (setq TeX-complete-list
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 "}"))
93 (when (and (featurep 'font-latex)
94 (eq TeX-install-font-lock 'font-latex-setup))
95 (font-latex-add-keywords '(("fref" "[{") ("Fref" "[{")) 'reference))))
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.")
106 (defun LaTeX-fancyref-formats () LaTeX-fancyref-formats)
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)))
117 (defvar LaTeX-fancyref-package-options '("english" "german" "loose"
118 "margin" "paren" "plain" "tight"
120 "Package options for the fancyref package.")
122 ;;; fancyref.el ends here