* [PATCH] New LaTeX exporter, switch for hypersetup
@ 2013-01-09 19:33 Thomas S. Dye
2013-01-10 21:22 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Thomas S. Dye @ 2013-01-09 19:33 UTC (permalink / raw)
To: Org-mode
[-- Attachment #1: Type: text/plain, Size: 505 bytes --]
Aloha all,
The attached patch introduces a new option, texht, that inhibits
insertion of \hypersetup when it is set to nil.
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.
The motivation for the patch is that I'm attempting to export to a
journal specification that stipulates which packages must be used and
prohibits any additions---hyperref isn't on the list.
All the best,
Tom
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to org-e-latex.el --]
[-- Type: text/x-patch, Size: 2423 bytes --]
From 448c9fe103d6b0f9a4ce42cbafc6d67093b7494e Mon Sep 17 00:00:00 2001
From: Thomas Dye <tsd@tsdye.com>
Date: Wed, 9 Jan 2013 09:19:14 -1000
Subject: [PATCH] New LaTeX exporter: Add an option to toggle \hypersetup
* contrib/lisp/org-e-latex.el: Added an option :texht that toggles
insertion of \hypersetup{} in the tex file.
It is possible to configure LaTeX export to omit the hyperref package
where the \hypersetup command is defined.
---
contrib/lisp/org-e-latex.el | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el
index 79ae355..c4e7b99 100644
--- a/contrib/lisp/org-e-latex.el
+++ b/contrib/lisp/org-e-latex.el
@@ -29,8 +29,8 @@
;; functions are available: `org-e-latex-publish-to-latex' and
;; `org-e-latex-publish-to-pdf'.
;;
-;; The library introduces three new buffer keywords: "LATEX_CLASS",
-;; "LATEX_CLASS_OPTIONS" and "LATEX_HEADER". Their value can be
+;; The library introduces four new buffer keywords: "LATEX_CLASS",
+;; "LATEX_CLASS_OPTIONS", "LATEX_HEADER", and "LATEX_HYPER". Their value can be
;; either a string or a symbol.
;;
;; Table export can be controlled with a number of attributes (through
@@ -164,7 +164,9 @@
: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)
+ ))
\f
@@ -1117,11 +1119,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 :with-hyper)
+ (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
[-- Attachment #3: Type: text/plain, Size: 146 bytes --]
--
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] New LaTeX exporter, switch for hypersetup
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
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2013-01-10 21:22 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: Org-mode
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'.
> + ))
Please do not leave parenthesis on a line of their own.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] New LaTeX exporter, switch for hypersetup
2013-01-10 21:22 ` Nicolas Goaziou
@ 2013-01-11 0:20 ` Thomas S. Dye
2013-01-12 11:07 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Thomas S. Dye @ 2013-01-11 0:20 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org-mode
[-- 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,
Tom
[-- 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)))
\f
@@ -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
[-- 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
http://www.tsdye.com
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-12 11:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-01-12 11:07 ` Nicolas Goaziou
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).