Re: [O] Org Export Latex Hyperref Options Format
Hello Andrea, thanks for your very useful reply and for the links. 2014-06-28 16:29 GMT+02:00 Andrea Rossetti andrea.rosse...@gmail.com: I had the same problem some time ago. That variable has been removed in recent Org versions, and you probably have (like me) an old built-in Org shadowed by a new Elpa Org. You should ignore that variable. How can I remove this old built-in Org shadowed by my new Elpa Org ? It seems to me that it should be the best solution, but I do not want to broke my org installation because it works well, this detail excepted. See previous discussion and some advices here: http://permalink.gmane.org/gmane.emacs.orgmode/77193 http://permalink.gmane.org/gmane.emacs.orgmode/77241 Thanks again for theses links. Best regards, Jo.
Re: [O] Org Export Latex Hyperref Options Format
Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes: How can I remove this old built-in Org shadowed by my new Elpa Org ? It seems to me that it should be the best solution, That time I thought life is too short to mess with it :) and simply ignored that zombie option; it's rare that an option is removed, so I never faced the same problem again. If you still want to try, I guess the built-in Org could be removed by deleting the elisp code from the directory youremacspath/lisp/org. Cheers, Andrea
Re: [O] Org Export Latex Hyperref Options Format
Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes: Hello, I meet problems to customize this variable via M-x customize-variable : Org Export Latex Hyperref Options Format I mean that the hypersetup options do not change in my .tex file after the export from an org-file. Does it correspond to a bug? Hello Joseph, I had the same problem some time ago. That variable has been removed in recent Org versions, and you probably have (like me) an old built-in Org shadowed by a new Elpa Org. You should ignore that variable. See previous discussion and some advices here: http://permalink.gmane.org/gmane.emacs.orgmode/77193 http://permalink.gmane.org/gmane.emacs.orgmode/77241 Kindest regards, Andrea
Re: [O] org-export-latex-hyperref-options-format
t...@tsdye.com (Thomas S. Dye) writes: The template is set up to produce two pdf files, one with hyperref and the other without. I suspect this is the root of the problem I'm having. Nope. The asynchronous process had to allow bind keywords. All is well. Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] org-export-latex-hyperref-options-format
Aloha Nick, Nick Dokos ndo...@gmail.com writes: t...@tsdye.com (Thomas S. Dye) writes: Aloha Nick, Nick Dokos ndo...@gmail.com writes: #+BIND is supposed to bind the variable *during export*. The test is to run the export and see if the hyperref stuff is gone from the tex file. Nick I did run the export and the hyperref stuff was still in the tex file. I'm exporting asynchronously--perhaps that's the problem? The old #+OPTIONS: texht:nil worked for asynchronous export, though, so I was expecting that BIND would do the same. I tried both with and without async (deleting the tex file before starting each time - I also used the default latex class, since I don't have plos-devel): either way the hyperref stuff was gone. It is part of an Org mode template for the open access journal PLOS One. You can find it here, if need be: http://orgmode.org/worg/exporters/plos-one-template-worg.html The template is set up to produce two pdf files, one with hyperref and the other without. I suspect this is the root of the problem I'm having. The old option used to suppress the hyperref stuff in one of the tex files, but kept it available for the other tex file. Somehow, the logic of that has changed and I suspect I'm going to have to find a way to set up hyperref for the document that needs it, rather than shutting it off for the document that doesn't need it. I had a look at ox-latex and the PLOS One template this morning over coffee, but wasn't able to find a smoking gun. Your simple test case works as expected here. All the best, Tom Here's the org file: #+TITLE: Structure and Growth of the Leeward Kohala Field System: An Analysis with Directed Graphs #+DATE: #+LANGUAGE: en #+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t :t ':t ^:{} #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:nil pri:nil tags:not-in-toc #+BIND: org-latex-hyperref-template #+STARTUP: entitiespretty #+PROPERTY: header-args:sh :eval no-export * foo bar Org-mode version 8.2.5h (release_8.2.5h-782-g040ec4 @ /home/nick/elisp/org-mode/lisp/) Nick -- Thomas S. Dye http://www.tsdye.com
Re: [O] org-export-latex-hyperref-options-format
Hi Joe, Joe Hirn joseph.h...@gmail.com writes: Against the latest master: can you repost the patch by creating another thread with [PATCH] in the subject line, and using plain text instead of HTML format? If you don't use plain text email, simply attach the patch instead of including it in the body of the email. Nicolas, I'll let you decide whether this can be applid (on top of master). Thanks, -- Bastien
Re: [O] org-export-latex-hyperref-options-format
Hello, Bastien b...@gnu.org writes: can you repost the patch by creating another thread with [PATCH] in the subject line, and using plain text instead of HTML format? If you don't use plain text email, simply attach the patch instead of including it in the body of the email. Nicolas, I'll let you decide whether this can be applid (on top of master). I think this patch is already in master. Regards -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
Hi Nicolas, Nicolas Goaziou n.goaz...@gmail.com writes: I think this patch is already in master. Indeed, sorry for the noise, PS: let's confirm on the list when a patch gets applied, that helps archiving threads faster. -- Bastien
Re: [O] org-export-latex-hyperref-options-format
Aloha all, I noticed yesterday that a legacy document with this option: #+OPTIONS: texht:nil is now broken in a recent Org mode from master. The following lines now appear in the LaTeX export, when they didn't before: \hypersetup{ pdfkeywords={}, pdfsubject={}, pdfcreator={Emacs 24.3.1 (Org mode 8.2.5h)}} I haven't looked at this patch, but I'm guessing that it is responsible. It would be great if the texht option could still be supported. If not, can someone offer advice on the best way to set org-latex-hyperref-template to achieve the same file-local effect? All the best, Tom Bastien b...@gnu.org writes: Hi Nicolas, Nicolas Goaziou n.goaz...@gmail.com writes: I think this patch is already in master. Indeed, sorry for the noise, PS: let's confirm on the list when a patch gets applied, that helps archiving threads faster. -- Thomas S. Dye http://www.tsdye.com
Re: [O] org-export-latex-hyperref-options-format
Thanks for the report. I'm not super familiar with how the texht option works. I did made the following change base on recommendation from Nicolas in the :options-alist. (:latex-hyperref-p nil texht org-latex-with-hyperref t) to (:latex-hyperref nil nil org-latex-hyperref-template t) From Nicolas: ... we can replace texht with nil since it doesn't make much sense to specify a full template from the OPTIONS line. I believe the patch worked without substituting texht with nil in this line. I'm not sure if this is a regression or if your document requires updating. That's not my call. Just chiming in with what's relevant to this side effect you're experiencing. On Fri, Mar 21, 2014 at 11:51 AM, Thomas S. Dye t...@tsdye.com wrote: Aloha all, I noticed yesterday that a legacy document with this option: #+OPTIONS: texht:nil is now broken in a recent Org mode from master. The following lines now appear in the LaTeX export, when they didn't before: \hypersetup{ pdfkeywords={}, pdfsubject={}, pdfcreator={Emacs 24.3.1 (Org mode 8.2.5h)}} I haven't looked at this patch, but I'm guessing that it is responsible. It would be great if the texht option could still be supported. If not, can someone offer advice on the best way to set org-latex-hyperref-template to achieve the same file-local effect? All the best, Tom Bastien b...@gnu.org writes: Hi Nicolas, Nicolas Goaziou n.goaz...@gmail.com writes: I think this patch is already in master. Indeed, sorry for the noise, PS: let's confirm on the list when a patch gets applied, that helps archiving threads faster. -- Thomas S. Dye http://www.tsdye.com
Re: [O] org-export-latex-hyperref-options-format
Hello, t...@tsdye.com (Thomas S. Dye) writes: It would be great if the texht option could still be supported. The equivalent property is no longer a boolean. It can have complex values, which cannot be set on the OPTIONS line. If not, can someone offer advice on the best way to set org-latex-hyperref-template to achieve the same file-local effect? Assuming `org-export-allow-bind-keywords' is non-nil, does #+BIND: org-latex-hyperref-template work? Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
Nicolas Goaziou n.goaz...@gmail.com writes: If not, can someone offer advice on the best way to set org-latex-hyperref-template to achieve the same file-local effect? Assuming `org-export-allow-bind-keywords' is non-nil, does #+BIND: org-latex-hyperref-template work? I can't get this to work. Here is the top of my Org mode file: #+TITLE: Structure and Growth of the Leeward Kohala Field System: An Analysis with Directed Graphs #+DATE: #+LANGUAGE: en #+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t :t ':t ^:{} #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:nil pri:nil tags:not-in-toc #+BIND: org-latex-hyperref-template #+LATEX_CLASS: plos-devel #+STARTUP: entitiespretty #+PROPERTY: header-args:sh :eval no-export The variable org-export-allow-bind-keywords is t. When I open this file and ask for information about org-latex-hyperref-template, I get this: org-latex-hyperref-template is a variable defined in `ox-latex.el'. Its value is \\hypersetup{\n pdfkeywords={%k},\n pdfsubject={%d},\n pdfcreator={%c}}\n Org-mode version 8.2.5h (release_8.2.5h-757-gc444e4 @ /Users/dk/.emacs.d/src/org-mode/lisp/) All the best, Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] org-export-latex-hyperref-options-format
t...@tsdye.com (Thomas S. Dye) writes: Nicolas Goaziou n.goaz...@gmail.com writes: If not, can someone offer advice on the best way to set org-latex-hyperref-template to achieve the same file-local effect? Assuming `org-export-allow-bind-keywords' is non-nil, does #+BIND: org-latex-hyperref-template work? I can't get this to work. Here is the top of my Org mode file: #+TITLE: Structure and Growth of the Leeward Kohala Field System: An Analysis with Directed Graphs #+DATE: #+LANGUAGE: en #+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t :t ':t ^:{} #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:nil pri:nil tags:not-in-toc #+BIND: org-latex-hyperref-template #+LATEX_CLASS: plos-devel #+STARTUP: entitiespretty #+PROPERTY: header-args:sh :eval no-export The variable org-export-allow-bind-keywords is t. When I open this file and ask for information about org-latex-hyperref-template, I get this: org-latex-hyperref-template is a variable defined in `ox-latex.el'. Its value is \\hypersetup{\n pdfkeywords={%k},\n pdfsubject={%d},\n pdfcreator={%c}}\n Org-mode version 8.2.5h (release_8.2.5h-757-gc444e4 @ /Users/dk/.emacs.d/src/org-mode/lisp/) #+BIND is supposed to bind the variable *during export*. The test is to run the export and see if the hyperref stuff is gone from the tex file. Nick
Re: [O] org-export-latex-hyperref-options-format
Aloha Nick, Nick Dokos ndo...@gmail.com writes: #+BIND is supposed to bind the variable *during export*. The test is to run the export and see if the hyperref stuff is gone from the tex file. Nick I did run the export and the hyperref stuff was still in the tex file. I'm exporting asynchronously--perhaps that's the problem? The old #+OPTIONS: texht:nil worked for asynchronous export, though, so I was expecting that BIND would do the same. I guess I could set org-export-hyperref-template to in the asynchronous export initialization file ... All the best, Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] org-export-latex-hyperref-options-format
Thomas, Thomas S. Dye wrote: Aloha Nick, Nick Dokos ndo...@gmail.com writes: #+BIND is supposed to bind the variable *during export*. The test is to run the export and see if the hyperref stuff is gone from the tex file. Nick I did run the export and the hyperref stuff was still in the tex file. I'm exporting asynchronously--perhaps that's the problem? The old #+OPTIONS: texht:nil worked for asynchronous export, though, so I was expecting that BIND would do the same. I guess I could set org-export-hyperref-template to in the asynchronous export initialization file ... All the best, Tom Nick pointed out this thread to me when I had a similar (or the same) problem. I changed the hyperref template to the empty string. http://thread.gmane.org/gmane.emacs.orgmode/82430 Charlie Millar
Re: [O] org-export-latex-hyperref-options-format
t...@tsdye.com (Thomas S. Dye) writes: Aloha Nick, Nick Dokos ndo...@gmail.com writes: #+BIND is supposed to bind the variable *during export*. The test is to run the export and see if the hyperref stuff is gone from the tex file. Nick I did run the export and the hyperref stuff was still in the tex file. I'm exporting asynchronously--perhaps that's the problem? The old #+OPTIONS: texht:nil worked for asynchronous export, though, so I was expecting that BIND would do the same. I tried both with and without async (deleting the tex file before starting each time - I also used the default latex class, since I don't have plos-devel): either way the hyperref stuff was gone. Here's the org file: --8---cut here---start-8--- #+TITLE: Structure and Growth of the Leeward Kohala Field System: An Analysis with Directed Graphs #+DATE: #+LANGUAGE: en #+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t :t ':t ^:{} #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:nil pri:nil tags:not-in-toc #+BIND: org-latex-hyperref-template #+STARTUP: entitiespretty #+PROPERTY: header-args:sh :eval no-export * foo bar --8---cut here---end---8--- Org-mode version 8.2.5h (release_8.2.5h-782-g040ec4 @ /home/nick/elisp/org-mode/lisp/) Nick
Re: [O] org-export-latex-hyperref-options-format
Against the latest master: **BEGIN PATCH* From 996e75b3538e60049645a5025a390be603425b8b Mon Sep 17 00:00:00 2001 From: Joe Hirn joseph.h...@gmail.com 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 b...@gnu.org wrote: Hi Joe, Joe Hirn joseph.h...@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, -- Bastien
Re: [O] org-export-latex-hyperref-options-format
Hello, Joe Hirn joseph.h...@gmail.com writes: Here you go. Thank you for the patch. Unfortunately, I cannot apply it on master branch. Would you mind updating your repository and generate the patch again? Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
Where can I clone the master branch from? I requested access to clone it from the contribution page but was told that's reserved for frequent committers. I generated this patch against the most recent version pulled down from package.el (version 20140210). On Sat, Feb 22, 2014 at 3:39 AM, Nicolas Goaziou n.goaz...@gmail.comwrote: Hello, Joe Hirn joseph.h...@gmail.com writes: Here you go. Thank you for the patch. Unfortunately, I cannot apply it on master branch. Would you mind updating your repository and generate the patch again? Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
Hi Joe, Joe Hirn joseph.h...@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, -- Bastien
Re: [O] org-export-latex-hyperref-options-format
Hello, Joe Hirn joseph.h...@gmail.com writes: With recommended changes. Thank you. It looks good. Could you add a commit message (see Commit messages and ChangeLog entries section in http://orgmode.org/worg/org-contribute.html) and send it again, using git format-patch? Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
Here you go. Thanks a lot for all your help. Was really nice working on it with you. From af2a8066be01b94504fff9e009617ce186bd9e03 Mon Sep 17 00:00:00 2001 From: Joe Hirn joseph.h...@gmail.com Date: Fri, 21 Feb 2014 12:15:58 -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 --- ox-latex.el | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/ox-latex.el b/ox-latex.el index 19f055e..f6e5a09 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 nil nil org-latex-hyperref-template t) ;; Redefine regular options. (:date DATE nil \\today t))) @@ -341,10 +341,18 @@ 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) + :type 'string) Headline @@ -1118,12 +1126,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 On Fri, Feb 21, 2014 at 11:28 AM, Nicolas Goaziou n.goaz...@gmail.comwrote: Hello, Joe Hirn joseph.h...@gmail.com writes: With recommended changes. Thank you. It looks good. Could you add a commit message (see Commit messages and ChangeLog entries section in http://orgmode.org/worg/org-contribute.html) and send it again, using git format-patch? Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
Hello, Joe Hirn joseph.h...@gmail.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-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
Re: [O] org-export-latex-hyperref-options-format
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 n.goaz...@gmail.com wrote: Hello, Joe Hirn joseph.h...@gmail.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-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
Re: [O] org-export-latex-hyperref-options-format
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 joseph.h...@gmail.com 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 n.goaz...@gmail.com wrote: Hello, Joe Hirn joseph.h...@gmail.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-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
Re: [O] org-export-latex-hyperref-options-format
Hello, Joe Hirn joseph.h...@gmail.com writes: 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. Thank you for the patch. Here are a few comments. - (:latex-hyperref-p nil texht org-latex-with-hyperref t) + (:latex-hyperref-p nil texht (if org-latex-hyperref-template t) t) I think we can drop the -p suffix since this is no longer a predicate. So the property can be named :latex-hyperref. Also we can replace texht with nil since it doesn't make much sense to specify a full template from the OPTIONS line. Eventually, the default value should be `org-latex-hyperref-template'. This boils down to the following line: (:latex-hyperref nil nil org-latex-hyperref-template t) -(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) The first line of the docstring should contain complete sentences only. I would say something along the lines: 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. Since you specify :type as 'string, it is wrong to expect a nil value in the variable. Note that nil is not an absolute necessity. We can allow to disable the template with an empty string instead. + (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) + You are not using the :latex-hyperref property. This should be: (format-spec (plist-get info :latex-hyperref) ...) Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
I really appreciate your review. Sorry for the pedestrian code submission. I don't get candid critical feedback on my e-lisp, so it's great to learn more about its idioms and conventions. I'll incorporate your feedback into a new patch. On Thu, Feb 20, 2014 at 2:51 PM, Nicolas Goaziou n.goaz...@gmail.comwrote: Hello, Joe Hirn joseph.h...@gmail.com writes: 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. Thank you for the patch. Here are a few comments. - (:latex-hyperref-p nil texht org-latex-with-hyperref t) + (:latex-hyperref-p nil texht (if org-latex-hyperref-template t) t) I think we can drop the -p suffix since this is no longer a predicate. So the property can be named :latex-hyperref. Also we can replace texht with nil since it doesn't make much sense to specify a full template from the OPTIONS line. Eventually, the default value should be `org-latex-hyperref-template'. This boils down to the following line: (:latex-hyperref nil nil org-latex-hyperref-template t) -(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) The first line of the docstring should contain complete sentences only. I would say something along the lines: 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. Since you specify :type as 'string, it is wrong to expect a nil value in the variable. Note that nil is not an absolute necessity. We can allow to disable the template with an empty string instead. + (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) + You are not using the :latex-hyperref property. This should be: (format-spec (plist-get info :latex-hyperref) ...) Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
With recommended changes. BEGIN PATCH * diff --git a/ox-latex.el b/ox-latex.el index 19f055e..f6e5a09 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 nil nil org-latex-hyperref-template t) ;; Redefine regular options. (:date DATE nil \\today t))) @@ -341,10 +341,18 @@ 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) + :type 'string) Headline @@ -1118,12 +1126,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. END PATCH * On Thu, Feb 20, 2014 at 3:52 PM, Joe Hirn joseph.h...@gmail.com wrote: I really appreciate your review. Sorry for the pedestrian code submission. I don't get candid critical feedback on my e-lisp, so it's great to learn more about its idioms and conventions. I'll incorporate your feedback into a new patch. On Thu, Feb 20, 2014 at 2:51 PM, Nicolas Goaziou n.goaz...@gmail.comwrote: Hello, Joe Hirn joseph.h...@gmail.com writes: 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. Thank you for the patch. Here are a few comments. - (:latex-hyperref-p nil texht org-latex-with-hyperref t) + (:latex-hyperref-p nil texht (if org-latex-hyperref-template t) t) I think we can drop the -p suffix since this is no longer a predicate. So the property can be named :latex-hyperref. Also we can replace texht with nil since it doesn't make much sense to specify a full template from the OPTIONS line. Eventually, the default value should be `org-latex-hyperref-template'. This boils down to the following line: (:latex-hyperref nil nil org-latex-hyperref-template t) -(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) The first line of the docstring should contain complete sentences only. I would say something along the lines: 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. Since you specify :type as 'string, it is wrong to expect a nil value in the variable. Note that nil is not an absolute necessity. We can allow to disable the template with an empty string instead. + (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) + You are not using the :latex-hyperref property. This should be: (format-spec (plist-get info :latex-hyperref) ...) Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
Hello, Joe Hirn joseph.h...@gmail.com writes: So I understand, you're recommending I disable org-latex-with-hyperref and then add my own \\hypersetup. My goal would be to avoid placing a #+ entry into every .org file I compose. Which var would be the easiest to to adjust so I can emit \\hypersetup by default and still access the info map that is passed to org-latex-template. I'd like to get the keywords, subject and creator variables that are emitted right now. On a personal level, if you only need to add keyword-value pairs, I think the simplest solution is to add a class in `org-latex-classes', where you insert an additional \hypersetup{...} command. You don't need to change `org-latex-with-hyperref' in this case. You can also use a (final) filter to install this command if you don't want to bother creating a new class. On a more general level, I'll welcome a solution replacing `org-latex-with-hyperref' with `org-latex-hyperref-template', which could be either nil (no hyperref command) or a string with some placeholders (e.g. %k for keywords). What do you think? Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
I think that's a great idea. Thanks for helping me workaround my individual problem and advice on what type of patch you're welcoming. I just happen to have the free time today so I'll try to get a patch to you. On Wed, Feb 19, 2014 at 7:05 AM, Nicolas Goaziou n.goaz...@gmail.comwrote: Hello, Joe Hirn joseph.h...@gmail.com writes: So I understand, you're recommending I disable org-latex-with-hyperref and then add my own \\hypersetup. My goal would be to avoid placing a #+ entry into every .org file I compose. Which var would be the easiest to to adjust so I can emit \\hypersetup by default and still access the info map that is passed to org-latex-template. I'd like to get the keywords, subject and creator variables that are emitted right now. On a personal level, if you only need to add keyword-value pairs, I think the simplest solution is to add a class in `org-latex-classes', where you insert an additional \hypersetup{...} command. You don't need to change `org-latex-with-hyperref' in this case. You can also use a (final) filter to install this command if you don't want to bother creating a new class. On a more general level, I'll welcome a solution replacing `org-latex-with-hyperref' with `org-latex-hyperref-template', which could be either nil (no hyperref command) or a string with some placeholders (e.g. %k for keywords). What do you think? Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
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. Thanks On Wed, Feb 19, 2014 at 7:05 AM, Nicolas Goaziou n.goaz...@gmail.comwrote: Hello, Joe Hirn joseph.h...@gmail.com writes: So I understand, you're recommending I disable org-latex-with-hyperref and then add my own \\hypersetup. My goal would be to avoid placing a #+ entry into every .org file I compose. Which var would be the easiest to to adjust so I can emit \\hypersetup by default and still access the info map that is passed to org-latex-template. I'd like to get the keywords, subject and creator variables that are emitted right now. On a personal level, if you only need to add keyword-value pairs, I think the simplest solution is to add a class in `org-latex-classes', where you insert an additional \hypersetup{...} command. You don't need to change `org-latex-with-hyperref' in this case. You can also use a (final) filter to install this command if you don't want to bother creating a new class. On a more general level, I'll welcome a solution replacing `org-latex-with-hyperref' with `org-latex-hyperref-template', which could be either nil (no hyperref command) or a string with some placeholders (e.g. %k for keywords). What do you think? Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
Hello, Joe Hirn joseph.h...@gmail.com writes: Hello. I recently upgraded to org 8 from the builtin org (7.x) of Emacs 24.3 and lost the ability to customize the \hypersetup block via the custom var org-export-latex-hyperref-options-format. Platform is OSX, Emacs installed via homebrew and org-mode updated via package.el. Org 7.x defines the var in org-latex.el. Because it's a builtin, the custom var still displays in the 'org-latex-export group when configuring options. However, the new export logic from ox-latex.el does not define this custom var, nor does it respect the value if it is set. This is doubly confusing because it appears the var is available, but it actually unused. The problem will go with the next Emacs release. I found this thread from September which describes the same issue, but the patch did not address adding the custom var back and seems to have died. http://lists.gnu.org/archive/html/emacs-orgmode/2013-09/msg01364.html Actually, there is a way to ignore hypersetup block. See `org-latex-with-hyperref'. If you really want a custom command, I think it is better to first disable it with the variable aforementioned, then include your own with #+latex_header or in a custom latex class (see `org-latex-classes'). You can also use a filter to change it on the fly, but that would be less straightforward. Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
Hm. That's disappointing. I really prefer the original behavior. I don't want to copy #+latex_header to get this default behavior into each of my org-mode files. I guess I'll just have to maintain this by redefining the entire org-latex-template function to look at my variable instead of the hard coded string. A pain but apparently my own option. Thanks. On Mon, Feb 17, 2014 at 4:13 PM, Nicolas Goaziou n.goaz...@gmail.comwrote: Hello, Joe Hirn joseph.h...@gmail.com writes: Hello. I recently upgraded to org 8 from the builtin org (7.x) of Emacs 24.3 and lost the ability to customize the \hypersetup block via the custom var org-export-latex-hyperref-options-format. Platform is OSX, Emacs installed via homebrew and org-mode updated via package.el. Org 7.x defines the var in org-latex.el. Because it's a builtin, the custom var still displays in the 'org-latex-export group when configuring options. However, the new export logic from ox-latex.el does not define this custom var, nor does it respect the value if it is set. This is doubly confusing because it appears the var is available, but it actually unused. The problem will go with the next Emacs release. I found this thread from September which describes the same issue, but the patch did not address adding the custom var back and seems to have died. http://lists.gnu.org/archive/html/emacs-orgmode/2013-09/msg01364.html Actually, there is a way to ignore hypersetup block. See `org-latex-with-hyperref'. If you really want a custom command, I think it is better to first disable it with the variable aforementioned, then include your own with #+latex_header or in a custom latex class (see `org-latex-classes'). You can also use a filter to change it on the fly, but that would be less straightforward. Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
Joe Hirn joseph.h...@gmail.com writes: Hm. That's disappointing. I really prefer the original behavior. I don't want to copy #+latex_header to get this default behavior into each of my org-mode files. I suggested other ways to handle it. Anyway your patch has two drawbacks: 1. It is partly redundant with `org-latex-with-hyperref'. 2. A mere format string doesn't provide real flexibility (e.g., what if I don't want the pdfkeywords part?) when you want some. Perhaps something based on `format-spec' would be better. Regards, -- Nicolas Goaziou
Re: [O] org-export-latex-hyperref-options-format
Joe Hirn joseph.h...@gmail.com writes: Hm. That's disappointing. I really prefer the original behavior. I don't want to copy #+latex_header to get this default behavior into each of my org-mode files. I guess I'll just have to maintain this by redefining the entire org-latex-template function to look at my variable instead of the hard coded string. A pain but apparently my own option. Before doing so reread Nicholas' suggestion. I.e.: Set org-latex-with-hyperref to nil. Look at org-latex-classes and add your preferred hypersetup to a new class (note an Org LaTeX class is a predefined preamble in LaTeX terms). Set org-latex-default-class to your new class. If this is not flexible enough use a filter. Several filter examples modifying the preamble have been posted on this list. —Rasmus On Mon, Feb 17, 2014 at 4:13 PM, Nicolas Goaziou n.goaz...@gmail.comwrote: Hello, Joe Hirn joseph.h...@gmail.com writes: Hello. I recently upgraded to org 8 from the builtin org (7.x) of Emacs 24.3 and lost the ability to customize the \hypersetup block via the custom var org-export-latex-hyperref-options-format. Platform is OSX, Emacs installed via homebrew and org-mode updated via package.el. Org 7.x defines the var in org-latex.el. Because it's a builtin, the custom var still displays in the 'org-latex-export group when configuring options. However, the new export logic from ox-latex.el does not define this custom var, nor does it respect the value if it is set. This is doubly confusing because it appears the var is available, but it actually unused. The problem will go with the next Emacs release. I found this thread from September which describes the same issue, but the patch did not address adding the custom var back and seems to have died. http://lists.gnu.org/archive/html/emacs-orgmode/2013-09/msg01364.html Actually, there is a way to ignore hypersetup block. See `org-latex-with-hyperref'. If you really want a custom command, I think it is better to first disable it with the variable aforementioned, then include your own with #+latex_header or in a custom latex class (see `org-latex-classes'). You can also use a filter to change it on the fly, but that would be less straightforward. Regards, -- Nicolas Goaziou -- El Rey ha muerto. ¡Larga vida al Rey!
Re: [O] org-export-latex-hyperref-options-format
I'm sorry man. That may have came off wrong. Did not mean to sound ungrateful. Thanks for offering the workarounds and thanks for responding. I definitely agree with drawback #2. So I understand, you're recommending I disable org-latex-with-hyperref and then add my own \\hypersetup. My goal would be to avoid placing a #+ entry into every .org file I compose. Which var would be the easiest to to adjust so I can emit \\hypersetup by default and still access the info map that is passed to org-latex-template. I'd like to get the keywords, subject and creator variables that are emitted right now. On Mon, Feb 17, 2014 at 5:23 PM, Nicolas Goaziou n.goaz...@gmail.comwrote: Joe Hirn joseph.h...@gmail.com writes: Hm. That's disappointing. I really prefer the original behavior. I don't want to copy #+latex_header to get this default behavior into each of my org-mode files. I suggested other ways to handle it. Anyway your patch has two drawbacks: 1. It is partly redundant with `org-latex-with-hyperref'. 2. A mere format string doesn't provide real flexibility (e.g., what if I don't want the pdfkeywords part?) when you want some. Perhaps something based on `format-spec' would be better. Regards, -- Nicolas Goaziou