[ 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.

>> 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.

>> 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.

>> 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")

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)

    #+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")))
                            ...

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.

Also, what about
(("en" "main" :font "FreeSerif")
 ("en" "sans" :font "FreeSans")
 ("en" "mono" :font "FreeMono")
 ("he" "main" :font "Hadasim CLM" :features "Script=Hebrew")
 ...)

Several changes here:
1. We follow fontspec variable format closely by specifying important
   arguments in front of the list: "en" "main"
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)
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")

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>

Reply via email to