emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] New LaTeX exporter, switch for hypersetup
Date: Thu, 10 Jan 2013 14:20:49 -1000	[thread overview]
Message-ID: <m1zk0glgda.fsf@poto.westell.com> (raw)
In-Reply-To: <87mwwg20of.fsf@gmail.com> (Nicolas Goaziou's message of "Thu, 10 Jan 2013 22:22:24 +0100")

[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]

Aloha Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
> tsd@tsdye.com (Thomas S. Dye) writes:
> Thanks for your patch. A few comments below.
>> I don't think I fully understand how :options-alist works.  With the
>> attached patch I was expecting to be able to use #+LATEX_HYPER: nil, but
>> this didn't work for me.
> Keywords values are either a string or a list of strings. In this case,
> #+LATEX_HYPER: nil means the value is "nil", not nil.
> You still can test it with `org-not-nil' function.
>>    :options-alist ((:date "DATE" nil org-e-latex-date-format t)
>>  		  (:latex-class "LATEX_CLASS" nil org-e-latex-default-class t)
>>  		  (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
>> -		  (:latex-header-extra "LATEX_HEADER" nil nil newline)))
>> +		  (:latex-header-extra "LATEX_HEADER" nil nil newline)
>> +		  (:with-hyper "LATEX_HYPER" "texht" t t)
> I suggest to use :latex-hyperref-p or :latex-with-hyperref instead
> of :with-hyper, since this is back-end specific.
> Moreover, IMO, it doesn't make sense to provide a way to set it both
> through the #+OPTIONS: line and with a "LATEX_HYPER" keyword. You should
> choose your side.
> Also, you may want to use a global defcustom for the default value,
> instead of setting it to t, i.e. `org-e-latex-with-hyperref'.

Thanks for the good explanation and suggestions.  A (hopefully) better
patch is attached. 

All the best,

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Revised patch --]
[-- Type: text/x-patch, Size: 2328 bytes --]

From 4946aec91aa6de433beb1301c77ebbb8924a2404 Mon Sep 17 00:00:00 2001
From: Thomas Dye <tsd@tsdye.com>
Date: Thu, 10 Jan 2013 14:06:18 -1000
Subject: [PATCH] New LaTeX exporter: Add an option to toggle insertion of
 \hypersetup{...} in preamble

* contrib/lisp/org-e-latex.el: Added an option, :texht, and a
  defcustom, org-e-latex-with-hyperref, to hold its default value.

It is possible to configure the exporter to omit the hyperref package,
which defines the \hypersetup{} command.
 contrib/lisp/org-e-latex.el | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el
index b8f8aa9..f394bc2 100644
--- a/contrib/lisp/org-e-latex.el
+++ b/contrib/lisp/org-e-latex.el
@@ -164,7 +164,8 @@
   :options-alist ((:date "DATE" nil org-e-latex-date-format t)
 		  (:latex-class "LATEX_CLASS" nil org-e-latex-default-class t)
 		  (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
-		  (:latex-header-extra "LATEX_HEADER" nil nil newline)))
+		  (:latex-header-extra "LATEX_HEADER" nil nil newline)
+		  (:latex-hyperref-p nil "texht" org-e-latex-with-hyperref t)))
@@ -399,6 +400,11 @@ toc:nil option, not to those generated with #+TOC keyword."
   :group 'org-export-e-latex
   :type 'string)
+(defcustom org-e-latex-with-hyperref t
+  "Toggle insertion of \hypersetup{...} in the preamble."
+  :group 'org-export-e-latex
+  :type 'boolean)
 ;;;; Headline
 (defcustom org-e-latex-format-headline-function nil
@@ -1117,11 +1123,12 @@ holding export options."
      ;; Title
      (format "\\title{%s}\n" title)
      ;; Hyperref options.
-     (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)))
+     (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))))
      ;; Document start.
      ;; Title command.

[-- Attachment #3: Type: text/plain, Size: 147 bytes --]

T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884

  reply	other threads:[~2013-01-11  0:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-09 19:33 [PATCH] New LaTeX exporter, switch for hypersetup Thomas S. Dye
2013-01-10 21:22 ` Nicolas Goaziou
2013-01-11  0:20   ` Thomas S. Dye [this message]
2013-01-12 11:07     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1zk0glgda.fsf@poto.westell.com \
    --to=tsd@tsdye.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).