I'm using mathspec to use an .otf font in Overleaf via the command:

setromanfont{myfont}[Path=./fonts/myfont, Extension = .otf, Uprightfont=*-regular]

myfont-regular.otf being the font file placed in a folder pointed at by the Path=.

which works great for all my normal text. However there is also a math version of the font that I would like to use for math: myfont-math.otf however I cannot find a way to import it with the mathspec package, all my attempts at using the \setmath(s)font have been futile. I've looked around and found some articles from Overleaf with instructions of how to use a .ttf font with tfm/map/type1 files but not much so far on how to do this is XeLaTeX. It might help to mention that I have all these files for my font as it has been designed to work with TeX.

Can anyone guide me in the right direction of how to do this?

  • if the math font is an opentype math font with a MATH table, use unicode-math rather than mathspec Feb 28, 2022 at 15:20
  • Thank you! This is exactly what I was looking for. I looked up the difference between mathspec and unicode-math and got the impression that they were mostly identical packages which led me down the wrong path.
    – HanLar
    Feb 28, 2022 at 15:37
  • For reference, David Carlisle has an example how to use otf font with mathspec here tex.stackexchange.com/a/650190/250119
    – user202729
    Jul 8, 2022 at 9:24

1 Answer 1


If the math font is an opentype math font with a MATH table, use unicode-math rather than mathspec.

  • is it possible to check if the font has a MATH table in it?
    – Masum
    Mar 15, 2022 at 10:30
  • 1
    @Masum look in a font editor such as fontforge or simply use the font with \setmathfont in unicode-math package, it will complain about it not being there. If the font hasn't got "math" in its name, it probably has not got a math table. Mar 15, 2022 at 10:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .