>From 92ba4854b74a36c9a6a8e7332c5f663e94abec67 Mon Sep 17 00:00:00 2001 From: Arash Date: Tue, 30 Dec 2014 16:21:03 +0100 Subject: [PATCH 1/3] Add `Form' environment needed for PDF and HTML forms. * style/hyperref.el ("hyperref"): Add `Form' environment needed for PDF and HTML forms. (LaTeX-hyperref-forms-options): New variable for key-val options used in form related macros (`TextField', `CheckBox', `ChoiceMenu', `PushButton', `Submit', `Reset'). --- ChangeLog | 8 ++++++ style/hyperref.el | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 82 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 10063c3..9baf491 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-12-30 Arash Esbati + + * style/hyperref.el ("hyperref"): Add `Form' environment needed + for PDF and HTML forms. + (LaTeX-hyperref-forms-options): New variable for key-val options + used in form related macros (`TextField', `CheckBox', + `ChoiceMenu', `PushButton', `Submit', `Reset'). + 2014-12-12 Mosè Giordano * latex.el (LaTeX-environment-name-regexp): New function. diff --git a/style/hyperref.el b/style/hyperref.el index ad1c628..a1eee7c 100644 --- a/style/hyperref.el +++ b/style/hyperref.el @@ -1,6 +1,6 @@ ;;; hyperref.el --- AUCTeX style for `hyperref.sty' v6.83m -;; Copyright (C) 2008, 2013 Free Software Foundation, Inc. +;; Copyright (C) 2008, 2013, 2014 Free Software Foundation, Inc. ;; Author: Ralf Angeli ;; Maintainer: address@hidden @@ -153,6 +153,64 @@ ("nextactionraw")) "Key=value options for href macro of the hyperref package.") +;; See http://www.tug.org/applications/hyperref/ftp/doc/manual.html#x1-220006.2 + +(defvar LaTeX-hyperref-forms-options + '(("accesskey") + ("align" ("0" "1" "2")) + ("altname") + ("backgroundcolor") + ("bordercolor") + ("bordersep") + ("borderwidth") + ;; "borderstyle" is not mentioned in the original hyperref-doc, it + ;; can be seen in action in + ;; http://mirrors.ctan.org/macros/latex/contrib/hyperref/test/testform.tex + ;; S=Solid (default), D=Dashed, B=Beveled, I=Inset, U=Underline + ("borderstyle" ("S" "D" "B" "I" "U")) + ("calculate") + ("charsize") + ("checkboxsymbol" ("true" "false")) + ("checked") + ("color") + ("combo" ("true" "false")) + ("default") + ("disabled" ("true" "false")) + ("format") + ("height") + ("hidden" ("true" "false")) + ("keystroke") + ("mappingname") + ("maxlen") + ("menulength") + ("multiline" ("true" "false")) + ("name") + ("onblur") + ("onchange") + ("onclick") + ("ondblclick") + ("onfocus") + ("onkeydown") + ("onkeypress") + ("onkeyup") + ("onmousedown") + ("onmousemove") + ("onmouseout") + ("onmouseover") + ("onmouseup") + ("onselect") + ("password" ("true" "false")) + ("popdown" ("true" "false")) + ("radio" ("true" "false")) + ("radiosymbol") + ("readonly" ("true" "false")) + ("rotation") + ("tabkey") + ("validate") + ("value") + ("width")) + "Key=value options for Forms related macros of the hyperref package.") + (TeX-add-style-hook "hyperref" (lambda () @@ -184,12 +242,15 @@ '("texorpdfstring" "TeX string" "PDF string") '("hypercalcbp" t) '("Acrobatmenu" "Menu option" "Text") - '("TextField" ["Parameters"] "Label") - '("CheckBox" ["Parameters"] "Label") - '("ChoiceMenu" ["Parameters"] "Label" "Choices") - '("PushButton" ["Parameters"] "Label") - '("Submit" ["Parameters"] "Label") - '("Reset" ["Parameters"] "Label") + ;; The next 6 macros take Key-vals defined in + ;; "LaTeX-hyperref-forms-options". For an example, see + ;; http://mirrors.ctan.org/macros/latex/contrib/hyperref/test/testform.tex + '("TextField" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") + '("CheckBox" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") + '("ChoiceMenu" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label" "Choices") + '("PushButton" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") + '("Submit" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") + '("Reset" [ (TeX-arg-key-val LaTeX-hyperref-forms-options) ] "Label") '("LayoutTextField" "Label" "Field") '("LayoutChoiceField" "Label" "Field") '("LayoutCheckField" "Label" "Field") @@ -199,6 +260,12 @@ '("MakeChoiceField" "Width" "Height") '("MakeButtonField" "Text")) + ;; Form fields must be inside a "Form"-env, one per file is allowed, cf. + ;; http://www.tug.org/applications/hyperref/ftp/doc/manual.html#x1-200006 + ;; It is up to user to insert [] after \begin{Form} + (LaTeX-add-environments + '("Form")) + (add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl") (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl") (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperimage") -- 2.2.1