1 ;;; cleveref.el --- Style hook for the `cleveref.sty' package.
3 ;; Copyright (C) 2014 Free Software Foundation, Inc.
5 ;; Author: Matthew Leach <matthew@mattleach.net>
6 ;; Maintainer: auctex-devel@gnu.org
9 ;; This file is part of AUCTeX.
11 ;; AUCTeX is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 3, or (at your option)
16 ;; AUCTeX is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with AUCTeX; see the file COPYING. If not, write to the Free
23 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 (defun TeX-arg-cleveref-multiple-labels (optional &optional prompt definition)
29 "Prompt for a series of labels completing with known labels.
30 If OPTIONAL is non-nil, insert the resulting value as an optional
31 argument, otherwise as a mandatory one. Use PROMPT as the prompt
32 string. If DEFINITION is non-nil, add each chosen label to the
33 list of defined labels."
34 (let* ((labels (TeX-completing-read-multiple
35 (TeX-argument-prompt optional prompt "Keys")
37 (labels-string (mapconcat 'identity labels ",")))
39 (apply 'LaTeX-add-labels labels))
40 (TeX-argument-insert labels-string optional optional)))
46 '("cref" TeX-arg-cleveref-multiple-labels)
47 '("Cref" TeX-arg-cleveref-multiple-labels)
48 '("crefrange" (TeX-arg-label "Key (first)") (TeX-arg-label "Key (last)"))
49 '("Crefrange" (TeX-arg-label "key (first)") (TeX-arg-label "Key (last)"))
50 '("cpageref" TeX-arg-cleveref-multiple-labels)
51 '("Cpageref" TeX-arg-cleveref-multiple-labels)
52 '("cpagerefrange" (TeX-arg-label "Key (first)") (TeX-arg-label "Key (last)"))
53 '("Cpagerefrange" (TeX-arg-label "Key (first)") (TeX-arg-label "Key (last)"))
54 '("cref*" TeX-arg-cleveref-multiple-labels)
55 '("Cref*" TeX-arg-cleveref-multiple-labels)
56 '("crefrange*" (TeX-arg-label "Key (first)") (TeX-arg-label "Key (last)"))
57 '("Crefrange*" (TeX-arg-label "Key (first)") (TeX-arg-label "Key (last)"))
58 '("namecref" TeX-arg-label)
59 '("nameCref" TeX-arg-label)
60 '("lnamecref" TeX-arg-label)
61 '("namecrefs" TeX-arg-label)
62 '("nameCrefs" TeX-arg-label)
63 '("lnamecrefs" TeX-arg-label)
64 '("labelcref" TeX-arg-cleveref-multiple-labels)
65 '("labelcpageref" TeX-arg-cleveref-multiple-labels))
67 ;; These macros aren't used particularly often during the course of
68 ;; normal referencing.
69 (TeX-declare-expert-macros
71 "namecref" "nameCref" "lnamecref" "namecrefs" "nameCrefs"
72 "lnamecrefs" "labelcref" "labelcpageref")
75 (when (and (fboundp 'font-latex-add-keywords)
76 (fboundp 'font-latex-set-syntactic-keywords)
77 (eq TeX-install-font-lock 'font-latex-setup))
78 (font-latex-add-keywords '(("cref" "*{")
84 ("cpagerefrange" "{{")
85 ("Cpagerefrange" "{{")
93 ("labelcpageref" "{"))
95 ;; For syntactic fontification, e.g. verbatim constructs.
96 (font-latex-set-syntactic-keywords)))
99 (defvar LaTeX-cleveref-package-options
100 '("capitalise" "nameinlink" "noabbrev" "poorman")
101 "Package options for the cleveref package.")
103 ;;; cleveref.el ends here.