[Top][All Lists]

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

Re: [possible patch] Basic fontspec code for LuaLaTeX and XelaTeX (was "

From: Ihor Radchenko
Subject: Re: [possible patch] Basic fontspec code for LuaLaTeX and XelaTeX (was "LaTeX export: when is it more useful...")
Date: Mon, 11 Jul 2022 10:19:51 +0800

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Considering some discussions in the parent thread, I think maybe it
> wouldn't hurt to ensure a minimal preamble when the output is compiled
> with LuaLaTeX or XelaTeX, so that some very basic fontspec configuration
> is loaded to be able to read PDFs in non-Latin scripts.


> But before proposing the patch directly, I'd like to discuss its
> structure. I think (IMHO) that a certain balance should be ensured
> between a) users who don't want to mess with fontspec and want something
> more out-of-the-box and b) users who prefer to be in control when
> compiling with LuaTeX and XeTeX.
> I think maybe it would be nice to let LaTeX do the work, via a
> conditional from the iftex package (idea taken from pandoc).
> The structure of the patch could be this:
> 1. There could be a defcustom, something like 'org-latex-use-fontspec'
> (I would vote for nil by default).

Does it mean that unicode text (like це or 这个) will not be exported by default?

> 2. There would be three variables for the default fonts: roman, sans and
> mono. By default, the FreeSerif, FreeSans and FreeMono fonts could be
> set as default value, since they are very ubiquitous and have a very
> good coverage for non-Latin scripts.

But can someone check if Free* fonts are available on Windows and Mac by
default? If not, can we distribute these fonts with Org?

> 3. A variable (something like 'org-latex-fontspec-default-configuration') 
> would return something like this:
> (format
>  \\usepackage{iftex}
>  \\ifpdftex
>  \\relax
>  \\else
>  \\usepackage{fontspec}
>  \\usepackage{unicode-math}
>  \\defaultfontfeatures{Scale=MatchLowercase}
>  \\defaultfontfeatures[\\rmfamily]{Ligatures=TeX}
>  \\setmainfont{%s}
>  \\setsansfont{%s}
>  \\setmonofont{%s}
>  \\fi
>  org-latex-fontspec-mainfont
>  org-latex-fontspec-sansfont
>  org-latex-fontspec-monofont)
> (and this string would be added at some point to org-latex-make-preamble)

Makes sense. Though I'd rather use format-spec instead to allow
arbitrary order of variable formatting.

> 4. Conclusion: I think the good thing about letting LaTeX do the
> conditional work with iftex is that it saves us less invasive code on
> our end. I also think that other more complex approaches, such as
> searching for the fonts present in the system and adding them according
> to the document scripts, would lead us to a completely slippery slope.
> Of course, a list of recommended free-licensed fonts could be included
> in the documentation.

This unified preamble approach is consistent with what we do now.
However, our currently used large preambles will slow down compilation.

As I recall, Timothy has been working on simplifying preamble
generation. If we do not put unnecessary packages into preamble,
compilation will be significantly faster.

If Timothy can come up with a patch some time soon, I'd prefer to have a
more targeted preamble. Otherwise, the proposed approach is the way to


reply via email to

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