Stefan Nobis writes: > Juan Manuel Macías <maciasch...@posteo.net> writes: > >> 1. There could be a defcustom, something like 'org-latex-use-fontspec' >> (I would vote for nil by default). > > I would vote to activate this by default.
I voted nil because of the available fonts issue. But I think what you say below is a good idea, so it could be activated by default >> (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) > > I would prefer to make it easier to stick with the default fonts. So > only add the font selection commands (including defaultfontfeatures) > when the font variables are non-nil. If no font has been explicitly > chosen, just use the default (in case of lualatex Latin Modern). > > For me, it does not matter whether the 'org-latex-fontspec-*' > variables have a default of nil or set to the Free* fonts or something > else. For my configuration, I would set these variable to nil in order > to get the LaTeX default fonts and would like to go with the default > preamble of Org and then add to this on a per document basis. > > This way, the whole configuration would be a little more composable, I > think. Sounds like a good idea and I agree. If I understand correctly, if the sans, roman, and mono font variables (or any of them) are non-nil, enable font selection. Otherwise, leave the default Latin Modern font. By the way, although I've already commented on it in some post in the parent thread, i think this package I wrote might be useful for doing a quick visual test of a font (including opentype features test), using org-latex-preview (compiling with LuaTeX). It can be done on any font marked in dired. There are three options: insert arbitrary characters, insert the Unicode code of the characters, or display a specimen of the font. The default specimen is in the file specimen.tex, which can be edited to add examples and languages. Some screenshots: https://i.imgur.com/3faKSjA.png https://i.imgur.com/OJfUcO9.png To create font tables I often use the LaTeX package unicodefonttable. An example of usage within Org: #+header: :headers '("\\usepackage{unicodefonttable}") #+begin_src latex :imagemagick yes :iminoptions -density 600 :results raw :results file :file -2256080143431736233.png \displayfonttable*[range-start=1F00,range-end=1FFE]{Old Standard} \displayfonttable*[range-start=0600,range-end=06FF]{FreeSerif} #+end_src A screenshot: https://i.imgur.com/Fwsg7bb.png Maybe it could also be added as an emergency fallback font GNU Unifont: https://unifoundry.com/ Best regards, Juan Manuel