emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Grant Rettke <gcr@wisdomandwonder.com>
To: Org-mode <emacs-orgmode@gnu.org>
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	[thread overview]
Message-ID: <CAAjq1megN9V0T40hS0aw=Tzh+XSuq6vOSOS8u3_DU+iWX7MPTw@mail.gmail.com> (raw)

Good evening,

A few months ago I migrated my Org-Mode configuration from PDFLaTeX to XeTeX.
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 read
any documentation on XeTeX, I know enough about LaTeX to stay out of trouble.
When I got around to choosing my primary fonts though I got a taste of my lack
of Unicode knowledge.

The fontspec let's you set up the three main fonts like this

\setmainfont{DejaVu Serif}
\setsansfont{DejaVu Sans}[Scale=MatchLowercase]
\setmonofont{DejaVu Sans Mono}[Scale=MatchLowercase]

And I figured those would cover at least the emoticon Unicode block. Nope!
Empty boxes appear the first time I want to use a 😈. Sheesh. Never 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 changing
my three font configurations. And I'm not the only one.

The ucharclass https://github.com/Pomax/ucharclasses packages exists to solve
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-font-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: 🁝.}
\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, figure 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 characters
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 XeTeX
users.

Regards,

Grant

                 reply	other threads:[~2018-06-16  4:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAjq1megN9V0T40hS0aw=Tzh+XSuq6vOSOS8u3_DU+iWX7MPTw@mail.gmail.com' \
    --to=gcr@wisdomandwonder.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).