
저는 xelatex를 사용하고 있으며 일반 문자처럼 수학 공식에 키릴 문자를 사용하고 싶습니다. 다음 코드를 사용하면 결과 PDF의 수식에 Cyrilli 문자 대신 공백이 있습니다.
\documentclass{letter}
\usepackage{fontspec}
\setmainfont{Liberation Serif}
\setmathrm{Liberation Serif}
\begin{document}
Cyrillics: {абВ 0123456789} \it{абВ 0123456789}
$ abC = 1,234567890 = абВ = \sin {1,234567890 {абВ}_{абВ} } \Phi \alpha $
\end{document}
로그 파일에는 다음과 같이 나와 있습니다.
Missing character: There is no а in font cmmi10!
Missing character: There is no б in font cmmi10!
Missing character: There is no В in font cmmi10!
Missing character: There is no а in font cmmi7!
Missing character: There is no б in font cmmi7!
Missing character: There is no В in font cmmi7!
모든 키릴 문자 조각에 \mathit 등을 사용하는 것은 일종의 절반의 해결책입니다.
구성에서 'Latin Modern' 계열을 키릴 문자와 적절한 글리프' 적용 범위를 모두 포함하는 'CMU'('Computer Modern Unicode') 계열로 교체하는 것이 가능합니까? ('unicode-math' 패키지 문제를 해결하려는 시도에서 비슷한 문제가 발생했습니다).
답변1
hyperref
and polyglossia
(내가 따르지 않는 일부 상호작용이 발생함)가 없으면 다음과 같은 결과를 얻습니다.
MWE
\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{unicode-math}
%\usepackage{polyglossia}
%\setdefaultlanguage{russian}
%\setotherlanguage{english}
%\newcommand\cyrillicfont{Noto Serif}
\setmainfont{Liberation Serif}
\setmathrm{Liberation Serif}
%\usepackage[russian]{hyperref}
\setmathfont{XITS Math}
%See: https://tex.stackexchange.com/questions/201239/cant-get-unicode-symbols-in-math-mode
\DeclareSymbolFont{cyrletters}{\encodingdefault}{\familydefault}{m}{it}
\newcommand{\makecyrmathletter}[1]{%
\begingroup\lccode`a=#1\lowercase{\endgroup
\Umathcode`a}="0 \csname symcyrletters\endcsname\space #1
}
\count255="409
\loop\ifnum\count255<"44F
\advance\count255 by 1
\makecyrmathletter{\count255}
\repeat
\begin{document}
\[
(д+ф)^{2}=д^{2}+2дф+ф^{2}м
\]
\[
г л а м н я^{2^{i}}
\]
Inline math mode: $ abC = 1,234 = абВ = \sin ({1,67895 \times {абВ}_{абВ} }) \Phi \alpha $
xxx $а + ц ж + е$ xxx
\end{document}
xelatex로 컴파일됨(Windows의 miktex):
This is XeTeX, Version 3.14159265-2.6-0.999992 (MiKTeX 2.9.7300 64-bit) entering extended mode (cyrillic_maths_egreg2a.tex LaTeX2e <2020-02-02> patch level 5 L3 programming layer <2020-03-06>
답변2
내 자신의 질문에 실제로 상당히 가까운 대답은 'mathfont' 패키지(CTAN 홈페이지에서 한 번의 클릭)와 결합된 @Cicada(코드의 참조)가 제안한 글리프 재정의에 대한 접근 방식입니다. OpenOffice의 TexMaths 애드온에서도 작동합니다.
\documentclass{letter}
\usepackage{mathfont}
\setmainfont{Liberation Serif}
\mathfont{Liberation Serif}
% The glyphs redefinition code by https://tex.stackexchange.com/users/182648/cicada
% as posted at https://tex.stackexchange.com/a/534590/210048
% See also: https://tex.stackexchange.com/questions/201239/cant-get-unicode-symbols-in-math-mode
\DeclareSymbolFont{cyrletters}{\encodingdefault}{\familydefault}{m}{it}
\newcommand{\makecyrmathletter}[1]{%
\begingroup\lccode`a=#1\lowercase{\endgroup
\Umathcode`a}="0 \csname symcyrletters\endcsname\space #1
}
\count255="409
\loop\ifnum\count255<"44F
\advance\count255 by 1
\makecyrmathletter{\count255}
\repeat
\begin{document}
Text: {\it{abC}} = 1,234567890 = {\it{абВ}\footnotesize{абВ}} = {sin} 1,234567890 \, {Φ} {\it{α}}
Math: $ abC = 1,234567890 = {абВ}_{абВ} = \sin {1,234567890} \, \Phi \, \alpha $
\end{document}
업데이트: 더 나은 방법은 'mathfont'처럼 'amsmath'와 충돌하지 않는 'mathspec' 패키지를 사용하는 것입니다. 동일한 샘플 코드 대체
\usepackage{mathfont}
\setmainfont{Liberation Serif}
\mathfont{Liberation Serif}
~와 함께
\usepackage{amsmath}
\usepackage{mathspec}
\setmainfont{Liberation Serif}
\setallmainfonts{Liberation Serif}