From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Hirn Subject: Re: org-export-latex-hyperref-options-format Date: Thu, 20 Feb 2014 11:58:02 -0600 Message-ID: References: <87a9dpo0as.fsf@gmail.com> <8738jhnx1m.fsf@gmail.com> <878ut72qyo.fsf@gmail.com> <87zjlm13st.fsf@gmail.com> <8672745997102408713@unknownmsgid> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0149ce3c25bac304f2da3f6d Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGXsr-0004jb-Up for emacs-orgmode@gnu.org; Thu, 20 Feb 2014 12:58:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGXsq-0003j7-CN for emacs-orgmode@gnu.org; Thu, 20 Feb 2014 12:58:05 -0500 Received: from mail-ob0-x234.google.com ([2607:f8b0:4003:c01::234]:36390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGXsq-0003j1-5Z for emacs-orgmode@gnu.org; Thu, 20 Feb 2014 12:58:04 -0500 Received: by mail-ob0-f180.google.com with SMTP id vb8so2051249obc.25 for ; Thu, 20 Feb 2014 09:58:03 -0800 (PST) In-Reply-To: <8672745997102408713@unknownmsgid> 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" --089e0149ce3c25bac304f2da3f6d Content-Type: text/plain; charset=ISO-8859-1 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. "\\begin{document}\n\n" ;; Title command. ****************END PATCH********************** On Thu, Feb 20, 2014 at 6:34 AM, Joseph Hirn 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 > wrote: > > > > Hello, > > > > Joe Hirn 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 > --089e0149ce3c25bac304f2da3f6d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Nicholas.=A0

I was able t= o 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 l= ike to see, please let me know.=A0

Thanks for your help. I really appreciate it.=A0


****************BEGIN PATCH**********= ************
diff --git a/ox-latex.el b/ox-latex.el
ind= ex 19f055e..9ed6372 100644
--- a/ox-latex.el
+++ b/ox-latex.el
@@ -103,7 +103= ,7 @@
=A0 =A0= (:latex-class-options "LATEX_CLASS_OPTIONS" nil 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-p nil "texht" (if org-latex-hyperref-template t) t)
=A0 =A0 ;; Redefine r= egular options.
=A0 =A0 (:date &qu= ot;DATE" nil "\\today" t)))
=A0
@@ -341,= 10 +341,11 @@ the toc: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"Toggle insertion of \\hypersetup{...} in the preamble."
+
+(defcustom org-latex-hyperref-template "\\hypersetup{\n =A0pdfke= ywords=3D{%k},\n =A0pdfsubject=3D{%d},\n =A0pdfcreator=3D{%c}}\n"
+ =A0"The value of \\hyperrefsetup{...} in the preamble. String = is a format-spec which accepts keywords for %k (pdfkeywords), %d (pdfdescri= ption) and %c (pdfcreator). Set to nil for no \\hyperrefsetup."
=A0 =A0:group 'org-export-latex
- =A0:type 'boolean)=
+ =A0:type 'string)
=A0
=A0;;;; Headline=
=A0
@@ -1119,11 +1120,13 @@ holding export options.&qu= ot;
=A0 =A0 =A0 (format "\\title{%s}\n" title)
=A0 =A0 =A0 = ;; Hyperref options.
=A0 =A0 =A0 (when (plist-get info :latex-hyp= erref-p)
- =A0 =A0 =A0 (format "\\hypersetup{\n =A0pdfkeywor= ds=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-creator)) ""
- (plist-get info :creator))))
+ =A0 =A0 =A0 (format-spec org-latex-hyperref-template
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(format-spec-make
+= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ?k (or (plist-get info :keywords) = "")
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ?d (or (p= list-get info :description)"")
+ =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 ?c (if (plist-get info :with-creator)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(plist-get in= fo :creator)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0""))))
=A0 =A0 =A0 ;; Document start.
=A0 = =A0 =A0 "\\begin{document}\n\n"
=A0 =A0 =A0 ;; Title co= mmand.
****************END =A0PATCH**********************


On Thu, Feb 20, 2014 = at 6:34 AM, Joseph Hirn <joseph.hirn@gmail.com> wrote:
Ok. I was hesitant to require anything addit= ional 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 <n.goaziou@gmail.com> wrote:
>
> Hello,
>
> Joe Hirn <joseph.hirn@gmai= l.com> 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-templat= e'. But
>> I'm not exactly sure what you mean by %k for keywords.
>>
>> Are you suggesting we could do something like:
>>
>> "\\hypersetup{\n =A0pdfkeywords=3D{%kkeywords},\n
>> pdfsubject=3D{%kdescription},\n =A0pdfcreator=3D{%kcreator}}\n&quo= t;
>>
>> If that's the idea, is there a more powerful construct than re= gex 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:
>
> =A0(and org-latex-hyperref-template
> =A0 =A0 =A0 (format-spec org-latex-hyperref-template
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(format-spec-make
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ?k (or (plist-get info :keywor= ds) "")
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ?d (or (plist-get info :descri= ption) "")
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ?c (if (not (plist-get info :w= ith-creator)) ""
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(plist-get info :cr= eator)))))
>
> Thus, when `org-latex-hyperref-template' is nil, no "\hyperre= f" command
> is inserted, otherwise, it is a format string where %k is replaced wit= h
> KEYWORDS, %d with DESCRIPTION and %c with CREATOR.
>
> Default value for the variable would be:
>
> =A0"\\hypersetup{\n =A0pdfkeywords=3D{%k},\n =A0pdfsubject=3D{%d}= ,\n =A0pdfcreator=3D{%c}}\n"
>
> A (require 'format-spec) will be needed in the beginning of
> "ox-latex.el".
>
>
> Regards,
>
> --
> Nicolas Goaziou

--089e0149ce3c25bac304f2da3f6d--