3

How to set a font for math mode? I would like to have something like Segoe UI of something similar. Thank you

\documentclass{article}
\usepackage{fontspec}
\usepackage{firamath-otf}
\begin{document}
\begin{equation}
x+y=45
\end{equation}

\end{document}

Error:

enter image description here

  • 1
    Welcome to TeX.SE! Where does this font comes from? Which type of font is it? Which tex engine do you use? Can you change the engine, if needed? – Mensch Aug 31 at 19:28
  • Segoe has no math symbols. You can try \usepackage{firamath-otf} – user187802 Aug 31 at 19:40
  • I use XeLaTex and I give an error that I added to my question – Marcia Cross Sep 1 at 2:32
  • @MarciaCross: It looks like that you have not an updated system. Try to update unicode-math and fontspec and latex3 – user187802 Sep 1 at 7:48
5

If you want Segoe UI specifically, you can select all the symbols it contains with the range= option of \setmathfont, with another font such as Fira Math as your fallback for the rest.

\documentclass{article}
\usepackage{unicode-math}

\defaultfontfeatures{Scale = MatchLowercase}
\setmainfont{Segoe UI}[
   Scale = 1.0,
   BoldFont = Segoe UI Semibold ,
   BoldItalicFont = Segoe UI Semibold Italic ]

\setmathfont{Fira Math}
\setmathfont{Segoe UI}[
  range= { up/{Latin,latin,Greek,greek,Digits},
           "2B-"2F,"3A-"3E,`¬,`·,`°,`±,`×,`÷,
           `←,`↑,`→,`↓,`↔,`↗,`↙,
           `Ω,`∂,`∆,`∏,`∑,`−,`∕,`∙,`∞,`∟,`∩,`∴,
           `∶,`≈,`≠,`≡,`≤,`≥,`⋲,
           `■,`□,`▪,`▫,`◊,`○,
           "02B0-"036F
         }]
\setmathfont{Segoe UI Semibold}[range=bfup/{Latin,latin,Greek,greek,Digits}]
\setmathfont{Segoe UI Italic}[range=it/{Latin,latin,Greek,greek}]
\setmathfont{Segoe UI Semibold Italic}[range=bfit/{Latin,latin,Greek,greek}]

\begin{document}

Segoe UI \textit{italic} \textbf{bold \textit{italic}} 0

\( \lim_{n \to 0} \frac{\partial}{\partial t}
    \int_n^\infty  \pm \symup{i} \sqrt{\symup{\pi} t} \symbfit{b} \times
                                 \symbfup{j} \,\mathup{d}t
    \approx \increment \symbfit{B} \)

\end{document}

Segoe UI font sample

You can tweak this further if you like. For example, you’d want to add "02B0-"036F, or at least \hat, to the range of all the math alphabets if you wanted to use the combining accent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.