Comments (8)
Sans-serif italic/upright greek letters are not defined in Unicode.
from unicode-math.
Some fonts may support these letters alternatively. For XITS, you can use ss02
to load the sans-serif version:
\documentclass{article}
\usepackage{unicode-math}
\setmathfont[StylisticSet=2]{XITSMath-Regular.otf}
\begin{document}
\[ \alpha + \beta + \Gamma \]
\end{document}
from unicode-math.
What can I do if I want some greek letters be sans-serif but a lot more others don't?
For example:
X^\mu_\nu = X^{\mu\rho} \eta_{\rho_\nu} = \mathsf{X \eta}
from unicode-math.
It's clearly impossible to use a glyph that doesn't exist in a font, unless you modify the font and add the things you need.
from unicode-math.
No unicode-math
issue here.
from unicode-math.
What can I do if I want some greek letters be sans-serif but a lot more others don't?
For example:
X^\mu_\nu = X^{\mu\rho} \eta_{\rho_\nu} = \mathsf{X \eta}
Here is a suggestion that relies on the XITS Math fonts and makes use of StylisticSet = 2
, as @stone-zeng suggested:
% !TeX program = xelatex
\documentclass{article}
\usepackage[mathsf=sym]{unicode-math}
\setmathfont{XITSMath-Regular.otf}[BoldFont = XITSMath-Bold.otf]
\newcommand{\mitsanseta}{%
\textit{%
\fontspec{XITSMath-Regular.otf}[
StylisticSet = 2,
Color = red
]%
\miteta%
}%
}
\newcommand{\msanseta}{%
\textit{%
\fontspec{XITSMath-Regular.otf}[
StylisticSet = 2,
Color = blue
]%
\mupeta%
}%
}
\begin{document}
\[ X^\mu_\nu = X^{\mu\rho} \eta_{\rho_\nu} = \mathsf{X \eta \msanseta} \mathsfit{X \eta \mitsanseta} \mathsfup{X \eta \msanseta} \mathbfsf{X \eta} \mathbfsfit{X \eta} \]
\boldmath
\[ X^\mu_\nu = X^{\mu\rho} \eta_{\rho_\nu} = \mathsf{X \eta \msanseta} \mathsfit{X \eta \mitsanseta} \mathsfup{X \eta \msanseta} \mathbfsf{X \eta} \mathbfsfit{X \eta} \]
\end{document}
Result:
I have made use of the Color
attribute only for the purpose of illustration, of course.
from unicode-math.
You can use FiraSans:
\documentclass{article}
\usepackage{firamath-otf}
\newcommand{\mitsanseta}{%
\textit{%
\fontspec{FiraMath-Regular.otf}[
StylisticSet = 2,
Color = red
]%
\miteta%
}%
}
\newcommand{\msanseta}{%
\textit{%
\fontspec{FiraMath-Regular.otf}[
StylisticSet = 2,
Color = blue
]%
\mupeta%
}%
}
\begin{document}
\[ X^\mu_\nu = X^{\mu\rho} \eta_{\rho_\nu} = \mathsf{X \eta \msanseta}
\mathsfit{X \eta }\mitsanseta \mathsfup{X \eta \msanseta} \mathbfsf{X \eta}
\mathbfsfit{X \eta} \]
\boldmath
\[ X^\mu_\nu = X^{\mu\rho} \eta_{\rho_\nu} = \mathsf{X \eta \msanseta}
\mathsfit{X \eta}\mitsanseta \mathsfup{X \eta \msanseta}
\mathbfsf{X \eta} \mathbfsfit{X \eta} \]
\end{document}
from unicode-math.
You can use FiraSans:
Sure, but @Firestar-Reimu wants math to be serif in general and only select symbols to be sans-serif:
What can I do if I want some greek letters be sans-serif but a lot more others don't?
It is true, though, that one take the upright sans-serif glyphs out of many different math (or even text fonts) that include Greek letters. For instance,
% !TeX program = xelatex
\documentclass{article}
\usepackage{xcolor}
\usepackage[mathsf=text]{unicode-math}
\setmainfont{XITS-Regular.otf}[
ItalicFont = XITS-Italic.otf,
BoldFont = XITS-Bold.otf,
BoldItalicFont = XITS-BoldItalic.otf,
]
\setsansfont{FiraSans-Regular.otf}[
ItalicFont = FiraSans-Italic.otf,
BoldFont = FiraSans-Bold.otf,
BoldItalicFont = FiraSans-BoldItalic.otf,
Scale = 0.9,
]
\setmonofont{FiraMono-Regular.otf}[
BoldFont = FiraMono-Bold.otf,
Scale = 0.9,
]
\setmathfont{XITSMath-Regular.otf}[BoldFont = XITSMath-Bold.otf]
\setmathfontface{\mathsf}{FiraMath-Regular.otf}[
BoldFont = FiraMath-Bold.otf,
Color = cyan
]
% FiraMath-Bold.otf is NOT included in CTAN; it must be downloaded from
% https://github.com/firamath/firamath/releases/tag/v0.4-beta-3.
\setmathfont{FiraMath-Regular.otf}[
BoldFont = FiraMath-Bold.otf,
range = {sfup, sfit->it},
Color = teal,
]
\setmathfont{FiraMath-Bold.otf}[
range = {bfsfup->up, bfsfit->it},
Color = orange,
]
\newcommand{\mitsanseta}{%
\textit{%
\fontspec{FiraMath-Regular.otf}[
Color = red
]%
\miteta%
}%
}
\newcommand{\msanseta}{%
\textup{%
\fontspec{FiraMath-Regular.otf}[
Color = blue
]%
\mupeta%
}%
}
\AtBeginDocument{%
\renewcommand{\mbfsanseta}{%
\textbf{%
\fontspec{FiraMath-Bold.otf}[
Color = green
]%
\mupeta%
}%
}%
\renewcommand{\mbfitsanseta}{%
\textbf{%
\fontspec{FiraMath-Bold.otf}[
Color = magenta
]%
\miteta%
}%
}%
}
\begin{document}
Test \texttt{\textbackslash mathversion[normal]}:
\[
X^\mu_\nu = X^{\mu\rho} \eta_{\rho_\nu} =
\mathsf{X \eta \msanseta} \mathsfit{X \eta \mitsanseta} \mathsfup{X \eta \msanseta} \mathbfsf{X \eta \mbfsanseta} \mathbfsfit{X \eta \mbfitsanseta}
\]
\bfseries\boldmath
Test \texttt{\textbackslash mathversion[bold]}/\texttt{\textbackslash boldmath}:
\[
X^\mu_\nu = X^{\mu\rho} \eta_{\rho_\nu} =
\mathsf{X \eta \msanseta} \mathsfit{X \eta \mitsanseta} \mathsfup{X \eta \msanseta} \mathbfsf{X \eta \mbfsanseta} \mathbfsfit{X \eta \mbfitsanseta}
\]
\end{document}
from unicode-math.
Related Issues (20)
- `\symliteral` not resulting in correct output of literal input HOT 1
- [Feature Request] Support for Combining Unicode Charactor HOT 2
- `a` and `\symnormal{a}` make differrent result
- \setmathfontface\mathit has no effect in preamble HOT 9
- Comparison with Unicode TR25 data HOT 10
- \setmathfontface does not respects Style key in lulatex HOT 2
- lualatex and mathsf italic and overline: not centered HOT 1
- Undocumented use of the `BoldFont` option? HOT 5
- Brackets of matrix too short HOT 1
- Font selection of minus sign only working with `range = { \minus, "2212 }`, but not with `range = { "2212 }` or with `range = { \minus }`
- Character selection in scriptsize HOT 1
- There are no simple alphabet commands
- Missing character: There is no 𝜋 (U+1D70B) in font [lmroman10-regular] HOT 2
- Wrong spacing between bold italic math letter and punctuation HOT 4
- XeLaTeX, set mono font after loading unicode-math and modify \parfillskip leads to big whitespace in \texttt HOT 2
- Doc bug: package is experimental or not? HOT 1
- In TeX Live 2024, why does \substack insert a vertical gap between the lines when STIXMath-Regular is loaded?
- For lualatex, if the main math font is TeX Gyre Termes Math, simplify and document getting new characters from STIX Math or STIX Two Math without causing unrelated issues. HOT 1
- [Feature request] Serif Greek and double-struck italic letters from the Private Use Area
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unicode-math.