
我正在嘗試在 Python 中創建一個圖形,其文字與 Latex 的數學模式字體相符(至少緊密匹配)。但是,我在網上沒有找到任何可以提供接近所需字體的結果的信息,特別是希臘字符。例如,Latex 會產生以下內容:
\documentclass{article}
\usepackage{textgreek}
\begin{document}
\textit{testθτμ}
$test\theta\tau\mu$
\end{document}
我正在嘗試複製第二行文字。根據SE上的其他答案以及我在網上找到的信息,我嘗試了以下字體,但遇到了以下問題:
現代電腦:太捲曲/草書
Computer Modern Sans:不同的風格,在 tau 上最引人注目
New Computer Modern 10:太捲曲/草書
新計算機現代數學:非斜體
拉丁現代數學:非斜體
我在這裡缺少什麼嗎?我只是沒有找到數學字體的斜體變體,還是數學模式使用完全不同的字體?任何線索將不勝感激;任何下載連結將不勝感激。
答案1
Classic TeX 不使用A數學字體。這些字體只有 127 個字符,每個數學表達式使用了很多(最多 16 個)字體。 (系統允許每種字體 256 個字符,但在 1980 年使用 8 位被認為過於激進,因此只使用每種字體的下半部分)
所以
\documentclass{article}
\showoutput
\begin{document}
$test\theta\tau\mu+1$
\end{document}
用於(字母位於標準 ASCII 位置)cmmi10.pfb
。test
它使用相同的字體,但希臘語的 、 和 的位置與Ctrl-R
和Ctrl-\
的位置相同。Ctrl-V
cmr10.pfb
+
1
這使得使用來自其他系統的 TeX 數學字體變得非常棘手,即使它們可以使用 Type 1 字體。
Unicode 數學字體將所有這些字元放在一個字體中,位於標準位置,這使得它更容易在其他系統中使用。
使用 LuaLaTeX 進行處理
\documentclass{article}
\usepackage{unicode-math}
\showoutput
\begin{document}
$test\theta\tau\mu+1$
\end{document}
所有字元均來自latinmodern-math.otf
標準 Unicode 插槽中的拉丁現代數學 ( ),請注意數學斜體是分離人物。
產生的字串適用於任何 Unicode 數學字體,而不僅僅是 Latin Modern。
例如,在此網站上,它將選擇您本機安裝的任何字型(此處使用 Windows 字型 Segoe UI Symbol)
答案2
(評論太長,因此作為答案發布)
在這個答案中,我主要解決OP的說法,即拉丁現代數學(LMM)「似乎沒有[數學]斜體」。我對這個說法感到困惑。事實上,下面的範例需要使用 XeLaTeX 或 LuaLaTeX 進行編譯,顯示 LMM 確實具有數學斜體拉丁字母和希臘字母。
當然,如果您想以文字模式斜體書寫某些內容,則應該使用文字斜體而不是數學斜體字形。
該軟體包提供了以直立模式書寫符號的unicode-math
命令。\symup
\documentclass{article}
\usepackage{unicode-math} % for '\setmathfont' macro; load 'fontspec' package automatically
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}
\begin{document}
\textit{abcxyz} $abcxzy$ $\theta\tau\mu$ abcxyz $\symup{\theta\tau\mu}$
\end{document}
答案3
除了其他好的答案之外,這篇文章還展示了另一個工具。以下是根據您的 MWE
\documentclass{article}
\usepackage{textgreek}
\begin{document}
\textit{testθτμ}%ϑ
$test\theta\tau\mu$
\end{document}
你也許可以使用pdf字體在您選擇的 shell 中產生 PDF 所有字體的表格(我用 [...] 替換了一些部分):
$ pdflatex Example.SE.tex; echo "\nTable for Ryan White:"; pdffonts Example.SE.pdf
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) (preloaded format=pdflatex)
[...]
Output written on Example.SE.pdf (1 page, 39405 bytes).
Transcript written on Example.SE.log.
Table for Ryan White:
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
MSKRKD+CMTI10 Type 1 Builtin yes yes yes 4 0
TPJLSH+grmi1000 Type 1 Builtin yes yes yes 5 0
OIWUEJ+SFTI1000 Type 1 Custom yes yes yes 6 0
RYTSZC+CMMI10 Type 1 Builtin yes yes yes 7 0
SDXKYB+CMR10 Type 1 Builtin yes yes yes 8 0
我透過以下方式得到了類似的表格$ latex Example.SE.tex; vipdfm Example.SE.dvi; echo "\nTable for Ryan White:"; pdffonts Example.SE.pdf
:
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
BGNOPA+CMTI10 Type 1C Builtin yes yes yes 4 0
DOYMNM+grmi1000 Type 1C Builtin yes yes yes 5 0
VQMNVE+SFTI1000 Type 1C WinAnsi yes yes yes 6 0
SIZLWA+CMMI10 Type 1C Builtin yes yes yes 7 0
ZIUSPE+CMR10 Type 1C Builtin yes yes yes 8 0
您會找到縮寫的描述,例如CMTI10(電腦現代斜體,“更濃縮,稍淡”,大小 10pt)https://ctan.org/tex-archive/fonts/cm/mf。其他資訊可在https://eng.m.fontke.com/font/10030505/detail/。SFTI1000在 SFTI1000 中被列為 Computer Modern 的「Postscript name」。GRMI1000似乎是斜體之一克勞迪奧貝卡里 希臘語字體,參見
https://ctan.org/tex-archive/fonts/greek/cbfonts/fonts/tfm/cbgreek和https://ctan.org/pkg/cbgreek-complete。如果刪除檔案中的\usepackage{textgreek}
和\textit{testθτμ}
並再次編譯,則僅保留 CMMI10(電腦現代斜體,“未壓縮且不太輕”,10pt)和 CMR10(電腦現代斜體,“基本”,10pt)。
因此,一個書呆子對你的問題的精確回答(在編輯之前)“Latex 的數學模式字體是什麼?”是CMMI10(電腦現代斜體,“不濃縮,也不那麼輕”,10pt)關於上述設定。
觀察差異LuaTeX:
$ lualatex Example.SE.tex; echo "\nTable for Ryan White:"; pdffonts Example.SE.pdf
This is LuaHBTeX, Version 1.17.0 (TeX Live 2023)
[...]
Output written on Example.SE.pdf (1 page, 12154 bytes).
Transcript written on Example.SE.log.
Table for Ryan White:
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
EJJTSY+LMRoman10-Italic CID Type 0C Identity-H yes yes yes 4 0
RYTSZC+CMMI10 Type 1 Builtin yes yes no 5 0
JFRMQG+LMRoman10-Regular CID Type 0C Identity-H yes yes yes 6 0
LM羅曼是拉丁現代主義。
編譯
\documentclass{article}
\usepackage{textgreek}
\usepackage{unicode-math} % ADDED
\begin{document}
\textit{testθτμ}
$test\theta\tau\mu$
\end{document}
給出
$ lualatex Example.SE.tex; echo "\nTable for Ryan White:"; pdffonts Example.SE.pdf
This is LuaHBTeX, Version 1.17.0 (TeX Live 2023)
[...]
Output written on Example.SE.pdf (1 page, 6180 bytes).
Transcript written on Example.SE.log.
Table for Ryan White:
name type encoding emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
EJJTSY+LMRoman10-Italic CID Type 0C Identity-H yes yes yes 4 0
WLUBUQ+LatinModernMath-Regular CID Type 0C Identity-H yes yes yes 5 0
JFRMQG+LMRoman10-Regular CID Type 0C Identity-H yes yes yes 6 0