From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EOvkGnOb62L8IwAAbAwnHQ (envelope-from ) for ; Thu, 04 Aug 2022 12:12:03 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 0CDIGXOb62JkFAAAG6o9tA (envelope-from ) for ; Thu, 04 Aug 2022 12:12:03 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D005D3F96D for ; Thu, 4 Aug 2022 12:12:02 +0200 (CEST) Received: from localhost ([::1]:36888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJXpi-0004K3-0q for larch@yhetil.org; Thu, 04 Aug 2022 06:12:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJXij-00016N-J6 for emacs-orgmode@gnu.org; Thu, 04 Aug 2022 06:04:56 -0400 Received: from mout02.posteo.de ([185.67.36.66]:37603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJXif-0002h4-Vk for emacs-orgmode@gnu.org; Thu, 04 Aug 2022 06:04:49 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 1A14B240101 for ; Thu, 4 Aug 2022 12:04:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1659607482; bh=6qboNVB2bxk0Q6xWiMv21g/e7ygc1Wwre0IJrGAsbL8=; h=From:To:Cc:Subject:Date:From; b=nfdt/PemLT+u4aNM2wipQCIRNTiJ0CUyHqCUtzxMIC6yHAOrK8iFKSEaMMfXLnz0C tlBV1J8nxDe3KgKihldf36m8BVtTI36Tub7zCxXzkLlDYFbgavhxtphThxJB47N5gW e62vr6GpcN+jaAAsWK+WlFTjv04YmpfENMfPyXrOnYs/Uc1THuX9rm27yxpy5gV/mR zQjMvHegMM0PXJDBlN9fH53TMwbHzvT3RQO7MdoWG+UxztBaJe/L45BSUi4SfRHe5B 0Sphimq8CZp84w5fXTbMlATUpjuUK5/4jA7GPSIxGmfqBLzUsn3E8Tiezo9pQnRlbJ n1aahd4E142/A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Lz48Q5FBnz6tmS; Thu, 4 Aug 2022 12:04:38 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Ihor Radchenko Cc: orgmode Subject: Re: [PATCH] ox-latex.el: `org-latex-language-alist' improved References: <87mtcq14gt.fsf@posteo.net> Date: Thu, 04 Aug 2022 10:04:36 +0000 In-Reply-To: (Ihor Radchenko's message of "Wed, 3 Aug 2022 19:23:29 +0800") Message-ID: <871qtw2ukr.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659607923; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=0tzTZA24vCV+YyDbeGENnJmgUJvDW7WHM5xx4sfHZJo=; b=atsP3jjmbiOjtrISstHG7QfzGX6XS2lasn+GZvWV5a1rb8RssIqfZDdCJ1aTDawQTvFFvA YiQr5lzT09V8cZWB/SCmZkQdhLTFYjnDP6dIa6uLpCR+FvI/ahk+8UVeAXedoXspyI0BoZ 7CWT1rAVOMplt/Oisx4uef4MJME7GkYp/fq9cNwfbdxVIiIeHaNY2M/qoqCPSOwki9P+uK L4QR1yhcIsORQbfIy3eGZS+6dyNSiNnvDExTm8a40p4xnKrLjx7sMbnMtQL2WnNKV+lj9y p7LyK9ANyoLMnvHtgxcWeT7zXEoWkiIrOuKMKMnEZRmykS+Xcj91vWZ1/64FsQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659607923; a=rsa-sha256; cv=none; b=ndydPRqp7dksmwWlnqLkBECXhgWZXBm7Uq4StbFkQxS8WBHnmdz5YwUyoeOa6K6CM0omIR hs/nENMJZFqKnys7Te50TkAFZpum1u9kYBZKV1XnlftwvD/ay7rWnscl4XMFxylPA12Lu4 uX2AZBu9xK/3R9DbQqE3qtFVd1sbSfxs+uBT8kHZEHRQABG3SMepDxtebxYCksDfr00q7T ACBd1/8qR4utfF1d+EyfnZM35WDWw/Z8ba8FNdI1qGCWj/9SxliMnE0PxhcNwjZ9MHGm71 UnMHLhj1Y9NlgxUOePscuCF56MS8tfJPwqiUqJMB61xtdHmyE8W2Bkc1dMtmUQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="nfdt/Pem"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.61 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="nfdt/Pem"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D005D3F96D X-Spam-Score: -2.61 X-Migadu-Scanner: scn1.migadu.com X-TUID: WRPS+A442fEz --=-=-= Content-Type: text/plain Hi, Ihor, Ihor Radchenko writes: > Thanks! I have some minor comments on the patch. > >> From b06cdd45198f470a135efad2cd1d8b22ab7e2f22 Mon Sep 17 00:00:00 > 2001 >> From: Juan Manuel Macias >> Date: Sun, 31 Jul 2022 02:31:08 +0200 >> Subject: [PATCH] lisp/ox-latex.el: `org-latex-language-alist' > improved. > > No dot after the firs message line, please. > >> + '(("am" . (:babel-ini-only "amharic" :polyglossia "amharic" : > lang-name "Amharic")) >> + ("ar" . (:babel "arabic" :polyglossia "arabic" :lang-name > "Arabic")) > > A simpler form would be > ("am" :babel-ini-only "amharic" :polyglossia "amharic" :lang-name > "Amharic") > >> + "Alist between language code and corresponding properties, such >> +as Babel/Polyglossia options and language names. > > The first line of the docstring should fit 80 characters and be a full > sentence. It is needed to make sure that eldoc can display the short > docstring in the message area. > >> +- `:poliglosia' the name of the language loaded by the Polyglossia > LaTeX package > > `:polyglossia', I think. > >> +- `:babel-ini-only' the name of the language loaded by Babel >> + exclusively through the new ini files method. > > May we put some kind of reference to LaTeX docs here? > >> + (let ((language (let* ((lang (plist-get info :language)) >> + (plist (cdr >> + (assoc lang org-latex-language-alist)))) >> + ;; Here the actual name of the LANGUAGE or LANG > is used > > Please end the comment sentence with ".". Thanks for your comments and patience, and sorry again for the typos. I am attaching a new fixed version of the patch. If everything is ok, I get down to work with the Manual and NEWS. I think it would be nice to add a few usage examples, and some links to the Babel and Polyglossia documentation. Best regards, Juan Manuel --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-lisp-ox-latex.el-org-latex-language-alist-improved.patch Content-Transfer-Encoding: quoted-printable >From 3d67d46cfc3e2f4a8feab1fed0598912700118a6 Mon Sep 17 00:00:00 2001 From: Juan Manuel Macias Date: Thu, 4 Aug 2022 11:54:01 +0200 Subject: [PATCH] lisp/ox-latex.el: `org-latex-language-alist' improved * (org-latex-language-alist): Alist between language code and corresponding properties, such as Babel/Polyglossia options and language names. Each element of the list consists of a cons cell, where car is the language code and cdr is a property list. * (org-latex-guess-babel-language): Modified to adapt the function to the new structure of `org-latex-language-alist'. * (org-latex-guess-polyglossia-language): Modified to adapt the function to the new structure of `org-latex-language-alist'. * (org-latex--format-spec): Modified to adapt the function to the new structure of `org-latex-language-alist'. --- lisp/ox-latex.el | 290 +++++++++++++++++++++++------------------------ 1 file changed, 140 insertions(+), 150 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index c56f9d347..69d01b9c7 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -173,110 +173,107 @@ ;;; Internal Variables =20 (defconst org-latex-language-alist - ;; TODO: replace this list with a property list (the actual - ;; implementation is not very robust). - '(("am" "amharic" "*") - ("ar" "arabic") - ("ast" "asturian" "*") - ("bg" "bulgarian") - ("bn" "bengali" "*") - ("bo" "tibetan" "*") - ("br" "breton") - ("ca" "catalan") - ("cop" "coptic" "*") - ("cs" "czech") - ("cy" "welsh") - ("da" "danish") - ("de" "ngerman" "german" "german") - ("de-at" "naustrian" "german" "austrian") - ("dsb" "lsorbian" "*") - ("dv" "divehi" "*") - ("el" "greek") - ("el-polyton" "polutonikogreek" "greek" "polytonic") - ("en" "american" "english" "usmax") - ("en-au" "australian" "english" "australian") - ("en-gb" "british" "english" "uk") - ("en-nz" "newzealand" "english" "newzealand") - ("en-us" "american" "english" "usmax") - ("eo" "esperanto") - ("es" "spanish") - ("es-mx" "spanishmx" "spanish" "mexican") - ("et" "estonian") - ("eu" "basque") - ("fa" "farsi") - ("fi" "finnish") - ("fr" "french") - ("fr-ca" "canadien" "french" "canadian") - ("fur" "friulan") - ("ga" "irish") - ("gd" "scottish") - ("gl" "galician") - ("he" "hebrew") - ("hi" "hindi") - ("hr" "croatian") - ("hsb" "uppersorbian" "sorbian" "upper") - ("hu" "magyar") - ("hy" "armenian" "*") - ("ia" "interlingua") - ("id" "bahasai" "*") - ("is" "icelandic") - ("it" "italian") - ("kn" "kannada" "*") - ("la" "latin") - ("la-classic" "classiclatin" "latin" "classic") - ("la-medieval" "medievallatin" "latin" "medieval") - ("la-ecclesiastic" "ecclesiasticlatin" "latin" "ecclesiastic") - ("lo" "lao" "*") - ("lt" "lithuanian") - ("lv" "latvian") - ("ml" "malayalam" "*") - ("mr" "maranthi" "*") - ("nb" "norsk" "norwegian" "bokmal") - ("nl" "dutch") - ("nn" "nynorsk" "norwegian" "nynorsk") - ("no" "norsk") - ("oc" "occitan") - ("pl" "polish") - ("pms" "piedmontese") - ("pt" "portuges") - ("pt-br" "brazilian") - ("rm" "romansh" "*") - ("ro" "romanian") - ("ru" "russian") - ("sa" "sanskrit" "*") - ("sk" "slovak") - ("sl" "slovene") - ("sq" "albanian") - ("sr" "serbian") - ("sv" "swedish") - ("syr" "syriac" "*") - ("ta" "tamil" "*") - ("te" "telugu" "*") - ("th" "thai") - ("tk" "turkmen") - ("tr" "turkish") - ("uk" "ukrainian") - ("ur" "urdu" "*") - ("vi" "vietnamese")) - "Alist between language code and corresponding Babel/Polyglossia option. - -For the names of the languages, the Babel nomenclature is -preferred to that of Polyglossia, in those cases where both -coincide. - -The alist supports three types of members: - -- Members with two elements: CODE BABEL/POLYGLOSSIA OPTION. - -- Members with three elements: CODE BABEL/POLYGLOSSIA OPTION -ASTERISK (the presence of the asterisk indicates that this -language is not loaded in Babel using the old method of ldf -files but using ini files. If Babel is loaded in an Org -document with these languages, the \"AUTO \" argument is just -removed, to avoid compilation errors). - -- Members with four elements (for variants of languages): CODE -BABEL-OPTION POLYGLOSSIA-OPTION POLYGLOSSIA-VARIANT") + '(("am" :babel-ini-only "amharic" :polyglossia "amharic" :lang-name "Amh= aric") + ("ar" :babel "arabic" :polyglossia "arabic" :lang-name "Arabic") + ("ast" :babel-ini-only "asturian" :polyglossia "asturian" :lang-name "= Asturian") + ("bg" :babel "bulgarian" :polyglossia "bulgarian" :lang-name "Bulgari= an") + ("bn" :babel-ini-only "bengali" :polyglossia "bengali" :lang-name "Be= ngali") + ("bo" :babel-ini-only "tibetan" :polyglossia "tibetan" :lang-name "Ti= betan") + ("br" :babel "breton" :polyglossia "breton" :lang-name "Breton") + ("ca" :babel "catalan" :polyglossia "catalan" :lang-name "Catalan") + ("cop" :babel-ini-only "coptic" :polyglossia "coptic" :lang-name "Cop= tic") + ("cs" :babel "czech" :polyglossia "czech" :lang-name "Czech") + ("cy" :babel "welsh" :polyglossia "welsh" :lang-name "Welsh") + ("da" :babel "danish" :polyglossia "danish" :lang-name "Danish") + ("de" :babel "ngerman" :polyglossia "german" :polyglossia-variant "ge= rman" :lang-name "German") + ("de-at" :babel "naustrian" :polyglossia "german" :polyglossia-varian= t "austrian" :lang-name "German") + ("dsb" :babel "lsorbian" :polyglossia "sorbian" :polyglossia-variant = "lower" :lang-name "Lower Sorbian") + ("dv" :babel-ini-only "divehi" :polyglossia "divehi" :lang-name "Dive= hi") + ("el" :babel "greek" :polyglossia "greek" :lang-name "Greek") + ("el-polyton" :babel "polutonikogreek" :polyglossia "greek" :polyglos= sia-variant "polytonic" :lang-name "Polytonic Greek") + ("en" :babel "american" :polyglossia "english" :polyglossia-variant "= usmax" :lang-name "English") + ("en-au" :babel "australian" :polyglossia "english" :polyglossia-vari= ant "australian" :lang-name "English") + ("en-gb" :babel "british" :polyglossia "english" :polyglossia-variant= "uk" :lang-name "English") + ("en-nz" :babel "newzealand" :polyglossia "english" :polyglossia-vari= ant "newzealand" :lang-name "English") + ("en-us" :babel "american" :polyglossia "english" :polyglossia-varian= t "usmax" :lang-name "English") + ("eo" :babel "esperanto" :polyglossia "esperanto" :lang-name "Esperan= to") + ("es" :babel "spanish" :polyglossia "spanish" :lang-name "Spanish") + ("es-mx" :babel "spanishmx" :polyglossia "spanish" :polyglossia-varia= nt "mexican" :lang-name "Spanish") + ("et" :babel "estonian" :polyglossia "estonian" :lang-name "Estonian") + ("eu" :babel "basque" :polyglossia "basque" :lang-name "Basque") + ("fa" :babel "farsi" :polyglossia "farsi" :lang-name "Farsi") + ("fi" :babel "finnish" :polyglossia "finnish" :lang-name "Finnish") + ("fr" :babel "french" :polyglossia "french" :lang-name "French") + ("fr-ca" :babel "canadien" :polyglossia "french" :polyglossia-variant= "canadian" :lang-name "French") + ("fur" :babel "friulan" :polyglossia "friulan" :lang-name "Friulian") + ("ga" :babel "irish" :polyglossia "irish" :lang-name "Irish") + ("gd" :babel "scottish" :polyglossia "scottish" :lang-name "Scottish = Gaelic") + ("gl" :babel "galician" :polyglossia "galician" :lang-name "Galician") + ("he" :babel "hebrew" :polyglossia "hebrew" :lang-name "Hebrew") + ("hi" :babel "hindi" :polyglossia "hindi" :lang-name "Hindi") + ("hr" :babel "croatian" :polyglossia "croatian" :lang-name "Croatian") + ("hsb" :babel "uppersorbian" :polyglossia "sorbian" :polyglossia-vari= ant "upper" :lang-name "Upper Sorbian") + ("hu" :babel "magyar" :polyglossia "magyar" :lang-name "Magyar") + ("hy" :babel-ini-only "armenian" :polyglossia "armenian" :lang-name "= Armenian") + ("ia" :babel "interlingua" :polyglossia "interlingua" :lang-name "Int= erlingua") + ("id" :babel-ini-only "bahasai" :polyglossia "bahasai" :lang-name "Ba= hasai") + ("is" :babel "icelandic" :polyglossia "icelandic" :lang-name "Iceland= ic") + ("it" :babel "italian" :polyglossia "italian" :lang-name "Italian") + ("kn" :babel-ini-only "kannada" :polyglossia "kannada" :lang-name "Ka= nnada") + ("la" :babel "latin" :polyglossia "latin" :lang-name "Latin") + ("la-classic" :babel "classiclatin" :polyglossia "latin" :polyglossia= -variant "classic" :lang-name "Classic Latin") + ("la-medieval" :babel "medievallatin" :polyglossia "latin" :polygloss= ia-variant "medieval" :lang-name "Medieval Latin") + ("la-ecclesiastic" :babel "ecclesiasticlatin" :polyglossia "latin" :p= olyglossia-variant "ecclesiastic" :lang-name "Ecclesiastic Latin") + ("lo" :babel-ini-only "lao" :polyglossia "lao" :lang-name "Lao") + ("lt" :babel "lithuanian" :polyglossia "lithuanian" :lang-name "Lithu= anian") + ("lv" :babel "latvian" :polyglossia "latvian" :lang-name "Latvian") + ("ml" :babel-ini-only "malayalam" :polyglossia "malayalam" :lang-name= "Malayalam") + ("mr" :babel-ini-only "maranthi" :polyglossia "maranthi" :lang-name "= Maranthi") + ("nb" :babel "norsk" :polyglossia "norwegian" :polyglossia-variant "b= okmal" :lang-name "Norwegian Bokm=C3=A5l") + ("nl" :babel "dutch" :polyglossia "dutch" :lang-name "Dutch") + ("nn" :babel "nynorsk" :polyglossia "norwegian" :polyglossia-variant = "nynorsk" :lang-name "Norwegian Nynorsk") + ("no" :babel "norsk" :polyglossia "norsk" :lang-name "Norwegian") + ("oc" :babel "occitan" :polyglossia "occitan" :lang-name "Occitan") + ("pl" :babel "polish" :polyglossia "polish" :lang-name "Polish") + ("pms" :babel "piedmontese" :polyglossia "piedmontese" :lang-name "Pi= edmontese") + ("pt" :babel "portuges" :polyglossia "portuges" :lang-name "Portuges") + ("pt-br" :babel "brazilian" :polyglossia "brazilian" :lang-name "Port= uges") + ("rm" :babel-ini-only "romansh" :polyglossia "romansh" :lang-name "Ro= mansh") + ("ro" :babel "romanian" :polyglossia "romanian" :lang-name "Romanian") + ("ru" :babel "russian" :polyglossia "russian" :lang-name "Russian") + ("sa" :babel-ini-only "sanskrit" :polyglossia "sanskrit" :lang-name "= Sanskrit") + ("sk" :babel "slovak" :polyglossia "slovak" :lang-name "Slovak") + ("sl" :babel "slovene" :polyglossia "slovene" :lang-name "Slovene") + ("sq" :babel "albanian" :polyglossia "albanian" :lang-name "Albanian") + ("sr" :babel "serbian" :polyglossia "serbian" :lang-name "Serbian") + ("sv" :babel "swedish" :polyglossia "swedish" :lang-name "Swedish") + ("syr" :babel-ini-only "syriac" :polyglossia "syriac" :lang-name "Syr= iac") + ("ta" :babel-ini-only "tamil" :polyglossia "tamil" :lang-name "Tamil") + ("te" :babel-ini-only "telugu" :polyglossia "telugu" :lang-name "Telu= gu") + ("th" :babel "thai" :polyglossia "thai" :lang-name "Thai") + ("tk" :babel "turkmen" :polyglossia "turkmen" :lang-name "Turkmen") + ("tr" :babel "turkish" :polyglossia "turkish" :lang-name "Turkish") + ("uk" :babel "ukrainian" :polyglossia "ukrainian" :lang-name "Ukraini= an") + ("ur" :babel-ini-only "urdu" :polyglossia "urdu" :lang-name "Urdu") + ("vi" :babel "vietnamese" :polyglossia "vietnamese" :lang-name "Vietn= amese")) + "Alist between language code and corresponding properties for LaTeX expo= rt. + +In each element of the list car is always the code of the +language and cdr is a property list. Valid keywords for this +list can be: + +- `:babel' the name of the language loaded by the Babel LaTeX package + +- `:polyglosia' the name of the language loaded by the Polyglossia LaTeX p= ackage + +- `:babel-ini-only' the name of the language loaded by Babel + exclusively through the new ini files method. See + `http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf' + +- `:polyglossia-variant' the language variant loaded by Polyglossia + +- `:lang-name' the actual name of the language.") + =20 (defconst org-latex-table-matrix-macros '(("bordermatrix" . "\\cr") ("qbordermatrix" . "\\cr") @@ -1619,11 +1616,15 @@ already loaded. =20 Return the new header." (let* ((language-code (plist-get info :language)) - (language (nth 1 (assoc language-code - org-latex-language-alist))) - ;; If no language is set or Babel package is not loaded, return - ;; HEADER as-is. - (header (if (or (not (stringp language-code)) + (plist (cdr + (assoc language-code org-latex-language-alist))) + (language (plist-get plist :babel)) + (language-ini-only (plist-get plist :babel-ini-only)) + ;; If no language is set, or Babel package is not loaded, or + ;; LANGUAGE keyword value is a language served by Babel + ;; exclusively through ini files, return HEADER as-is. + (header (if (or language-ini-only + (not (stringp language-code)) (not (string-match "\\\\usepackage\\[\\(.*\\)\\]{babel}" header))) header (let ((options (save-match-data @@ -1634,22 +1635,13 @@ Return the new header." ;; served in Babel exclusively through ini files are not added ;; to the babel argument, and must be loaded using ;; `\babelprovide'. - (let ((l (assoc language-code org-latex-language-alist))) - ;; Three elements imply that LANGUAGE is served - ;; in Babel only by means of an ini file. - ;; Therefore it will not be added to the Babel - ;; argument. TODO: this should be improved - ;; when `org-latex-language-alist' is replaced - ;; by a more robust list. - (if (and (consp l) (=3D (length l) 3)) - header - (replace-match - (mapconcat (lambda (option) (if (equal "AUTO" option) language option= )) - (cond ((member language options) (delete "AUTO" options)) - ((member "AUTO" options) options) - (t (append options (list language)))) - ", ") - t nil header 1))))))) + (replace-match + (mapconcat (lambda (option) (if (equal "AUTO" option) language opt= ion)) + (cond ((member language options) (delete "AUTO" options)) + ((member "AUTO" options) options) + (t (append options (list language)))) + ", ") + t nil header 1))))) ;; If `\babelprovide[args]{AUTO}' is present, AUTO is ;; replaced by LANGUAGE. (if (not (string-match "\\\\babelprovide\\[.*\\]{\\(.+\\)}" header)) @@ -1658,7 +1650,9 @@ Return the new header." (when (equal "AUTO" prov) (replace-regexp-in-string (format "\\(\\\\babelprovide\\[.*\\]\\)\\({\\)%s}" prov) - (format "\\1\\2%s}" language) header t)))))) + (format "\\1\\2%s}" + (or language language-ini-only)) + header t)))))) =20 (defun org-latex-guess-polyglossia-language (header info) "Set the Polyglossia language according to the LANGUAGE keyword. @@ -1675,13 +1669,13 @@ replaced with the language of the document or using \setdefaultlanguage and not as an option to the package. =20 Return the new header." - (let ((language (plist-get info :language))) + (let* ((language (plist-get info :language))) ;; If no language is set or Polyglossia is not loaded, return ;; HEADER as-is. (if (or (not (stringp language)) (not (string-match - "\\\\usepackage\\(?:\\[\\([^]]+?\\)\\]\\){polyglossia}\n" - header))) + "\\\\usepackage\\(?:\\[\\([^]]+?\\)\\]\\){polyglossia}\n" + header))) header (let* ((options (org-string-nw-p (match-string 1 header))) (languages (and options @@ -1700,23 +1694,20 @@ Return the new header." (concat "\\usepackage{polyglossia}\n" (mapconcat (lambda (l) - (let ((l (or (assoc l org-latex-language-alist) - l))) - (format (if main-language-set "\\setotherlanguage%s{%s}\n" + (let* ((plist (cdr + (assoc language org-latex-language-alist))) + (polyglossia-variant (plist-get plist :polyglossia-variant)) + (polyglossia-lang (plist-get plist :polyglossia)) + (l (if (equal l language) + polyglossia-lang + l))) + (format (if main-language-set (format "\\setotherlanguage{%s}\n" l) (setq main-language-set t) "\\setmainlanguage%s{%s}\n") - ;; Four elements implies that there is a - ;; variant (4) for LANGUAGE when - ;; declared by Polyglossia (3). - ;; FIXME: This should be improved when - ;; `org-latex-language-alist' is - ;; replaced by a more robust list. - (if (and (consp l) (=3D (length l) 4)) - (format "[variant=3D%s]" (nth 3 l)) + (if polyglossia-variant + (format "[variant=3D%s]" polyglossia-variant) "") - (if (and (consp l) (=3D (length l) 4)) - (nth 2 l) - (nth 1 l))))) + l))) languages "")) t t header 0))))) @@ -1860,13 +1851,12 @@ INFO is a plist used as a communication channel." (defun org-latex--format-spec (info) "Create a format-spec for document meta-data. INFO is a plist used as a communication channel." - (let ((language (let ((lang (plist-get info :language))) - ;; The second element in - ;; `org-latex-language-alist' is always the - ;; language name, regardless of the type of the - ;; alist entry. - (or (nth 1 (assoc-string lang org-latex-language-alist= t)) - lang)))) + (let ((language (let* ((lang (plist-get info :language)) + (plist (cdr + (assoc lang org-latex-language-alist)))) + ;; Here the actual name of the LANGUAGE or LANG is use= d. + (or (plist-get plist :lang-name) + lang)))) `((?a . ,(org-export-data (plist-get info :author) info)) (?t . ,(org-export-data (plist-get info :title) info)) (?s . ,(org-export-data (plist-get info :subtitle) info)) --=20 2.37.1 --=-=-=--