Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In knitr, can't get metropolis theme to work with \mathbf and greek letters, or with \bm from the bm package #375

Open
lfmcmillan opened this issue Aug 3, 2020 · 2 comments

Comments

@lfmcmillan
Copy link

lfmcmillan commented Aug 3, 2020

If I try to include \mathbf around greek letters, or try to use the \bm command instead which is actually the better way of producing bold greek letters, I get various errors when trying to compile

Minimal non-working example:


title: Greek symbols, mathbf and bm with Metropolis
output:
beamer_presentation:
theme: "metropolis"
latex_engine: xelatex
header-includes:

  • \usefonttheme{professionalfonts}
  • \setsansfont[BoldFont={Fira Sans SemiBold}]{Fira Sans Book}
  • \usepackage{bm}

require(knitr)

Greek symbols

This $\mathbf{\theta}$ should be a greek symbol using

\mathbf{\theta}

This should be a greek symbol using

\bm{\theta}

Neither works.

@lfmcmillan
Copy link
Author

To clarify, $\bm{x}$ also breaks, but $\mathbf{x}$ is ok, but neither works for greek letters

@maxnoe
Copy link

maxnoe commented Jan 12, 2021

@lfmcmillan You should use the package unicode-math together with the mtheme and the font "Fira Math" is especially suited as companion to Fira Sans: https://github.com/firamath/firamath.

With unicode-math you then have to use \symbf{\theta}

Minimal example:

\documentclass[1610]{beamer}

\usefonttheme{professionalfonts}
\usetheme{metropolis}

\usepackage{fontspec}
\setsansfont[BoldFont={Fira Sans SemiBold}]{Fira Sans Book}

\usepackage{amsmath}
\usepackage{amssymb}

\usepackage[
  mathrm=sym,
  math-style=ISO,  % Greek letters also in italics
  bold-style=ISO,  % bold letters also in italics
]{unicode-math}

\setmathfont{Fira Math}
% top is still missing in Fira Math, get it from another font
\setmathfont[range={\top}]{XITS Math}



\begin{document}
  \begin{frame}[t]{Example}
    \begin{align}
      \symbf{\theta} &= (1, 2, 3)^\top \\
    \theta_0 &= 1
    \end{align}
  \end{frame}
\end{document}

There are several other math fonts and you should always set one. Go with "Latin Modern Math" for the "TeX" font.

With Fira Math (and \top from XITS Math):

test

With Latin Modern Math:

test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants