ox-latex: Allow customization of hyperrefsetup

* lisp/ox-latex.el (org-latex-hyperref-template): New variable.
(org-latex-with-hyperref): Remove variable.
(org-latex-template): Use new variable.
This commit is contained in:
Joe Hirn 2014-02-28 09:40:37 +01:00 committed by Nicolas Goaziou
parent bd9e0ad63d
commit 73714684e4
1 changed files with 20 additions and 11 deletions

View File

@ -106,7 +106,7 @@
(:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t) (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
(:latex-header "LATEX_HEADER" nil nil newline) (:latex-header "LATEX_HEADER" nil nil newline)
(:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline) (:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline)
(:latex-hyperref-p nil "texht" org-latex-with-hyperref t) (:latex-hyperref nil nil org-latex-hyperref-template t)
(:latex-custom-id-labels nil nil org-latex-custom-id-as-label)) (:latex-custom-id-labels nil nil org-latex-custom-id-as-label))
:filters-alist '((:filter-options . org-latex-math-block-options-filter) :filters-alist '((:filter-options . org-latex-math-block-options-filter)
(:filter-parse-tree . org-latex-math-block-tree-filter))) (:filter-parse-tree . org-latex-math-block-tree-filter)))
@ -348,11 +348,19 @@ the toc:nil option, not to those generated with #+TOC keyword."
:group 'org-export-latex :group 'org-export-latex
:type 'string) :type 'string)
(defcustom org-latex-with-hyperref t (defcustom org-latex-hyperref-template
"Toggle insertion of \\hypersetup{...} in the preamble." "\\hypersetup{\n pdfkeywords={%k},\n pdfsubject={%d},\n pdfcreator={%c}}\n"
"Template for hyperref package options.
Value is a format string, which can contain the following placeholders:
%k for KEYWORDS line
%d for DESCRIPTION line
%c for CREATOR line
Set it to the empty string to ignore the command completely."
:group 'org-export-latex :group 'org-export-latex
:type 'boolean :type 'string)
:safe #'booleanp)
;;;; Headline ;;;; Headline
@ -1188,12 +1196,13 @@ holding export options."
;; Title ;; Title
(format "\\title{%s}\n" title) (format "\\title{%s}\n" title)
;; Hyperref options. ;; Hyperref options.
(when (plist-get info :latex-hyperref-p) (format-spec (plist-get info :latex-hyperref)
(format "\\hypersetup{\n pdfkeywords={%s},\n pdfsubject={%s},\n pdfcreator={%s}}\n" (format-spec-make
(or (plist-get info :keywords) "") ?k (or (plist-get info :keywords) "")
(or (plist-get info :description) "") ?d (or (plist-get info :description)"")
(if (not (plist-get info :with-creator)) "" ?c (if (plist-get info :with-creator)
(plist-get info :creator)))) (plist-get info :creator)
"")))
;; Document start. ;; Document start.
"\\begin{document}\n\n" "\\begin{document}\n\n"
;; Title command. ;; Title command.