all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] LaTeX export in non-English language [9.6-pre (release_9.5.5-1087-g620a96.dirty @ /home/yantar92/.emacs.d/straight/build/org/)]
Date: Sun, 13 Nov 2022 13:27:23 +0000	[thread overview]
Message-ID: <87bkpb6l38.fsf@posteo.net> (raw)
In-Reply-To: <87r0y78pi2.fsf@localhost> (Ihor Radchenko's message of "Sun, 13 Nov 2022 04:09:09 +0000")

Ihor Radchenko writes:

> On Gentoo, the required package is dev-texlive/texlive-langarabic.
>
> However, installing the package is not yet enough!
>
> With the same file, I am getting missing font errors:
>
> Setting \if@calendar@hebrew
> (/usr/share/texmf-dist/tex/latex/polyglossia/babel-hebrewalph.def)) (./bug.aux
>
> ! Package polyglossia Error: The current latin font  does not contain the "Hebr
> ew" script!
> (polyglossia)                Please define \hebrewfont with \newfontfamily comm
> and.

hmm, yes, I forgot to mention it before... It is necessary to load a
font that has support for Hebrew script, via fontspec package, otherwise
it will return an error, both with Polyglossia and with Babel. It should
be added:

\usepackage{fontspec}
\setmainfont{FreeSerif}

FreeSerif would work, if we do the test with otfinfo:

┌────
│ otfinfo -s /path/to/FreeSerif.ttf
│ 
│ DFLT            Default
│ arab            Arabic
│ beng            Bengali
│ bng2            Bengali v.2
│ copt            Coptic
│ cyrl            Cyrillic
│ dev2            Devanagari v.2
│ glag            Glagolitic
│ goth            Gothic
│ grek            Greek
│ hano            Hanunoo
│ hebr            Hebrew
│ latn            Latin
│ latn.NLD        Latin/Dutch
│ latn.TRK        Latin/Turkish
│ mlym            Malayalam
│ taml            Tamil
│ thai            Thai
└────

The use of the fontspec package (https://www.ctan.org/pkg/fontspec) is
ubiquitous in LuaTeX or XeTeX as long as one wants to have control
over fonts and use extended languages and characters. LuaTeX and XeTeX
use by default (for debatable historical reasons[1]) a Unicode variant
of the Computern Modern font, which has limited language coverage. I
remember that it was commented in a previous thread the possibility of
offering (for example, through a series of variables), a minimum
coverage of fonts to ensure that the documents, at least, are compiled
well and are readable. The user could redefine those variables to use
their preferred fonts. Or have the option that this part of the
preamble is not created, to have full control. I remember that I
proposed this, but there were other interesting proposals. For
example, Timothy commented on the possibility of using fontsets.

In LuaTeX you can define fallback fonts at a low level, using
luaotfload, for example:

┌────
│ \directlua
│ {luaotfload.add_fallback
│   ("myfallback",
│   {
│     "freeserif:mode=harf;script=grek",
│     "freeserif:mode=harf;script=cyrl",
│     "freeserif:mode=harf;script=arab",
│     "freeserif:mode=harf;script=hebr",
│   }
│   )
│ }
│ 
│ \setmainfont{latinmodernroman}[RawFeature={fallback=myfallback}]
└────

In the example above, it is defined Free Serif as fallback font for
Cyrillic, Greek, Arabic and Hebrew scripts. And HarfBuzz is used as
the OpenType rendering engine. As an example, it is valid, although it
is still a typographical aberration, since Free Serif and Latin Modern
are incompatible by design. But that is already an aesthetic issue :-) 

I think that doing something similar in Org would be a bit complicated,
since it would be necessary to guess what languages and scripts are used
in each document. But a number of basic variables like
’defaultromanfont’, ’defaultmonofont’, etc. could be enough. But leaving
the possibility for the user with advanced knowledge of LuaTeX or XeTeX
to have full control, since the configuration of fonts and languages can
become very complex and extensive in multilingual documents.

[1] My admiration for Donald Knuth is limitless, but in the case of the
Computern Modern font I think Knuth (IMHO) was not inspired. It is a
font with many design flaws, difficult to read on the screen. I
understand that it is hard to get rid of such a TeX hallmark as
Computern Modern, but it would be necessary, especially now that TeX
can use truetype and opentype fonts and metafont has been obsolete. The
CM font is also the reason why many people who have never used LaTeX
think that all LaTeX documents look alike.
 


  reply	other threads:[~2022-11-13 13:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10  6:11 [BUG] LaTeX export in non-English language [9.6-pre (release_9.5.5-1087-g620a96.dirty @ /home/yantar92/.emacs.d/straight/build/org/)] Ihor Radchenko
2022-11-10 12:40 ` Juan Manuel Macías
2022-11-11  2:04   ` Ihor Radchenko
2022-11-11 15:08     ` Juan Manuel Macías
2022-11-13  4:09       ` Ihor Radchenko
2022-11-13 13:27         ` Juan Manuel Macías [this message]
2022-11-14  2:38           ` Ihor Radchenko
2022-11-14 22:25             ` Juan Manuel Macías
2022-11-15  2:46               ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkpb6l38.fsf@posteo.net \
    --to=maciaschain@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.