Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-09-05 Thread Ihor Radchenko
"Pedro A. Aranda"  writes:

> this could have waited. I told you that I was going to take a real break 
> from this starting on 01/08. So all the exchange was for you to study 
> the proposals and put your ideas on "frozen water".
>
> We would retake the discussion upon my return.

Sorry. As explained off-list, I was confused by another email.

> +  :group 'org-export-latex
> +  :package-version '(Org . "10.0")
> +  :type 'alist

 We could use a more detailed type definition.
>>>
>>> FFS
>> 
>> Please elaborate.
>> If you disagree with the suggested change in the patch, it would be
>> useful to provide more details on why.
>> 
>> I have improved the :type definition in
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=63f1e2e86
>
> FFS means "for further study". I was just asking for time to reset and 
> to ponder possible solutions away from a screen and a keyboard. Attached 
> is a patch that contains my proposal. I don't want to make anyone a 
> second class citizen.

I see now. I had no idea what FFS means and reached to
https://dictionary.cambridge.org/dictionary/english/ffs
with results suggesting... dissatisfaction with my request.

Now, things are more clear.

>>> 3.- unicode-math is only included when needed, i.e. when we use
>>> \setmonofont.
>> 
>> Ok. I note that you used \RequirePackage. I think \usepackage should be
>> used instead. Given that you asked to apply the patch quickly, I have
>> changed it to \usepackage without waiting for your input in a separate
>> followup patch.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=127788853
>> If you believe that \RequirePackage should be used, let's discuss it
>> later.
>
> OK, \RequirePackage and \usepackage are functionally equivalent in this 
> context. Whatever you think. But please look at the listings export in 
> LaTeX and the docstrings. They referred to \RequirePackage there and I 
> opted for uniformity.

Right. I missed that instance.
If you prefer it, feel free to revert my change.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-09-05 Thread Ihor Radchenko
"Pedro A. Aranda"  writes:

> Subject: [PATCH] Fix fontspec commit

Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6cc7751d0

I changed the commit message to follow the format:

1. "Fix fontspec commit" is not descriptive. The first line of the
   commit message should be understandable without knowing the context,
   even years from now.
   I changed to "ox-latex: Improve wording about CJK".

> * lisp/ox-latex.el (org-latex-fontspec-config): Don't make CJK second
> class citizens

2. I added "." at the end of sentence.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-09-01 Thread Pedro A. Aranda

Hi,

please discard the last patch and use the attached patch. I have been 
able to fix the git synchronisation issues I had. Apparently savannah 
shares part of the ASPATH with the football pirates and periodically 
becomes a colateral damage in the fight between them and the copyright 
holders from here (on top of the damage caused periodically by the LLM 
scavengers).

:-(

/PA

On 31/08/2026 12:55, Pedro A. Aranda wrote:

Hi Ihor,

this could have waited. I told you that I was going to take a real break 
from this starting on 01/08. So all the exchange was for you to study 
the proposals and put your ideas on "frozen water".


We would retake the discussion upon my return.

Anyhow...

On 01/08/2026 11:02, Ihor Radchenko wrote:

"Pedro A. Aranda"  writes:


Subject: [PATCH] LaTeX export: add org-latex-fontspec-config


Applied, onto main, with changes.
I have fixed a number of typos and formatting problems.
I have also moved org-get-string-scripts to org-macs.el to avoid even 
more
circular dependencies in org.el and because it is a pretty generic 
function.

I removed some leftover comments from the earlier iterations that are
no longer relevant.
Finally, there was one missed uncommented (message ...). From our
previous discussion, I judged that it was unintentional omission.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=aab2bc0c9

Additionally, as a separate patch, I reworded one warning.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=de710748b


(org-latex-guess-fontspec): New funciton to insert the fontspec
configuration when the fontspec package is requested in the LaTeX
prelude.


Shouldn't "prelude" be preamble?


As mentioned before, both are used interchangeably, but anyhow...
changed


The patch did not contain this change.
I made the change myself on top of the patch.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0197489cf


Yes, that may have been a glitch when synchronising my git. Remember I 
told you that I was having difficulties accessing savannah...


Now everything is "preamble".


+  :group 'org-export-latex
+  :package-version '(Org . "10.0")
+  :type 'alist


We could use a more detailed type definition.


FFS


Please elaborate.
If you disagree with the suggested change in the patch, it would be
useful to provide more details on why.

I have improved the :type definition in
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=63f1e2e86


FFS means "for further study". I was just asking for time to reset and 
to ponder possible solutions away from a screen and a keyboard. Attached 
is a patch that contains my proposal. I don't want to make anyone a 
second class citizen.
+    (matched (string-match "\\\ 
\usepackage{fontspec}\n" header))


Why trailing \n?
Also, what about \usepackage[...]{fontspec}?

Removed.


You missed my comment about

    Also, what about \usepackage[...]{fontspec}?

I have updated the regexp in
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=33f6197aa


OK>> EXTRA stuff to make the patch as feature-completeas possible:


1.- I included the :languages -> :language in the INFO channel from
feature/all-tex-fonts.


I have removed this change from the applied patch.
The :languages property in the patch is unused by the actual code, so
the news entry is not very useful - you changed nothing for the users.
I think we discussed similar situations in the past - adding new code
APIs that are not used in the code (at least, partially) in anticipation
of new features is not a good practice.


Once again, I just wanted to draw _your_ attention to this and test 
suggest you test it and spend some meditation time on this.


My concern right now is that :languages provides a completely different 
response to #+LANGUAGE: than the current implementation.


If you look at the tests, there are some that expect to know only about 
the last language defined with #+LANGUAGE: (for example in the HTML tests).


I have trouble understanding what the effect of :languages may be in the 
PDF when exporting such documents and wanted _your_ opinion.



We can't use it, however, because some exporters
rely on the original #+LANGUAGE implementation overwriting the current
language.


Could you please elaborate what exactly is broken?


See above


2.- I reintroduced handling CJK fonts with fontspec+xelatex (w/ test and
documentation).


Ok.


3.- unicode-math is only included when needed, i.e. when we use
\setmonofont.


Ok. I note that you used \RequirePackage. I think \usepackage should be
used instead. Given that you asked to apply the patch quickly, I have
changed it to \usepackage without waiting for your input in a separate
followup patch.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=127788853
If you believe that \RequirePackage should be used, let's discuss it
later.


OK, \RequirePackage and \usepackage are functionally equivalent in this 
context. Whatever you think. 

Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-08-31 Thread Pedro A. Aranda

Hi Ihor,

this could have waited. I told you that I was going to take a real break 
from this starting on 01/08. So all the exchange was for you to study 
the proposals and put your ideas on "frozen water".


We would retake the discussion upon my return.

Anyhow...

On 01/08/2026 11:02, Ihor Radchenko wrote:

"Pedro A. Aranda"  writes:


Subject: [PATCH] LaTeX export: add org-latex-fontspec-config


Applied, onto main, with changes.
I have fixed a number of typos and formatting problems.
I have also moved org-get-string-scripts to org-macs.el to avoid even more
circular dependencies in org.el and because it is a pretty generic function.
I removed some leftover comments from the earlier iterations that are
no longer relevant.
Finally, there was one missed uncommented (message ...). From our
previous discussion, I judged that it was unintentional omission.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=aab2bc0c9

Additionally, as a separate patch, I reworded one warning.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=de710748b


(org-latex-guess-fontspec): New funciton to insert the fontspec
configuration when the fontspec package is requested in the LaTeX
prelude.


Shouldn't "prelude" be preamble?


As mentioned before, both are used interchangeably, but anyhow...
changed


The patch did not contain this change.
I made the change myself on top of the patch.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0197489cf


Yes, that may have been a glitch when synchronising my git. Remember I 
told you that I was having difficulties accessing savannah...


Now everything is "preamble".


+  :group 'org-export-latex
+  :package-version '(Org . "10.0")
+  :type 'alist


We could use a more detailed type definition.


FFS


Please elaborate.
If you disagree with the suggested change in the patch, it would be
useful to provide more details on why.

I have improved the :type definition in
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=63f1e2e86


FFS means "for further study". I was just asking for time to reset and 
to ponder possible solutions away from a screen and a keyboard. Attached 
is a patch that contains my proposal. I don't want to make anyone a 
second class citizen.

+(matched (string-match "usepackage{fontspec}\n" header))


Why trailing \n?
Also, what about \usepackage[...]{fontspec}?

Removed.


You missed my comment about

Also, what about \usepackage[...]{fontspec}?

I have updated the regexp in
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=33f6197aa


OK>> EXTRA stuff to make the patch as feature-completeas possible:


1.- I included the :languages -> :language in the INFO channel from
feature/all-tex-fonts.


I have removed this change from the applied patch.
The :languages property in the patch is unused by the actual code, so
the news entry is not very useful - you changed nothing for the users.
I think we discussed similar situations in the past - adding new code
APIs that are not used in the code (at least, partially) in anticipation
of new features is not a good practice.


Once again, I just wanted to draw _your_ attention to this and test 
suggest you test it and spend some meditation time on this.


My concern right now is that :languages provides a completely different 
response to #+LANGUAGE: than the current implementation.


If you look at the tests, there are some that expect to know only about 
the last language defined with #+LANGUAGE: (for example in the HTML tests).


I have trouble understanding what the effect of :languages may be in the 
PDF when exporting such documents and wanted _your_ opinion.



We can't use it, however, because some exporters
rely on the original #+LANGUAGE implementation overwriting the current
language.


Could you please elaborate what exactly is broken?


See above


2.- I reintroduced handling CJK fonts with fontspec+xelatex (w/ test and
documentation).


Ok.


3.- unicode-math is only included when needed, i.e. when we use
\setmonofont.


Ok. I note that you used \RequirePackage. I think \usepackage should be
used instead. Given that you asked to apply the patch quickly, I have
changed it to \usepackage without waiting for your input in a separate
followup patch.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=127788853
If you believe that \RequirePackage should be used, let's discuss it
later.


OK, \RequirePackage and \usepackage are functionally equivalent in this 
context. Whatever you think. But please look at the listings export in 
LaTeX and the docstrings. They referred to \RequirePackage there and I 
opted for uniformity.


/PA

--
Pedro A. Aranda
ox-latex & ox-beamer maintainer

Sagen's Paradeiser! (ORF: Als Radiohören gefährlich war) => write BE!
IA: onomatopeya del rebuzno
2nd year of the New Koprocracy
From b7c0b44386b7e68cbbac1084793c5052fc1ba9c3 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" 
Date: Mon, 31 

Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-08-01 Thread Ihor Radchenko
"Pedro A. Aranda"  writes:

> Subject: [PATCH] LaTeX export: add org-latex-fontspec-config

Applied, onto main, with changes.
I have fixed a number of typos and formatting problems.
I have also moved org-get-string-scripts to org-macs.el to avoid even more
circular dependencies in org.el and because it is a pretty generic function.
I removed some leftover comments from the earlier iterations that are
no longer relevant.
Finally, there was one missed uncommented (message ...). From our
previous discussion, I judged that it was unintentional omission.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=aab2bc0c9

Additionally, as a separate patch, I reworded one warning.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=de710748b

>>> (org-latex-guess-fontspec): New funciton to insert the fontspec
>>> configuration when the fontspec package is requested in the LaTeX
>>> prelude.
>> 
>> Shouldn't "prelude" be preamble?
>
> As mentioned before, both are used interchangeably, but anyhow...
> changed

The patch did not contain this change.
I made the change myself on top of the patch.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0197489cf

>>> +  :group 'org-export-latex
>>> +  :package-version '(Org . "10.0")
>>> +  :type 'alist
>> 
>> We could use a more detailed type definition.
>
> FFS

Please elaborate.
If you disagree with the suggested change in the patch, it would be
useful to provide more details on why.

I have improved the :type definition in
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=63f1e2e86

>>> +(matched (string-match "usepackage{fontspec}\n" 
>>> header))
>> 
>> Why trailing \n?
>> Also, what about \usepackage[...]{fontspec}?
> Removed.

You missed my comment about

   Also, what about \usepackage[...]{fontspec}?

I have updated the regexp in
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=33f6197aa

> EXTRA stuff to make the patch as feature-completeas possible:
>
> 1.- I included the :languages -> :language in the INFO channel from 
> feature/all-tex-fonts. 

I have removed this change from the applied patch.
The :languages property in the patch is unused by the actual code, so
the news entry is not very useful - you changed nothing for the users.
I think we discussed similar situations in the past - adding new code
APIs that are not used in the code (at least, partially) in anticipation
of new features is not a good practice.

> We can't use it, however, because some exporters 
> rely on the original #+LANGUAGE implementation overwriting the current 
> language.

Could you please elaborate what exactly is broken?

> 2.- I reintroduced handling CJK fonts with fontspec+xelatex (w/ test and 
> documentation).

Ok.

> 3.- unicode-math is only included when needed, i.e. when we use 
> \setmonofont.

Ok. I note that you used \RequirePackage. I think \usepackage should be
used instead. Given that you asked to apply the patch quickly, I have
changed it to \usepackage without waiting for your input in a separate
followup patch.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=127788853
If you believe that \RequirePackage should be used, let's discuss it
later.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-07-26 Thread Pedro A. Aranda

So here comes the fontspec...


On 26/07/2026 08:53, Ihor Radchenko wrote:

Pedro Andres Aranda Gutierrez  writes:


Subject: [PATCH 1/2] LaTeX export: add org-latex-fontspec-config


Thanks for the updated patch. The new wording on the manual reads much
smoother compared to the early versions.

Some minor comments inline.


* doc/org-manual.org
(*** Controlling font setup for LuaLaTeX andXeLaTeX): New section
describing org-latex-fontspec-config.


You should just use "(Controlling font setup for LuaLaTeX andXeLaTeX)"
to refer to section.
Also, 'org-latex-fontspec-config' (quoted).


Done


* etc/ORG-NEWS: Annouce org-latex-fontspec-config.


'org-latex-fontspec-config'.
And you missed the section in ORG-NEWS where you put the announcement.


Done


(org-latex-guess-fontspec): New funciton to insert the fontspec
configuration when the fontspec package is requested in the LaTeX
prelude.


Shouldn't "prelude" be preamble?


As mentioned before, both are used interchangeably, but anyhow...
changed


(org-latex-make-preamble): Add the previous function in the chain of
guessers, just before the babel and polyglossia guessers. Fix null class
options or empty string.


Double space between sentences.


Done

(test-ox-latex/lualatex-fontspec-recognised): Test correct
implementation of fontspec handling.
(test-ox-latex/lualatex-fontspec-recognised): Test fallbacks.


You have a duplicate changelog entry here.


Fixed


+This mapping takes place in ~org-latex-fontspec-config~.  Although not
+mandatory, it is recommended that you define mapping for the four
+families.  An example mapping the fonts to use another popular font family,
+[[https://www.gust.org.pl/projects/e-foundry/tex-gyre][the TeX Gyre
+(TG) Collection of Fonts]] could be [fn::We use this family, because
+it is also included in most LaTeX distributions.]:


Nit: Maybe fn can go right after "the TeX Gyre (TG) Collection of
Fonts", not after "could be".


Kept because it looks too cluttered in the PDF.


+As you see, each element in the list maps one of the LaTeX font
+families to a property =:font=, that indicates the font to use for the


~:font~ (it is a code)

done>

+Additionally, you can also define "=:features="[fn::You may also use
+=:props= as a synonym for =:features=.] for each of the fonts.


~:features~, ~:props~.

done>

+the missing glyph set, by using the =:fallback= property for the


~:fallback~ (similar problems later on as well)

done (hoperfully) everywhere>

+*** New custom variable ~org-latex-fontspec-config~
+
+When using LuaLaTeX (or XeLaTeX in a reduced scope), you can use the
+new custom variable ~org-latex-fontspec-config~ to change the
+document's fonts and add fallback fonts for missing scripts.


I think we can refer to the new section in the manual for more details.


Done, I referred to the section.

"Return complete document string after Beamer conversion.
  CONTENTS is the transcoded contents string.  INFO is a plist
  holding export options."
+  ;; Before doing anything else, add the script information
+  ;; to the INFO channel. Used by org-latex-make-preamble
+  ;; to add fallback fonts for lualatex.
+  (setq info (plist-put info
+:doc-scripts
+(org-get-string-scripts contents)))
+


May we do the same in :filter-body instead? Then, we can just arrange
calling org-get-string-scripts in ox-latex without a need to repeat the
procedure in ox-beamer.


Done... hopefully the correct way... At least tests don't fail.




+(defcustom org-latex-fontspec-config nil
+  "An alist with the configuration for the fontspec package.
+
+This configuration will be generated when using lualatex or xelatex.
+
+Each element is defined as
+(`font-name' . `font-plist')
+ where `font-name' one of \"main\", \"sans\", \"mono\" or \"math\"
+ and `font-plist' is a plist. The keys for this plist are
+  `:font': font name for font installed in your system
+  `:features': string or list of strings with font features (optional).
+  `:fallback': an alist of (`script' . `mapping') to map _Emacs_ script names
+   to their fallback font (optional). The exporter will warn you
+   about scripts in your document that need a fallback font."


These are not many details.
We should at least refer to the new manual section.


Done>

+  :group 'org-export-latex
+  :package-version '(Org . "10.0")
+  :type 'alist


We could use a more detailed type definition.


FFS




+(defun org-latex-guess-fontspec (header info)
+  "Add the fontspec package configuration passed in INFO to HEADER.
+
+The HEADER contains \"\\usepackage{fontspec}\",
+and INFO contains fontspec font conguration and
+add the fontspec configuration after the package."
+(when-let* ((fonst (plist-get info :latex-fontspec-config))


fonst?

Replaced with `_'


+(matched (string-match "usepackage{fontspec}\n" header))


Why trailing \n?
Also, what about \usepackage[...]{fontspec}?

Removed.


Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-07-26 Thread Ihor Radchenko
"Pedro A. Aranda"  writes:

 +  ;; Before doing anything else, add the script information
 +  ;; to the INFO channel. Used by org-latex-make-preamble
 +  ;; to add fallback fonts for lualatex.
 +  (setq info (plist-put info
 +:doc-scripts
 +(org-get-string-scripts contents)))
 +
>>> May we do the same in :filter-body instead? Then, we can just arrange
>>> calling org-get-string-scripts in ox-latex without a need to repeat the
>>> procedure in ox-beamer.
>> Will see and put that as the last patch in [1]
>
> I don't see :filter-body begin referenced anywhere in Org except in ox.el:

It is one of the examples of :filters-alist.

> So I could say that the default value for 
> `org-export-filter-body-functions' is a list with the new filter 
> function or I could push that in the body of ox.el (whatever is easier 
> for you).
>
> My reservation is that someone may have personal filters and the font 
> detection filter is overwritten when he/she installs them.
>
> That's my reason for putting this stuff in ox-latex/ox-beamer.

You can follow the pattern used in ox-md:

(org-export-define-derived-backend 'md 'html
  :filters-alist '((:filter-parse-tree . org-md-separate-elements))

The user filters and backend filter are combined together in
`org-export-install-filters'.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-07-26 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

>> > * doc/org-manual.org
>> > (*** Controlling font setup for LuaLaTeX andXeLaTeX): New section
>> > describing org-latex-fontspec-config.
>>
>> You should just use "(Controlling font setup for LuaLaTeX andXeLaTeX)"
>> to refer to section.
>>
> I'm confused... I've seen it with the stars in other log messages...
> anyhow. Fixed

Could you show me those log messages you are referring to?

>> Also, 'org-latex-fontspec-config' (quoted).
>>
> Fixed using `'  if you don't mind.

I do not mind. Either way is fine, as documented in
https://orgmode.org/worg/org-contribute.html#commit-messages

>> And you missed the section in ORG-NEWS where you put the announcement.
>>
> Never noticed that elsewhere ... will do.

I admit that I do not always ask to put it into the changelog.
Mostly mentioned here for completeness.

>> > (org-latex-guess-fontspec): New funciton to insert the fontspec
>> > configuration when the fontspec package is requested in the LaTeX
>> > prelude.
>>
>> Shouldn't "prelude" be preamble?
>>
> Both can be used... but anyhow... changed

We use preamble in some functions in ox-latex. Mixing two is confusing,
IMHO. Also, the new patch does not have "prelude" changed.

>> Nit: Maybe fn can go right after "the TeX Gyre (TG) Collection of
>> Fonts", not after "could be".
>>
> The resulting PDF looks cluttered, so I preferred this way.
>
> All the next were the to enhance readability...

Ok.

>> > +the missing glyph set, by using the =:fallback= property for the
>>
>> ~:fallback~ (similar problems later on as well)
>>
> Changed

But not similar problems. There are many instances of similar issue with
=:prop= instead of ~:prop~. Again, this is minor. If not other comments,
I could simply fix this myself.

>> > +*** New custom variable ~org-latex-fontspec-config~
>> > +
>> > +When using LuaLaTeX (or XeLaTeX in a reduced scope), you can use the
>> > +new custom variable ~org-latex-fontspec-config~ to change the
>> > +document's fonts and add fallback fonts for missing scripts.
>>
>> I think we can refer to the new section in the manual for more details.

Looks like you missed this comment.

>> >"Return complete document string after Beamer conversion.
>> >  CONTENTS is the transcoded contents string.  INFO is a plist
>> >  holding export options."
>> > +  ;; Before doing anything else, add the script information
>> > +  ;; to the INFO channel. Used by org-latex-make-preamble
>> > +  ;; to add fallback fonts for lualatex.
>> > +  (setq info (plist-put info
>> > +:doc-scripts
>> > +(org-get-string-scripts contents)))
>> > +
>>
>> May we do the same in :filter-body instead? Then, we can just arrange
>> calling org-get-string-scripts in ox-latex without a need to repeat the
>> procedure in ox-beamer.
>
> Will see and put that as the last patch in [1]

See my reply below.

>> > +(defcustom org-latex-fontspec-config nil
>> > +  "An alist with the configuration for the fontspec package.
>> > +
>> > +This configuration will be generated when using lualatex or xelatex.
>> > +
>> > +Each element is defined as
>> > +(`font-name' . `font-plist')
>> > + where `font-name' one of \"main\", \"sans\", \"mono\" or \"math\"
>> > + and `font-plist' is a plist. The keys for this plist are
>> > +  `:font': font name for font installed in your system
>> > +  `:features': string or list of strings with font features (optional).
>> > +  `:fallback': an alist of (`script' . `mapping') to map _Emacs_ script
>> names
>> > +   to their fallback font (optional). The exporter will
>> warn you
>> > +   about scripts in your document that need a fallback
>> font."
>>
>> These are not many details.
>> We should at least refer to the new manual section.

Not addressed.

>> > +  :group 'org-export-latex
>> > +  :package-version '(Org . "10.0")
>> > +  :type 'alist
>>
>> We could use a more detailed type definition.

Not addressed.

>> > +(defun org-latex-guess-fontspec (header info)
>> > +  "Add the fontspec package configuration passed in INFO to HEADER.
>> > +
>> > +The HEADER contains \"\\usepackage{fontspec}\",
>> > +and INFO contains fontspec font conguration and
>> > +add the fontspec configuration after the package."
>> > +(when-let* ((fonst (plist-get info :latex-fontspec-config))
>>
>> fonst?
>>
> I'm not using it in the function. It's there for when-let*.

Then, could just use (_ ...)

Each element of VARLIST is a list (SYMBOL VALUEFORM) that binds SYMBOL
to the value of VALUEFORM.  If only the test result is of interest, use
_ as SYMBOL, i.e. (_ VALUEFORM), in which case VALUEFORM is evaluated
and checked for nil but the result is not bound.
An element of VARLIST can also be of the form SYMBOL, in which case the
binding of SYMBOL is checked for nil, only.

>>
>> > +(matched (string-match "usepackage{fontspec}\n"
>> header))
>>
>> Why trailing \n?
>> Also, what about 

Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-07-26 Thread Pedro Andres Aranda Gutierrez
Hi

attached is a new version of the patch with the basic things
(commit message) simple changes in the config, etc. I'll look into
moving the script detection before going on holidays (time permitting)...

On Sun, 26 Jul 2026 at 08:53, Ihor Radchenko  wrote:

> Pedro Andres Aranda Gutierrez  writes:
>
> > Subject: [PATCH 1/2] LaTeX export: add org-latex-fontspec-config
>
> Thanks for the updated patch. The new wording on the manual reads much
> smoother compared to the early versions.
>
> Some minor comments inline.
>
> > * doc/org-manual.org
> > (*** Controlling font setup for LuaLaTeX andXeLaTeX): New section
> > describing org-latex-fontspec-config.
>
> You should just use "(Controlling font setup for LuaLaTeX andXeLaTeX)"
> to refer to section.
>
I'm confused... I've seen it with the stars in other log messages...
anyhow. Fixed


> Also, 'org-latex-fontspec-config' (quoted).
>
Fixed using `'  if you don't mind.

>
> > * etc/ORG-NEWS: Annouce org-latex-fontspec-config.
>
> 'org-latex-fontspec-config'.
>
Fixed

> And you missed the section in ORG-NEWS where you put the announcement.
>
Never noticed that elsewhere ... will do.

>
> > (org-latex-guess-fontspec): New funciton to insert the fontspec
> > configuration when the fontspec package is requested in the LaTeX
> > prelude.
>
> Shouldn't "prelude" be preamble?
>
Both can be used... but anyhow... changed

>
> > (org-latex-make-preamble): Add the previous function in the chain of
> > guessers, just before the babel and polyglossia guessers. Fix null class
> > options or empty string.
>
> Double space between sentences.
>
Fixed

>
> > (test-ox-latex/lualatex-fontspec-recognised): Test correct
> > implementation of fontspec handling.
> > (test-ox-latex/lualatex-fontspec-recognised): Test fallbacks.
>
> You have a duplicate changelog entry here.
>
Fixed

>
> > +This mapping takes place in ~org-latex-fontspec-config~.  Although not
> > +mandatory, it is recommended that you define mapping for the four
> > +families.  An example mapping the fonts to use another popular font
> family,
> > +[[https://www.gust.org.pl/projects/e-foundry/tex-gyre][the TeX Gyre
> > +(TG) Collection of Fonts]] could be [fn::We use this family, because
> > +it is also included in most LaTeX distributions.]:
>
> Nit: Maybe fn can go right after "the TeX Gyre (TG) Collection of
> Fonts", not after "could be".
>
The resulting PDF looks cluttered, so I preferred this way.

All the next were the to enhance readability...

> > +As you see, each element in the list maps one of the LaTeX font
> > +families to a property =:font=, that indicates the font to use for the
>
> ~:font~ (it is a code)

Changed

>
> > +Additionally, you can also define "=:features="[fn::You may also use
> > +=:props= as a synonym for =:features=.] for each of the fonts.
>
> ~:features~, ~:props~.
>
Changed

> > +the missing glyph set, by using the =:fallback= property for the
>
> ~:fallback~ (similar problems later on as well)
>
Changed

>
> > +*** New custom variable ~org-latex-fontspec-config~
> > +
> > +When using LuaLaTeX (or XeLaTeX in a reduced scope), you can use the
> > +new custom variable ~org-latex-fontspec-config~ to change the
> > +document's fonts and add fallback fonts for missing scripts.
>
> I think we can refer to the new section in the manual for more details.
>
> >"Return complete document string after Beamer conversion.
> >  CONTENTS is the transcoded contents string.  INFO is a plist
> >  holding export options."
> > +  ;; Before doing anything else, add the script information
> > +  ;; to the INFO channel. Used by org-latex-make-preamble
> > +  ;; to add fallback fonts for lualatex.
> > +  (setq info (plist-put info
> > +:doc-scripts
> > +(org-get-string-scripts contents)))
> > +
>
> May we do the same in :filter-body instead? Then, we can just arrange
> calling org-get-string-scripts in ox-latex without a need to repeat the
> procedure in ox-beamer.
>

Will see and put that as the last patch in [1]


> > +(defcustom org-latex-fontspec-config nil
> > +  "An alist with the configuration for the fontspec package.
> > +
> > +This configuration will be generated when using lualatex or xelatex.
> > +
> > +Each element is defined as
> > +(`font-name' . `font-plist')
> > + where `font-name' one of \"main\", \"sans\", \"mono\" or \"math\"
> > + and `font-plist' is a plist. The keys for this plist are
> > +  `:font': font name for font installed in your system
> > +  `:features': string or list of strings with font features (optional).
> > +  `:fallback': an alist of (`script' . `mapping') to map _Emacs_ script
> names
> > +   to their fallback font (optional). The exporter will
> warn you
> > +   about scripts in your document that need a fallback
> font."
>
> These are not many details.
> We should at least refer to the new manual section.
>
> > +  :group 'org-export-latex
> > +  :package-version '(Org . "10.0")
> > +  

Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-07-25 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> Subject: [PATCH 1/2] LaTeX export: add org-latex-fontspec-config

Thanks for the updated patch. The new wording on the manual reads much
smoother compared to the early versions.

Some minor comments inline.

> * doc/org-manual.org
> (*** Controlling font setup for LuaLaTeX andXeLaTeX): New section
> describing org-latex-fontspec-config.

You should just use "(Controlling font setup for LuaLaTeX andXeLaTeX)"
to refer to section.
Also, 'org-latex-fontspec-config' (quoted).

> * etc/ORG-NEWS: Annouce org-latex-fontspec-config.

'org-latex-fontspec-config'.
And you missed the section in ORG-NEWS where you put the announcement.

> (org-latex-guess-fontspec): New funciton to insert the fontspec
> configuration when the fontspec package is requested in the LaTeX
> prelude.

Shouldn't "prelude" be preamble?

> (org-latex-make-preamble): Add the previous function in the chain of
> guessers, just before the babel and polyglossia guessers. Fix null class
> options or empty string.

Double space between sentences.

> (test-ox-latex/lualatex-fontspec-recognised): Test correct
> implementation of fontspec handling.
> (test-ox-latex/lualatex-fontspec-recognised): Test fallbacks.

You have a duplicate changelog entry here.

> +This mapping takes place in ~org-latex-fontspec-config~.  Although not
> +mandatory, it is recommended that you define mapping for the four
> +families.  An example mapping the fonts to use another popular font family,
> +[[https://www.gust.org.pl/projects/e-foundry/tex-gyre][the TeX Gyre
> +(TG) Collection of Fonts]] could be [fn::We use this family, because
> +it is also included in most LaTeX distributions.]:

Nit: Maybe fn can go right after "the TeX Gyre (TG) Collection of
Fonts", not after "could be".

> +As you see, each element in the list maps one of the LaTeX font
> +families to a property =:font=, that indicates the font to use for the

~:font~ (it is a code)

> +Additionally, you can also define "=:features="[fn::You may also use
> +=:props= as a synonym for =:features=.] for each of the fonts.

~:features~, ~:props~.

> +the missing glyph set, by using the =:fallback= property for the

~:fallback~ (similar problems later on as well)

> +*** New custom variable ~org-latex-fontspec-config~
> +
> +When using LuaLaTeX (or XeLaTeX in a reduced scope), you can use the
> +new custom variable ~org-latex-fontspec-config~ to change the
> +document's fonts and add fallback fonts for missing scripts.

I think we can refer to the new section in the manual for more details.

>"Return complete document string after Beamer conversion.
>  CONTENTS is the transcoded contents string.  INFO is a plist
>  holding export options."
> +  ;; Before doing anything else, add the script information
> +  ;; to the INFO channel. Used by org-latex-make-preamble
> +  ;; to add fallback fonts for lualatex.
> +  (setq info (plist-put info
> +:doc-scripts
> +(org-get-string-scripts contents)))
> +

May we do the same in :filter-body instead? Then, we can just arrange
calling org-get-string-scripts in ox-latex without a need to repeat the
procedure in ox-beamer.

> +(defcustom org-latex-fontspec-config nil
> +  "An alist with the configuration for the fontspec package.
> +
> +This configuration will be generated when using lualatex or xelatex.
> +
> +Each element is defined as
> +(`font-name' . `font-plist')
> + where `font-name' one of \"main\", \"sans\", \"mono\" or \"math\"
> + and `font-plist' is a plist. The keys for this plist are
> +  `:font': font name for font installed in your system
> +  `:features': string or list of strings with font features (optional).
> +  `:fallback': an alist of (`script' . `mapping') to map _Emacs_ script names
> +   to their fallback font (optional). The exporter will warn you
> +   about scripts in your document that need a fallback font."

These are not many details.
We should at least refer to the new manual section.

> +  :group 'org-export-latex
> +  :package-version '(Org . "10.0")
> +  :type 'alist

We could use a more detailed type definition.

> +(defun org-latex-guess-fontspec (header info)
> +  "Add the fontspec package configuration passed in INFO to HEADER.
> +
> +The HEADER contains \"\\usepackage{fontspec}\",
> +and INFO contains fontspec font conguration and
> +add the fontspec configuration after the package."
> +(when-let* ((fonst (plist-get info :latex-fontspec-config))

fonst?

> +(matched (string-match "usepackage{fontspec}\n" header))

Why trailing \n?
Also, what about \usepackage[...]{fontspec}?

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-07-25 Thread Ihor Radchenko
"Pedro A. Aranda"  writes:

>> I will look into the patches here, but, as a reminder, the only
>> remaining blocker for the feature branch was our discussion about the
>> variable format for *-font-config customization. AFAIK, you included the
>> question about it into your surveys. I am looking forward to seeing the
>> results.
>
> There are no conclusive answers in other topics and this is why I'd like
> to have all things fontspec sorted out first.

Do you mean that the results are mixed? Some people prefer LaTeX way,
while similar fraction of people prefer something more standard?

> The babel and polyglossia configurations allow both closer-to-manual and 
> "abstracted" configurations. They will not be activated unless you use 
> LATEX-MULTI-LANG though. This is to provide transparent support for 
> current documents.

Good. I will look into this set of patches then.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-07-25 Thread Pedro A. Aranda




On 25/07/2026 12:47, Ihor Radchenko wrote:

Pedro Andres Aranda Gutierrez  writes:


Yes! In all these months waiting for something to happen, I have had time
for several iterations refining what was already there and
trying to find a way to help you understand the implications and feel more
comfortable with the changes.
I was just trying to make everything more traceable, with blocks that
address feature by feature incrementally.


Ok. So, I will discard the previous patch.


PS: If you need, take your time to study it. I'll be starting my (very much
needed) Internet-free month.
16 or 18 months will make little difference in the waiting time.


I will look into the patches here, but, as a reminder, the only
remaining blocker for the feature branch was our discussion about the
variable format for *-font-config customization. AFAIK, you included the
question about it into your surveys. I am looking forward to seeing the
results.



Currently, one of the main results is that we must resurrect the CJK font
handling in fontspec + xelatex we had in the beginning.

There are no conclusive answers in other topics and this is why I'd like
to have all things fontspec sorted out first.

The babel and polyglossia configurations allow both closer-to-manual and 
"abstracted" configurations. They will not be activated unless you use 
LATEX-MULTI-LANG though. This is to provide transparent support for 
current documents.


/PA
--
Pedro A. Aranda
ox-latex & ox-beamer maintainer

Sagen's Paradeiser! (ORF: Als Radiohören gefährlich war) => write BE!
IA: onomatopeya del rebuzno
2nd year of the New Koprocracy




Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-07-25 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> Yes! In all these months waiting for something to happen, I have had time
> for several iterations refining what was already there and
> trying to find a way to help you understand the implications and feel more
> comfortable with the changes.
> I was just trying to make everything more traceable, with blocks that
> address feature by feature incrementally.

Ok. So, I will discard the previous patch.

> PS: If you need, take your time to study it. I'll be starting my (very much
> needed) Internet-free month.
> 16 or 18 months will make little difference in the waiting time.

I will look into the patches here, but, as a reminder, the only
remaining blocker for the feature branch was our discussion about the
variable format for *-font-config customization. AFAIK, you included the
question about it into your surveys. I am looking forward to seeing the
results.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-07-25 Thread Pedro Andres Aranda Gutierrez
Yes! In all these months waiting for something to happen, I have had time
for several iterations refining what was already there and
trying to find a way to help you understand the implications and feel more
comfortable with the changes.
I was just trying to make everything more traceable, with blocks that
address feature by feature incrementally.

As said a try to make things easier to digest for you (which obviously
hasn't worked, sorry)

/PA

PS: If you need, take your time to study it. I'll be starting my (very much
needed) Internet-free month.
16 or 18 months will make little difference in the waiting time.

On Sat, 25 Jul 2026 at 10:21, Ihor Radchenko  wrote:

> Pedro Andres Aranda Gutierrez  writes:
>
> > As discussed already, I would like to introduce fontspec configuration
> and
> > fallback fonts incrementally.
>
> I am confused.
> Is this patch a replacement of the earlier patch in
>
> https://list.orgmode.org/orgmode/cao48bk9j8yr8ghwpi5ojcyy4r2r6dkrh_rtz+5-c0oloc-v...@mail.gmail.com/
> ?
>
> --
> Ihor Radchenko // yantar92,
> Org mode maintainer,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

"Sagen's Paradeiser" (ORF: Als Radiohören gefährlich war) => write BE!
Year 2 of the New Koprocracy

*IA: onomatopeya del rebuznar*

This was produced by a human (implied virtues and weaknesses acknowledged)
I'd hate this being fed to any form of AS (sorry AI)...


Re: [PATCH] Initial fontspec-only support for the LaTeX exporter

2026-07-25 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> As discussed already, I would like to introduce fontspec configuration and
> fallback fonts incrementally.

I am confused.
Is this patch a replacement of the earlier patch in
https://list.orgmode.org/orgmode/cao48bk9j8yr8ghwpi5ojcyy4r2r6dkrh_rtz+5-c0oloc-v...@mail.gmail.com/
 ?

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at .
Support Org development at ,
or support my work at