emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: emanuel.charpentier@gmail.com
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: Possible bug in org-mode (MELPA version as of 1018-11-25) : #+language: is not (fully) honored.
Date: Sun, 02 Dec 2018 21:26:43 +0100	[thread overview]
Message-ID: <0b203d5f5c53407d7d19dbb4a1351fd22909615b.camel@gmail.com> (raw)
In-Reply-To: <87h8fzr93h.fsf@nicolasgoaziou.fr>

[-- Attachment #1: Type: text/plain, Size: 2293 bytes --]

Dear all,

Please find enclosed a proposed patch (against master) to document the
need for babel/polyglossia in order to honor #+language in LaTeX
export.

This is purely a documentation patch. A better solution would be to
detect the use of a non-default #+language: and act accordingly.
Nicolas notes (rightly) that babel (and polyglossia, BTW) are too
"invasive" to be default, and is shy of auto-loading the necessary
package(s) "automagically.

I do not (yet) know how ti reconcile these imperative, hence the
present interim atch (which should disappear if/when a better solution
is created).

HTH,

--
Emmanuel Charpentier


Le jeudi 29 novembre 2018 à 20:12 +0100, Nicolas Goaziou a écrit :
> Emmanuel Charpentier <emanuel.charpentier@gmail.com> writes:
> 
> > This is *not* *documented* (not even in the `org-latex-packages-
> > alist''s
> > docstring).
> 
> I know. I fixed `org-latex-packages-alist''s docstring two days ago.
> 
> > Also agreed, with the reservation that "invasive" didn't mean the
> > same
> > thing in the 1980s (when the core size of computers was measured in
> > kilobytes) and in the 2010s (the current core measurement unit is
> > the
> > /giga/byte...).
> 
> Not invasive by its sheer size, but by the number of alterations it
> generates in the LaTeX default behaviour, and the incompatibilities
> it
> may introduce. For example there used to be issues between frenchb
> and
> KOMA-Script.
> 
> > Again, I think that the end user should *not* have to worry with
> > this only
> > when exporting to LaTeX (or beamer or PDF). 
> 
> Ideally, that would be nice.
> 
> > If this can be handled silently when exporting to ODT, HTML or
> > plain
> > text, it should be handled silently when exporting to LaTeX.
> 
> I disagree. Packages should not be loaded /silently/.
> 
> > I do not know how to handle this. My *hunch* is that the Latex
> > Export
> > function generating the preamble should check for language
> 
> It does already, in `org-latex-guess-babel-language'.
> 
> > and if not default, add the relevant package(s) to the preamble.
> 
> Don't. Anything that is in the header should be declared.
> 
> We could try and see if Babel causes trouble by adding it to default
> packages in "next" branch. I'd rather do that than inserting it
> magically.

[-- Attachment #2: 0001-org-manual.org-document-the-need-for-babel-when-sett.patch --]
[-- Type: text/x-patch, Size: 2119 bytes --]

From 7fa155f018687a3395c972661c42159dbfc35fe6 Mon Sep 17 00:00:00 2001
From: Emmanuel Charpentier <emm.charpentier@free.fr>
Date: Sun, 2 Dec 2018 21:01:08 +0100
Subject: [PATCH] org-manual.org: document the need for babel when setting
 #+language:

* Add a note to Export Variables.

* Describe the use of org-latex-packages-alist for loading babel (or
  polyglossia) with the right argument in LaTeX specific export settings.
---
 doc/org-manual.org | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 458e59a4a..349d01e48 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -11249,6 +11249,10 @@ global variables, include:
      example, Org translates =Table of contents= to the French =Table
      des matières=.
 
+     For export to LaTeX format (or LaTeX-related formats such as PDF
+     or =beamer=), the =org-latex-package-alist= variable needs
+     configuration in [[LaTeX specific export settings]] ([[LatexSetupForLanguage][description)]]
+
 - =SELECT_TAGS= ::
 
      #+cindex: @samp{SELECT_TAGS}, keyword
@@ -12973,6 +12977,26 @@ general options (see [[*Export Settings]]).
      the document's front matter.  Use multiple =DESCRIPTION= keywords
      for long descriptions.
 
+- =LANGUAGE= ::
+     #+cindex: @samp{LANGUAGE}, keyword
+     #+vindex: org-export-default-language
+     #+vindex: org-latex-package-alist
+     <<LatexSetupForLanguage>>LaTeX-specific setting: in order to be
+     effective in LaTeX export, the =babel= or =polyglossia= packages
+     (according to the LaTeX compiler used) must be loaded with the
+     appropriate language as argument.
+
+     These packages being too invasive for loading them by default,
+     this is not currently done by default. This can be accomplished
+     by setting (or adding to) the =org-latex-package-alist= variable
+     the following snippet:
+
+#+BEGIN_EXAMPLE
+'(("AUTO" "babel" t '("pdflatex"))
+  ("AUTO" "polyglossia" t '("xelatex" "lualatex"))) 
+#+END_EXAMPLE
+
+     
 - =LATEX_CLASS= ::
 
      #+cindex: @samp{LATEX_CLASS}, keyword
-- 
2.19.2


  reply	other threads:[~2018-12-02 20:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-25 20:36 Possible bug in org-mode (MELPA version as of 1018-11-25) : #+language: is not (fully) honored emanuel.charpentier
2018-11-27 14:20 ` Eric S Fraga
2018-11-27 15:29   ` Emmanuel Charpentier
2018-11-27 20:26     ` Nicolas Goaziou
2018-11-27 20:55       ` emanuel.charpentier
2018-11-27 23:40         ` Nicolas Goaziou
2018-11-28 11:38           ` Emmanuel Charpentier
2018-11-28 14:06             ` Nicolas Goaziou
2018-11-29  7:21               ` emanuel.charpentier
2018-11-29 14:07                 ` Nicolas Goaziou
2018-11-29 17:31                   ` Emmanuel Charpentier
2018-11-29 19:12                     ` Nicolas Goaziou
2018-12-02 20:26                       ` emanuel.charpentier [this message]
2018-12-05 16:37                         ` Emmanuel Charpentier
2018-12-06 22:40                         ` Nicolas Goaziou
  -- strict thread matches above, loose matches on Subject: below --
2018-11-25 18:01 emanuel.charpentier
2018-11-25 15:54 Emmanuel Charpentier
2018-11-25 19:03 ` Nicolas Goaziou
2018-11-25 20:32   ` Emmanuel Charpentier
2018-11-25 22:31     ` Nicolas Goaziou
2018-11-26  3:40       ` Emmanuel Charpentier
2018-11-26  8:58         ` Nicolas Goaziou
2018-11-25 21:33   ` Emmanuel Charpentier
2018-11-27 14:19 ` Michael Welle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b203d5f5c53407d7d19dbb4a1351fd22909615b.camel@gmail.com \
    --to=emanuel.charpentier@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).