emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babe


From: Rasmus
Subject: Re: [O] [PATCH][ox-latex.el] Allow AUTO argument to org-latex-guess-babel-language.
Date: Mon, 03 Jun 2013 17:10:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]