I was trying to change fonts in my document but run into some problems:
- It seems that the custom font I am using does not support numbers (and symbols) in math mode and instead the default font is being used.
- The same problems appears in the axes: ticks values are displayed in the default font and not in the custom font.
I know for sure that all the fonts in question (and especially Harding Text Web that I am using for maths) support all the symbols, greek letters, and numbers that I would ever need in my document.
My intention is to use some of the fonts I have installed on my computer. I am aware that I could e.g. swap my 'system' Roboto
to the roboto
TeX package. But this is impossible with some other fonts.
Something I noticed: using the ASCII symbol for e.g. sigma inside\mathrm works, but \sigma reverts to the default font anyway. I do not see myself looking up all the UTF/ASCII codes for all symbols and numbers...
I am using TeXShop with XeLaTeX.
Notice how the zeros, infinity symbol, and the greek letters are in Computer Modern
My code:
\documentclass[12pt, oneside]{article}
\usepackage[a4paper, margin=1.5in]{geometry}
\usepackage[english]{babel}
%----- Custom font -------------
\usepackage{fontspec}
\setmainfont{Harding Text Web}
\setsansfont{Roboto}
\setmonofont{Hack}
%-------------------------------
%----- Include maths -----
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%-------------------------
%----- Sans math, math as text --------
\usepackage[italic]{mathastext}
\usepackage{sfmath}
%--------------------------------------
%----- Custom commands -------------
\newcommand{\T}{\textrm{\sf T}}
\newcommand{\A}{\mathbf{A}}
\newcommand{\B}{\mathbf{B}_\kappa}
\newcommand{\uk}{\mathbf{u}_\kappa}
\newcommand{\de}{\mathrm{d}}
\newcommand{\trace}{\mathrm{Tr}}
\newcommand{\Gramian}{\textbf{W}_{\rm c}}
\newcommand{\vect}{\mathrm{vec}}
%-----------------------------------
\begin{document}
\subsection*{Normalization}
$$ \A_{\rm norm} = \frac{\A}{\lambda(\A)_{\rm max} + c} - \textbf{I} $$
%
where $\lambda(\A)_{\rm max}$ denotes the largest eigenvalue of $\A$ and $\textbf{I}$ is the identity matrix.
\subsection*{Controllability Gramian}
$$ \Gramian = \int_{0}^{\infty} \exp(\A\tau)\B\B^\T \exp(\A^\T\tau) \de \tau $$
%
where $^\T$ denotes the transpose of a matrix.
Alternatively, we can obtain the controllability Gramian $ \textbf{W}_{\rm c} $ by solving the Lyapunov equation:
%
$$ \A\textbf{W}_{\rm c} + \textbf{W}_{\rm c}\A^\T + \B\B^\T = 0$$
%
limitation being that it can be only applied to stable systems.
\end{document}