Git Product home page Git Product logo

Comments (8)

stone-zeng avatar stone-zeng commented on September 27, 2024

Sans-serif italic/upright greek letters are not defined in Unicode.

from unicode-math.

stone-zeng avatar stone-zeng commented on September 27, 2024

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}
Screenshot 2023-08-17 at 16 43 35

from unicode-math.

Firestar-Reimu avatar Firestar-Reimu commented on September 27, 2024

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} $$

X^\mu_\nu = X^{\mu\rho} \eta_{\rho_\nu} = \mathsf{X \eta}

from unicode-math.

stone-zeng avatar stone-zeng commented on September 27, 2024

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.

khaledhosny avatar khaledhosny commented on September 27, 2024

No unicode-math issue here.

from unicode-math.

HolgerGerhardt avatar HolgerGerhardt commented on September 27, 2024

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:

mathsf

I have made use of the Color attribute only for the purpose of illustration, of course.

from unicode-math.

hvoss49 avatar hvoss49 commented on September 27, 2024

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}

Bildschirmfoto 2024-07-15 um 13 51 16

from unicode-math.

HolgerGerhardt avatar HolgerGerhardt commented on September 27, 2024

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}
mathsf-fira

from unicode-math.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.