Pseudomanifold/latex-mimosis

Matching math font?

mdeff opened this issue · 8 comments

mdeff commented

As it stands, the template pairs the EB Garamond font for text with the Latin Modern Math font for math. Shouldn't it use the Garamond Math font for a better match? Though I'm unsure of its typographic quality.

That can be achieved with the unicode-math package as follows:

\usepackage{unicode-math}
\setmathfont{Garamond Math}

A comprehensive list of OpenType math fonts (with rendered math) is available here.

mdeff commented

The unicode-math package also allows unicode math input, i.e., $∫ λ ∈$ will render as $\int \lambda \in$.

Excellent point; have you tested this by any chance? Ideally, it should work almost the same for pdflatex, xelatex, and lualatex.

mdeff commented

Yes, I've tested it for my PhD thesis with lualatex. I believe it should work the same for xelatex, while pdflatex probably requires the importation of the font package.

mdeff commented

One caveat (AFAIU): using unicode-math will render math through the OpenType font engine instead of the TeX engine. That might break complex mathematics as the engine is surely less mature and tested.

Good point—maybe I'd rather add this to the FAQ, then. Can you post your current changes?

mdeff commented

Adding the two lines above, as follows:

\ifxetexorluatex
  \usepackage{unicode-math}  % use OpenType instead of Tex for math
  \setmainfont{EB Garamond}
  \setmonofont[Scale=MatchLowercase]{Source Code Pro}
  \setmathfont{Garamond Math}
\else

Awesome, thanks a lot! I use this now in the main template and added your name to the list of contributors.

mdeff commented

Thank you Bastian!