all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* ox-latex language handling in Org-9.5 vs 9.6
@ 2023-09-06 14:55 Max Nikulin
  2023-09-06 22:20 ` Juan Manuel Macías
  0 siblings, 1 reply; 26+ messages in thread
From: Max Nikulin @ 2023-09-06 14:55 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I consider the following as an issue rather close to the discussion in 
the thread
Juan Manuel Macías. Fallback fonts in LaTeX export for non latin 
scripts. Wed, 30 Aug 2023 08:25:53 +0000.
https://list.orgmode.org/878r9t7x7y.fsf@posteo.net

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042450
elpa-org: #+LANGUAGE: de-de is not working in LaTeX export. Debian Bug 
report logs

I am unsure if the change was intentional.

#+language: de-de
#+latex_header: \usepackage[AUTO]{babel}

is exported to

\usepackage[ngerman]{babel}
% ...
\hypersetup{
% ...
  pdflang={Ngerman}}

by Org-9.5 and as

\usepackage[]{babel}
% ...
\hypersetup{
% ...
  pdflang={De-De}}

by Org-9.6. Similar user expectation should be had in mind during 
planning of further changes.



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: ox-latex language handling in Org-9.5 vs 9.6
  2023-09-06 14:55 ox-latex language handling in Org-9.5 vs 9.6 Max Nikulin
@ 2023-09-06 22:20 ` Juan Manuel Macías
  2023-09-07 10:38   ` Max Nikulin
  2023-09-07 11:50   ` Ihor Radchenko
  0 siblings, 2 replies; 26+ messages in thread
From: Juan Manuel Macías @ 2023-09-06 22:20 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin writes:

> I consider the following as an issue rather close to the discussion in 
> the thread
> Juan Manuel Macías. Fallback fonts in LaTeX export for non latin 
> scripts. Wed, 30 Aug 2023 08:25:53 +0000.
> https://list.orgmode.org/878r9t7x7y.fsf@posteo.net
>
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042450
> elpa-org: #+LANGUAGE: de-de is not working in LaTeX export. Debian Bug 
> report logs
>
> I am unsure if the change was intentional.

I seem to remember that when I made org-latex-language-alist I made some
corrections to a few language codes. I was guided by page 19 of the
Babel manual and by

https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

In both lists the language code for German is simply "de". Of course,
I'm no expert on the subject, so if I'm wrong in this case, I should
revert the change. I understand that de-de is German of Germany (="de"?); on
org-latex-language-alist exists de-at (Austrian German). The babel ini
file for german babel/locale/de/babel-de.ini has this id:

[identification]
charset = utf8
version = 1.3
date = 2020-06-30
name.local = Deutsch
name.english = German
name.babel = german
name.polyglossia = german
tag.bcp47 = de
language.tag.bcp47 = de
tag.bcp47.likely = de-Latn-DE
tag.opentype = DEU
script.name = Latin
script.tag.bcp47 = Latn
script.tag.opentype = latn
level = 1
encodings = T1 OT1 LY1
derivate = no

and babel-de-AT.ini:

[identification]
charset = utf8
version = 1.3
date = 2020-06-30
name.local = Deutsch
name.english = German
name.babel = austrian german-austria german-at
name.polyglossia = german
tag.bcp47 = de-AT
language.tag.bcp47 = de
tag.opentype = DEU
region.local = Österreich
region.english = Austria
region.tag.bcp47 = AT
script.name = Latin
script.tag.bcp47 = Latn
script.tag.opentype = latn
polyglossia.variant = austrian
polyglossia.spelling = new
level = 1
encodings = T1 OT1 LY1
derivate = no

ini files use german and german-at, but in classic babel nomenclature
(ldf files) we have ngerman and naustrian.

Maybe it should be corrected like this:

("de-de"  :babel "ngerman" :polyglossia "german" :polyglossia-variant "german" :lang-name "German")
("de"  :babel-ini-only "german" :polyglossia "german" :polyglossia-variant "german" :lang-name "German")

The case of de-at is more problematic because a single language code
serves for naustrian (ldf) and (ini:) austrian, german-at and
german-austria. Some new property, something like :babel-ini-alt, would
have to be introduced . There are other similar cases on the list, such
as el-polyton, which points to polutonikogreek (ldf). In general, except
in cases where only the ini file exists, I used the ldf nomenclature for
backward compatibility.

In any case, these dances of language names between some places and
others make the list of language names that Ihor is working on
increasingly necessary. 


-- 
Juan Manuel Macías

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: ox-latex language handling in Org-9.5 vs 9.6
  2023-09-06 22:20 ` Juan Manuel Macías
@ 2023-09-07 10:38   ` Max Nikulin
  2023-09-07 11:50   ` Ihor Radchenko
  1 sibling, 0 replies; 26+ messages in thread
From: Max Nikulin @ 2023-09-07 10:38 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: emacs-orgmode

On 07/09/2023 05:20, Juan Manuel Macías wrote:
> Maybe it should be corrected like this:
> 
> ("de-de"  :babel "ngerman" :polyglossia "german" :polyglossia-variant "german" :lang-name "German")
> ("de"  :babel-ini-only "german" :polyglossia "german" :polyglossia-variant "german" :lang-name "German")

Sorry, I have only used basic babel configuration, so I am unaware of 
real differences of .ldf and .ini ways. My expectation is that in 
absence of "de-de" definition a fallback to "de" should be used.

Perhaps .ldf vs. .ini should be an orthogonal setting independent of 
locale selection.

Frankly speaking, I am a bit confused by locale definitions in general:

ls /usr/share/locale/ | grep '^de'
de
de_CH
de_DE
de@hebrew

ls /usr/share/i18n/locales/ | grep '^de'
de_AT
de_AT@euro
de_BE
de_BE@euro
de_CH
de_DE
de_DE@euro
de_IT
de_LI
de_LU
de_LU@euro



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: ox-latex language handling in Org-9.5 vs 9.6
  2023-09-06 22:20 ` Juan Manuel Macías
  2023-09-07 10:38   ` Max Nikulin
@ 2023-09-07 11:50   ` Ihor Radchenko
  2023-09-07 14:19     ` Juan Manuel Macías
  1 sibling, 1 reply; 26+ messages in thread
From: Ihor Radchenko @ 2023-09-07 11:50 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: Max Nikulin, emacs-orgmode

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Max Nikulin writes:
>
>> I consider the following as an issue rather close to the discussion in 
>> the thread
>> Juan Manuel Macías. Fallback fonts in LaTeX export for non latin 
>> scripts. Wed, 30 Aug 2023 08:25:53 +0000.
>> https://list.orgmode.org/878r9t7x7y.fsf@posteo.net
>>
>> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042450
>> elpa-org: #+LANGUAGE: de-de is not working in LaTeX export. Debian Bug 
>> report logs
>>
>> I am unsure if the change was intentional.
>
> I seem to remember that when I made org-latex-language-alist I made some
> corrections to a few language codes. I was guided by page 19 of the
> Babel manual and by
>
> https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

> In both lists the language code for German is simply "de". Of course,
> I'm no expert on the subject, so if I'm wrong in this case, I should
> revert the change. I understand that de-de is German of Germany (="de"?); on
> org-latex-language-alist exists de-at (Austrian German). The babel ini
> file for german babel/locale/de/babel-de.ini has this id:

I understand the motivation, but the end result is a clear regression.
May you please review 97cfb959d and recover the removed language names
to put into #+language as aliases to their correct names?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: ox-latex language handling in Org-9.5 vs 9.6
  2023-09-07 11:50   ` Ihor Radchenko
@ 2023-09-07 14:19     ` Juan Manuel Macías
  2023-09-07 14:49       ` Max Nikulin
  0 siblings, 1 reply; 26+ messages in thread
From: Juan Manuel Macías @ 2023-09-07 14:19 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Max Nikulin, emacs-orgmode

Ihor Radchenko writes:

>> In both lists the language code for German is simply "de". Of course,
>> I'm no expert on the subject, so if I'm wrong in this case, I should
>> revert the change. I understand that de-de is German of Germany (="de"?); on
>> org-latex-language-alist exists de-at (Austrian German). The babel ini
>> file for german babel/locale/de/babel-de.ini has this id:
>
> I understand the motivation, but the end result is a clear regression.
> May you please review 97cfb959d and recover the removed language names
> to put into #+language as aliases to their correct names?

I think I can introduce some fixes to org-latex-language-alist to
restore the removed language codes, without breaking the new and
maintaining compatibility with the old. As soon as I have some time I
will send a patch. Probably this weekend.

-- 
Juan Manuel Macías

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: ox-latex language handling in Org-9.5 vs 9.6
  2023-09-07 14:19     ` Juan Manuel Macías
@ 2023-09-07 14:49       ` Max Nikulin
  2023-09-08 10:30         ` Max Nikulin
  0 siblings, 1 reply; 26+ messages in thread
From: Max Nikulin @ 2023-09-07 14:49 UTC (permalink / raw)
  To: emacs-orgmode

On 07/09/2023 21:19, Juan Manuel Macías wrote:
> I think I can introduce some fixes to org-latex-language-alist to
> restore the removed language codes

I have no idea why in

393f2f5ae 2012-06-14 12:57:35 +0200 Nicolas Goaziou: org-e-latex: Set 
Babel language according to LANGUAGE keyword

new "ngerman" was used for de-de, while older "germanb" was chosen for 
"de". From my point of view modern ngerman rules should be used in both 
cases. Those who really need older style may specify germanb explicitly, 
not through #+language mapping. Difference de-de vs. de is rather subtle 
to rely on it.



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: ox-latex language handling in Org-9.5 vs 9.6
  2023-09-07 14:49       ` Max Nikulin
@ 2023-09-08 10:30         ` Max Nikulin
  2023-09-08 14:42           ` Juan Manuel Macías
  0 siblings, 1 reply; 26+ messages in thread
From: Max Nikulin @ 2023-09-08 10:30 UTC (permalink / raw)
  To: emacs-orgmode

On 07/09/2023 21:49, Max Nikulin wrote:
> On 07/09/2023 21:19, Juan Manuel Macías wrote:
>> I think I can introduce some fixes to org-latex-language-alist to
>> restore the removed language codes
> 
> I have no idea why in
> 
> 393f2f5ae 2012-06-14 12:57:35 +0200 Nicolas Goaziou: org-e-latex: Set 
> Babel language according to LANGUAGE keyword

https://list.orgmode.org/871umay444.fsf@med.uni-goettingen.de/
Andreas Leha <andreas.leha@med.uni-goettingen.de> Re: new (LaTeX) 
exporter and date formatting. Wed, 23 May 2012 23:33:31 +0200

contains a table that is likely a source for Nicolas' commit:

> this list of LaTeX-babel supported languages from
> http://www.tug.org/texlive/Contents/live/texmf-dist/doc/generic/babel/babel.pdf:

> 
> | LaTeX babel  | lang symbol |
> |--------------+-------------|

> | austrian     | de-at       |

> | german       | de          |
> | germanb      | de          |

> | ngerman      | de-de       |

Contemporary babel.pdf contains another table (1.13 ini files)

de-1901    German
de-1996    German
de-AT-1901 Austrian German
de-AT-1996 Austrian German
de-AT      Austrian German
de-CH-1901 Swiss High German
de-CH-1996 Swiss High German
de-CH      Swiss High German

I am still unsure that de and de-de should be mapped to different babel 
language configurations.



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: ox-latex language handling in Org-9.5 vs 9.6
  2023-09-08 10:30         ` Max Nikulin
@ 2023-09-08 14:42           ` Juan Manuel Macías
  2023-09-08 19:02             ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Juan Manuel Macías
  0 siblings, 1 reply; 26+ messages in thread
From: Juan Manuel Macías @ 2023-09-08 14:42 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode, Ihor Radchenko

Max Nikulin writes:

> I am still unsure that de and de-de should be mapped to different
> babel language configurations.

I think that for practical purposes de and de-de should be treated the
same in both babel and polyglossia. In the new fixed version of
org-babel-language-alist I thought it would be useful to support a list
of languages codes as car for each element, in addition to a simple
string. In such a way:

(("de" "de-de") :babel "ngerman" :babel-ini-alt "german" :polyglossia "german" :polyglossia-variant "german" :lang-name "German" :script "latin" :script-tag "latn")

I've had to make some small modifications to
org-latex-guess-babel/polyglossia-language, to get that to work.

:babel-ini-alt refers to an alternative name that is used only if
\babelprovide is present. I'm also adding the :script and :script-tag
properties for each language.

I have done something similar with the case of Chinese Simplified (a new
language that I have added):

(("zh" "zh-cn")  :babel-ini-only "chinese" :polyglossia "chinese" :lang-name "Chinese Simplified" :script "hans" :script-tag "hans")

Between today and tomorrow I will try to send the patch. I saw that
org-latex-language-alist had a few typos as well, some inherited from
the previous lists that were merged.

-- 
Juan Manuel Macías 

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com




^ permalink raw reply	[flat|nested] 26+ messages in thread

* [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6)
  2023-09-08 14:42           ` Juan Manuel Macías
@ 2023-09-08 19:02             ` Juan Manuel Macías
  2023-09-09  9:11               ` Ihor Radchenko
  0 siblings, 1 reply; 26+ messages in thread
From: Juan Manuel Macías @ 2023-09-08 19:02 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Max Nikulin, Ihor Radchenko

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

I think that with this patch the possible regressions are removed. I
took the opportunity to add some improvements (the :babel-ini-alt,
:script and :script-tag properties) and correct some errors and typos.

I don't know if it's a valid path to allow the car of each element to
also be a list of languages codes, but I couldn't think of a better
solution for the "de"/"de-de" cases. A similar case is in Chinese
Simplified (new language added), where the possible language codes are
zh and zh-cn, if I'm not wrong.

--
Juan Manuel Macías

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com


[-- Attachment #2: 0001-ox-latex.el-Fixes-and-improvements-in-org-latex-lang.patch --]
[-- Type: text/x-patch, Size: 22948 bytes --]

From 52f17bc841241562a52e91159cb1531dbe5684e1 Mon Sep 17 00:00:00 2001
From: Juan Manuel Macias <maciaschain@posteo.net>
Date: Fri, 8 Sep 2023 19:33:25 +0200
Subject: [PATCH] ox-latex.el: Fixes and improvements in
 `org-latex-language-alist'.

* (org-latex-language-alist): Fix a language code (`de-de') removed
when `org-latex-babel-language-alist' and
`org-latex-polyglossia-language-alist' were merged.  To allow language
codes that can have a similar translation in `babel' or `polyglossia'
now in each element of `org-latex-language-alist' car can also be a
list of language codes.  New admitted properties: `:babel-ini-alt',
`:script' and `:script-tag'.  Add language code for ancient Greek.
Fix Afrikaans (was previously removed).  New languages: Chinese
Simplified and Traditional.  Correction of some typos, errors and
inaccuracies.

* (org-latex-guess-babel-language): Some necessary modifications.

* (org-latex-guess-polyglossia-language): Some necessary modifications.
---
 lisp/ox-latex.el | 208 +++++++++++++++++++++++++++--------------------
 1 file changed, 118 insertions(+), 90 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 241ef603a..d6790ea27 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -177,94 +177,102 @@
 ;;; Internal Variables
 
 (defconst org-latex-language-alist
-  '(("am" :babel-ini-only "amharic" :polyglossia "amharic" :lang-name "Amharic")
-    ("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 "Bulgarian")
-    ("bn"  :babel-ini-only "bengali" :polyglossia "bengali" :lang-name "Bengali")
-    ("bo"  :babel-ini-only "tibetan" :polyglossia "tibetan" :lang-name "Tibetan")
-    ("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 "Coptic")
-    ("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 "german" :lang-name "German")
-    ("de-at"  :babel "naustrian" :polyglossia "german" :polyglossia-variant "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 "Divehi")
-    ("el"  :babel "greek" :polyglossia "greek" :lang-name "Greek")
-    ("el-polyton"  :babel "polutonikogreek" :polyglossia "greek" :polyglossia-variant "polytonic" :lang-name "Polytonic Greek")
-    ("en"  :babel "american" :polyglossia "english" :polyglossia-variant "usmax" :lang-name "English")
-    ("en-au"  :babel "australian" :polyglossia "english" :polyglossia-variant "australian" :lang-name "English")
-    ("en-gb"  :babel "british" :polyglossia "english" :polyglossia-variant "uk" :lang-name "English")
-    ("en-nz"  :babel "newzealand" :polyglossia "english" :polyglossia-variant "newzealand" :lang-name "English")
-    ("en-us"  :babel "american" :polyglossia "english" :polyglossia-variant "usmax" :lang-name "English")
-    ("eo"  :babel "esperanto" :polyglossia "esperanto" :lang-name "Esperanto")
-    ("es"  :babel "spanish" :polyglossia "spanish" :lang-name "Spanish")
-    ("es-mx"  :babel "spanishmx" :polyglossia "spanish" :polyglossia-variant "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-variant "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 "Interlingua")
-    ("id"  :babel-ini-only "bahasai" :polyglossia "bahasai" :lang-name "Bahasai")
-    ("is"  :babel "icelandic" :polyglossia "icelandic" :lang-name "Icelandic")
-    ("it"  :babel "italian" :polyglossia "italian" :lang-name "Italian")
-    ("kn"  :babel-ini-only "kannada" :polyglossia "kannada" :lang-name "Kannada")
-    ("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" :polyglossia-variant "medieval" :lang-name "Medieval Latin")
-    ("la-ecclesiastic"  :babel "ecclesiasticlatin" :polyglossia "latin" :polyglossia-variant "ecclesiastic" :lang-name "Ecclesiastic Latin")
-    ("lo"  :babel-ini-only "lao" :polyglossia "lao" :lang-name "Lao")
-    ("lt"  :babel "lithuanian" :polyglossia "lithuanian" :lang-name "Lithuanian")
-    ("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 "bokmal" :lang-name "Norwegian Bokmål")
-    ("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 "Piedmontese")
-    ("pt"  :babel "portuges" :polyglossia "portuges" :lang-name "Portuges")
-    ("pt-br"  :babel "brazilian" :polyglossia "brazilian" :lang-name "Portuges")
-    ("rm"  :babel-ini-only "romansh" :polyglossia "romansh" :lang-name "Romansh")
-    ("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 "Syriac")
-    ("ta"  :babel-ini-only "tamil" :polyglossia "tamil" :lang-name "Tamil")
-    ("te"  :babel-ini-only "telugu" :polyglossia "telugu" :lang-name "Telugu")
-    ("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 "Ukrainian")
-    ("ur"  :babel-ini-only "urdu" :polyglossia "urdu" :lang-name "Urdu")
-    ("vi"  :babel "vietnamese" :polyglossia "vietnamese" :lang-name "Vietnamese"))
+  '(("af" :babel "afrikaans" :polyglossia "afrikaans" :lang-name "Afrikaans" :script "latin" :script-tag "latn")
+    ("am" :babel-ini-only "amharic" :polyglossia "amharic" :lang-name "Amharic" :script "ethiopic" :script-tag "ethi")
+    ("ar" :babel-ini-only "arabic" :polyglossia "arabic" :lang-name "Arabic" :script "arabic" :script-tag "arab")
+    ("ast" :babel-ini-only "asturian" :polyglossia "asturian" :lang-name "Asturian" :script "latin" :script-tag "latn")
+    ("bg"  :babel "bulgarian" :polyglossia "bulgarian" :lang-name "Bulgarian" :script "cyrillic" :script-tag "cyrl")
+    ("bn"  :babel-ini-only "bengali" :polyglossia "bengali" :lang-name "Bengali" :script "bengali" :script-tag: "beng")
+    ("bo"  :babel-ini-only "tibetan" :polyglossia "tibetan" :lang-name "Tibetan" :script "tibetan" :script-tag "tib")
+    ("br"  :babel "breton" :polyglossia "breton" :lang-name "Breton" :script "latin" :script-tag "latn")
+    ("ca"  :babel "catalan" :polyglossia "catalan" :lang-name "Catalan" :script "latin" :script-tag "latn")
+    ("cop"  :babel-ini-only "coptic" :polyglossia "coptic" :lang-name "Coptic" :script "coptic" :script-tag "copt")
+    ("cs"  :babel "czech" :polyglossia "czech" :lang-name "Czech" :script "latin" :script-tag "latn")
+    ("cy"  :babel "welsh" :polyglossia "welsh" :lang-name "Welsh" :script "latin" :script-tag "latn")
+    ("da"  :babel "danish" :polyglossia "danish" :lang-name "Danish" :script "latin" :script-tag "latn")
+    (("de" "de-de")  :babel "ngerman" :babel-ini-alt "german" :polyglossia "german" :polyglossia-variant "german" :lang-name "German" :script "latin" :script-tag "latn")
+    ("de-at"  :babel "naustrian" :babel-ini-alt "german-austria" :polyglossia "german" :polyglossia-variant "austrian" :lang-name "German" :script "latin" :script-tag "latn")
+    ("dsb"  :babel "lowersorbian" :babel-ini-alt "lsorbian" :polyglossia "sorbian" :polyglossia-variant "lower" :lang-name "Lower Sorbian" :script "latin" :script-tag "latn")
+    ("dv" :polyglossia "divehi" :lang-name "Dhivehi" :script "latin" :script-tag "latn")
+    ("el"  :babel "greek" :polyglossia "greek" :lang-name "Greek" :script "greek" :script-tag "grek")
+    ("el-polyton"  :babel "polutonikogreek" :babel-ini-alt "polytonicgreek" :polyglossia "greek" :polyglossia-variant "polytonic" :lang-name "Polytonic Greek" :script "greek" :script-tag "grek")
+    ("grc"  :babel "greek.ancient" :babel-ini-alt "ancientgreek" :polyglossia "greek" :polyglossia-variant "ancient" :lang-name "Ancient Greek" :script "greek" :script-tag "grek")
+    ("en"  :babel "english" :polyglossia "english" :polyglossia-variant "usmax" :lang-name "English" :script "latin" :script-tag "latn")
+    ("en-au"  :babel "australian" :polyglossia "english" :polyglossia-variant "australian" :lang-name "English" :script "latin" :script-tag "latn")
+    ("en-ca"  :babel "canadian" :polyglossia "english" :polyglossia-variant "canadian" :lang-name "English" :script "latin" :script-tag "latn")
+    ("en-gb"  :babel "british" :polyglossia "english" :polyglossia-variant "uk" :lang-name "English" :script "latin" :script-tag "latn")
+    ("en-nz"  :babel "newzealand" :polyglossia "english" :polyglossia-variant "newzealand" :lang-name "English" :script "latin" :script-tag "latn")
+    ("en-us"  :babel "american" :polyglossia "english" :polyglossia-variant "usmax" :lang-name "English" :script "latin" :script-tag "latn")
+    ("eo"  :babel "esperanto" :polyglossia "esperanto" :lang-name "Esperanto" :script "latin" :script-tag "latn")
+    ("es"  :babel "spanish" :polyglossia "spanish" :lang-name "Spanish" :script "latin" :script-tag "latn")
+    ("es-mx"  :babel "spanishmx" :polyglossia "spanish" :polyglossia-variant "mexican" :lang-name "Spanish" :script "latin" :script-tag "latn")
+    ("et"  :babel "estonian" :polyglossia "estonian" :lang-name "Estonian" :script "latin" :script-tag "latn")
+    ("eu"  :babel "basque" :polyglossia "basque" :lang-name "Basque" :script "latin" :script-tag "latn")
+    ("fa"  :babel "persian" :polyglossia "persian" :lang-name "Persian" :script "arabic" :script-tag "arab")
+    ("fi"  :babel "finnish" :polyglossia "finnish" :lang-name "Finnish" :script "latin" :script-tag "latn")
+    ("fr"  :babel "french" :polyglossia "french" :lang-name "French" :script "latin" :script-tag "latn")
+    ("fr-ca"  :babel "canadien" :babel-ini-alt "canadian" :polyglossia "french" :polyglossia-variant "canadian" :lang-name "French" :script "latin" :script-tag "latn")
+    ("fur"  :babel "friulian" :polyglossia "friulian" :lang-name "Friulian" :script "latin" :script-tag "latn")
+    ("ga"  :babel "irish" :polyglossia "gaelic" :polyglossia-variant "irish" :lang-name "Irish Gaelic" :script "latin" :script-tag "latn")
+    ("gd"  :babel "scottish" :polyglossia "gaelic" :polyglossia-variant "scottish" :lang-name "Scottish Gaelic" :script "latin" :script-tag "latn")
+    ("gl"  :babel "galician" :polyglossia "galician" :lang-name "Galician" :script "latin" :script-tag "latn")
+    ("he"  :babel "hebrew" :polyglossia "hebrew" :lang-name "Hebrew" :script "hebrew" :script-tag "hebr")
+    ("hi"  :babel "hindi" :polyglossia "hindi" :lang-name "Hindi" :script "devanagari" :script-tag "deva")
+    ("hr"  :babel "croatian" :polyglossia "croatian" :lang-name "Croatian" :script "latin" :script-tag "latn")
+    ("hsb"  :babel "uppersorbian" :polyglossia "sorbian" :polyglossia-variant "upper" :lang-name "Upper Sorbian" :script "latin" :script-tag "latn")
+    ("hu"  :babel "magyar" :polyglossia "magyar" :lang-name "Magyar" :script "latin" :script-tag "latn")
+    ("hy"  :babel-ini-only "armenian" :polyglossia "armenian" :lang-name "Armenian" :script "armenian" :script-tag "armn")
+    ("ia"  :babel "interlingua" :polyglossia "interlingua" :lang-name "Interlingua" :script "latin" :script-tag "latn")
+    ("id"  :babel "indonesian" :polyglossia "malay" :polyglossia-variant "indonesian" :lang-name "Indonesian" :script "latin" :script-tag "latn")
+    ("is"  :babel "icelandic" :polyglossia "icelandic" :lang-name "Icelandic" :script "latin" :script-tag "latn")
+    ("it"  :babel "italian" :polyglossia "italian" :lang-name "Italian" :script "latin" :script-tag "latn")
+    ("kn"  :babel-ini-only "kannada" :polyglossia "kannada" :lang-name "Kannada" :script "kannada" :script-tag "knda")
+    ("la"  :babel "latin" :polyglossia "latin" :lang-name "Latin" :script "latin" :script-tag "latn")
+    ("la-classic"  :babel "classiclatin" :polyglossia "latin" :polyglossia-variant "classic" :lang-name "Classic Latin" :script "latin" :script-tag "latn")
+    ("la-medieval"  :babel "medievallatin" :polyglossia "latin" :polyglossia-variant "medieval" :lang-name "Medieval Latin" :script "latin" :script-tag "latn")
+    ("la-ecclesiastic"  :babel "ecclesiasticlatin" :polyglossia "latin" :polyglossia-variant "ecclesiastic" :lang-name "Ecclesiastic Latin" :script "latin" :script-tag "latn")
+    ("lo"  :babel-ini-only "lao" :polyglossia "lao" :lang-name "Lao" :script "lao" :script-tag "lao")
+    ("lt"  :babel "lithuanian" :polyglossia "lithuanian" :lang-name "Lithuanian" :script "latin" :script-tag "latn")
+    ("lv"  :babel "latvian" :polyglossia "latvian" :lang-name "Latvian" :script "latin" :script-tag "latn")
+    ("ml"  :babel-ini-only "malayalam" :polyglossia "malayalam" :lang-name "Malayalam" :script "malayalam" :script-tag "mlym")
+    ("mr"  :babel-ini-only "marathi" :polyglossia "marathi" :lang-name "Marathi" :script "devanagari" :script-tag "deva")
+    ("ms"  :babel "malay" :polyglossia "malay" :polyglossia-variant "malaysian" :lang-name "Malay" :script "latin" :script-tag "latn")
+    ("nb"  :babel "norsk" :polyglossia "norwegian" :polyglossia-variant "bokmal" :lang-name "Norwegian Bokmål" :script "latin" :script-tag "latn")
+    ("nl"  :babel "dutch" :polyglossia "dutch" :lang-name "Dutch" :script "latin" :script-tag "latn")
+    ("nn"  :babel "nynorsk" :polyglossia "norwegian" :polyglossia-variant "nynorsk" :lang-name "Norwegian Nynorsk" :script "latin" :script-tag "latn")
+    ("no"  :babel "norsk" :polyglossia "norsk" :lang-name "Norwegian" :script "latin" :script-tag "latn")
+    ("oc"  :babel "occitan" :polyglossia "occitan" :lang-name "Occitan" :script "latin" :script-tag "latn")
+    ("pl"  :babel "polish" :polyglossia "polish" :lang-name "Polish" :script "latin" :script-tag "latn")
+    ("pms" :babel "piedmontese" :polyglossia "piedmontese" :lang-name "Piedmontese" :script "latin" :script-tag "latn")
+    ("pt"  :babel "portuges" :polyglossia "portuges" :lang-name "Portuges" :script "latin" :script-tag "latn")
+    ("pt-br" :babel "brazilian" :polyglossia "brazilian" :lang-name "Portuges" :script "latin" :script-tag "latn")
+    ("rm"  :babel-ini-only "romansh" :polyglossia "romansh" :lang-name "Romansh" :script "latin" :script-tag "latn")
+    ("ro"  :babel "romanian" :polyglossia "romanian" :lang-name "Romanian" :script "latin" :script-tag "latn")
+    ("ru"  :babel "russian" :polyglossia "russian" :lang-name "Russian" :script "cyrillic" :script-tag "cyrl")
+    ("sa"  :babel-ini-only "sanskrit" :polyglossia "sanskrit" :lang-name "Sanskrit" :script "devanagari" :script-tag "deva")
+    ("sk"  :babel "slovak" :polyglossia "slovak" :lang-name "Slovak" :script "latin" :script-tag "latn")
+    ("sl"  :babel "slovene" :polyglossia "slovene" :lang-name "Slovene" :script "latin" :script-tag "latn")
+    ("sq"  :babel "albanian" :polyglossia "albanian" :lang-name "Albanian" :script "latin" :script-tag "latn")
+    ("sr"  :babel "serbian" :polyglossia "serbian" :lang-name "Serbian" :script "latin" :script-tag "latn")
+    ("sr-cyrl" :babel-ini-only "serbian-cyrl" :polyglossia "serbian" :lang-name "Serbian" :script "cyrillic" :script-tag "cyrl")
+    ("sr-latn" :babel-ini-only "serbian-latin" :polyglossia "serbian" :lang-name "Serbian" :script "latin" :script-tag "latn")
+    ("sv"  :babel "swedish" :polyglossia "swedish" :lang-name "Swedish" :script "latin" :script-tag "latn")
+    ("syr" :babel-ini-only "syriac" :polyglossia "syriac" :lang-name "Syriac" :script "syriac" :script-tag "syrc")
+    ("ta"  :babel-ini-only "tamil" :polyglossia "tamil" :lang-name "Tamil" :script "tamil" :script-tag "taml")
+    ("te"  :babel-ini-only "telugu" :polyglossia "telugu" :lang-name "Telugu" :script "telugu" :script-tag "telu")
+    ("th"  :babel "thai" :polyglossia "thai" :lang-name "Thai" :script "thai" :script-tag "thai")
+    ("tk"  :babel "turkmen" :polyglossia "turkmen" :lang-name "Turkmen" :script "latin" :script-tag "latn")
+    ("tr"  :babel "turkish" :polyglossia "turkish" :lang-name "Turkish" :script "latin" :script-tag "latn")
+    ("uk"  :babel "ukrainian" :polyglossia "ukrainian" :lang-name "Ukrainian" :script "cyrillic" :script-tag "cyrl")
+    ("ur"  :babel-ini-only "urdu" :polyglossia "urdu" :lang-name "Urdu" :script "arabic" :script-tag "arab")
+    ("vi"  :babel "vietnamese" :polyglossia "vietnamese" :lang-name "Vietnamese" :script "latin" :script-tag "latn")
+    (("zh" "zh-cn")  :babel-ini-only "chinese" :polyglossia "chinese" :lang-name "Chinese Simplified" :script "hans" :script-tag "hans")
+    ("zh-tw"  :babel-ini-only "chinese-traditional" :polyglossia "chinese" :polyglossia-variant "traditional" :lang-name "Chinese Traditional" :script "hant" :script-tag "hant"))
   "Alist between language code and its properties for LaTeX export.
 
-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:
+In each element of the list car is always the language code or a
+list of languages codes 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
 
@@ -275,9 +283,17 @@ list can be:
  exclusively through the new ini files method.  See
  `http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf'
 
+- `:babel-ini-alt' an alternative language name when it is loaded
+  using ini files
+
 - `:polyglossia-variant' the language variant loaded by Polyglossia
 
-- `:lang-name' the actual name of the language.")
+- `:lang-name' the actual name of the language
+
+- `:script' the script name
+
+- `:script-tag' the script otf tag.")
+
 
 (defconst org-latex-line-break-safe "\\\\[0pt]"
   "Linebreak protecting the following [...].
@@ -1657,9 +1673,15 @@ already loaded.
 Return the new header."
   (let* ((language-code (plist-get info :language))
 	 (plist (cdr
-		 (assoc language-code org-latex-language-alist)))
+		 (cl-assoc-if (lambda (x)
+                                (or (and (stringp x)
+                                         (string= language-code x))
+                                    (and (listp x)
+                                         (member language-code x))))
+                              org-latex-language-alist)))
 	 (language (plist-get plist :babel))
 	 (language-ini-only (plist-get plist :babel-ini-only))
+         (language-ini-alt (plist-get plist :babel-ini-alt))
 	 ;; 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.
@@ -1691,7 +1713,8 @@ Return the new header."
 	    (replace-regexp-in-string (format
 				       "\\(\\\\babelprovide\\[.*\\]\\)\\({\\)%s}" prov)
 				      (format "\\1\\2%s}"
-					      (or language language-ini-only))
+					      (if language-ini-alt language-ini-alt
+                                                (or language language-ini-only)))
 				      header t)
 	  header)))))
 
@@ -1736,7 +1759,12 @@ Return the new header."
 		 (mapconcat
 		  (lambda (l)
 		    (let* ((plist (cdr
-				   (assoc language org-latex-language-alist)))
+				   (cl-assoc-if (lambda (x)
+                                                  (or (and (stringp x)
+                                                           (string= language x))
+                                                      (and (listp x)
+                                                           (member language x))))
+                                                org-latex-language-alist)))
 			   (polyglossia-variant (plist-get plist :polyglossia-variant))
 			   (polyglossia-lang (plist-get plist :polyglossia))
 			   (l (if (equal l language)
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6)
  2023-09-08 19:02             ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Juan Manuel Macías
@ 2023-09-09  9:11               ` Ihor Radchenko
  2023-09-09 10:36                 ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
  2023-09-10 16:15                 ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Max Nikulin
  0 siblings, 2 replies; 26+ messages in thread
From: Ihor Radchenko @ 2023-09-09  9:11 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: emacs-orgmode, Max Nikulin

Juan Manuel Macías <maciaschain@posteo.net> writes:

> I think that with this patch the possible regressions are removed. I
> took the opportunity to add some improvements (the :babel-ini-alt,
> :script and :script-tag properties) and correct some errors and typos.
>
> I don't know if it's a valid path to allow the car of each element to
> also be a list of languages codes, but I couldn't think of a better
> solution for the "de"/"de-de" cases. A similar case is in Chinese
> Simplified (new language added), where the possible language codes are
> zh and zh-cn, if I'm not wrong.

I am not sure if making a breaking change to public constant is the best
approach.
What about simply adding an extra entry:
("de" ....)
("de-de" <copy of "de" property list>)
?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist
  2023-09-09  9:11               ` Ihor Radchenko
@ 2023-09-09 10:36                 ` Juan Manuel Macías
  2023-09-09 11:33                   ` Ihor Radchenko
  2023-09-10 16:15                 ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Max Nikulin
  1 sibling, 1 reply; 26+ messages in thread
From: Juan Manuel Macías @ 2023-09-09 10:36 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode, Max Nikulin

Ihor Radchenko writes:

>> I don't know if it's a valid path to allow the car of each element to
>> also be a list of languages codes, but I couldn't think of a better
>> solution for the "de"/"de-de" cases. A similar case is in Chinese
>> Simplified (new language added), where the possible language codes are
>> zh and zh-cn, if I'm not wrong.
>
> I am not sure if making a breaking change to public constant is the best
> approach.
> What about simply adding an extra entry:
> ("de" ....)
> ("de-de" <copy of "de" property list>)
> ?

At first I had done it with extra entries, but I was wondering if there
wasn't a more "economical" way... If you don't mind having extra entries
with identical plists, then I do it that way. After all, there are only
two cases (Chinese and German).

-- 
Juan Manuel Macías

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist
  2023-09-09 10:36                 ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
@ 2023-09-09 11:33                   ` Ihor Radchenko
  2023-09-09 23:59                     ` Juan Manuel Macías
  0 siblings, 1 reply; 26+ messages in thread
From: Ihor Radchenko @ 2023-09-09 11:33 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: emacs-orgmode, Max Nikulin

Juan Manuel Macías <maciaschain@posteo.net> writes:

>> I am not sure if making a breaking change to public constant is the best
>> approach.
>> What about simply adding an extra entry:
>> ("de" ....)
>> ("de-de" <copy of "de" property list>)
>> ?
>
> At first I had done it with extra entries, but I was wondering if there
> wasn't a more "economical" way... If you don't mind having extra entries
> with identical plists, then I do it that way. After all, there are only
> two cases (Chinese and German).

I am thinking about something like

(let ((de-plist '(...)))
 `(...
   ("de" ,@de-plist)
   ("de-de" ,@de-plist)
   ...))

This is copy-paste-proof and does not require breaking changes in the
value structure.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist
  2023-09-09 11:33                   ` Ihor Radchenko
@ 2023-09-09 23:59                     ` Juan Manuel Macías
  2023-09-10  7:55                       ` Ihor Radchenko
  0 siblings, 1 reply; 26+ messages in thread
From: Juan Manuel Macías @ 2023-09-09 23:59 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode, Max Nikulin

Ihor Radchenko writes:

> I am thinking about something like
>
> (let ((de-plist '(...)))
>  `(...
>    ("de" ,@de-plist)
>    ("de-de" ,@de-plist)
>    ...))
>
> This is copy-paste-proof and does not require breaking changes in the
> value structure.

I like the idea because it avoids errors, but I don't know if
it's worth it, there being only two cases (at the moment). This other
possibility occurred to me, just to make it easier to read and not have
to navigate to the list of variables:

(let* ((basic-code)
       (shared-plist (lambda (&rest plist)
		 (setq basic-code plist))))
  `(...
    ("de" ,(funcall shared-plist :babel "ngerman" :babel-ini-alt "german" :polyglossia "german" :polyglossia-variant "german" :lang-name "German" :script "latin" :script-tag "latn"))
    ("de-de" ,@basic-code)
    ...
    ("zh" ,(funcall shared-plist :babel-ini-only "chinese" :polyglossia "chinese" :lang-name "Chinese Simplified" :script "hans" :script-tag "hans"))
    ("zh-cn" ,@basic-code)))

Likewise, there being two cases (even in the case of Chinese you could
perfectly omit zh-cn, because it is a new language and there is no
danger of regression), I would say that it is not worth complicating the
code so much.

-- 
Juan Manuel Macías

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist
  2023-09-09 23:59                     ` Juan Manuel Macías
@ 2023-09-10  7:55                       ` Ihor Radchenko
  2023-09-10 11:06                         ` Juan Manuel Macías
  0 siblings, 1 reply; 26+ messages in thread
From: Ihor Radchenko @ 2023-09-10  7:55 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: emacs-orgmode, Max Nikulin

Juan Manuel Macías <maciaschain@posteo.net> writes:

>> (let ((de-plist '(...)))
>>  `(...
>>    ("de" ,@de-plist)
>>    ("de-de" ,@de-plist)
>>    ...))
>>
>> This is copy-paste-proof and does not require breaking changes in the
>> value structure.
>
> I like the idea because it avoids errors, but I don't know if
> it's worth it, there being only two cases (at the moment).

It is not that complex, really. I suggested the above approach because:
1. It is easy to read - clearly, ,@de-plist and ,@de-plist are the same
   thing.
2. If we ever need to change de-plist, we should only do it in a single
   place.

> ... This other
> possibility occurred to me, just to make it easier to read and not have
> to navigate to the list of variables:
>
> (let* ((basic-code)
>        (shared-plist (lambda (&rest plist)
> 		 (setq basic-code plist))))
>   `(...
>     ("de" ,(funcall shared-plist :babel "ngerman" :babel-ini-alt "german" :polyglossia "german" :polyglossia-variant "german" :lang-name "German" :script "latin" :script-tag "latn"))
>     ("de-de" ,@basic-code)
>     ...
>     ("zh" ,(funcall shared-plist :babel-ini-only "chinese" :polyglossia "chinese" :lang-name "Chinese Simplified" :script "hans" :script-tag "hans"))
>     ("zh-cn" ,@basic-code)))

This is less readable compared to having ",@de-plist" - ",@de-plist".
One would need to put extra effort to understand the equality of
(funcall shared-plist ...) and ,@basic-code.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist
  2023-09-10  7:55                       ` Ihor Radchenko
@ 2023-09-10 11:06                         ` Juan Manuel Macías
  2023-09-10 13:36                           ` Ihor Radchenko
  0 siblings, 1 reply; 26+ messages in thread
From: Juan Manuel Macías @ 2023-09-10 11:06 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode, Max Nikulin

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

Ihor Radchenko writes:

> It is not that complex, really. I suggested the above approach because:
> 1. It is easy to read - clearly, ,@de-plist and ,@de-plist are the same
>    thing.
> 2. If we ever need to change de-plist, we should only do it in a single
>    place.


The fact of avoiding copy/paste is already an advantage. New patch
attached with your suggestions. I have simply modified the variable name
a little. de-plist may seem a bit confusing, because there is also de-at
(Austrian German). I have set de-default-plist, since for babel and
polyglossia German (de) and German from Germany (de-de) are the default
variant. The same with the case of the Chinese (Chinese = Chinese
Simplified).

-- 
Juan Manuel Macías

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com


[-- Attachment #2: 0001-ox-latex.el-Fixes-and-improvements-in-org-latex-lang.patch --]
[-- Type: text/x-patch, Size: 22021 bytes --]

From 73057fc06990f861468c397c94b7076d025acbc8 Mon Sep 17 00:00:00 2001
From: Juan Manuel Macias <maciaschain@posteo.net>
Date: Fri, 8 Sep 2023 19:33:25 +0200
Subject: [PATCH] ox-latex.el: Fixes and improvements in
 `org-latex-language-alist'.

* (org-latex-language-alist): Fix a language code (`de-de') removed
when `org-latex-babel-language-alist' and
`org-latex-polyglossia-language-alist' were merged.  To allow language
codes that can have a similar translation in `babel' or `polyglossia'
now in each element of `org-latex-language-alist' car can also be a
list of language codes.  New admitted properties: `:babel-ini-alt',
`:script' and `:script-tag'.  Add language code for ancient Greek.
Fix Afrikaans (was previously removed).  New languages: Chinese
Simplified and Traditional.  Correction of some typos, errors and
inaccuracies.  `let' bindings suggested by Ihor Radchenko.

* (org-latex-guess-babel-language): Some necessary modifications.
---
 lisp/ox-latex.el | 197 ++++++++++++++++++++++++++---------------------
 1 file changed, 109 insertions(+), 88 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 241ef603a..14105c7cc 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -177,94 +177,105 @@
 ;;; Internal Variables
 
 (defconst org-latex-language-alist
-  '(("am" :babel-ini-only "amharic" :polyglossia "amharic" :lang-name "Amharic")
-    ("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 "Bulgarian")
-    ("bn"  :babel-ini-only "bengali" :polyglossia "bengali" :lang-name "Bengali")
-    ("bo"  :babel-ini-only "tibetan" :polyglossia "tibetan" :lang-name "Tibetan")
-    ("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 "Coptic")
-    ("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 "german" :lang-name "German")
-    ("de-at"  :babel "naustrian" :polyglossia "german" :polyglossia-variant "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 "Divehi")
-    ("el"  :babel "greek" :polyglossia "greek" :lang-name "Greek")
-    ("el-polyton"  :babel "polutonikogreek" :polyglossia "greek" :polyglossia-variant "polytonic" :lang-name "Polytonic Greek")
-    ("en"  :babel "american" :polyglossia "english" :polyglossia-variant "usmax" :lang-name "English")
-    ("en-au"  :babel "australian" :polyglossia "english" :polyglossia-variant "australian" :lang-name "English")
-    ("en-gb"  :babel "british" :polyglossia "english" :polyglossia-variant "uk" :lang-name "English")
-    ("en-nz"  :babel "newzealand" :polyglossia "english" :polyglossia-variant "newzealand" :lang-name "English")
-    ("en-us"  :babel "american" :polyglossia "english" :polyglossia-variant "usmax" :lang-name "English")
-    ("eo"  :babel "esperanto" :polyglossia "esperanto" :lang-name "Esperanto")
-    ("es"  :babel "spanish" :polyglossia "spanish" :lang-name "Spanish")
-    ("es-mx"  :babel "spanishmx" :polyglossia "spanish" :polyglossia-variant "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-variant "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 "Interlingua")
-    ("id"  :babel-ini-only "bahasai" :polyglossia "bahasai" :lang-name "Bahasai")
-    ("is"  :babel "icelandic" :polyglossia "icelandic" :lang-name "Icelandic")
-    ("it"  :babel "italian" :polyglossia "italian" :lang-name "Italian")
-    ("kn"  :babel-ini-only "kannada" :polyglossia "kannada" :lang-name "Kannada")
-    ("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" :polyglossia-variant "medieval" :lang-name "Medieval Latin")
-    ("la-ecclesiastic"  :babel "ecclesiasticlatin" :polyglossia "latin" :polyglossia-variant "ecclesiastic" :lang-name "Ecclesiastic Latin")
-    ("lo"  :babel-ini-only "lao" :polyglossia "lao" :lang-name "Lao")
-    ("lt"  :babel "lithuanian" :polyglossia "lithuanian" :lang-name "Lithuanian")
-    ("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 "bokmal" :lang-name "Norwegian Bokmål")
-    ("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 "Piedmontese")
-    ("pt"  :babel "portuges" :polyglossia "portuges" :lang-name "Portuges")
-    ("pt-br"  :babel "brazilian" :polyglossia "brazilian" :lang-name "Portuges")
-    ("rm"  :babel-ini-only "romansh" :polyglossia "romansh" :lang-name "Romansh")
-    ("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 "Syriac")
-    ("ta"  :babel-ini-only "tamil" :polyglossia "tamil" :lang-name "Tamil")
-    ("te"  :babel-ini-only "telugu" :polyglossia "telugu" :lang-name "Telugu")
-    ("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 "Ukrainian")
-    ("ur"  :babel-ini-only "urdu" :polyglossia "urdu" :lang-name "Urdu")
-    ("vi"  :babel "vietnamese" :polyglossia "vietnamese" :lang-name "Vietnamese"))
+  (let ((de-default-plist '(:babel "ngerman" :babel-ini-alt "german" :polyglossia "german" :polyglossia-variant "german" :lang-name "German" :script "latin" :script-tag "latn"))
+        (zh-default-plist '(:babel-ini-only "chinese" :polyglossia "chinese" :polyglossia-variant "simplified" :lang-name "Chinese Simplified" :script "hans" :script-tag "hans")))
+    `(("af" :babel "afrikaans" :polyglossia "afrikaans" :lang-name "Afrikaans" :script "latin" :script-tag "latn")
+      ("am" :babel-ini-only "amharic" :polyglossia "amharic" :lang-name "Amharic" :script "ethiopic" :script-tag "ethi")
+      ("ar" :babel-ini-only "arabic" :polyglossia "arabic" :lang-name "Arabic" :script "arabic" :script-tag "arab")
+      ("ast" :babel-ini-only "asturian" :polyglossia "asturian" :lang-name "Asturian" :script "latin" :script-tag "latn")
+      ("bg"  :babel "bulgarian" :polyglossia "bulgarian" :lang-name "Bulgarian" :script "cyrillic" :script-tag "cyrl")
+      ("bn"  :babel-ini-only "bengali" :polyglossia "bengali" :lang-name "Bengali" :script "bengali" :script-tag: "beng")
+      ("bo"  :babel-ini-only "tibetan" :polyglossia "tibetan" :lang-name "Tibetan" :script "tibetan" :script-tag "tib")
+      ("br"  :babel "breton" :polyglossia "breton" :lang-name "Breton" :script "latin" :script-tag "latn")
+      ("ca"  :babel "catalan" :polyglossia "catalan" :lang-name "Catalan" :script "latin" :script-tag "latn")
+      ("cop"  :babel-ini-only "coptic" :polyglossia "coptic" :lang-name "Coptic" :script "coptic" :script-tag "copt")
+      ("cs"  :babel "czech" :polyglossia "czech" :lang-name "Czech" :script "latin" :script-tag "latn")
+      ("cy"  :babel "welsh" :polyglossia "welsh" :lang-name "Welsh" :script "latin" :script-tag "latn")
+      ("da"  :babel "danish" :polyglossia "danish" :lang-name "Danish" :script "latin" :script-tag "latn")
+      ("de" ,@de-default-plist)
+      ("de-de" ,@de-default-plist)
+      ("de-at" :babel "naustrian" :babel-ini-alt "german-austria" :polyglossia "german" :polyglossia-variant "austrian" :lang-name "German" :script "latin" :script-tag "latn")
+      ("dsb" :babel "lowersorbian" :babel-ini-alt "lsorbian" :polyglossia "sorbian" :polyglossia-variant "lower" :lang-name "Lower Sorbian" :script "latin" :script-tag "latn")
+      ("dv" :polyglossia "divehi" :lang-name "Dhivehi" :script "latin" :script-tag "latn")
+      ("el" :babel "greek" :polyglossia "greek" :lang-name "Greek" :script "greek" :script-tag "grek")
+      ("el-polyton"  :babel "polutonikogreek" :babel-ini-alt "polytonicgreek" :polyglossia "greek" :polyglossia-variant "polytonic" :lang-name "Polytonic Greek" :script "greek" :script-tag "grek")
+      ("grc" :babel "greek.ancient" :babel-ini-alt "ancientgreek" :polyglossia "greek" :polyglossia-variant "ancient" :lang-name "Ancient Greek" :script "greek" :script-tag "grek")
+      ("en" :babel "english" :polyglossia "english" :polyglossia-variant "usmax" :lang-name "English" :script "latin" :script-tag "latn")
+      ("en-au" :babel "australian" :polyglossia "english" :polyglossia-variant "australian" :lang-name "English" :script "latin" :script-tag "latn")
+      ("en-ca" :babel "canadian" :polyglossia "english" :polyglossia-variant "canadian" :lang-name "English" :script "latin" :script-tag "latn")
+      ("en-gb" :babel "british" :polyglossia "english" :polyglossia-variant "uk" :lang-name "English" :script "latin" :script-tag "latn")
+      ("en-nz" :babel "newzealand" :polyglossia "english" :polyglossia-variant "newzealand" :lang-name "English" :script "latin" :script-tag "latn")
+      ("en-us" :babel "american" :polyglossia "english" :polyglossia-variant "usmax" :lang-name "English" :script "latin" :script-tag "latn")
+      ("eo" :babel "esperanto" :polyglossia "esperanto" :lang-name "Esperanto" :script "latin" :script-tag "latn")
+      ("es" :babel "spanish" :polyglossia "spanish" :lang-name "Spanish" :script "latin" :script-tag "latn")
+      ("es-mx" :babel "spanishmx" :polyglossia "spanish" :polyglossia-variant "mexican" :lang-name "Spanish" :script "latin" :script-tag "latn")
+      ("et" :babel "estonian" :polyglossia "estonian" :lang-name "Estonian" :script "latin" :script-tag "latn")
+      ("eu" :babel "basque" :polyglossia "basque" :lang-name "Basque" :script "latin" :script-tag "latn")
+      ("fa" :babel "persian" :polyglossia "persian" :lang-name "Persian" :script "arabic" :script-tag "arab")
+      ("fi" :babel "finnish" :polyglossia "finnish" :lang-name "Finnish" :script "latin" :script-tag "latn")
+      ("fr" :babel "french" :polyglossia "french" :lang-name "French" :script "latin" :script-tag "latn")
+      ("fr-ca" :babel "canadien" :babel-ini-alt "canadian" :polyglossia "french" :polyglossia-variant "canadian" :lang-name "French" :script "latin" :script-tag "latn")
+      ("fur" :babel "friulian" :polyglossia "friulian" :lang-name "Friulian" :script "latin" :script-tag "latn")
+      ("ga" :babel "irish" :polyglossia "gaelic" :polyglossia-variant "irish" :lang-name "Irish Gaelic" :script "latin" :script-tag "latn")
+      ("gd" :babel "scottish" :polyglossia "gaelic" :polyglossia-variant "scottish" :lang-name "Scottish Gaelic" :script "latin" :script-tag "latn")
+      ("gl" :babel "galician" :polyglossia "galician" :lang-name "Galician" :script "latin" :script-tag "latn")
+      ("he" :babel "hebrew" :polyglossia "hebrew" :lang-name "Hebrew" :script "hebrew" :script-tag "hebr")
+      ("hi" :babel "hindi" :polyglossia "hindi" :lang-name "Hindi" :script "devanagari" :script-tag "deva")
+      ("hr" :babel "croatian" :polyglossia "croatian" :lang-name "Croatian" :script "latin" :script-tag "latn")
+      ("hsb" :babel "uppersorbian" :polyglossia "sorbian" :polyglossia-variant "upper" :lang-name "Upper Sorbian" :script "latin" :script-tag "latn")
+      ("hu" :babel "magyar" :polyglossia "magyar" :lang-name "Magyar" :script "latin" :script-tag "latn")
+      ("hy" :babel-ini-only "armenian" :polyglossia "armenian" :lang-name "Armenian" :script "armenian" :script-tag "armn")
+      ("ia" :babel "interlingua" :polyglossia "interlingua" :lang-name "Interlingua" :script "latin" :script-tag "latn")
+      ("id" :babel "indonesian" :polyglossia "malay" :polyglossia-variant "indonesian" :lang-name "Indonesian" :script "latin" :script-tag "latn")
+      ("is" :babel "icelandic" :polyglossia "icelandic" :lang-name "Icelandic" :script "latin" :script-tag "latn")
+      ("it" :babel "italian" :polyglossia "italian" :lang-name "Italian" :script "latin" :script-tag "latn")
+      ("kn" :babel-ini-only "kannada" :polyglossia "kannada" :lang-name "Kannada" :script "kannada" :script-tag "knda")
+      ("la" :babel "latin" :polyglossia "latin" :lang-name "Latin" :script "latin" :script-tag "latn")
+      ("la-classic"  :babel "classiclatin" :polyglossia "latin" :polyglossia-variant "classic" :lang-name "Classic Latin" :script "latin" :script-tag "latn")
+      ("la-medieval"  :babel "medievallatin" :polyglossia "latin" :polyglossia-variant "medieval" :lang-name "Medieval Latin" :script "latin" :script-tag "latn")
+      ("la-ecclesiastic"  :babel "ecclesiasticlatin" :polyglossia "latin" :polyglossia-variant "ecclesiastic" :lang-name "Ecclesiastic Latin" :script "latin" :script-tag "latn")
+      ("lo" :babel-ini-only "lao" :polyglossia "lao" :lang-name "Lao" :script "lao" :script-tag "lao")
+      ("lt" :babel "lithuanian" :polyglossia "lithuanian" :lang-name "Lithuanian" :script "latin" :script-tag "latn")
+      ("lv" :babel "latvian" :polyglossia "latvian" :lang-name "Latvian" :script "latin" :script-tag "latn")
+      ("ml" :babel-ini-only "malayalam" :polyglossia "malayalam" :lang-name "Malayalam" :script "malayalam" :script-tag "mlym")
+      ("mr" :babel-ini-only "marathi" :polyglossia "marathi" :lang-name "Marathi" :script "devanagari" :script-tag "deva")
+      ("ms" :babel "malay" :polyglossia "malay" :polyglossia-variant "malaysian" :lang-name "Malay" :script "latin" :script-tag "latn")
+      ("nb" :babel "norsk" :polyglossia "norwegian" :polyglossia-variant "bokmal" :lang-name "Norwegian Bokmål" :script "latin" :script-tag "latn")
+      ("nl" :babel "dutch" :polyglossia "dutch" :lang-name "Dutch" :script "latin" :script-tag "latn")
+      ("nn" :babel "nynorsk" :polyglossia "norwegian" :polyglossia-variant "nynorsk" :lang-name "Norwegian Nynorsk" :script "latin" :script-tag "latn")
+      ("no" :babel "norsk" :polyglossia "norsk" :lang-name "Norwegian" :script "latin" :script-tag "latn")
+      ("oc" :babel "occitan" :polyglossia "occitan" :lang-name "Occitan" :script "latin" :script-tag "latn")
+      ("pl" :babel "polish" :polyglossia "polish" :lang-name "Polish" :script "latin" :script-tag "latn")
+      ("pms" :babel "piedmontese" :polyglossia "piedmontese" :lang-name "Piedmontese" :script "latin" :script-tag "latn")
+      ("pt"  :babel "portuges" :polyglossia "portuges" :lang-name "Portuges" :script "latin" :script-tag "latn")
+      ("pt-br" :babel "brazilian" :polyglossia "brazilian" :lang-name "Portuges" :script "latin" :script-tag "latn")
+      ("rm" :babel-ini-only "romansh" :polyglossia "romansh" :lang-name "Romansh" :script "latin" :script-tag "latn")
+      ("ro" :babel "romanian" :polyglossia "romanian" :lang-name "Romanian" :script "latin" :script-tag "latn")
+      ("ru" :babel "russian" :polyglossia "russian" :lang-name "Russian" :script "cyrillic" :script-tag "cyrl")
+      ("sa" :babel-ini-only "sanskrit" :polyglossia "sanskrit" :lang-name "Sanskrit" :script "devanagari" :script-tag "deva")
+      ("sk" :babel "slovak" :polyglossia "slovak" :lang-name "Slovak" :script "latin" :script-tag "latn")
+      ("sl" :babel "slovene" :polyglossia "slovene" :lang-name "Slovene" :script "latin" :script-tag "latn")
+      ("sq" :babel "albanian" :polyglossia "albanian" :lang-name "Albanian" :script "latin" :script-tag "latn")
+      ("sr" :babel "serbian" :polyglossia "serbian" :lang-name "Serbian" :script "latin" :script-tag "latn")
+      ("sr-cyrl" :babel-ini-only "serbian-cyrl" :polyglossia "serbian" :lang-name "Serbian" :script "cyrillic" :script-tag "cyrl")
+      ("sr-latn" :babel-ini-only "serbian-latin" :polyglossia "serbian" :lang-name "Serbian" :script "latin" :script-tag "latn")
+      ("sv"  :babel "swedish" :polyglossia "swedish" :lang-name "Swedish" :script "latin" :script-tag "latn")
+      ("syr" :babel-ini-only "syriac" :polyglossia "syriac" :lang-name "Syriac" :script "syriac" :script-tag "syrc")
+      ("ta" :babel-ini-only "tamil" :polyglossia "tamil" :lang-name "Tamil" :script "tamil" :script-tag "taml")
+      ("te" :babel-ini-only "telugu" :polyglossia "telugu" :lang-name "Telugu" :script "telugu" :script-tag "telu")
+      ("th" :babel "thai" :polyglossia "thai" :lang-name "Thai" :script "thai" :script-tag "thai")
+      ("tk" :babel "turkmen" :polyglossia "turkmen" :lang-name "Turkmen" :script "latin" :script-tag "latn")
+      ("tr" :babel "turkish" :polyglossia "turkish" :lang-name "Turkish" :script "latin" :script-tag "latn")
+      ("uk" :babel "ukrainian" :polyglossia "ukrainian" :lang-name "Ukrainian" :script "cyrillic" :script-tag "cyrl")
+      ("ur" :babel-ini-only "urdu" :polyglossia "urdu" :lang-name "Urdu" :script "arabic" :script-tag "arab")
+      ("vi" :babel "vietnamese" :polyglossia "vietnamese" :lang-name "Vietnamese" :script "latin" :script-tag "latn")
+      ("zh" ,@zh-default-plist)
+      ("zh-cn" ,@zh-default-plist)
+      ("zh-tw" :babel-ini-only "chinese-traditional" :polyglossia "chinese" :polyglossia-variant "traditional" :lang-name "Chinese Traditional" :script "hant" :script-tag "hant")))
   "Alist between language code and its properties for LaTeX export.
 
-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:
+In each element of the list car is always the language code 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
 
@@ -275,9 +286,17 @@ list can be:
  exclusively through the new ini files method.  See
  `http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf'
 
+- `:babel-ini-alt' an alternative language name when it is loaded
+  using ini files
+
 - `:polyglossia-variant' the language variant loaded by Polyglossia
 
-- `:lang-name' the actual name of the language.")
+- `:lang-name' the actual name of the language
+
+- `:script' the script name
+
+- `:script-tag' the script otf tag.")
+
 
 (defconst org-latex-line-break-safe "\\\\[0pt]"
   "Linebreak protecting the following [...].
@@ -1660,6 +1679,7 @@ Return the new header."
 		 (assoc language-code org-latex-language-alist)))
 	 (language (plist-get plist :babel))
 	 (language-ini-only (plist-get plist :babel-ini-only))
+         (language-ini-alt (plist-get plist :babel-ini-alt))
 	 ;; 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.
@@ -1691,7 +1711,8 @@ Return the new header."
 	    (replace-regexp-in-string (format
 				       "\\(\\\\babelprovide\\[.*\\]\\)\\({\\)%s}" prov)
 				      (format "\\1\\2%s}"
-					      (or language language-ini-only))
+					      (if language-ini-alt language-ini-alt
+                                                (or language language-ini-only)))
 				      header t)
 	  header)))))
 
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist
  2023-09-10 11:06                         ` Juan Manuel Macías
@ 2023-09-10 13:36                           ` Ihor Radchenko
  0 siblings, 0 replies; 26+ messages in thread
From: Ihor Radchenko @ 2023-09-10 13:36 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: emacs-orgmode, Max Nikulin

Juan Manuel Macías <maciaschain@posteo.net> writes:

> The fact of avoiding copy/paste is already an advantage. New patch
> attached with your suggestions.

Thanks!
Applied, onto main.
I amended the commit message, removing the statement about list of
language identifiers and adding a link to this discussion.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=893c5d085

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6)
  2023-09-09  9:11               ` Ihor Radchenko
  2023-09-09 10:36                 ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
@ 2023-09-10 16:15                 ` Max Nikulin
  2023-09-10 16:52                   ` Ihor Radchenko
  1 sibling, 1 reply; 26+ messages in thread
From: Max Nikulin @ 2023-09-10 16:15 UTC (permalink / raw)
  To: emacs-orgmode

On 09/09/2023 16:11, Ihor Radchenko wrote:
> I am not sure if making a breaking change to public constant is the best
> approach.
> What about simply adding an extra entry:
> ("de" ....)
> ("de-de" <copy of "de" property list>)

Ideally it should not be a public constant. Values should be accessed 
using a helper that returns "de" value for "de-de", "de-ch", "de-it" 
without copies, unless a more specific key is defined as it is done for 
de-at.

I have a hope that properties may be generated from CLDR data, LaTeX 
babel .ini files, etc. However it should be possible to override 
specific properties.



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6)
  2023-09-10 16:15                 ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Max Nikulin
@ 2023-09-10 16:52                   ` Ihor Radchenko
  2023-09-10 21:15                     ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
  2023-09-11 17:06                     ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Max Nikulin
  0 siblings, 2 replies; 26+ messages in thread
From: Ihor Radchenko @ 2023-09-10 16:52 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> On 09/09/2023 16:11, Ihor Radchenko wrote:
>> I am not sure if making a breaking change to public constant is the best
>> approach.
>> What about simply adding an extra entry:
>> ("de" ....)
>> ("de-de" <copy of "de" property list>)
>
> Ideally it should not be a public constant. Values should be accessed 
> using a helper that returns "de" value for "de-de", "de-ch", "de-it" 
> without copies, unless a more specific key is defined as it is done for 
> de-at.

It is already a public constant. And I see no strong reason to change
this (strong enough to justify breaking change).

> I have a hope that properties may be generated from CLDR data, LaTeX 
> babel .ini files, etc. However it should be possible to override 
> specific properties.

For context, I plan to provide a global language-identifier alist that
will link human-readable language names to abbreviations like "de",
"de-de", etc. These abbreviations are not unique to LaTeX, but also used
elsewhere, so there is no guarantee that babel .ini files will always
use a consistent set of language abbreviations.

Thus, auto-generating the alist may be not reliable. At least some
manual overseeing may be needed.

But the general idea of auto-generating this alist is not bad. Patches
welcome, I think. Though I am not sure if we can easily handle tricky
cases like weird installation directory for TeXLive or MikTeX.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist
  2023-09-10 16:52                   ` Ihor Radchenko
@ 2023-09-10 21:15                     ` Juan Manuel Macías
  2023-09-11  8:32                       ` Ihor Radchenko
  2023-09-11 17:06                     ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Max Nikulin
  1 sibling, 1 reply; 26+ messages in thread
From: Juan Manuel Macías @ 2023-09-10 21:15 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Max Nikulin, emacs-orgmode

Ihor Radchenko writes:

> For context, I plan to provide a global language-identifier alist that
> will link human-readable language names to abbreviations like "de",
> "de-de", etc. These abbreviations are not unique to LaTeX, but also used
> elsewhere, so there is no guarantee that babel .ini files will always
> use a consistent set of language abbreviations.

Is the code you're working on in a public repository, to keep an eye on?
As I mentioned in previous messages, that seems like a great improvement
to me. I think it was not a happy decision at the time to use languages
codes to declare the language of the document in Org. Language codes can
be useful at a low level (although they can also lead to confusion), but
I think that for a user level it is more practical to use human-readable
names, as is done in babel or polyglossia, and in general, any user
interface outside of LaTeX. Although babel also allows language codes as
a value for some \babelprovide options (for example, I can define a new
"virtual" language, importing the Greek captions:
\babelprovide[captions=el]{mylanguage}).

In case it helps you, on page. 19 of the Babel manual there is an
exhaustive list of all the languages codes, and on p. 22 a list of
supported (human readable) language names for loading ini files. The
language names of the old ldf files are on p. 49:

https://CTAN/macros/latex/required/babel/base/babel.pdf

-- 
Juan Manuel Macías

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist
  2023-09-10 21:15                     ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
@ 2023-09-11  8:32                       ` Ihor Radchenko
  0 siblings, 0 replies; 26+ messages in thread
From: Ihor Radchenko @ 2023-09-11  8:32 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: Max Nikulin, emacs-orgmode

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Ihor Radchenko writes:
>
>> For context, I plan to provide a global language-identifier alist that
>> will link human-readable language names to abbreviations like "de",
>> "de-de", etc. These abbreviations are not unique to LaTeX, but also used
>> elsewhere, so there is no guarantee that babel .ini files will always
>> use a consistent set of language abbreviations.
>
> Is the code you're working on in a public repository, to keep an eye
> on?

Not really. The story starts from the previous discussion of
translations in your French quote patch:
https://list.orgmode.org/orgmode/87pm3e6qx3.fsf@localhost/

I started writing it and realized that the current situation with all
the translations scattered all over the place (at least, ox libraries,
column view, and org-clock) is not ideal. So, I plan to factor out all
the translations into a separate file (say, org-translate). That file
will also define common interfaces to work with language codes and
translating phrases.

> As I mentioned in previous messages, that seems like a great improvement
> to me. I think it was not a happy decision at the time to use languages
> codes to declare the language of the document in Org. Language codes can
> be useful at a low level (although they can also lead to confusion), but
> I think that for a user level it is more practical to use human-readable
> names, as is done in babel or polyglossia, and in general, any user
> interface outside of LaTeX. Although babel also allows language codes as
> a value for some \babelprovide options (for example, I can define a new
> "virtual" language, importing the Greek captions:
> \babelprovide[captions=el]{mylanguage}).

That's very LaTeX-specific and will be limited to LaTeX export.
I do not see any problem since we have to support languages defined by
language code anyway, for backwards compatibility.

> In case it helps you, on page. 19 of the Babel manual there is an
> exhaustive list of all the languages codes, and on p. 22 a list of
> supported (human readable) language names for loading ini files. The
> language names of the old ldf files are on p. 49:
>
> https://CTAN/macros/latex/required/babel/base/babel.pdf

Thanks!

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6)
  2023-09-10 16:52                   ` Ihor Radchenko
  2023-09-10 21:15                     ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
@ 2023-09-11 17:06                     ` Max Nikulin
  2023-09-12  9:05                       ` Ihor Radchenko
  1 sibling, 1 reply; 26+ messages in thread
From: Max Nikulin @ 2023-09-11 17:06 UTC (permalink / raw)
  To: emacs-orgmode

On 10/09/2023 23:52, Ihor Radchenko wrote:
> Max Nikulin writes:
> 
>> On 09/09/2023 16:11, Ihor Radchenko wrote:
>>> I am not sure if making a breaking change to public constant is the best
>>> approach.
>>> What about simply adding an extra entry:
>>> ("de" ....)
>>> ("de-de" <copy of "de" property list>)
>>
>> Ideally it should not be a public constant. Values should be accessed
>> using a helper that returns "de" value for "de-de", "de-ch", "de-it"
>> without copies, unless a more specific key is defined as it is done for
>> de-at.
> 
> It is already a public constant. And I see no strong reason to change
> this (strong enough to justify breaking change).

Every piece of code accessing this public constant must implement 
fallback from e.g. "de-ch" (or de_CH) to "de". Or to "en" for an 
unsupported language. To achieve consistent behavior it is better to 
provide a helper function.

>> I have a hope that properties may be generated from CLDR data, LaTeX
>> babel .ini files, etc. However it should be possible to override
>> specific properties.
> 
> For context, I plan to provide a global language-identifier alist that
> will link human-readable language names to abbreviations like "de",
> "de-de", etc.

This languange-region identifiers may be written in different way 
(dash/underscore, case), but they are used specify POSIX locale LANG, 
LC_* and extensions like LANGUAGE, so in some cases human friendly names 
may be less convenient.

> Thus, auto-generating the alist may be not reliable. At least some
> manual overseeing may be needed.

Of course, some overrides may be necessary. E.g. it was decided to use 
French inner quotes different from CLDR.

> Though I am not sure if we can easily handle tricky
> cases like weird installation directory for TeXLive or MikTeX.

kpsewhich babel-de.ini
/usr/share/texlive/texmf-dist/tex/generic/babel/locale/de/babel-de.ini





^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6)
  2023-09-11 17:06                     ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Max Nikulin
@ 2023-09-12  9:05                       ` Ihor Radchenko
  2023-09-12 15:22                         ` Max Nikulin
  0 siblings, 1 reply; 26+ messages in thread
From: Ihor Radchenko @ 2023-09-12  9:05 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

>> It is already a public constant. And I see no strong reason to change
>> this (strong enough to justify breaking change).
>
> Every piece of code accessing this public constant must implement 
> fallback from e.g. "de-ch" (or de_CH) to "de". Or to "en" for an 
> unsupported language. To achieve consistent behavior it is better to 
> provide a helper function.

Not necessarily. I mostly thought about some unconventional code that
uses the constant for some reason unexpected to us. We do not want to
break that.

Helper function is certainly a good idea. I did plan for it.

>>> I have a hope that properties may be generated from CLDR data, LaTeX
>>> babel .ini files, etc. However it should be possible to override
>>> specific properties.
>> 
>> For context, I plan to provide a global language-identifier alist that
>> will link human-readable language names to abbreviations like "de",
>> "de-de", etc.
>
> This languange-region identifiers may be written in different way 
> (dash/underscore, case), but they are used specify POSIX locale LANG, 
> LC_* and extensions like LANGUAGE, so in some cases human friendly names 
> may be less convenient.

Sorry, but I do not follow you about the downsides of "human friendly" names.

>> Though I am not sure if we can easily handle tricky
>> cases like weird installation directory for TeXLive or MikTeX.
>
> kpsewhich babel-de.ini

which may not be in the PATH.

> /usr/share/texlive/texmf-dist/tex/generic/babel/locale/de/babel-de.ini

which is not true on Guix, or when installed under /opt via make install.

I did not mean the conventional distros that follow conventional naming
schemes, but the edge cases - I see no point adding automation just to
fight various non-standard user installations later. It will not make
maintenance any easier.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6)
  2023-09-12  9:05                       ` Ihor Radchenko
@ 2023-09-12 15:22                         ` Max Nikulin
  2023-09-12 18:12                           ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
  2023-09-15  9:51                           ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Ihor Radchenko
  0 siblings, 2 replies; 26+ messages in thread
From: Max Nikulin @ 2023-09-12 15:22 UTC (permalink / raw)
  To: emacs-orgmode

On 12/09/2023 16:05, Ihor Radchenko wrote:
> Max Nikulin writes:
> 
>> Every piece of code accessing this public constant must implement
>> fallback from e.g. "de-ch" (or de_CH) to "de". Or to "en" for an
>> unsupported language.
> 
> Not necessarily. I mostly thought about some unconventional code that
> uses the constant for some reason unexpected to us. We do not want to
> break that.

My point is that direct usage of `org-latex-language-alist' should be 
discouraged.

>> This languange-region identifiers may be written in different way
>> (dash/underscore, case), but they are used specify POSIX locale LANG,
>> LC_* and extensions like LANGUAGE, so in some cases human friendly names
>> may be less convenient.
> 
> Sorry, but I do not follow you about the downsides of "human friendly" names.

I am not against them for the "#+language" keyword (however I am unsure 
concerning e.g. human variant for de_IT). In the code I would prefer 
ll_RR locale identifiers as a widely accepted practice.

>>> Though I am not sure if we can easily handle tricky
>>> cases like weird installation directory for TeXLive or MikTeX.
>>
>> kpsewhich babel-de.ini
> 
> which may not be in the PATH.

 From my point of view it is a call to trouble. E.g. I have no idea how 
to determine if LuaLaTeX is installed. Notice that in Debian the 
executable file is provided by

     texlive-latex-base: /usr/bin/lualatex

while actually texlive-luatex must be installed to make lualatex usable. 
Unsure if there is a better way than

     kpsewhich -engine luahbtex lualatex.fmt

and I am not sure that this particular command is reliable enough.

Moreover kpsewhich may help to detect if some packages are available for 
export or a fallback to less advanced ones should be used instead.

>> /usr/share/texlive/texmf-dist/tex/generic/babel/locale/de/babel-de.ini
> 
> which is not true on Guix, or when installed under /opt via make install.

It is the exact reason to use kpsewhich. Besides install paths it 
respects TEXMF environment variables that may additional user-specific 
directories to search path.

> I did not mean the conventional distros that follow conventional naming
> schemes, but the edge cases - I see no point adding automation just to
> fight various non-standard user installations later. It will not make
> maintenance any easier.

I am considering generating of some locale data on a developer machine 
that has all necessary packages installed. In general I am against 
storing of autogenerated files in git, but in this case it may have sense.




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist
  2023-09-12 15:22                         ` Max Nikulin
@ 2023-09-12 18:12                           ` Juan Manuel Macías
  2023-09-15  9:54                             ` Ihor Radchenko
  2023-09-15  9:51                           ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Ihor Radchenko
  1 sibling, 1 reply; 26+ messages in thread
From: Juan Manuel Macías @ 2023-09-12 18:12 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode, Ihor Radchenko

Max Nikulin writes:

>>> Every piece of code accessing this public constant must implement
>>> fallback from e.g. "de-ch" (or de_CH) to "de". Or to "en" for an
>>> unsupported language.
>> Not necessarily. I mostly thought about some unconventional code
>> that
>> uses the constant for some reason unexpected to us. We do not want to
>> break that.
>
> My point is that direct usage of `org-latex-language-alist' should be
> discouraged.

I understand that org-latex-language-alist is a temporary patch waiting
for something better, and is very dependent on
org-latex-guess-babel-language and
org-latex-guess-polyglossia-language[1], two functions that (IMHO)
should be made obsolete in the future. Keep in mind that the old
org-latex-babel-language-alist was more focused on the old babel ldf
files, which is a limited number of languages. Polyglossia also has a
rather limited number of supported languages. The ini files system is
more extensive and more flexible. One can even define new "virtual"
languages using \babelprovide, or write new custom ini files. With this
scenario a closed list like org-latex-language-alist doesn't make much
sense. I actually think that there would be no need for any ad hoc list
of this type for latex, and everything should be delegated to a global
language name translation system like the one Ihor is developing. I
think that would be the first stone to build native Org multilingual
support.

[1] I think also that in this function there was an unhappy decision:
using a syntax that is not from polyglossia but from babel leaves the
user with little freedom of action, since polyglossia has more 'keyval'
options, not only language variants. For example, this (real polyglossia
code):

\usepackage{polyglossia}
\setmainlanguage{spanish}
\setotherlanguage[numerals=arabic]{chinese}

cannot be translated from (fake polyglossia code):

#+language: es
#+LaTeX_Header: \usepackage[chinese,AUTO]{polyglossia}

--
Juan Manuel Macías

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6)
  2023-09-12 15:22                         ` Max Nikulin
  2023-09-12 18:12                           ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
@ 2023-09-15  9:51                           ` Ihor Radchenko
  1 sibling, 0 replies; 26+ messages in thread
From: Ihor Radchenko @ 2023-09-15  9:51 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

>>> Every piece of code accessing this public constant must implement
>>> fallback from e.g. "de-ch" (or de_CH) to "de". Or to "en" for an
>>> unsupported language.
>> 
>> Not necessarily. I mostly thought about some unconventional code that
>> uses the constant for some reason unexpected to us. We do not want to
>> break that.
>
> My point is that direct usage of `org-latex-language-alist' should be 
> discouraged.

I doubt that code using `org-latex-language-alist' is common.
But in any case, before trying to discourage the usage, we need to have
alternative API.

> I am not against them for the "#+language" keyword (however I am unsure 
> concerning e.g. human variant for de_IT). In the code I would prefer 
> ll_RR locale identifiers as a widely accepted practice.

Either way should work. Because we have to support ll_RR/de_IT/etc for
backwards compatibility anyway. This is a minor detail, IMHO.

>>>> Though I am not sure if we can easily handle tricky
>>>> cases like weird installation directory for TeXLive or MikTeX.
>>>
>>> kpsewhich babel-de.ini
>> 
>> which may not be in the PATH.
>
>  From my point of view it is a call to trouble. E.g. I have no idea how 
> to determine if LuaLaTeX is installed. Notice that in Debian the 
> executable file is provided by
>
>      texlive-latex-base: /usr/bin/lualatex
>
> while actually texlive-luatex must be installed to make lualatex usable. 
> Unsure if there is a better way than
>
>      kpsewhich -engine luahbtex lualatex.fmt
>
> and I am not sure that this particular command is reliable enough.
>
> Moreover kpsewhich may help to detect if some packages are available for 
> export or a fallback to less advanced ones should be used instead.

We do not yet have a mechanism for fallback packages.
The idea is reasonable. Not for now though.

>>> /usr/share/texlive/texmf-dist/tex/generic/babel/locale/de/babel-de.ini
>> 
>> which is not true on Guix, or when installed under /opt via make install.
>
> It is the exact reason to use kpsewhich. Besides install paths it 
> respects TEXMF environment variables that may additional user-specific 
> directories to search path.

Makes sense.

>> I did not mean the conventional distros that follow conventional naming
>> schemes, but the edge cases - I see no point adding automation just to
>> fight various non-standard user installations later. It will not make
>> maintenance any easier.
>
> I am considering generating of some locale data on a developer machine 
> that has all necessary packages installed. In general I am against 
> storing of autogenerated files in git, but in this case it may have sense.

This sounds like an extra maintenance burden. I'd prefer not to add it.

What can be done is defining a constant in the code and adding a comment
how to generate its value in case one needs to update the babel language
info in future.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [patch] Fixes and improvements in org-latex-language-alist
  2023-09-12 18:12                           ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
@ 2023-09-15  9:54                             ` Ihor Radchenko
  0 siblings, 0 replies; 26+ messages in thread
From: Ihor Radchenko @ 2023-09-15  9:54 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: Max Nikulin, emacs-orgmode

Juan Manuel Macías <maciaschain@posteo.net> writes:

> [1] I think also that in this function there was an unhappy decision:
> using a syntax that is not from polyglossia but from babel leaves the
> user with little freedom of action, since polyglossia has more 'keyval'
> options, not only language variants. For example, this (real polyglossia
> code):
>
> \usepackage{polyglossia}
> \setmainlanguage{spanish}
> \setotherlanguage[numerals=arabic]{chinese}
>
> cannot be translated from (fake polyglossia code):
>
> #+language: es
> #+LaTeX_Header: \usepackage[chinese,AUTO]{polyglossia}

Since we are up to extending #+language keyword in future, may as well
allow LANG [:key val ...] values.

I expressed similar idea in https://list.orgmode.org/orgmode/87fsc05hkl.fsf@localhost/

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2023-09-15  9:54 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-06 14:55 ox-latex language handling in Org-9.5 vs 9.6 Max Nikulin
2023-09-06 22:20 ` Juan Manuel Macías
2023-09-07 10:38   ` Max Nikulin
2023-09-07 11:50   ` Ihor Radchenko
2023-09-07 14:19     ` Juan Manuel Macías
2023-09-07 14:49       ` Max Nikulin
2023-09-08 10:30         ` Max Nikulin
2023-09-08 14:42           ` Juan Manuel Macías
2023-09-08 19:02             ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Juan Manuel Macías
2023-09-09  9:11               ` Ihor Radchenko
2023-09-09 10:36                 ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
2023-09-09 11:33                   ` Ihor Radchenko
2023-09-09 23:59                     ` Juan Manuel Macías
2023-09-10  7:55                       ` Ihor Radchenko
2023-09-10 11:06                         ` Juan Manuel Macías
2023-09-10 13:36                           ` Ihor Radchenko
2023-09-10 16:15                 ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Max Nikulin
2023-09-10 16:52                   ` Ihor Radchenko
2023-09-10 21:15                     ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
2023-09-11  8:32                       ` Ihor Radchenko
2023-09-11 17:06                     ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Max Nikulin
2023-09-12  9:05                       ` Ihor Radchenko
2023-09-12 15:22                         ` Max Nikulin
2023-09-12 18:12                           ` [patch] Fixes and improvements in org-latex-language-alist Juan Manuel Macías
2023-09-15  9:54                             ` Ihor Radchenko
2023-09-15  9:51                           ` [patch] Fixes and improvements in org-latex-language-alist (was: ox-latex language handling in Org-9.5 vs 9.6) Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.