I'm using the awesome-cv
class file (from here) to write a statement, but I'm unhappy with the math fonts. Specifically, I don't like the result of using \mathbb
. Also, math operators (even predefined ones like \log
) are italicized while I would like them to be as in \mathrm
(as shown below).
I tried installing a different font (Palatino) in the fonts directory, but this did not affect the math font at all.
I would even be willing to change the font entirely using, e.g., \usepackage{mathpazo}
, but it doesn't seem to change anything, probably due to specifications in the awesome-cv.cls
file.
The awesome-cv.cls
file includes the line \RequirePackage[math-style=TeX,vargreek-shape=unicode]{unicode-math}
, and it turned out that configuring the math font with this package was most of my problem.
Some useful posts:
Changing the operator font with unicode-math loaded, Unicode-math changes font outside of range, lost symbols with unicode-math
Final update thanks to Davislor's comments.
MWE:
% Important note:
% This template must be compiled with XeLaTeX, the below lines will ensure this
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass[letterpaper]{awesome-cv}
\geometry{left=2cm, top=1.5cm, right=2cm, bottom=2cm, footskip=.5cm}
\fontdir[fonts/]
% math packages
%\usepackage{amssymb} % throws errors/conflicts
\usepackage{amsfonts}
\usepackage{amsmath}
% math commands
% new commands
\renewcommand{\C}{\mathbb C}
\newcommand{\R}{\mathbb R}
\newcommand{\Q}{\mathbb Q}
\newcommand{\Z}{\mathbb Z}
% new operators
\DeclareMathOperator{\Gal}{Gal}
\setmathfont[Path=fonts/STIXv2.0.0/OTF/]{STIX2Math.otf}
%\setmathfont[Path=fonts/,range=\sqrt]{SourceSansPro-Regular.otf}
\setmathfont[range=\mathnormal,Path=fonts/]{SourceSansPro-It.otf}
\ExplSyntaxOn
\makeatletter
\renewcommand{\operator@font}{\um_switchto_mathsf:}
\makeatother
\ExplSyntaxOff
%\setmainfont[Path=fonts/]{SourceSansPro-Regular.otf}
%\setmathfont[Path=fonts/]{SourceSansPro-It.otf}
\begin{document}
%----------------------------------------------------------------------------------------
% LETTER CONTENT
%----------------------------------------------------------------------------------------
\begin{cvletter}
%------------------------------------------------
$$
\log(N) \qquad \mathrm{log}(N)
$$
$$
\C \quad \R \quad \Q \quad \Z
$$
$$
\Gal(K/\Q) \quad \mathrm{Gal}(K/\Q)
$$
$$
\varphi: X \to Y
$$
\end{cvletter}
\end{document}
Thanks for any help!
fontspec
. You therefore probably want to loadunicode-math
and use the\setmathfont
command. (You would want\setmathfont[range=it]{SourceSansPro-It.otf}
and so on to match your text font.) You might also be able to usemathspec
.\setmathfont{STIX Two Math}
, and then override one or more of the math alphabets (up, it, by up, bfit, etc.). I would also suggest you set\defaultfontfeatures{Scale=MatchLowercase}
before you start declaring any fonts. That will ensure they come out properly scaled.\mathrm{Gal}
problem. Since you appear to be using this font only for operator names, the simplest workaround is to use\operatorname{Gal}
. You can also, however,\setmathfont[range=up]{SourceSansPro-Regular.otf}
and use\symup
, as well as overriding\setoperatorfont
and\setmathrm
if you need to.