Browse Source

New LaTeX exporter: Add an option to toggle insertion of \hypersetup{...} in preamble

* contrib/lisp/org-e-latex.el: Added an option, :texht, and a
  defcustom, org-e-latex-with-hyperref, to hold its default value.

It is possible to configure the exporter to omit the hyperref package,
which defines the \hypersetup{} command.
Thomas Dye 12 years ago
parent
commit
c1ecc51835
1 changed files with 16 additions and 8 deletions
  1. 16 8
      contrib/lisp/org-e-latex.el

+ 16 - 8
contrib/lisp/org-e-latex.el

@@ -30,8 +30,8 @@
 ;; `org-e-latex-publish-to-pdf'.
 ;;
 ;; The library introduces three new buffer keywords: "LATEX_CLASS",
-;; "LATEX_CLASS_OPTIONS" and "LATEX_HEADER".  Their value can be
-;; either a string or a symbol.
+;; "LATEX_CLASS_OPTIONS" and "LATEX_HEADER", and a new OPTIONS item:
+;; "textht".
 ;;
 ;; Table export can be controlled with a number of attributes (through
 ;; ATTR_LATEX keyword).
@@ -164,7 +164,8 @@
   :options-alist ((:date "DATE" nil org-e-latex-date-format t)
 		  (:latex-class "LATEX_CLASS" nil org-e-latex-default-class t)
 		  (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
-		  (:latex-header-extra "LATEX_HEADER" nil nil newline)))
+		  (:latex-header-extra "LATEX_HEADER" nil nil newline)
+		  (:latex-hyperref-p nil "texht" org-e-latex-with-hyperref t)))
 
 
 
@@ -399,6 +400,12 @@ toc:nil option, not to those generated with #+TOC keyword."
   :group 'org-export-e-latex
   :type 'string)
 
+(defcustom org-e-latex-with-hyperref t
+  "Toggle insertion of \hypersetup{...} in the preamble."
+  :group 'org-export-e-latex
+  :type 'boolean)
+
+
 ;;;; Headline
 
 (defcustom org-e-latex-format-headline-function nil
@@ -1117,11 +1124,12 @@ holding export options."
      ;; Title
      (format "\\title{%s}\n" title)
      ;; Hyperref options.
-     (format "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n  pdfcreator={%s}}\n"
-	     (or (plist-get info :keywords) "")
-	     (or (plist-get info :description) "")
-	     (if (not (plist-get info :with-creator)) ""
-	       (plist-get info :creator)))
+     (when (plist-get info :latex-hyperref-p)
+       (format "\\hypersetup{\n  pdfkeywords={%s},\n  pdfsubject={%s},\n  pdfcreator={%s}}\n"
+	       (or (plist-get info :keywords) "")
+	       (or (plist-get info :description) "")
+	       (if (not (plist-get info :with-creator)) ""
+		 (plist-get info :creator))))
      ;; Document start.
      "\\begin{document}\n\n"
      ;; Title command.