From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Hirn Subject: Re: org-export-latex-hyperref-options-format Date: Fri, 21 Feb 2014 12:35:50 -0600 Message-ID: References: <87a9dpo0as.fsf@gmail.com> <8738jhnx1m.fsf@gmail.com> <878ut72qyo.fsf@gmail.com> <87zjlm13st.fsf@gmail.com> <8672745997102408713@unknownmsgid> <87vbw91pac.fsf@gmail.com> <87ha7s1il4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c3001821c5d904f2eee4f3 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGuwz-0007Gj-FB for emacs-orgmode@gnu.org; Fri, 21 Feb 2014 13:35:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGuwx-0006ZC-T4 for emacs-orgmode@gnu.org; Fri, 21 Feb 2014 13:35:53 -0500 Received: from mail-oa0-x22d.google.com ([2607:f8b0:4003:c02::22d]:37990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGuwx-0006Z0-Kw for emacs-orgmode@gnu.org; Fri, 21 Feb 2014 13:35:51 -0500 Received: by mail-oa0-f45.google.com with SMTP id i11so4954471oag.18 for ; Fri, 21 Feb 2014 10:35:50 -0800 (PST) In-Reply-To: <87ha7s1il4.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: "emacs-orgmode@gnu.org" --001a11c3001821c5d904f2eee4f3 Content-Type: text/plain; charset=ISO-8859-1 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 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 wrote: > Hello, > > Joe Hirn 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 > --001a11c3001821c5d904f2eee4f3 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Here you go.

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


From af2a8066be01b94504fff9e009617ce186bd9e03 Mon Sep 17 00:00= :00 2001
From: Joe Hirn <joseph.hir= n@gmail.com>
Date: Fri, 21 Feb 2014 12:15:58 -0600
Subject: [PATCH] Allow customization of hyperrefsetup via
=A0`= org-latex-hyperref-template'

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

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

=A0 (org-latex-template): Make use of new `org-latex-hy= perref-template'
=A0 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 Goazio= u

TINYCHANGE
---
=A0ox-latex.e= l | 29 +++++++++++++++++++----------
=A01 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/ox-latex.el b/ox-latex.el
index 19f055e..f6e= 5a09 100644
--- a/ox-latex.el
+++ b/ox-latex.el
@@ -103,7 +103,7 @@
=A0 =A0 (:latex-class-options "LATEX_CLASS_OPTIONS" n= il nil t)
=A0 = =A0 (:latex-header "LATEX_HEADER" nil nil newline)
=A0 =A0 (:latex-he= ader-extra "LATEX_HEADER_EXTRA" nil nil newline)
- =A0 (:latex-hyperref-p nil = "texht" org-latex-with-hyperref t)
+ =A0 (:latex-hype= rref nil nil org-latex-hyperref-template t)
=A0 =A0 ;; Redefine regular options.
=A0 =A0 (:date "= ;DATE" nil "\\today" t)))
=A0
@@ -341,10 +341,18 @@ the toc:nil option, not to those g= enerated with #+TOC keyword."
=A0 =A0:group 'org-export-= latex
=A0 =A0:type 'string)
=A0
-(defcust= om org-latex-with-hyperref t
- =A0"Toggle insertion of \\hypersetup{...} in the preamble."= ;
+(defcustom org-latex-hyperref-template "\\hypersetup{\n p= dfkeywords=3D{%k},\n =A0pdfsubject=3D{%d},\n =A0pdfcreator=3D{%c}}\n"<= /div>
+ =A0"Template for hyperref package options.
+
+Va= lue is a format string, which can contain the following placeholders:
=
+
+ =A0%k for KEYWORDS line
+ =A0%d for DESCRIPTIO= N line
+ =A0%c for CREATOR line
+
+An empty string disabl= es the setup."
=A0 =A0:group 'org-export-latex
- =A0:type 'boolean)
+ =A0:type 'string)
=A0
=A0;;;; Headline
=A0
@@ -1118,12 +1126,13 @@ holding ex= port options."
=A0 =A0 =A0 ;; Title
=A0 =A0 =A0 (f= ormat "\\title{%s}\n" title)
=A0 =A0 =A0 ;; Hyperref op= tions.
- =A0 =A0 (when (plist-get info :latex-hyperref-p)
- =A0 =A0 =A0 (format "\\hypersetup{\n =A0pdfkeywords=3D{%s},\n = =A0pdfsubject=3D{%s},\n =A0pdfcreator=3D{%s}}\n"
- =A0 =A0 =A0 (or (plist-get info := keywords) "")
- =A0 =A0 =A0 (or (= plist-get info :description) "")
- =A0 =A0 =A0 (if (not (plist-get info :with-c= reator)) ""
- (plist-get info = :creator))))
+ =A0 =A0 (format-spec (plist-get info :latex-hyperr= ef)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(format-spec-make
<= div>+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ?k (or (plist-get info :keywords)= "")
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ?d (or (plist-get info :descript= ion)"")
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ?c (if (p= list-get info :with-creator)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0(plist-get info :creator)
+ =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"")))
=A0 =A0 =A0 ;; Document start.
=A0 =A0 =A0 "\\begin{doc= ument}\n\n"
=A0 =A0 =A0 ;; Title command.
--=A0
1.8.5.4



On Fri, Feb 21, 2014 at 11:28 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> 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) an= d
send it again, using "git format-patch"?


Regards,

--
Nicolas Goaziou

--001a11c3001821c5d904f2eee4f3--