0

I want to change the math fonts from the standard latex fonts to a font that matches more closely to my text font (as I am using a custom font for the text). However, I do not want to use the text font in math mode because the text font has issues with overlapping etc...

I believe the solution is to just choose an existing math font that goes well with my text font. Here is a minimal example of how I am doing this:

\documentclass[a4paper]{article} 
\usepackage{amsmath,amssymb}
\usepackage{mathspec}
\setmathfont(Digits,Latin,Greek){Latin Modern Math}

\begin{document}

Let $\mathbf{x} \in \mathcal{X}$, $\pi \in \Pi$, and $\gamma \in [0,1]$. Now, see the following example equation: \begin{align} J(\mathbf{x}) = \mathbb{E} \left[ \sum_{i=0}^{N-1} \gamma^i c(\mathbf{x}_i, \pi(\mathbf{x})) \right] \end{align}

\end{document}

In the example, I use Latin Modern Math, but how do I see a list of the available fonts for mathspec?

Note: I am compiling using XeLaTeX using Overleaf.

Ralff
  • 283
  • mathspec is a package specifically for using text fonts for mathematics (As you already realized, this is always a bit problematic and it is better to use a real math font instead). If you want to use a math font for math, you should use unicode-math instead. – Marcel Krüger Jul 05 '21 at 16:45
  • @AlanMunn This does indeed answer the question I asked. Thanks! – Ralff Jul 05 '21 at 16:46
  • @MarcelKrüger Okay. I see. How can I set to unicode math? The math fonts in my equation seem to be set as the text font after I change the main text font to a custom type. This is why I was using mathspec as I was able to get the math font to show properly. – Ralff Jul 05 '21 at 16:48
  • @Ralff Replace {mathspec} with {unicode-math} and remove (Digits,Latin,Greek). (Latin Modern Math looks rather similar to the default math setup though, so it's not very obvious. But the font is not supposed to look like in your mathspec example where most operators come from other fonts and default letters are upright.) – Marcel Krüger Jul 05 '21 at 17:00

0 Answers0