1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
;;; varioref.el --- AUCTeX style for `varioref.sty' (v1.6b) -*- lexical-binding: t; -*-
;; Copyright (C) 1999, 2013, 2015, 2018--2020 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
;; Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Commentary:
;; This file adds support for `varioref.sty' (v1.6b) from 2019/09/08.
;; `varioref.sty' is a standard LaTeX package and part of TeXLive.
;;; Code:
(require 'tex)
(require 'tex-style)
;; Silence the compiler:
(declare-function font-latex-add-keywords
"font-latex"
(keywords class))
(TeX-add-style-hook
"varioref"
(lambda ()
(TeX-add-symbols
;; 3 The user interface
'("vref" TeX-arg-ref)
'("vpageref" [ "Same page text" ] [ "Different page text" ] TeX-arg-ref)
'("vrefrange" [ "Same page text" ] TeX-arg-ref TeX-arg-ref)
'("vpagerefrange" [ "Same page text" ] TeX-arg-ref TeX-arg-ref)
"vpagerefnum"
'("vpagerefcompare" 4)
'("vpagerefnearby" 3)
'("vref*" TeX-arg-ref)
'("vpageref*" [ "Same page text" ] [ "Different page text" ] TeX-arg-ref)
'("vrefrange*" [ "Same page text" ] TeX-arg-ref TeX-arg-ref)
'("vpagerefrange*" [ "Same page text" ] TeX-arg-ref TeX-arg-ref)
'("Vref" TeX-arg-ref)
'("Vref*" TeX-arg-ref)
;; 5 Customization
"reftextbefore" "reftextfacebefore"
"reftextafter" "reftextfaceafter"
"reftextfaraway" "vreftextvario"
"reftextpagerange" "reftexlabelrange"
"vrefwarning" "vrefshowerrors"
'("fullref" TeX-arg-ref))
;; Install completion for labels. Only offer completion for
;; commands that take only one reference as an argument
;; FIXME: The first 3 entries can be reduced to
;; ("\\\\[Vv]ref\\*?{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") ???
(setq TeX-complete-list
(append
'(("\\\\[Vv]ref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
("\\\\vref\\*?{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
("\\\\vref\\*{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
("\\\\fullref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
("\\\\vpageref\\*?\\(\\[[^]]*\\]\\)*{\\([^{}\n\r\\%,]*\\)"
2 LaTeX-label-list "}"))
TeX-complete-list))
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(;; vref is already in font-latex.el,
;; so don't add it here again
("vpageref" "*[[{")
("vrefrange" "*[{{")
("vpagerefrange" "*[{{")
("Vref" "*{")
("fullref" "{"))
'reference))
;; Activate RefTeX reference style.
(and LaTeX-reftex-ref-style-auto-activate
(fboundp 'reftex-ref-style-activate)
(reftex-ref-style-activate "Varioref")))
TeX-dialect)
(defvar LaTeX-varioref-package-options
'("afrikaans" "american" "arabic" "austrian" "naustrian" "basque"
"bahasam" "brazil" "breton" "bulgarian" "catalan" "croatian"
"czech" "danish" "dutch" "english" "esperanto" "finnish" "french"
"galician" "german" "ngerman" "greek" "icelandic" "italian" "magyar"
"norsk" "nynorsk" "polish" "portuges" "romanian" "russian"
"slovak" "slovene" "spanish" "swedish" "turkish" "ukrainian"
"francais" "germanb" "draft" "final" "space" "nospace")
"Package options for the varioref package.")
;;; varioref.el ends here
|