From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Hirn Subject: Re: org-export-latex-hyperref-options-format Date: Mon, 24 Feb 2014 15:51:24 -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> <874n3r1o73.fsf@gmail.com> <87eh2vm66g.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1136b9de15461604f32df9bd Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WI3Qt-0006Nn-OJ for emacs-orgmode@gnu.org; Mon, 24 Feb 2014 16:51:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WI3Qs-000677-31 for emacs-orgmode@gnu.org; Mon, 24 Feb 2014 16:51:27 -0500 In-Reply-To: <87eh2vm66g.fsf@bzg.ath.cx> 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: Bastien Cc: "emacs-orgmode@gnu.org" , Nicolas Goaziou --001a1136b9de15461604f32df9bd Content-Type: text/plain; charset=ISO-8859-1 Against the latest master: **************BEGIN PATCH************* >From 996e75b3538e60049645a5025a390be603425b8b Mon Sep 17 00:00:00 2001 From: Joe Hirn Date: Mon, 24 Feb 2014 15:23:09 -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 --- lisp/ox-latex.el | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 50a08f6..8f9dcdd 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -106,7 +106,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) (:latex-custom-id-labels nil nil org-latex-custom-id-as-label)) :filters-alist '((:filter-options . org-latex-math-block-options-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 :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 - :safe #'booleanp) + :type 'string) ;;;; Headline @@ -1188,12 +1196,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 ******************* END PATCH ********************************* On Sat, Feb 22, 2014 at 11:02 AM, Bastien wrote: > Hi Joe, > > Joe Hirn writes: > > > Where can I clone the master branch from? > > This should do the trick: > > ~$ git clone git://orgmode.org/org-mode.git > > Best, > > -- > Bastien > --001a1136b9de15461604f32df9bd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Against the latest master:

************= **BEGIN PATCH*************
From 996e75b3538e60049645a5025a39= 0be603425b8b Mon Sep 17 00:00:00 2001
From: Joe Hirn <joseph.hirn@gmail.com>
Date: Mon, 24 Feb 2014 15:23:09 -0600
Subject: [PATCH] Allow= customization of hyperrefsetup via
=A0`org-latex-hyperref-templa= te'

*=A0ox-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 placeholders for KEYWO= RDS, DESCRIPTION and CREATOR.

=A0 (org-latex-with-hy= perref): Remove custom var
=A0 `org-latex-with-hyperref'. Set `org-latex-hyperref-template' to=
=A0 an emp= ty string to disable the \\hypersetup{...} output.

=A0 (o= rg-latex-template): Make use of new `org-latex-hyperref-template'
=
=A0 when emittin= g \\hypersetup{...}.

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


TINYCHANGE
-= --
=A0lisp/ox-latex.el | 31 ++++++++++++++++++++-----------
=
=A01 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
<= div>index 50a08f6..8f9dcdd 100644
+++ b/lisp/ox-latex.el
@@ -106,7 +106,7 @@
=A0 =A0 (:latex-class-options "LAT= EX_CLASS_OPTIONS" nil nil t)
=A0 =A0 (:latex-header &= quot;LATEX_HEADER" nil nil newline)
=A0 =A0 (:latex-header-extra "LATEX_HEADER_EXTRA= " nil nil newline)
- =A0 (:latex-hyperref-p= nil "texht" org-latex-with-hyperref t)
+ =A0 (:latex-hyperref nil nil org-latex-hyp= erref-template t)
=A0 =A0 (:latex-custom-i= d-labels nil nil org-latex-custom-id-as-label))
=A0 =A0:filters-a= list '((:filter-options . org-latex-math-block-options-filter)
=A0 =A0 (:filter-parse-tree .= org-latex-math-block-tree-filter)))
@@ -348,11 +348,19 @@ the to= c:nil option, not to those generated with #+TOC keyword."
=A0 =A0:group 'org-export-latex
=A0 =A0:type 'string)
=A0
-(defcustom org-latex-with-hyperref t
- =A0&= quot;Toggle insertion of \\hypersetup{...} in the preamble."
+
+(defcustom org-latex-hyperref-template "\\hypersetup{\n pdfkeywo= rds=3D{%k},\n =A0pdfsubject=3D{%d},\n =A0pdfcreator=3D{%c}}\n"
+ =A0"Template for hyperref package options.
+
= +Value 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 s= tring disables the setup."
=A0 =A0:group 'org-export-lat= ex
- =A0:type 'boolean
- =A0:safe #'booleanp)
+ =A0:type 'string)
=A0
=A0;;;; Headline
=A0
@@ -1188,12 +1196,13 @@ holding export options."
<= div>=A0 =A0 =A0 ;; Title
=A0 =A0 =A0 (format "\\title{%s}\n" title)
=A0 =A0= =A0 ;; Hyperref options.
- =A0 =A0 (when (plist-get info :latex-= hyperref-p)
- =A0 =A0 =A0 (format "\\hypersetup{\n =A0pdfkey= words=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 (p= list-get info :with-creator)) ""
- (plist-get info :creator))))
+ =A0 =A0 = (format-spec (plist-get info :latex-hyperref)
+ =A0(format-spec-make
+ =A0 ?k (or (plist-= get info :keywords) "")
+ =A0 ?d (or (plist-get info :description)"")
+ =A0 ?c (if (plist-get = info :with-creator)
+ =A0(plist-get info :creator)
+ "")))
=A0 =A0 =A0 ;; Document start.
=A0 =A0 =A0 "\\begin{doc= ument}\n\n"
=A0 =A0 =A0 ;; Title command.
--
=
1.8.5.4
******************* END PATCH **********************= ***********


O= n Sat, Feb 22, 2014 at 11:02 AM, Bastien <bzg@gnu.org> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex"> Hi Joe,

Joe Hirn <joseph.hirn@gmail.com= > writes:

> Where can I clone the master branch from?

This should do the trick:

~$ git clone git://orgmode.org/org-mode.git

Best,

--
=A0Bastien

--001a1136b9de15461604f32df9bd--