From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babel-language. Date: Mon, 03 Jun 2013 17:10:05 +0200 Message-ID: <87obbn8c36.fsf@pank.eu> References: <87sj12bwzj.fsf@pank.eu> <8661xvprju.fsf@somewhere.org> <87ehcj9uh7.fsf@pank.eu> <8638sz1e3b.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjWOz-0002qM-PV for emacs-orgmode@gnu.org; Mon, 03 Jun 2013 11:10:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjWOu-0004UP-Sc for emacs-orgmode@gnu.org; Mon, 03 Jun 2013 11:10:29 -0400 Received: from plane.gmane.org ([80.91.229.3]:38245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjWOu-0004UI-Li for emacs-orgmode@gnu.org; Mon, 03 Jun 2013 11:10:24 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UjWOp-0000FP-GH for emacs-orgmode@gnu.org; Mon, 03 Jun 2013 17:10:19 +0200 Received: from ip-pool-133.iue.it ([192.167.90.133]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 03 Jun 2013 17:10:19 +0200 Received: from rasmus by ip-pool-133.iue.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 03 Jun 2013 17:10:19 +0200 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: emacs-orgmode@gnu.org Cc: public-sva-news-D0wtAvR13HarG/iDocfnWg@plane.gmane.org 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-mmmm bacon!