LaTeX 수학 모드와 Python에서 생성된 그림 간의 글꼴을 일치시키는 방법은 무엇입니까?

LaTeX 수학 모드와 Python에서 생성된 그림 간의 글꼴을 일치시키는 방법은 무엇입니까?

저는 텍스트가 Latex의 수학 모드 글꼴과 (적어도 거의) 일치하는 Python의 그림을 만들려고 합니다. 그러나 특히 그리스 문자에 대해 원하는 글꼴에 가까운 결과를 제공하는 정보를 온라인에서 찾을 수 없습니다. 예를 들어 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은 사용하지 않습니다.수학 글꼴. 글꼴은 127자만 포함하므로 수학 표현식당 너무 많은(최대 16개) 글꼴이 사용됩니다. (시스템은 글꼴당 256자를 허용하지만 8비트를 사용하는 것은 1980년에는 너무 급진적인 것으로 간주되어 각 글꼴의 아래쪽 절반만 사용되었습니다.)

그래서

\documentclass{article}
\showoutput
\begin{document}

$test\theta\tau\mu+1$

\end{document}

cmmi10.pfbfor test(표준 ASCII 위치의 문자 사용)를 사용합니다 . 동일한 글꼴을 사용하지만 그리스어 의 Ctrl-R, Ctrl-\및 위치는 및 및 에 사용됩니다 .Ctrl-Vcmr10.pfb+1

이로 인해 다른 시스템에서 Type 1 글꼴을 사용할 수 있더라도 TeX 수학 글꼴을 사용하는 것이 매우 까다로워집니다.

유니코드 수학 글꼴은 이러한 모든 문자를 단일 글꼴로 표준 위치에 포함하므로 다른 시스템에서 훨씬 쉽게 사용할 수 있습니다.

LuaLaTeX를 사용한 처리

\documentclass{article}
\usepackage{unicode-math}
\showoutput
\begin{document}

$test\theta\tau\mu+1$

\end{document}

모든 문자는 latinmodern-math.otf표준 유니코드 슬롯의 Latin Modern Math( )에서 유래되었습니다. 수학 이탤릭체는 다음과 같습니다.분리된문자.

결과 문자열은 Latin Modern뿐만 아니라 모든 유니코드 수학 글꼴에서 작동합니다.

예를 들어 이 사이트에서는 로컬에 설치한 글꼴이 무엇이든 선택됩니다(여기에서는 Windows 글꼴 Segoe UI 기호를 사용합니다).

답변2

(댓글이 너무 길어서 답변으로 게시되었습니다)

이 답변에서 저는 LMM(Latin Modern Math)에 "[수학] 이탤릭체가 없는 것 같습니다"라는 OP의 주장을 주로 다룹니다. 나는 이 주장에 의아해한다. 실제로 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 글꼴선택한 셸에서 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(Computer Modern Italic, "더 압축되고 약간 더 가벼워짐", 크기 10pt) onhttps://ctan.org/tex-archive/fonts/cm/mf. 기타 정보는 다음에서 확인할 수 있습니다.https://eng.m.fontke.com/font/10030505/detail/.SFTI1000SFTI1000에는 Computer Modern의 "Postscript 이름"으로 등재되어 있습니다.grmi1000이탤릭체로 된 것 같아클라우디오 베카리 그리스어글꼴, 참조 https://ctan.org/tex-archive/fonts/greek/cbfonts/fonts/tfm/cbgreek그리고https://ctan.org/pkg/cbgreek-complete. 파일을 제거 \usepackage{textgreek}하고 \textit{testθτμ}다시 컴파일하면 CMMI10(Computer Modern Italic, "압축되지 않고 가볍지 않음", 10pt) 및 CMR10(Computer Modern Italic, "basic", 10pt)만 남습니다.

따라서 (편집 전) "Latex의 수학 모드 글꼴은 무엇입니까?"라는 질문에 대한 정확한 괴상한 답변입니다. ~이다CMMI10(Computer Modern Italic, "응축되지도 않고 아주 가볍지도 않음", 10pt)위에서 언급한 설정과 관련하여.

차이점을 관찰하세요루아텍스:

$ 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

관련 정보