Feeding the code
\documentclass{article}
\pagestyle{empty}
\usepackage[ngerman]{babel}
\usepackage{mathtools}%%% loads amsmath internally
\mathtoolsset{mathic=true} %%% See http://tex.stackexchange.com/a/3496
\usepackage[math-style=ISO]{unicode-math}%%% In general, we wish to have ISO style.
\setmainfont[Ligatures=TeX]{TeX Gyre Termes}%%% Times in general.
\setsansfont{TeX Gyre Heros}[Scale=0.88]%%% scaling somewhat ok.
\setmonofont{TeX Gyre Cursor}%%% no explicit turning on ligatures for the monospaced font.
\setmathfont[Ligatures=TeX]{TeX Gyre Termes Math}%%% Times-like math font.
\newcommand{\concreteSort}[1]{\mathsf{#1}}
\begin{document}
\begin{tabular}{ll}
Normal math italic Latin:& \(Sigma\).\\ %%% product of five variables S, i, g, m, a.
Normal math italic Greek:& \(\Sigma\).\\ %%% a single variable.
Upright sans-serif math Latin:&\(\concreteSort{Sigma}\).\\%%% a constant with a fixed meaning.
Upright sans-serif math Greek:&\(\concreteSort{\upSigma}\).%%% another constant with a fixed meaning. Where to get an upright sans-serif math Σ without changing the rest?
\end{tabular}
\end{document}
to xelatex
leads to
As you see above, the last Σ has serifs. How to get rid of the serifs for upright math capital Greek without changing the rest, i.e., maintaining the formatting of the remaining text and math? Yes, we wish to stay with [xe|lua]latex
. I expect that a different font is needed, but which one? How to switch to it only for the upright capital Greek math letters? Ideally, \concreteSort
should produce the same (upright, sans-serif) formatting for Latin and capital Greek, but it doesn't.
EDIT: Inspired by http://tex.stackexchange.com/a/537218, I fed
\documentclass{standalone}
\usepackage[ngerman]{babel}
\usepackage{mathtools}%%% loads amsmath internally
\mathtoolsset{mathic=true} %%% See http://tex.stackexchange.com/a/3496
\usepackage[math-style=ISO]{unicode-math}%%% In general, we wish to have ISO style.
\setmainfont[Ligatures=TeX]{TeX Gyre Termes}%%% Times in general.
\setsansfont{TeX Gyre Heros}[Scale=0.88]%%% %%% this scaling factor is a middle way between MatchUppercase and MatchLowercase.
\setmonofont{TeX Gyre Cursor}%%% no explicit turning on ligatures for the monospaced font.
\setmathfont[Ligatures=TeX]{TeX Gyre Termes Math}%%% Times-like math font.
\setmathfontface\mathsans{TeX Gyre Heros}%%% suggested by http://tex.stackexchange.com/a/537218
\begin{document}\noindent%
\begin{tabular}{@{}rl@{}}
\verb!\(\mathsf{\mupSigma}\)!:&\(\mathsf{\mupSigma}\)\\
\verb!\(\mathsans{\mupSigma}\)!:&\(\mathsans{\mupSigma}\)
\end{tabular}
\end{document}
to xelatex
and obtained that \mathsans{\mupSigma}
is larger than \mathsf{\mupSigma}
:
Why? Which one do I need for an identifier Σ with a fixed meaning? Here is some test code:
\documentclass{article}
\pagestyle{empty}
\usepackage[ngerman]{babel}
\usepackage{mathtools}%%% loads amsmath internally
\mathtoolsset{mathic=true} %%% See http://tex.stackexchange.com/a/3496
\usepackage[math-style=ISO]{unicode-math}%%% In general, we wish to have ISO style.
\defaultfontfeatures{Scale=MatchUppercase}
\setmainfont[Ligatures=TeX]{TeX Gyre Termes}%%% Times in general.
\setsansfont{TeX Gyre Heros} %[Scale=0.88]%%% this scaling factor is a middle way between MatchUppercase and MatchLowercase.
\setmonofont{TeX Gyre Cursor}%%% no explicit turning on ligatures for the monospaced font.
\setmathfont[Ligatures=TeX]{TeX Gyre Termes Math}%%% Times-like math font.
\setmathfontface\mathsans{TeX Gyre Heros}%%% suggested by http://tex.stackexchange.com/a/537218
\newcommand{\concreteSortSf}[1]{\mathsf{#1}}
\newcommand{\concreteSortSfup}[1]{\mathsfup{#1}}
\newcommand{\concreteSortSans}[1]{\mathsans{#1}}
\begin{document}\noindent%
\begin{tabular}{@{}rl@{}}
\verb!\mathsf!: & Serif \(\mathsf{sans}\) serif.\\
\verb!\mathsans!: & Serif \(\mathsans{sans}\) serif.
\end{tabular}
With \verb!\mathsf!:\\
Consider the sort \(\concreteSortSf{Queue}\,\concreteSortSf{\mupSigma}\) and the function signature
\[f\colon\ \,\concreteSortSf{Queue}\,\concreteSortSf{\mupSigma}\ \to\ \concreteSortSf{Stack}\,\concreteSortSf{\mupSigma}\ .\]
With \verb!\mathsfup!:\\
Consider the sort \(\concreteSortSfup{Queue}\,\concreteSortSfup{\mupSigma}\) and the function signature\[f\colon\ \,\concreteSortSfup{Queue}\,\concreteSortSfup{\mupSigma}\ \to\ \concreteSortSfup{Stack}\,\concreteSortSfup{\mupSigma}\ .\]
With \verb!\mathsans!:\\
Consider the sort \(\concreteSortSans{Queue}\,\concreteSortSans{\mupSigma}\) and the function signature\[f\colon\ \,\concreteSortSans{Queue}\,\concreteSortSans{\mupSigma}\ \to\ \concreteSortSans{Stack}\,\concreteSortSans{\mupSigma}\ .\]
\end{document}
The result is good for \mathsf
and \mathsans
(and the question still remains as which one to use, at least conventionally) and bad for \mathsfup
, as it produces a slanted 𝛴 with serifs:
\mathsf
is smaller because you loaded\setsansfont
with aScale=
parameter. See my answer for a recommendation on how to handle that.\defaultfontfeatures{Scale=MatchUppercase}
as I did, or add the[Scale=MatchUppercase]
option to each font command, except\setmainfont
.\mathsf
and\mathsans
both get you the Σ from TeX Gyre Heros, and there are no problems with either in practice. I think\mathsans
is semantically cleaner, but\mathsfup
is.more standard.\sansmath
if you do not define aversion=sans
.\setmathfontface
. The details are in the link in my answer.