# How to tell XeLaTeX to use one font for italic math and another font for bold math?

I'm striving to get XeLaTeX give me bold Greek symbols in mathematical mode, but I can't figure out how to properly specify things in the preamble. I've been spending hours googling and browsing this forum, and although I've found many extremely hints that helped me remove my compile errors, I'm still not there.

I've just purchased the Greek fonts from Rotis Semi Sans family, so I now have two files RotisSemiSansProGrk-Italic.otf and RotisSemiSansProGrk-Bold.otf, which I expect are sufficient for my purpose: I would like non-bold Latin and Greek letters in math mode to be in italics, and bold Latin and Greek letters (still in math mode) to be upright. Below is my best attempt, which gives me no error on compile and works just fine as far as non-bold Latin and Greek symbols and bold Latin symbols are concerned, but just fails to give me the upright bold Greek symbols:

    \documentclass{article}

\usepackage{mathspec}

\setprimaryfont{Rotis Semi Sans Std}
\setmathsfont(Greek)[Lowercase=Regular]{RotisSemiSansProGrk-Italic}
%\setmathsfont(Greek)[Lowercase=Regular]{RotisSemiSansProGrk-Bold}

\begin{document}

This is some sample text.

\textbf{This is some sample text in bold.}

This is a pair of equations with italic Latin letters:
%%
$a+2b=3c,\quad B=S$

This is a pair of equations with upright and bold Latin letters:
%%
$\mathbf{a}+2\mathbf{b}=3\mathbf{c},\quad \mathbf{B}=\mathbf{S}$

This is a pair of equations with italic Greek letters:
%%
$\alpha+2\beta=3\gamma,\quad \beta=\Sigma$

This is a pair of equations with Greek letters, which I'd like to be upright and bold:
%%
$\mathbf{\alpha}+2\mathbf{\beta}=3\mathbf{\gamma},\quad \mathbf{\beta}=\mathbf{\Sigma}$

\fontspec{RotisSemiSansProGrk-Bold} There I can get bold upright Greek, but not in math mode: α β γ Σ

\end{document}


Here is the output:

If I uncomment the commented line in the preamble, I get my bold Greek symbols in equations, but then any Greek comes out bold. I can't figure out how to tell XeLaTex to use one .otf file for italics and the other one for bold.

I've considered using unicode-math, but it does not support Rotis Semi Sans.

Any help would be welcome!

A hack-like solution using tikz and textgreek extra packages, but independent from the font you of your choice (as far as I can understand).

Extra: A kind of control over thickness.

\documentclass{article}
\usepackage{tikz}
\usepackage[euler]{textgreek}
\usepackage{bm}

\usepackage{mathspec}
\setromanfont{Linux Libertine O}
\newfontfamily{\newfont}{Liberation Serif}
\setmathsfont(Greek)[Lowercase=Regular]{Liberation Serif-Italic}

%%% Joseph Wright's code from here: https://tex.stackexchange.com/a/42332/120578
\makeatletter
\newcommand{\removeabs}[1]{%
\ifcat\relax\noexpand#1%
\expandafter\removeabs@aux@i
\fi
#1%
}
\newcommand*{\removeabs@aux@i}{%
\romannumeral
\if\string\ \removeabs@aux@ii\fi
\expandafter\removeabs@aux@iii\string
}
\newcommand{\removeabs@aux@ii}{}
\long\def\removeabs@aux@ii#1\removeabs@aux@iii{%
-\number\fi\expandafter\z@
}
\newcommand{\removeabs@aux@iii}[1]{\z@}
\makeatother

%%%End of Josheph Wrigth's code

\newcommand{\mybold}[2][0.06]{\tikz[remember picture,inner sep=0,anchor=base,baseline]%
\node(A1){$#2$};%
\foreach \i in{-#1,0,#1}{%
\begin{tikzpicture}[inner sep=0,remember picture,overlay,anchor=center, baseline]\node[xshift=\i pt,yshift=-\i pt] at(A1){$#2$};%
\node[xshift=-\i pt,yshift=\i pt] at(A1){$#2$};%
\end{tikzpicture}}%
}%

%%% Added this code of mine:
\newcommand{\myUpbold}[2][0.06]{\tikz[remember picture,inner sep=0,anchor=base,baseline]%
\node(A1){\csname text\removeabs{#2}\endcsname};%
\foreach \i in{-#1,0,#1}{%
\begin{tikzpicture}[inner sep=0,remember picture,overlay,anchor=center,baseline]\node[xshift=\i pt,yshift=-\i pt] at(A1){\csname text\removeabs{#2}\endcsname};%
\node[xshift=-\i pt,yshift=\i pt] at(A1){\csname text\removeabs{#2}\endcsname};%
\end{tikzpicture}}%
}%
%%%End my code
\begin{document}

This is some sample text.

\textbf{This is some sample text in bold.}

This is a pair of equations with italic Latin letters:
%%
$a+2b=3c,\quad B=S$

This is a pair of equations with upright and bold Latin letters:
%%
$\mathbf{a}+2\mathbf{b}=3\mathbf{c},\quad \mathbf{B}=\mathbf{S}$

This is a pair of equations with italic Greek letters:
%%
$\alpha+2\beta=3\gamma,\quad \beta=\Sigma$

This is a pair of equations with Greek letters, which I'd like to be upright and semi-bold:
%%

\newfont\selectfont
\def\mathbf#1{\myUpbold[0.005]{#1}}
$\mathbf{\alpha}+2\mathbf{\beta}=3\mathbf{\gamma},\quad \mathbf{\beta}=\mathbf{\Sigma}$

This is a pair of equations with Greek letters, which I'd like to be upright and bold:
%%

\newfont\selectfont
\def\mathbf#1{\myUpbold{#1}}
$\mathbf{\alpha}+2\mathbf{\beta}=3\mathbf{\gamma},\quad \mathbf{\beta}=\mathbf{\Sigma}$

This is a pair of equations with Greek letters, which are italic and semi-bold:
%%

\newfont\selectfont
\def\mathbf#1{\mybold[0.005]{#1}}
$\mathbf{\alpha}+2\mathbf{\beta}=3\mathbf{\gamma},\quad \mathbf{\beta}=\mathbf{\Sigma}$

This is a pair of equations with Greek letters, which are italic and really-bold:
%%

\newfont\selectfont
\def\mathbf#1{\mybold[0.09]{#1}}
$\mathbf{\alpha}+2\mathbf{\beta}=3\mathbf{\gamma},\quad \mathbf{\beta}=\mathbf{\Sigma}$

{   \bfseries

There I can get bold upright Greek: α β γ Σ

}
\end{document}


The idea was one old idea of mine and was here: https://tex.stackexchange.com/a/396336/120578

But needed more hack this time.

Used Joseph Wright's code from here: https://tex.stackexchange.com/a/42332/120578

Output:

@koleygr great solution, thank you! I did not think about the "poor man's bold" option, but it gives pretty convincing results. I just changed the font choice in the preamble as follows:

    \setprimaryfont{Rotis Semi Sans Std}
\newfontfamily{\newfont}{Rotis Semi Sans Std}
\setmathsfont(Greek)[Lowercase=Regular]{RotisSemiSansProGrk-Italic}


Here is the output for the equations with Greek symbols (I've added the exponents in the equations to showcase that they are properly spaced from the Greek letter):

• Nice... Glad that helped... (Just noticing that needs double compiling for people who will use it) [Now you can comment I think] Dec 23, 2017 at 0:27