Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matching math font? #33

Closed
mdeff opened this issue Oct 25, 2021 · 8 comments
Closed

Matching math font? #33

mdeff opened this issue Oct 25, 2021 · 8 comments

Comments

@mdeff
Copy link

mdeff commented Oct 25, 2021

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
Copy link
Author

mdeff commented Oct 25, 2021

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

@Pseudomanifold
Copy link
Owner

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

@mdeff
Copy link
Author

mdeff commented Oct 26, 2021

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
Copy link
Author

mdeff commented Oct 26, 2021

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.

@Pseudomanifold
Copy link
Owner

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

@mdeff
Copy link
Author

mdeff commented Oct 26, 2021

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

Pseudomanifold added a commit that referenced this issue Oct 27, 2021
@Pseudomanifold
Copy link
Owner

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

@mdeff
Copy link
Author

mdeff commented Oct 27, 2021

Thank you Bastian!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants