From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: [PATCH] New LaTeX exporter, switch for hypersetup Date: Thu, 10 Jan 2013 14:20:49 -1000 Message-ID: References: <87mwwg20of.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:45136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtSNL-0004kt-5Q for emacs-orgmode@gnu.org; Thu, 10 Jan 2013 19:21:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtSNI-0006uF-Ny for emacs-orgmode@gnu.org; Thu, 10 Jan 2013 19:21:35 -0500 Received: from oproxy6-pub.bluehost.com ([67.222.54.6]:34421) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TtSNI-0006tz-Ez for emacs-orgmode@gnu.org; Thu, 10 Jan 2013 19:21:32 -0500 In-Reply-To: <87mwwg20of.fsf@gmail.com> (Nicolas Goaziou's message of "Thu, 10 Jan 2013 22:22:24 +0100") 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: Org-mode --=-=-= Content-Type: text/plain Aloha Nicolas, Nicolas Goaziou 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, Tom --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-New-LaTeX-exporter-Add-an-option-to-toggle-insertion.patch Content-Description: Revised patch >From 4946aec91aa6de433beb1301c77ebbb8924a2404 Mon Sep 17 00:00:00 2001 From: Thomas Dye 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. "\\begin{document}\n\n" ;; Title command. -- 1.8.0.2 --=-=-= Content-Type: text/plain -- T.S. Dye & Colleagues, Archaeologists 735 Bishop St, Suite 315, Honolulu, HI 96813 Tel: 808-529-0866, Fax: 808-529-0884 http://www.tsdye.com --=-=-=--