1

I am using XeLaTeX in combination with fontspec package which enables me to use TTF fonts:

\usepackage{fontspec}

    \setmainfont{freeserif}[
    Path=./oblika/pisave/,
    Extension=.ttf,
    UprightFont=*-regular,
    BoldFont=*-bold,
    ItalicFont=*-italic]

But in math mode text remains unchanged:

enter image description here

Is there a way to use TTF fonts in mathmode?

  • 1
    Have you checked out mathspec? – TeXnician Jun 18 '17 at 8:40
  • Not yet! Does it work in a similar way? I guess I will read the documentation on CTAN first and then report back. – 71GA Jun 18 '17 at 8:48
  • or unicode-math if you want o use opentype math fonts – David Carlisle Jun 18 '17 at 8:57
  • 2
    @71GA uniocde-math is better if the font is a math font (that is, has an OpenType MATH table internally) it does not work at all with a normal text font. Conversely mathspec is better if you are trying to use a standard text font in math – David Carlisle Jun 18 '17 at 9:34
  • 2
    I wouldn't recommend using FreeSerif as a text font; it has wide coverage of Unicode, at the expense of being just a collection of fonts and symbols not particularly studied to go along well. – egreg Jun 18 '17 at 10:05
2

You can use unicode-math which is fontspec, but for math

\documentclass{article}
\usepackage[math-style=ISO]{unicode-math}
\setmathfont{STIX Two Math}

\begin{document}

    $This\ is\ typeset\ in\ math\ font\ STIX\ Two$


\end{document}
  • Or TeX Gyre Termes Math, or XITS Math, if STIX Two Math is not available. – egreg Jun 18 '17 at 10:04
  • @egreg yes, TeX Gyre fonts are good, having both text and math variants. – Michael Fraiman Jun 18 '17 at 12:54
0

Another version is to use mathspec. This package especially enables you to use text fonts (which might not even support maths) as math font. To make this text font the default math font, but use another font for some specific fonts you can use the range option (f.i. to specify another calligraphic font, ...)

To show that it works, I'll use the not-really-math-font Calibri.

calibri

\documentclass{article}
\usepackage{mathspec}
\setallmainfonts{Calibri}
\setallsansfonts{Calibri}
\setmathfont(Digits,Latin,Greek){Calibri}

\begin{document}
    Lorem ipsum dolor sit amet
    \[
        \sum Calibri~is~fine~\mathrm{here}
    \]
\end{document}

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.