From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Rettke Subject: Want to automatically specify different mainfont in XeTeX and wondering if a custom exporter is the right way Date: Fri, 15 Jun 2018 23:48:28 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fU38b-0004pv-1X for emacs-orgmode@gnu.org; Sat, 16 Jun 2018 00:48:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fU38Z-0005EV-Om for emacs-orgmode@gnu.org; Sat, 16 Jun 2018 00:48:33 -0400 Received: from mail-lf0-x236.google.com ([2a00:1450:4010:c07::236]:36875) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fU38Z-0005Ck-Fk for emacs-orgmode@gnu.org; Sat, 16 Jun 2018 00:48:31 -0400 Received: by mail-lf0-x236.google.com with SMTP id g21-v6so17441022lfb.4 for ; Fri, 15 Jun 2018 21:48:31 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org-mode Good evening, A few months ago I migrated my Org-Mode configuration from PDFLaTeX to XeTe= X. It is great using "real fonts" and Unicode symbols, and my Org-Mode configuration only needed a few changes to use XeTeX. Although I didn't rea= d any documentation on XeTeX, I know enough about LaTeX to stay out of troubl= e. When I got around to choosing my primary fonts though I got a taste of my l= ack of Unicode knowledge. The fontspec let's you set up the three main fonts like this \setmainfont{DejaVu Serif} \setsansfont{DejaVu Sans}[Scale=3DMatchLowercase] \setmonofont{DejaVu Sans Mono}[Scale=3DMatchLowercase] And I figured those would cover at least the emoticon Unicode block. Nope! Empty boxes appear the first time I want to use a =F0=9F=98=88. Sheesh. Nev= er knew how much work font authors face to cover the code blocks. Now I do. Anyway I am left scratching my head how to use emoticons in my documents without changi= ng my three font configurations. And I'm not the only one. The ucharclass https://github.com/Pomax/ucharclasses packages exists to sol= ve this topic. It detects the Unicode block for the characters and changes the font in place. However #1 I couldn't get it working and #2 the package has = no maintainer. After looking at it I don't think I can do it so I looked for another way to handle this. This post https://tex.stackexchange.com/questions/25249/how-do-i-use-a-particular-fon= t-for-a-small-section-of-text-in-my-document explains how to change the font for a particular region. It works great. I tested it out for my use cases and it works fine. Here is an example file: \documentclass[]{article} \usepackage{fontspec} \newfontfamily\xxtx{Symbola} \begin{document} The domino doesn't exist in my default font. {\xxtx But it does in here: =F0=9F=81=9D.} \end{document} The ability to use Unicode in Org-Mode and seamlessly export it to PDF via XeTeX is so nice. And it looks pretty easy to handle different fontx in the code. So I figured I could write an exporter that extends ox-latex exporter= to do this for me. The exporter would be basic: it would look at every single character, figur= e out if it is in a "special to me" block, and if it is use a different font. My plan is that simple. Questions for you: - What do you think of this? - What would you do here? - Would you use it? My use case is pretty simple, being able to use emoticons and APL character= s and stuff. And I can't be the only one that would use it. I'm reaching out here though because I'm pretty out of touch in regards to other Org-Mode Xe= TeX users. Regards, Grant