I'm trying to create a figure in Python whose text matches (at least closely) Latex's math mode font. However, I'm not finding any information online that gives results close to the desired font, particularly on the Greek characters. For example, Latex produces the following:
\documentclass{article}
\usepackage{textgreek}
\begin{document}
\textit{testΞΈΟΞΌ}
$test\theta\tau\mu$
\end{document}
I'm trying to replicate the second line of text. Based on other answers on SE, and information I've found online, I've tried the following fonts, and had the following issues:
Computer Modern: way too curly/cursive
Computer Modern Sans: different style, most noticeable on tau
New Computer Modern 10: way too curly/cursive
New Computer Modern Math: not italic
Latin Modern Math: not italic
Is there something I'm missing here? Am I just not finding the italic variants of the math fonts, or is math mode using an entirely different font? Any clues would be appreciated; any links to a download would be very much appreciated.
Best Answer
Classic TeX does not use a math font. The fonts only have 127 characters and so many (up to 16) fonts per math expression are used. (The system allows 256 characters per font but using 8 bits was thought too radical in 1980 so only the lower half of each font is used)
so
uses
cmmi10.pfb
fortest
(with the letters in standard ascii positions). It uses the same font but the positions forCtrl-R
,Ctrl-\
, andCtrl-V
for the Greek and it usescmr10.pfb
for the+
and1
.This makes it very tricky to use TeX math fonts from other systems even if they can use Type 1 fonts.
A Unicode math font has all these characters in a single font, in standard positions which makes it much easier to use in other systems.
Processing with LuaLaTeX
All the characters come from Latin Modern Math (
latinmodern-math.otf
) in standard Unicode slots, note the math italic are separate characters.The resulting string will work with any Unicode math font, not just Latin Modern.
For example on this site it will pick up whatever font you have installed locally (it uses the Windows font Segoe UI Symbol here)
Or see this URL for a listing of all the Unicode slots used.