Re: [O] [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babel-language.
Hello Rasmus, Rasmus wrote: 1. As far as I remember, if more than one language is loaded the order is not neutral one one should issue a \selectlanguage{LANG}. If there are multiple languages, the main language is the latest loaded; that is `english' in the following example: \RequirePackage[frenchb,english]{babel} So if a #+LANGUAGE: LANG cookie is present I guess it should be loaded last. Or a \selectlanguage{LANG} should be issued. Non-rigorous testing suggests that it will do the former now on master and thus presumably also in the patch. AFAICT, this is so since a while. Nicolas implemented the above described behavior months ago... See http://lists.gnu.org/archive/html/emacs-orgmode/2012-06/msg00387.html. Doesn't that work for you already in Org core as it is? I'm sorry, I guess the changelog is too sparse or too unclear. Let me try to annotate it. ** Goal: make bable work similar to inputenc (and try to be less 'smart') ** * ox-latex.el (org-latex-guess-babel-language): ignore AUTO if argument. I can now add (AUTO babel t) to org-latex-default-packages-alist—you'll recognize this syntax from inputenc (see org-latex-default-packages-alist). This means allows me to load babel every time I export a LaTeX document. Babel is important enough that I want I always want to load it. Due to the exists of org-export-default-language there is's always a replacement for AUTO. Let's consider an example: 1. Say, org-export-default-language is en. 2. In my document #+LANGUAGE: fr. Using this patch AUTO is replaced by 'french' when I have a LANGUAGE-cookie. When no LANGUAGE is present, it defaults to org-export-default-language. Thus, I only load one language and I can have a more general org-latex-default-packages-alist. * ox-latex.el (org-lat ex-guess-babel-language): use language if is not in =`org-latex-inputenc-alist'=. Let's just continue the example above, but suppose I now want to write a German document. For instance with German there is both german and ngerman, and apparently a germanb. Through the LANGUAGE-cookie I can only get ngerman (de-de) and germanb (de). But I might want to get german for whatever reason. So I might try #+LANGUAGE: german Currently it's discarded. But why not just pass it along when the value of LANGUAGE is not in org-latex-babel-language-alist and assume I know what I am doing? * ox-latex.el (org-latex-guess-babel-language): retain case in final regexp of function. Needed for AUTO to replacing everything with uppercase. I hope the above makes the purpose of the patch clear. I'll try to write better change logs in the future. Behavior changes: 1. =(AUTO babel t)= works like (AUTO inputenc t) in =`org-latex-default-packages-alist'=. I.e. the default language is choosen (sic). 2. if #+LANGUAGE: mylang then then \usepackage[mylang]{babel} in outpu (sic). This message in five line. . . That's much clearer. Do I understand correctly that your patch does not change anything for people who don't use AUTO for Babel in their `org-latex-default-packages-alist'? Best regards, Seb -- Sebastien Vauban
Re: [O] [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babel-language.
Hello Rasmus, Rasmus wrote: 1. As far as I remember, if more than one language is loaded the order is not neutral one one should issue a \selectlanguage{LANG}. If there are multiple languages, the main language is the latest loaded; that is `english' in the following example: \RequirePackage[frenchb,english]{babel} Best regards, Seb -- Sebastien Vauban
Re: [O] [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babel-language.
Sebastien Vauban sva-n...@mygooglest.com writes: Hello Rasmus, Rasmus wrote: 1. As far as I remember, if more than one language is loaded the order is not neutral one one should issue a \selectlanguage{LANG}. If there are multiple languages, the main language is the latest loaded; that is `english' in the following example: \RequirePackage[frenchb,english]{babel} So if a #+LANGUAGE: LANG cookie is present I guess it should be loaded last. Or a \selectlanguage{LANG} should be issued. Non-rigorous testing suggests that it will do the former now on master and thus presumably also in the patch. –Rasmus -- El Rey ha muerto. ¡Larga vida al Rey!
Re: [O] [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babel-language.
Rasmus wrote: Sebastien Vauban sva-n...@mygooglest.com writes: Rasmus wrote: 1. As far as I remember, if more than one language is loaded the order is not neutral one one should issue a \selectlanguage{LANG}. If there are multiple languages, the main language is the latest loaded; that is `english' in the following example: \RequirePackage[frenchb,english]{babel} So if a #+LANGUAGE: LANG cookie is present I guess it should be loaded last. Or a \selectlanguage{LANG} should be issued. Non-rigorous testing suggests that it will do the former now on master and thus presumably also in the patch. AFAICT, this is so since a while. Nicolas implemented the above described behavior months ago... See http://lists.gnu.org/archive/html/emacs-orgmode/2012-06/msg00387.html. Doesn't that work for you already in Org core as it is? Best regards, Seb -- Sebastien Vauban
Re: [O] [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babel-language.
Dear Sebastien, 1. As far as I remember, if more than one language is loaded the order is not neutral one one should issue a \selectlanguage{LANG}. If there are multiple languages, the main language is the latest loaded; that is `english' in the following example: \RequirePackage[frenchb,english]{babel} So if a #+LANGUAGE: LANG cookie is present I guess it should be loaded last. Or a \selectlanguage{LANG} should be issued. Non-rigorous testing suggests that it will do the former now on master and thus presumably also in the patch. AFAICT, this is so since a while. Nicolas implemented the above described behavior months ago... See http://lists.gnu.org/archive/html/emacs-orgmode/2012-06/msg00387.html. Doesn't that work for you already in Org core as it is? I'm sorry, I guess the changelog is too sparse or too unclear. Let me try to annotate it. ** Goal: make bable work similar to inputenc (and try to be less 'smart') ** * ox-latex.el (org-latex-guess-babel-language): ignore AUTO if argument. I can now add (AUTO babel t) to org-latex-default-packages-alist—you'll recognize this syntax from inputenc (see org-latex-default-packages-alist). This means allows me to load babel every time I export a LaTeX document. Babel is important enough that I want I always want to load it. Due to the exists of org-export-default-language there is's always a replacement for AUTO. Let's consider an example: 1. Say, org-export-default-language is en. 2. In my document #+LANGUAGE: fr. Using this patch AUTO is replaced by 'french' when I have a LANGUAGE-cookie. When no LANGUAGE is present, it defaults to org-export-default-language. Thus, I only load one language and I can have a more general org-latex-default-packages-alist. * ox-latex.el (org-lat ex-guess-babel-language): use language if is not in =`org-latex-inputenc-alist'=. Let's just continue the example above, but suppose I now want to write a German document. For instance with German there is both german and ngerman, and apparently a germanb. Through the LANGUAGE-cookie I can only get ngerman (de-de) and germanb (de). But I might want to get german for whatever reason. So I might try #+LANGUAGE: german Currently it's discarded. But why not just pass it along when the value of LANGUAGE is not in org-latex-babel-language-alist and assume I know what I am doing? * ox-latex.el (org-latex-guess-babel-language): retain case in final regexp of function. Needed for AUTO to replacing everything with uppercase. I hope the above makes the purpose of the patch clear. I'll try to write better change logs in the future. Behavior changes: 1. =(AUTO babel t)= works like (AUTO inputenc t) in =`org-latex-default-packages-alist'=. I.e. the default language is choosen (sic). 2. if #+LANGUAGE: mylang then then \usepackage[mylang]{babel} in outpu (sic). This message in five line. . . Cheers, Rasmus -- m-mm-mmm- bacon!
Re: [O] [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babel-language.
Dear Achim, Rasmus writes: This patch allows ox-latex to make a guess on which language to use if babel is a default package. See the head of the patch. What's the status of your copyright assignment? You're neither listed as a contributor nor as one of the people whose papers are in processing (see http://orgmode.org/worg/org-contribute.html) although you've mentioned that you might consider assigning copyright just recently. I'm not assigned but I'm happy to. Should I start the process? I haven't made any significant contributions to org-core. –Rasmus -- When in doubt, do it!
Re: [O] [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babel-language.
Rasmus ras...@gmx.us writes: Dear Achim, Rasmus writes: This patch allows ox-latex to make a guess on which language to use if babel is a default package. See the head of the patch. What's the status of your copyright assignment? You're neither listed as a contributor nor as one of the people whose papers are in processing (see http://orgmode.org/worg/org-contribute.html) although you've mentioned that you might consider assigning copyright just recently. I'm not assigned but I'm happy to. Should I start the process? I haven't made any significant contributions to org-core. I've send an email to assing at gnu just now. -- Powered by magic pixies!
[O] [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babel-language.
This patch allows ox-latex to make a guess on which language to use if babel is a default package. See the head of the patch. Two notes on the funcion: 1. As far as I remember, if more than one language is loaded the order is not neutral one one should issue a \selectlanguage{LANG}. 2. Perhaps it should look for babel /and/ pologlossya or whatever the package the xelatex and perhaps lualatex uses. Any thoughs? –Rasmus -- Together we'll stand, divided we'll fall From dde65056267bcb4c1bfe23c2e66f570739bb72c7 Mon Sep 17 00:00:00 2001 From: rasmus ras...@gmx.us Date: Sat, 1 Jun 2013 00:20:18 +0200 Subject: [PATCH] Allow AUTO argument to org-latex-guess-babel-language. * ox-latex.el (org-latex-guess-babel-language): ignore AUTO if argument. * ox-latex.el (org-lat ex-guess-babel-language): use language if is not in =`org-latex-inputenc-alist'=. * ox-latex.el (org-latex-guess-babel-language): retain case in final regexp of function. Behavior changes: 1. =(AUTO babel t)= works like (AUTO inputenc t) in =`org-latex-default-packages-alist'=. I.e. the default language is choosen. 2. if #+LANGUAGE: mylang then then \usepackage[mylang]{babel} in outpu. TINYCHANGE --- lisp/ox-latex.el | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 3a01693..033d318 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -929,19 +929,21 @@ Return the new header. ;; If no language is set or Babel package is not loaded, return ;; HEADER as-is. (if (or (not (stringp language-code)) - (not (string-match usepackage\\[\\(.*\\)\\]{babel} header))) + (not (string-match usepackage\\[\\(AUTO\\)?,?\\(.*\\)\\]{babel} header))) header (let ((options (save-match-data - (org-split-string (match-string 1 header) ,))) - (language (cdr (assoc language-code - org-latex-babel-language-alist + (org-split-string (match-string 2 header) ,))) + (language (or + (cdr (assoc language-code + org-latex-babel-language-alist)) + language-code))) ;; If LANGUAGE is already loaded, return header. Otherwise, ;; append LANGUAGE to other options. (if (member language options) header (replace-match (mapconcat 'identity (append options (list language)) ,) - nil nil header 1)) + t nil header 1)) (defun org-latex--find-verb-separator (s) Return a character not used in string S. -- 1.8.3
Re: [O] [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babel-language.
Rasmus writes: This patch allows ox-latex to make a guess on which language to use if babel is a default package. See the head of the patch. What's the status of your copyright assignment? You're neither listed as a contributor nor as one of the people whose papers are in processing (see http://orgmode.org/worg/org-contribute.html) although you've mentioned that you might consider assigning copyright just recently. Regards, Achim. -- +[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+ SD adaptation for Waldorf rackAttack V1.04R1: http://Synth.Stromeko.net/Downloads.html#WaldorfSDada