Hi Ih
On Thu, 25 Dec 2025 at 20:37, Ihor Radchenko <[email protected]> wrote:
> [ Re-adding mailing list to CC ]
>
> >> I am now digging into the topic again, and it looks like regardless of
> >> fontspec/polyglossia/babel, we *must* specify main/sans/mono/math fonts
> >> separately.
> >
> >
> > Or at least the fonts that you use in your document apart from 'main'.
> > Consider a letter which you write and use a sans serif font in the PDF.
> You
> > need to define 'main' and 'sans' and then
> >
> > # +LATEX_HEADER: \\renewcommand*\\familydefault{\\sfdefault}
>
> I'd say that mono is very likely to be needed for verbatim/code markup.
>
Trust me (after having written the nth letter using the LaTeX letter
class), please.
>
> >> Can we modify the manual, saying upfront both for font configuration and
> >> per-language font configuration that user MUST specify 3-4 font
> >> variants: main, sans, mono, and (maybe) math?
> >>
> >
> > Read the new version. It's closer to reality and the manuals ;-)
>
> What about adding the following to Font configuration for LuaLaTeX and
> XeLaTeX:
>
> Remember that LaTeX requires setting 4 fonts to reliably render all
> parts of the document: =main= (roman) font used for main text, =sans=
> (sans serif) font often used for headings and captions, =mono=
> (monospace) font used for code snippets and verbatim text, and =math=
> font used in equations. If you are using non-ASCII characters in
> main text/headings/code/equations, make sure to specify appropriate
> fonts that can render those characters.
>
It is already there for fontspec:
~fontspec~ distinguishes between the Roman (=main=), the Sans-Serif
(=sans=) and the Monotype (=mono=) font, and can provide fall-backs for
character sets (for example, ~emoji~, ~han~, ~kana~, etc.) that are
not provided by the fonts you use in your document. See
[[#lualatex-fontspec]] for more details. Note that ~fontspec~ does
not work with =pdflatex= compiler. For =pdflatex=, you can control
fonts using font packages (cf. [[#pdflatex-fonts]]).
We recommend using =lualatex= or =xelatex= for reliable non-Latin
language support and using Unicode fonts that include
the non-Latin character sets you use to simplify the configuration
(cf. [[#nonpdflatex-fonts]]).
>
> >> I have no problem with mode=harf. (I am not sure what is the
> >> disagreement about font features/properties).
> >>
> >> Where I do have slight problem is "emoji" (or other script
> >> name). Consider
> >>
> >> ("math" :font "Stix Two Math")
> >> ("main" :font "FreeSerif"
> >> :fallbacks (("mathematical" "Noto Serif")))
> >
> > That has never happened to me. I have seen 'symbol', but never
> > mathematical.
> > And maths are quite well covered with \setmathfont and
> > \usepackage{unicode-math}.
> > If and when we have to cross that bridge, we will see.
>
> Ok. I will agree with your position here for now, but make sure to do
> RFC to hear from others after we finalize other aspects of the variable
> value formats.
>
Reading through your slight objection, I don't think I fully grasp what
your reservations are. We are mapping a string from a message produced by
Emacs to a system font when there are indications that this string point to
a Unicode glyph range not included in the system font we use in the
document.
> >> Please consider reverting and re-applying changes cleanly.
> >>
> > (Hopefully) done...
>
> Looks much better. Thanks!
>
> (setq-default org-latex-fontspec-config
> ...
> #+BEGIN_SRC elisp
> ("mono" :font "TeX Gyre Cursor"
> :features ("Color=blue"
> "Scale=MatchLowercase"))
> ...
>
> As discussed, we should also allow
> ("mono" :font "TeX Gyre Cursor:Color=blue,Scale=MatchLowercase")
>
If you continue reading in the manual:
#+BEGIN_SRC elisp
("mono" :font "TeX Gyre Cursor"
:features ("Color=blue"
"Scale=MatchLowercase"))
#+END_SRC
#+texinfo: @noindent
When you have more than one feature to add, you can also provide them
as a comma-separated list in a string. The following code also would
also define the ~mono~ font as blue and scaled:
#+BEGIN_SRC emacs-lisp
("mono" :font "TeX Gyre Cursor"
:features "Color=blue,Scale=MatchLowercase")
#+END_SRC
> Does it make sense?
>
> You can declare the fallback fonts for missing scripts in the
> ~:fallback~ property based on this list. It consists of an
> associative list that maps the script names as detected by Emacs with
> their fallback system font and optional extra configuration.
>
> We can probably point to
> M-: (char-table-extra-slot char-script-table 0) RET
> as a way to consult what scripts are known by Emacs
> (I took it from 34.6 Character Properties in Elisp manual)
>
Isn't it much easier to tell people too look for the script list generated
by the exporter and starting from there?
And this is what my Emacs shows both in the minibuffer and in the
*Messages* window:
[image: image.png]
Where are the emojis there? I would be extremely confused. Whereas if I see
a messages telling me which scripts are detected during the export process,
I have a (more solid) base to start investigating.
>
> #+BEGIN_SRC emacs-lisp
> (setq-default org-latex-fontspec-config
> '(("main"
> :font "TeX Gyre Termes"
> :fallback (("emoji" . "Noto Color Emoji:mode=harf")
> ("han" . "Noto Serif CJK JP")
> ("kana" . "Noto Serif CJK JP")))
> ("sans" :font "FreeSans")
> ("mono"
> :font "TeX Gyre Cursor"
> :features "Scale=MatchLowercase")
> ("math" :font "TeX Gyre Termes Math")))
> #+END_SRC
>
> I do not like that fallback is an alist, while the main config is using
> plists.
>
> What about
>
> '(("main"
> :font "TeX Gyre Termes"
> :fallback (("emoji" :font "Noto Color Emoji:mode=harf")
> ("han" :font "Noto Serif CJK JP")
> ("kana" :font "Noto Serif CJK JP")))
> ...
>
Would you be more happy if we allowed both?
Next...
>
> ((org-mode
> . ((org-latex-polyglossia-font-config
> . (("en" :font "FreeSerif")
> ("en" :variant "sf" :font "FreeSans")
> ("en" :variant "tt" :font "FreeMono")
> ("he" :font "Hadasim CLM"
> :props "Script=Hebrew")
> ("he" :variant "tt" :font "Miriam Mono CLM"
> :props "Script=Hebrew")
> ("he" :variant "sf" :font "Miriam CLM"
> :props "Script=Hebrew"))))))
>
> Let's drop ("en" :font "FreeSerif"). It implies :variant "rm", but we
> should recommend specifying :variant explicitly. Maybe even make
> :variant mandatory.
>
Once again, if you read through the manual, you will see:
2. ~:variant~: a string for the font variant (e.g. ~sf~ for Sans
Serif, ~tt~ for Mono, ~rm~ for Roman aka. Serif). The variants
are [[https://en.wikibooks.org/wiki/LaTeX/Fonts][the two-letter
codes used in LaTeX for the different font families]]. When no
variant is indicated, it is assumed that the serif font family
(~:variant "rm"~) is implied. It is recommended that you always add
variant =rm= *explicitly*.
Isn't that enough?
Also, what about
> (("en" "main" :font "FreeSerif")
> ("en" "sans" :font "FreeSans")
> ("en" "mono" :font "FreeMono")
> ("he" "main" :font "Hadasim CLM" :features "Script=Hebrew")
> ...)
>
That looks really confusing to me...
Several changes here:
> 1. We follow fontspec variable format closely by specifying important
> arguments in front of the list: "en" "main"
>
I'd rather say we keep the :variant.
> 2. We replace "sf"/"rm"/"tt" with "main"/"sans"/"mono" - this is to
> reduce confusion about latex terminology. (We may still allow
> "sf"/"rm"/"tt" as aliases, for people familiar with LaTeX)
>
My gut feeling is that this will confuse people who browse through the
suggested bibliography.
If we want to be strict, it would be allowing aliases "main","sans" and
"mono" and not the other way round.
3. :props -> :features. As discussed, I want the same things to be named
> with the same keywords.
>
> Same for babel (:props -> :features, "lang" "main/sans/mono")
>
Once again, the fontspec references speak about font features while the
polyglossia/babel sources mostly use properties.
Introducing new terminology will confuse people.
With a ton of reservations, but I would introduce :features as an alias to
:props.
WDYT?
>
> Best,
> Ihor
>
> P.S. Adding the original message verbatim as it was off-list.
>
> Pedro Andres Aranda Gutierrez <[email protected]> writes:
>
> > Hi
> >
> > On Thu, 25 Dec 2025 at 10:41, Ihor Radchenko <[email protected]>
> wrote:
> >
> >> Pedro Andres Aranda Gutierrez <[email protected]> writes:
> >>
> >> > From what I read you would prefer to have fonts as the keyword.
> >> > However that goes _against_ the philosophy of *all* LaTeX packages
> (and
> >> > compilers) I'm trying to handle.
> >> > They all map LaTeX font families and/or a human languages to system
> font
> >> > files.
> >>
> >> Let me explain my logic. I am not coming from LaTeX at all.
> >> I am coming from a simple thinking: I have an org file to be exported to
> >> pdf (by whatever means). I need to specify font for that file.
> >> So, I want to do (setq org-latex-<something> "My font") or even
> >> #+LATEX_FONT: My font. I was hoping that we may (at least sometimes)
> >> avoid setting individual fonts for main/sans/mono/math. That's why I
> >> found ("family" :font "name") construct awkward - if family may be
> >> omitted, then (nil :font "name") is worse than simple ("name").
> >>
> >
> > Sometimes your hopes are just that, hopes...
> >
> > I am now digging into the topic again, and it looks like regardless of
> >> fontspec/polyglossia/babel, we *must* specify main/sans/mono/math fonts
> >> separately.
> >
> >
> > Or at least the fonts that you use in your document apart from 'main'.
> > Consider a letter which you write and use a sans serif font in the PDF.
> You
> > need to define 'main' and 'sans' and then
> >
> > # +LATEX_HEADER: \\renewcommand*\\familydefault{\\sfdefault}
> >
> >
> >> There is theoretically
> >> % If the font has sans and mono variants, this may work
> automatically
> >> \setmainfont{TeX Gyre Termes}[
> >> UprightFont = *-Regular,
> >> BoldFont = *-Bold,
> >> ItalicFont = *-Italic,
> >> BoldItalicFont = *-BoldItalic,
> >> % Sans and mono variants would be auto-detected if they exist
> >> ]
> >> but that is not recommended and is not universal.
> >>
> > I will not have read this. Abandon this path and erase it from your
> memory
> >
> >>
> >> Somehow, I thought that we may get along with a single font for
> >> main/sans/mono for polyglossia via
> >> \newfontfamily\greekfont{⟨font⟩}
> >> However, after more research, it looks like \greekfont is simply an
> >> equivalent of \setmainfont, so it does not do anything about sans/mono,
> >> which need to be specified regardless.
> >>
> >> Can we modify the manual, saying upfront both for font configuration and
> >> per-language font configuration that user MUST specify 3-4 font
> >> variants: main, sans, mono, and (maybe) math?
> >>
> >
> > Read the new version. It's closer to reality and the manuals ;-)
> >
> >
> >> > And for the script is it approx. the same... Our example translates to
> >> > "human" as:
> >> >
> >> > If Emacs finds an emoji, load "noto color emoji" and delegate to
> lualatex
> >> > to see if that contains the missing character.
> >> > The extra property there (mode=harf) tells lualatex to use the
> HarfBuzz
> >> > renderer for glyphs contained in this font file if they are needed.
> >>
> >> > Which, I think, is easier to understand.
> >>
> >> I have no problem with mode=harf. (I am not sure what is the
> >> disagreement about font features/properties).
> >>
> >> Where I do have slight problem is "emoji" (or other script
> >> name). Consider
> >>
> >> ("math" :font "Stix Two Math")
> >> ("main" :font "FreeSerif"
> >> :fallbacks (("mathematical" "Noto Serif")))
> >>
> >
> > That has never happened to me. I have seen 'symbol', but never
> > mathematical.
> > And maths are quite well covered with \setmathfont and
> > \usepackage{unicode-math}.
> > If and when we have to cross that bridge, we will see.
> >
> >> PS: Look at the latest commits in the feature branch. I hope they
> clarify
> >> > your doubts a bit more.
> >>
> >> Commit c2ba3fe72 is a mess. You somehow moved inline footnotes from
> >> non-latex sections into numbered footnotes. Also, I see changes like
> >> -#+texinfo: @noindent
> >> +# +texinfo: @noindent
> >> that have no clear purpose (accidental?)
> >>
> >> Then, there is
> >> +[fn:48] DEFINITION NOT FOUND.
> >> ??
> >>
> >> Please consider reverting and re-applying changes cleanly.
> >>
> > (Hopefully) done...
> >
> >>
> >> --
> >> Ihor Radchenko // yantar92,
> >> Org mode maintainer,
> >> 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>
> >>
> >
> >
> > --
> > 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 1 of the New Koprocracy
>
> --
> Ihor Radchenko // yantar92,
> Org mode maintainer,
> 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>
>
--
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 1 of the New Koprocracy