Pedro Andres Aranda Gutierrez <paag...@gmail.com> writes: >> For example, we can make the above 3 fonts defcustoms with default >> values of 'auto. Then, if we detect non-ascii characters in latex >> export, we can auto-detect fonts (from some pre-populated constant list) >> and raise a warning message while proceeding with export. It is probably >> better than producing pdfs with unreadable characters. >> > > That we need to discuss a bit more... It depends on many things, including > the LaTeX compiler. > If we want to take this path, I would make code generation depend on the > compiler and not > on the characters present in a document,
Sure, but choosing the font requires knowing the characters. In particular, we should not do anything if the document is ASCII only. > And if and when we go this road, I'd take the step of getting over it and > using lualatex as the default LaTeX compiler. > My experience in adopting lualatex was that I only had to change font > management, and that the new configuration > was by far simpler. I will be ok if we implement automatic font settings just to lualatex, and only when it is clear that the defaults cannot support all the characters in the document. For changing the default compiler, I am afraid that many users will resist. Especially users who configured everything for pdflatex will not appreciate sudden breakage. > My take on it would be to have a predefined alist of fonts à la > (defcustom ox-latex-default-fonts-alist > '((main . "FreeSerif") > (sans . "FreeSans" > (mono . "FreeMono")) > "An alist for the fonts to be used in a document"))) > > which eventually could be customised by the user and a variable controlling > whether it should > be used or not > > (defcustom ox-latex-use-default-fonts-alist > nil > "Set this variable to non-nil to generate a font list declaration in the > exporter LaTeX header") > > With this two variables, it shouldn't be too difficult to generate the font > control commands for latex, lualatex or xetex. > This should be cleaner than trying to detect non-ascii characters and do > all the stuff, which would, nevertheless, depend > on the LaTeX compiler. > > WDYT? My main idea is making export work "by default" for more users. Without having to set defcustoms. So, I'd prefer detecting non-ascii to be done, if possible. That said, even having the infrastructure to auto-generate the font preamble will be an improvement. -- 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>