auctex / style / fancyref.el

;; AUCTeX style file with support for fancyref.sty
;; Author: C. Dominik <>
;; Last change: 20 Feb 1999

(TeX-add-style-hook "fancyref"
   (lambda ()

      ;; The macros with label arguments
      '("fref" [ TeX-arg-fancyref-format ] TeX-arg-label)
      '("Fref" [ TeX-arg-fancyref-format ] TeX-arg-label)

      ;; The macros which define new prefixes and formats
      '("fancyrefchangeprefix" TeX-arg-macro "Prefix")
      '("Frefformat" TeX-arg-fancyref-format TeX-arg-macro "Output")
      '("frefformat" TeX-arg-fancyref-format TeX-arg-macro "Output")

      ;; The delimiter

      ;; All those names and abbreviations.
      ;; Part
      "Frefpartname" "frefpartname"   
      ;; Chapter
      "Frefchaname" "frefchaname"   
      ;; Section
      "Frefsecname" "frefsecname"
      ;; Equation
      "Frefeqname" "frefeqname"   
      ;; Figure
      "Freffigname" "freffigname" "Freffigshortname"
      ;; Footnote
      "Freffnname" "freffnname"   
      ;; Item
      "Frefitemname" "frefitemname" 
      ;; Table
      "Freftabname" "freftabname" "Freftabshortname"
      ;; Page
      "Frefpgname" "frefpgname" "Frefpgshortname"
      ;; On
      "Frefonname" "frefonname" 
      ;; See
      "Frefseename" "frefseename"

      ;; The spacing macros
      "fancyrefloosespacing" "fancyreftightspacing" "fancyrefdefaultspacing"

      ;; And the hook

     ;; Insatall completion for labels and formats
     (setq TeX-complete-list
	       2 LaTeX-label-list "}")
	       1 LaTeX-fancyref-formats "]")
	       1 LaTeX-fancyref-formats "}"))
     ;; font-lock:
     (when (and (featurep 'font-latex)
		(eq TeX-install-font-lock 'font-latex-setup))
       (add-to-list 'font-latex-match-reference-keywords-local "fref")
       (add-to-list 'font-latex-match-reference-keywords-local "Fref")

;; The following list keeps a list of available format names
;; Note that this list is only updated when a format is used, not
;; during buffer parsing.  We could install a regexp to look for
;; formats, but this would not work in multifile documents since the
;; formats are not written out to the auto files.
;; For now, we just leave it at that.
(defvar LaTeX-fancyref-formats '(("plain") ("vario") ("margin") ("main"))
  "List of formats for fancyref.")

(defun LaTeX-fancyref-formats () LaTeX-fancyref-formats)

(defun TeX-arg-fancyref-format (optional &optional prompt definition)
  "Prompt for a fancyref format name.
If the user gives an unknown name, add it to the list."
  (let ((format (completing-read (TeX-argument-prompt optional prompt "Format")
    (if (not (string-equal "" format))
	(add-to-list 'LaTeX-fancyref-formats (list format)))
    (TeX-argument-insert format optional)))

(defvar LaTeX-fancyref-package-options '("english" "german" "loose"
					 "margin" "paren" "plain" "tight"
  "Package options for the fancyref package.")

;; fancyref.el ends here