emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-export-latex-hyperref-options-format


From: Joe Hirn
Subject: Re: [O] org-export-latex-hyperref-options-format
Date: Fri, 21 Feb 2014 12:35:50 -0600

Here you go.

Thanks a lot for all your help. Was really nice working on it with you. 


From af2a8066be01b94504fff9e009617ce186bd9e03 Mon Sep 17 00:00:00 2001
From: Joe Hirn <address@hidden>
Date: Fri, 21 Feb 2014 12:15:58 -0600
Subject: [PATCH] Allow customization of hyperrefsetup via
 `org-latex-hyperref-template'

* ox-latex.el (org-latex-hyperref-template): Add custom var `org-latex-hyperref-template' to enable
  customization of the \\hypersetup{...}. The value is a format-spec
  with placeholders for KEYWORDS, DESCRIPTION and CREATOR.

  (org-latex-with-hyperref): Remove custom var
  `org-latex-with-hyperref'. Set `org-latex-hyperref-template' to
  an empty string to disable the \\hypersetup{...} output.

  (org-latex-template): Make use of new `org-latex-hyperref-template'
  when emitting \\hypersetup{...}.

This patch allows the user to emit custom options for the
\\hypersetup{...} options which are used by the \\hyperref package.

Modfied by Joe Hirn with advice from Nicholas Goaziou

TINYCHANGE
---
 ox-latex.el | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/ox-latex.el b/ox-latex.el
index 19f055e..f6e5a09 100644
--- a/ox-latex.el
+++ b/ox-latex.el
@@ -103,7 +103,7 @@
    (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
    (:latex-header "LATEX_HEADER" 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)
    ;; Redefine regular options.
    (:date "DATE" nil "\\today" t)))
 
@@ -341,10 +341,18 @@ the toc:nil option, not to those generated with #+TOC keyword."
   :group 'org-export-latex
   :type 'string)
 
-(defcustom org-latex-with-hyperref t
-  "Toggle insertion of \\hypersetup{...} in the preamble."
+(defcustom org-latex-hyperref-template "\\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
+
+An empty string disables the setup."
   :group 'org-export-latex
-  :type 'boolean)
+  :type 'string)
 
 ;;;; Headline
 
@@ -1118,12 +1126,13 @@ holding export options."
      ;; Title
      (format "\\title{%s}\n" title)
      ;; Hyperref options.
-     (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))))
+     (format-spec (plist-get info :latex-hyperref)
+                  (format-spec-make
+                   ?k (or (plist-get info :keywords) "")
+                   ?d (or (plist-get info :description)"")
+                   ?c (if (plist-get info :with-creator)
+                          (plist-get info :creator)
+                        "")))
      ;; Document start.
      "\\begin{document}\n\n"
      ;; Title command.
-- 
1.8.5.4



On Fri, Feb 21, 2014 at 11:28 AM, Nicolas Goaziou <address@hidden> wrote:
Hello,

Joe Hirn <address@hidden> writes:

> With recommended changes.

Thank you. It looks good.

Could you add a commit message (see "Commit messages and ChangeLog
entries" section in http://orgmode.org/worg/org-contribute.html) and
send it again, using "git format-patch"?


Regards,

--
Nicolas Goaziou


reply via email to

[Prev in Thread] Current Thread [Next in Thread]