[Top][All Lists]

[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: Thu, 20 Feb 2014 11:58:02 -0600

Hi Nicholas. 

I was able to test this on my local machine and it seems to work as we discussed.

If there are any other changes to the patch you'd like to see, please let me know. 

Thanks for your help. I really appreciate it. 

****************BEGIN PATCH**********************
diff --git a/ox-latex.el b/ox-latex.el
index 19f055e..9ed6372 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-p nil "texht" (if org-latex-hyperref-template t) t)
    ;; Redefine regular options.
    (:date "DATE" nil "\\today" t)))
@@ -341,10 +341,11 @@ 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"
+  "The value of \\hyperrefsetup{...} in the preamble. String is a format-spec which accepts keywords for %k (pdfkeywords), %d (pdfdescription) and %c (pdfcreator). Set to nil for no \\hyperrefsetup."
   :group 'org-export-latex
-  :type 'boolean)
+  :type 'string)
 ;;;; Headline
@@ -1119,11 +1120,13 @@ holding export options."
      (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 org-latex-hyperref-template
+                    (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.
      ;; Title command.
****************END  PATCH**********************

On Thu, Feb 20, 2014 at 6:34 AM, Joseph Hirn <address@hidden> wrote:
Ok. I was hesitant to require anything additional but I should be able
to knock this out.

Thx again.

Sent from my iPhone

> On Feb 20, 2014, at 4:22 AM, Nicolas Goaziou <address@hidden> wrote:
> Hello,
> Joe Hirn <address@hidden> writes:
>> Hi just sat down to code this up. I assume the keywords are so we can use
>> data within the plist argument (info) passed to `org-latex-template'. But
>> I'm not exactly sure what you mean by %k for keywords.
>> Are you suggesting we could do something like:
>> "\\hypersetup{\n  pdfkeywords={%kkeywords},\n
>> pdfsubject={%kdescription},\n  pdfcreator={%kcreator}}\n"
>> If that's the idea, is there a more powerful construct than regex matching
>> for achieving this? Otherwise, can you give me an example of what you had
>> in mind for the keyword placeholders.
> I'm suggesting to use `format-spec', e.g., something like:
>  (and org-latex-hyperref-template
>       (format-spec org-latex-hyperref-template
>                    (format-spec-make
>                     ?k (or (plist-get info :keywords) "")
>                     ?d (or (plist-get info :description) "")
>                     ?c (if (not (plist-get info :with-creator)) ""
>                          (plist-get info :creator)))))
> Thus, when `org-latex-hyperref-template' is nil, no "\hyperref" command
> is inserted, otherwise, it is a format string where %k is replaced with
> KEYWORDS, %d with DESCRIPTION and %c with CREATOR.
> Default value for the variable would be:
>  "\\hypersetup{\n  pdfkeywords={%k},\n  pdfsubject={%d},\n  pdfcreator={%c}}\n"
> A (require 'format-spec) will be needed in the beginning of
> "ox-latex.el".
> Regards,
> --
> Nicolas Goaziou

reply via email to

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