emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] LaTeX export in non-English language [9.6-pre (release_9.5.5-1


From: Juan Manuel Macías
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

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 via email to

[Prev in Thread] Current Thread [Next in Thread]