Tamas Ferenci
Tamas Ferenci

Reputation: 658

Using Unicode characters in math mode with Bookdown (xelatex)

I try to use a Unicode character (U+2685) in math mode with Bookdown, I set mathfont: STIX Two Math (which contains this character), yet the resulting PDF contains an empty space. (At the same time the HTML is correct.)

What's wrong here?

(My best guess is that I should perhaps use the unicode-math package. Unfortunately I can't include it in the preamble.tex as it is incompatible with the mathspec, but at the same time I see no way to get rid of mathspec; it seems to be hardcoded in Bookdown that mathspec is usepackaged when xelatex is used.)

Minimal reproducible example (showing index.Rmd, all other file is the same as with the default new project created with RStudio):

--- 
title: "A Minimal Book Example"
author: "Yihui Xie"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: book
link-citations: yes
description: "This is a minimal example of using the bookdown package to write a book. The output format for this example is bookdown::gitbook."
mainfont: STIX Two Math
mathfont: STIX Two Math
---

# Prerequisites

In text: ⚀.

In math mode: $⚀$.

This is how the result looks like:

enter image description here

Upvotes: 1

Views: 618

Answers (1)

Tamas Ferenci
Tamas Ferenci

Reputation: 658

This issue is now solved (after an update to rmarkdown), see here.

Upvotes: 1

Related Questions