emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Want to automatically specify different mainfont in XeTeX and wondering if a custom exporter is the right way
@ 2018-06-16  4:48 Grant Rettke
  0 siblings, 0 replies; only message in thread
From: Grant Rettke @ 2018-06-16  4:48 UTC (permalink / raw)
  To: Org-mode

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-16  4:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-16  4:48 Want to automatically specify different mainfont in XeTeX and wondering if a custom exporter is the right way Grant Rettke

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).