Initial Commit
[packages] / xemacs-packages / auctex / style / hyperref.el
1 ;;; hyperref.el --- AUCTeX style for `hyperref.sty' v6.83m
2
3 ;; Copyright (C) 2008, 2013 Free Software Foundation, Inc.
4
5 ;; Author: Ralf Angeli <angeli@caeruleus.net>
6 ;; Maintainer: auctex-devel@gnu.org
7 ;; Created: 2008-06-21
8 ;; Keywords: tex
9
10 ;; This file is part of AUCTeX.
11
12 ;; AUCTeX is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; any later version.
16
17 ;; AUCTeX is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 ;; General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
24 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25 ;; 02110-1301, USA.
26
27 ;;; Commentary:
28
29 ;; This file adds support for the hyperref package.
30
31 ;;; Code:
32
33 (defvar LaTeX-hyperref-package-options-list
34   '(;; See http://www.tug.org/applications/hyperref/manual.html#x1-40003
35     ;; General options
36     ("draft" ("true" "false"))
37     ("final" ("true" "false"))
38     ("debug" ("true" "false"))
39     ("verbose" ("true" "false"))
40     ("implicit" ("true" "false"))
41     ("setpagesize" ("true" "false"))
42     ;; Options for destination names
43     ("destlabel" ("true" "false"))
44     ("hypertexnames" ("true" "false"))
45     ("naturalnames" ("true" "false"))
46     ("plainpages" ("true" "false"))
47     ;; Configuration options
48     ("raiselinks" ("true" "false"))
49     ("breaklinks" ("true" "false"))
50     ("pageanchor" ("true" "false"))
51     ("nesting" ("true" "false"))
52     ;; Backend drivers
53     ("driverfallback")
54     ("dvipdfm")
55     ("dvipdfmx")
56     ("dvips")
57     ("dvipsone")
58     ("dviwindo")
59     ("hypertex")
60     ("latex2html")
61     ("nativepdf")
62     ("pdfmark")
63     ("pdftex")
64     ("ps2pdf")
65     ("tex4ht")
66     ("textures")
67     ("vtex")
68     ("vtexpdfmark")
69     ("xetex")
70     ;; Extension options
71     ("extension")
72     ("hyperfigures" ("true" "false"))
73     ("backref" ("section" "slide" "page" "none" "false"))
74     ("pagebackref" ("true" "false"))
75     ("hyperindex" ("true" "false"))
76     ("hyperfootnotes" ("true" "false"))
77     ("encap")
78     ("linktocpage" ("true" "false"))
79     ("breaklinks" ("true" "false"))
80     ("colorlinks" ("true" "false"))
81     ("linkcolor")
82     ("anchorcolor")
83     ("citecolor")
84     ("filecolor")
85     ("menucolor")
86     ("runcolor")
87     ("urlcolor")
88     ("allcolors")
89     ("frenchlinks" ("true" "false"))
90     ("hidelinks")
91     ;; PDF-specific display options
92     ("bookmarks" ("true" "false"))
93     ("bookmarksopen" ("true" "false"))
94     ("bookmarksopenlevel")
95     ("bookmarksnumbered" ("true" "false"))
96     ("bookmarkstype")
97     ("CJKbookmarks" ("true" "false"))
98     ("pdfhighlight" ("/I" "/N" "/O" "/P"))
99     ("citebordercolor")
100     ("filebordercolor")
101     ("linkbordercolor")
102     ("menubordercolor")
103     ("runbordercolor")
104     ("urlbordercolor")
105     ("allbordercolors")
106     ("pdfborder")
107     ;; PDF display and information options
108     ("baseurl")
109     ("pdfpagemode" ("UseOutlines" "UseThumbs" "FullScreen" "UseOC" "UseAttachments"))
110     ("pdftitle")
111     ("pdfauthor")
112     ("pdfsubject")
113     ("pdfcreator")
114     ("pdfproducer")
115     ("pdfkeywords")
116     ("pdftrapped" ("True" "False" "Unknown"))
117     ("pdfinfo")
118     ("pdfview" ("XYZ" "Fit" "FitH" "FitV" "FitR" "FitB" "FitBH" "FitBV"))
119     ("pdfstartpage")
120     ("pdfstartview" ("XYZ" "Fit" "FitH" "FitV" "FitR" "FitB" "FitBH" "FitBV"))
121     ("pdfremotestartview" ("XYZ" "Fit" "FitH" "FitV" "FitR" "FitB" "FitBH" "FitBV"))
122     ("pdfpagescrop")
123     ("pdfcenterwindow" ("true" "false"))
124     ("pdfdirection" ("L2R" "R2L"))
125     ("pdfdisplaydoctitle" ("true" "false"))
126     ("pdfduplex" ("Simplex" "DuplexFlipShortEdge" "DuplexFlipLongEdge"))
127     ("pdffitwindow" ("true" "false"))
128     ("pdflang")
129     ("pdfmenubar" ("true" "false"))
130     ("pdfnewwindow" ("true" "false"))
131     ("pdfnonfullscreenpagemode" ("UseNone" "UseOutlines" "UseThumbs" "FullScreen" "UseOC" "UseAttachments"))
132     ("pdfnumcopies")
133     ("pdfpagelayout" ("SinglePage" "OneColumn" "TwoColumnLeft" "TwoColumnRight" "TwoPageLeft" "TwoPageRight"))
134     ("pdfpagelabels" ("true" "false"))
135     ("pdfpagetransition" ("Blinds" "Box" "Dissolve" "Glitter" "Split" "Wipe"))
136     ("pdfpicktraybypdfsize" ("true" "false"))
137     ("pdfprintarea" ("MediaBox" "CropBox" "BleedBox" "TrimBox" "ArtBox"))
138     ("pdfprintclip" ("MediaBox" "CropBox" "BleedBox" "TrimBox" "ArtBox"))
139     ("pdfprintpagerange")
140     ("pdfprintscaling" ("AppDefault" "None"))
141     ("pdftoolbar" ("true" "false"))
142     ("pdfviewarea" ("MediaBox" "CropBox" "BleedBox" "TrimBox" "ArtBox"))
143     ("pdfviewclip" ("MediaBox" "CropBox" "BleedBox" "TrimBox" "ArtBox"))
144     ("pdfwindowui" ("true" "false"))
145     ("unicode" ("true" "false")))
146   "Package options for the hyperref package.")
147
148 (defvar LaTeX-hyperref-href-options
149   '(("pdfremotestartview" ("XYZ" "Fit" "FitH" "FitV" "FitR" "FitB" "FitBH" "FitBV"))
150     ("pdfnewwindow" ("true" "false"))
151     ("page")
152     ("ismap" ("true" "false"))
153     ("nextactionraw"))
154   "Key=value options for href macro of the hyperref package.")
155
156 (TeX-add-style-hook
157  "hyperref"
158  (lambda ()
159    ;; hyperref loads nameref and url (+ some other packages which do not have
160    ;; style hooks)
161    (TeX-run-style-hooks "url" "nameref")
162
163    (TeX-add-symbols
164     '("hypersetup" (TeX-arg-key-val LaTeX-hyperref-package-options-list))
165     '("href" [ (TeX-arg-key-val LaTeX-hyperref-href-options) ] "URL" "Text")
166     '("nolinkurl" t)
167     '("hyperbaseurl" t)
168     '("hyperimage" "Image URL" "Text")
169     '("hyperdef" "Category" "Name" "Text")
170     '("hyperref" "URL" "Category" "Name" "Text")
171     '("hyperlink" "Name" "Text")
172     '("hypertarget" "Name" "Text")
173     '("phantomsection" 0)
174     '("autoref" TeX-arg-ref)
175     '("ref*" TeX-arg-ref)
176     '("pageref*" TeX-arg-ref)
177     '("autopageref" TeX-arg-ref)
178     '("autopageref*" TeX-arg-ref)
179     '("pdfstringdef" "Macro name" "TeX string")
180     '("pdfbookmark" [ "Level" ] "Text" "name")
181     '("currentpdfbookmark" "Text" "Name")
182     '("subpdfbookmark" "Text" "Name")
183     '("belowpdfbookmark" "Text" "Name")
184     '("texorpdfstring" "TeX string" "PDF string")
185     '("hypercalcbp" t)
186     '("Acrobatmenu" "Menu option" "Text")
187     '("TextField" ["Parameters"] "Label")
188     '("CheckBox" ["Parameters"] "Label")
189     '("ChoiceMenu" ["Parameters"] "Label" "Choices")
190     '("PushButton" ["Parameters"] "Label")
191     '("Submit" ["Parameters"] "Label")
192     '("Reset" ["Parameters"] "Label")
193     '("LayoutTextField" "Label" "Field")
194     '("LayoutChoiceField" "Label" "Field")
195     '("LayoutCheckField" "Label" "Field")
196     '("MakeRadioField" "Width" "Height")
197     '("MakeCheckField" "Width" "Height")
198     '("MakeTextField" "Width" "Height")
199     '("MakeChoiceField" "Width" "Height")
200     '("MakeButtonField" "Text"))
201
202    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl")
203    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl")
204    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperimage")
205    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperref")
206
207    ;; Fontification
208    (when (and (fboundp 'font-latex-add-keywords)
209               (fboundp 'font-latex-set-syntactic-keywords)
210               (eq TeX-install-font-lock 'font-latex-setup))
211      (font-latex-add-keywords '(("href" "[{{")
212                                 ("nolinkurl" "{")
213                                 ("hyperbaseurl" "{")
214                                 ("hyperimage" "{{")
215                                 ("hyperdef" "{{{")
216                                 ("hyperref" "{{{{")
217                                 ("hyperlink" "{{")
218                                 ("hypertarget" "{{")
219                                 ("autoref" "{")
220                                 ("ref" "*{")
221                                 ("pageref" "*{")
222                                 ("autopageref" "*{"))
223                               'reference)
224      ;; For syntactic fontification, e.g. verbatim constructs.
225      (font-latex-set-syntactic-keywords))
226
227    ;; RefTeX
228    (when (fboundp 'reftex-ref-style-activate)
229      (reftex-ref-style-activate "Hyperref")))
230  LaTeX-dialect)
231
232 (defun LaTeX-hyperref-package-options ()
233   "Read the hyperref package options from the user."
234   (TeX-read-key-val t LaTeX-hyperref-package-options-list))
235
236 ;;; hyperref.el ends here