The declaration \DeclareMathAlphabet{cmd}{encoding}{family}{series}{shape} works to create a new command whose argument would be a font as specified in the declaration. PSNFSS distribution families work with it.
However, I want to get a simple way to declare global math fonts using the following code
\usepackage[]{mathspec}
\newcommand{\mainmathfont}{TeX Gyre Termes}
\setmathsfont(Latin)[]{\mainmathfont}
\setmathsfont(Greek)[]{\mainmathfont}
\setmathsfont(Digits)[]{\mainmathfont}
But it looks like it works only for TeX Gyre, Courier, and Computer Modern font families. How can I modify the commands above to globally customize math fonts?
Here is my source code
\documentclass[]{book}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb, amsfonts}
\DeclareMathAlphabet{\mathsf}{OT1}{pzc}{m}{n}
\usepackage[]{mathspec}
\newcommand{\mainmathfont}{TeX Gyre Termes}
\setmathsfont(Latin)[]{\mainmathfont}
\setmathsfont(Greek)[]{\mainmathfont}
\setmathsfont(Digits)[]{\mainmathfont}
\begin{document}
\begin{equation}
\sum\limits_{i=1}^{\left[ \frac{n}{2} \right]}{\left(\substack{{x_{i, i+1}^{i^{2}}} \\ \\ {\left[ \frac{i+3}{3} \right]}}\right)}
\frac{\sqrt{\mu(i)^{\frac{3}{2}}\left( i^{2} - 1 \right)}}{\sqrt[3]{\rho(i)-2} + \sqrt[3]{\rho(i)-1}} \Omega
\end{equation}
\[
\int_{\mathcal{D}} | \overline{\partial u} |^{2}
\Phi_{0}(z) e^{\alpha |z|^2}
\geq c_{4} \alpha \int_{\mathcal{D}} |u|^{2}\Phi_{0}
e^{\alpha |z|^{2}}
+ c_{5} \delta^{-2} \int_{A} |u|^{2}
\Phi_{0} e^{\alpha |z|^{2}}
\]
$\alpha \medspace \beta \medspace \gamma \medspace \delta \medspace \epsilon \medspace \varepsilon \medspace \zeta \medspace \eta \medspace \theta \medspace \vartheta \medspace \iota \medspace \kappa \medspace \lambda \medspace \mu \medspace \nu \medspace \xi \medspace \pi \medspace \sigma \medspace \varsigma \tau \medspace \upsilon \medspace \phi \medspace \varphi \medspace \chi \medspace \psi \medspace \omega \medspace \Delta \medspace \Xi \medspace \Phi \medspace \Omega \medspace \Psi$
$[1], \thinspace [2], \thinspace [3], \thinspace [4], \thinspace [5], \thinspace [6], \thinspace [7], \thinspace [8], \thinspace [9]$
\begin{equation}
\mathbf{A} =
\begin{pmatrix}
\dfrac{\varphi \cdot X_{n, 1}} {\varphi_{1} \times
\varepsilon_{1}} & (x + \varepsilon_{2})^{2}
& \cdots & (x + \varepsilon_{n - 1})^{n - 1}
& (x + \varepsilon_{n})^{n}\\[10pt]
\dfrac{\varphi \cdot X_{n, 1}} {\varphi_{2} \times
\varepsilon_{1}} & \dfrac{\varphi \cdot X_{n, 2}}
{\varphi_{2} \times \varepsilon_{2}} & \cdots &
(x + \varepsilon_{n - 1})^{n - 1}
& (x + \varepsilon_{n})^{n}\\
\hdotsfor{5}\\
\dfrac{\varphi \cdot X_{n, 1}} {\varphi_{n} \times
\varepsilon_{1}} & \dfrac{\varphi \cdot X_{n, 2}}
{\varphi_{n} \times \varepsilon_{2}} & \cdots
& \dfrac{\varphi \cdot X_{n, n - 1}} {\varphi_{n}
\times \varepsilon_{n - 1}} &
\dfrac{\varphi\cdot X_{n, n}}
{\varphi_{n} \times \varepsilon_{n}}
\end{pmatrix}
+ \mathbf{I}_{n}
\end{equation}
\begin{equation}
I = I_{ ph } -
\overbrace{
I_{ rs }
\biggl[
\mathrm{exp} \biggl(
\frac{V + I R_{s}}{a \thinspace V_{t}}
\biggl) - 1
\biggl]
% overbrace title
}^{ I_{d} }
-
\overbrace{
\frac{V + I R_{s}}{R_{p}}
% overbrace title
}^{I_{p}}
%
\label{eq:I_PV_m}
\end{equation}
\begin{equation}
P_{e, \thinspace WT} =
\left \{
%
\begin{aligned}
%
& 0 & & v_{w} \thinspace < \thinspace v_{ci}
\\
& P_{GCR} (v_{w}) \quad & v_{ci} \thinspace \leq \thinspace & v_{w} \thinspace \leq v_{r}
\\
& P_{r, \thinspace WT} & v_{r} \thinspace \leq \thinspace & v_{w} \thinspace \leq v_{co}
\\
& 0 & & v_{w} > \thinspace v_{co}
%
\end{aligned}
%
\right.
%
\label{eq:WTPSC}
\end{equation}
\begin{equation}
%
\begin{aligned}
%
PMSE_{av} &= \frac{Mean \ Square \ Error}{Average \ of \ Estimations} \times 100\%
\\
& = \frac{ \displaystyle
\frac{1}{n} \sum \limits_{i=1}^{n} {(x_{i}-y_{i})^2}
}
{ \displaystyle
\sum\limits_{i=1}^{n} {y_{i}}
} \times 100\%
%
\end{aligned}
%
\label{eq:PMSE_av}
\end{equation}
\begin{equation}










unicode-mathrather thanmathspec, isn't it? Of course,mathspecstill expects unicode fonts, but wouldn't you usually use it to combine stuff from multiple fonts? – cfr Jul 24 '18 at 22:09\usepackage[T1]{fontenc}is unusable with xetex and probably will do the wrong thing in luatex, so I'm trying to find out what the actual use case is, this seems to be an X-Y question that's starting from the wrong point – David Carlisle Jul 24 '18 at 22:12T1encoding only works withpdfLaTeX, how can someone use accents and get the font customization features ofXeLaTexat the same time? – Al-Motasem Aldaoudeyeh Jul 24 '18 at 22:16TeX Gyre Termeswith something likeptmbut it did not work. – Al-Motasem Aldaoudeyeh Jul 24 '18 at 22:19mathspecif you want to use a PSNFSS font for maths? Just use a traditional configuration for maths and then loadfontspecwithnomathif you want to use opentype fonts for text mode. – cfr Jul 24 '18 at 22:25XeLaTeXand be able to change math fonts? – Al-Motasem Aldaoudeyeh Jul 24 '18 at 22:31