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" <[email protected]> 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" <[email protected]>
Date: Mon, 31 Aug 2026 12:26:45 +0200
Subject: [PATCH 4/4] Fix initial commit of the fontspec features
* lisp/ox-latex.el (org-latex-fontspec-config): Simplify key
definition. Rationale: the initial proposal makes CJK font users second
class citizens and dealing with all possible names makes the custom
interface unusable.
(org-latex--needs-xecjk): The proposed warning did not convey the origin
of the problem and was grammatically incorrect: subject and predicate
did not concord.
(org-latex--fontspec-preamble): Possibly a glitch when refreshing my
git.
---
lisp/ox-latex.el | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 6512f1de0..d1a998582 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1637,9 +1637,7 @@ (defcustom org-latex-fontspec-config nil
:group 'org-export-latex
:package-version '(Org . "10.0")
:type '(alist
- :key-type (choice (const "main") (const "sans")
- (const "mono") (const "math")
- (string :tag "CJKmain/CJKsans/CJKmono/etc"))
+ :key-type string :tag "Font family name"
:value-type (plist :options
((:font (string :tag "Font name"))
(:features (choice string (repeat string)))
@@ -1917,7 +1915,7 @@ (defun org-latex--needs-xecjk (info)
(warn "`org-latex-fontspec-config' defines CJK fonts. Compile with xelatex instead of %s!" compiler)))
result))
;;;;
-(defun org-latex--fontspec-prelude (info)
+(defun org-latex--fontspec-preamble (info)
"Return the fontspec configuration for the INFO channel as a string.
If COMPILER is \"xelatex\", omit fallback font detection."
--
2.43.0