6

The Question

Hi, I've recently decided to switch over to IBM Plex, and while computer modern is very nice, it doesn't go too well with Plex it seems, and I'm not sure what I can do with regards to maths fonts.

Edit: I'm using pdfLaTeX

I'm looking for either good alternatives from people who have seen / know more than me, and / or some way of finding out what's available. (Most of my google searches have returned results comparing \mathrm etc.)

Demos

Plex Serif

enter image description here

Plex Sans

enter image description here

9
  • You are using Overleaf, aren't you? And are you using XeLaTeX or LuaLaTeX?
    – user156344
    Commented Nov 6, 2018 at 4:16
  • If you have used \setmainfont to set your main body font, I suggest using \setmathfont to set your math font.
    – user156344
    Commented Nov 6, 2018 at 4:16
  • 2
    You may get some inspiration here: jf.burnol.free.fr/showcase.html#frclog
    – Ross
    Commented Nov 6, 2018 at 4:57
  • 1
    @Ross thanks for showing that! That makes it a lot better. If you put that as an answer I'll happily mark it as 'correct'
    – tecosaur
    Commented Nov 6, 2018 at 6:30
  • 1
    @Ross Thank you very much for the link... I couldn't even think that there existed such a link before.
    – user156344
    Commented Nov 6, 2018 at 7:09

2 Answers 2

12

Thanks to @Ross showing me mathastext I reckon I've got a working solution.

Solution

Math Symbols

\usepackage{fourier}

In my opinion, fourier's symbols matches better stylistically, however I don't want to keep the font-related changes so I add it first (so that the other font packages overwrite that).

Math Font

\usepackage{plex-serif}

I want to use a serif font for the math, so I add this after fourier so that it overwrites it, and before mathastext so that it's actually used for the maths

Apply the font to math

\usepackage[basic,italic,symbolgreek]{mathastext}

mathastext seems good, but to me it had a few issues when used without any options.

  1. Brackets for matrices, when multiline brackets were required mathastext just grabbed the [] characters used by the font, and didn't do anything to make them multiline. This was fixed by adding the basic option — though this also had the effect of no replacing a few other symbols (a worthwhile price in my mind)
  2. Non-italic math by default. This was an easy fix: italic
  3. Not using the greek letters from the font. Once again easy fix: symbolgreek
  4. Bad kerning / overlapping (or crammed) letters

To solve the last issue I used another command, seen at the end of this mini-section.

Text Font

\usepackage[sfdefault]{plex-sans}

After the serif variant has been set to be used in math by mathastext I change to the sans font I want to use for the rest of the document.

Spacing Issues

By default, the spacing was the same as italic/slanted text. Which is an issue for math because it can cause overlaps/cramping. To see this in action I drew vertical rules of width 0.1ex with \hspace{-0.1ex} after them, producing Demo For most letters adding 0.5mu of space either side fixed things up, however letters with 'tails' required some extra attention. After some tweaking I managed to get this: Fixed(sort of)

While I wouldn't consider this 'fixed' it's better. This is the code used (sans):

\makeatletter
\@for\@tempa:=a,b,c,d,e,h,i,k,l,m,n,o,q,r,s,t,u,v,w,x\do{%
\MTsetmathskips{\@tempa}{0.5mu}{0.5mu}}%
\makeatother

\MTsetmathskips{f}{2.5mu}{0.5mu}
\MTsetmathskips{g}{1.5mu}{0.5mu}
\MTsetmathskips{j}{2.5mu}{0.5mu}
\MTsetmathskips{p}{1.5mu}{0mu}
\MTsetmathskips{y}{1.5mu}{0.5mu}
\MTsetmathskips{z}{1mu}{0.5mu}

And then for the serif version:

 \makeatletter
 \@for\@tempa:=a,b,c,d,e,h,i,k,l,m,n,o,q,r,t,u,v,w\do{%
 \MTsetmathskips{\@tempa}{0.5mu}{0.5mu}}%
 \makeatother

 \MTsetmathskips{f}{4.5mu}{0.5mu}
 \MTsetmathskips{g}{2.5mu}{0.5mu}
 \MTsetmathskips{j}{4mu}{0.5mu}
 \MTsetmathskips{p}{2.5mu}{0mu}
 \MTsetmathskips{s}{1mu}{0.5mu}
 \MTsetmathskips{x}{1.5mu}{0.5mu}
 \MTsetmathskips{y}{3.5mu}{0.5mu}
 \MTsetmathskips{z}{1.5mu}{0.5mu}
Before

Before

After

After

It's minor but it's an improvement

All together

\usepackage{fourier}
\usepackage{plex-serif}
\usepackage[basic,italic,symbolgreek]{mathastext}
\usepackage[sfdefault]{plex-sans}

\makeatletter
\@for\@tempa:=a,b,c,d,e,h,i,k,l,m,n,o,q,r,s,t,u,v,w,x\do{%
\MTsetmathskips{\@tempa}{0.5mu}{0.5mu}}%
\makeatother

\MTsetmathskips{f}{2.5mu}{0.5mu}
\MTsetmathskips{g}{1.5mu}{0.5mu}
\MTsetmathskips{j}{2.5mu}{0.5mu}
\MTsetmathskips{p}{1.5mu}{0mu}
\MTsetmathskips{y}{1.5mu}{0.5mu}
\MTsetmathskips{z}{1mu}{0.5mu}

Result

Serif

\usepackage[sfdefault]{plex-sans}
\usepackage[basic,italic,symbolgreek]{mathastext}

Serif

Sans

\usepackage{plex-serif}
\usepackage[basic,italic,symbolgreek]{mathastext}

Sans

Mixed

\usepackage{plex-serif}
\usepackage[basic,italic,symbolgreek]{mathastext}
\usepackage[sfdefault]{plex-sans}

Mixed

2

IBM has released official Plex Math fonts with full OpenType maths tables as of 30 August 2024. These may be used straightforwardly in XeTeX and LuaTeX with:

% assuming \usepackage{plex-otf} is already set...
\usepackage{unicode-math}
\setmathfont{IBM Plex Math}

% rest of preamble and document

You must log in to answer this question.

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