Pedro Andres Aranda Gutierrez <paag...@gmail.com> writes: > @Ihor: do we want this integrated in the existing sections, or does a new > section of multi-lingual for LaTeX make sense?
I believe that we need a new subsection explaining about multilingual export. That section should also absorb the existing paragraphs explaining about polyglossia and babel. > Before I push too much, I'd also ask for a code/documentation review, > knowing that the polyglossia configuration additions need to be documented > in the manual. > +*** Controlling the font configuration for LuaLaTeX and XeLaTeX > + > +The LaTeX templates in =org= have been enriched by a new keyword, > +=[FONTSPEC]=, which act as a placeholder for font specification > +code. This feature is currently supported for LuaLaTeX and XeLaTex. > +(c.f. [[#lualatex-fontspec][below]]). An empty string will be > +generated for PDFLaTeX. We should not mention "new" in the manual. Manual describes the existing state of affairs, and it makes little sense to discuss new/old additions there. Also, your writing is a bit too heavily-focused on technical aspect of LaTeX output. It may be confusing for users not familiar with latex, especially as the opening paragraph. I suggest explaining *why* font configuration is needed in latex and which users should pay attention to this section. > +**** Controlling the font configuration for LuaLaTeX > +:PROPERTIES: > +:custom_id: lualatex-fontspec > +:description: Using org-latex-fontspec-config > +:END: > +#+cindex: LuaLaTeX font configuration Isn't it the same for xelatex/lualatex? > +Org mode uses the variable ~org-latex-fontspec-config~ to map your > +document's fonts to the fonts used in the document. To familiarise > +yourself with fonts and options, read the > +[[http://mirrors.ctan.org/macros/unicodetex/latex/fontspec/fontspec.pdf][~fontspec~ > +package manual]] Part II. This variable be set in your Emacs > +initialisation code, in the file local variables or in the > [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html][directory > +local variable file]] ~.dir-locals.el~ . This reveals the awkwardness of forcing people to use a variable. We need to use keywords in addition to variable. I think that we can take inspiration from https://tecosaur.github.io/emacs-config/config.html#font-collections and introduce an idea of font collections. The font collections are named font presets that can be selected as a whole. (and potentially contributed by users) Then, we can introduce a #+LATEX_FONT: collection-name keyword so that users can set it per-document. We can then easily introduce #+LATEX_FONT as the entry point for people interested in customization. In addition to font collections, we may allow directly tweaking fonts like #+LATEX_FONT: main "TeX Gyre Termes[Scale=MatchLowercase]" and > +If do not want or need any specific configuration for the ~fontspec~ > +package, set ~org-latex-fontspec-config~ to ~nil~. This is the > +default value. This is normally the se when exporting to =beamer=, > +where you most probably want to use the fonts defined in the template. > + > +~org-latex-fontspec-config~ maps the font name used in the > +=\set...font{}= commands defined by the =fontspec= package with the > +font name and optional font features. > .. This sounds advanced. I'd rather move this to `org-latex-fontspec-config' docstring, so that people can read it only when interested in fine-tuning things. > +You can also add fallback fonts for specific font names for specific > +character scripts. These are detected by Emacs during the export > +process. > ... > +#+BEGIN_SRC elisp > +("main" :font "TeX Gyre Termes" > + :fallback (("emoji" . "Noto Color Emoji:mode=harf") > + ("han" . "Noto Serif CJK JP:") > + ("kana" . "Noto Serif CJK JP:"))) > +#+END_SRC > +if Emacs detects characters belonging to the ~emoji~ character set, it > +will include the following fallback definition for the =main= font[fn:49]: This sounds like something intersecting polyglossia, or maybe I miss something? If it is related, maybe we can make use of `org-latex-language-alist' names instead of forcing people to figure out the character set names? > +*Notes* > +- You may use any font name used in the ~\set..font{}~ command by the > + ~fontspec~ package. For example, when using XeLaTeX, you can > + compose Chinese, Japanese or Korean test using the ~xeCJK~ and > + ~xpinyin~ packages. These packages define the ~\\setCKJmainfont{}~, > + ~\\setCJKsansfont{}~ and ~\\setCJKmonofnt{}~ commands. Use the > + ~CJKmain~, ~CJKsans~ and ~CJK mono~ definitions in your documents to > + customise them: > + #+BEGIN_SRC elisp :results none :exports code > +((org-mode . > + ((org-latex-fontspec-config . > + (("main" :font "Noto Serif") > + ("sans" :font "Noto Sans") > + ("mono" :font "Noto Sans Mono") > + ("CJKmain" :font "Noto Serif CJK SC") > + ("CJKsans" :font "Noto Sans CJK SC") > + ("CJKmono" :font "Noto Sans Mono CJK SC")))))) > + #+END_SRC > + I think we can automatically load xeCJK/xpinyin when CJKmain/sans/mono are specified and the relevant scripts are detected in the document. -- 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>