XeLaTeX 내 수식에서 Computer Modern으로 다시 전환하려면 어떻게 해야 합니까?

XeLaTeX 내 수식에서 Computer Modern으로 다시 전환하려면 어떻게 해야 합니까?

질문에 대한 답변XeLaTeX 내에서 Computer Modern으로 다시 전환XeLaTex에서 기본 글꼴로 다시 전환하는 방법을 제공합니다. 그러나 \mathrm수식에 사용하면 솔루션이 작동하지 않습니다 .

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
%\newfontfamily\lmodern{Latin Modern Roman} % If font exists on your system
% Optical sizes need to be set up manually using the [SizeFeatures] option
% or select the font using the regular font selection methods
\newcommand{\lmr}{\fontfamily{lmr}\selectfont} % Latin Modern Roman
\newcommand{\lmss}{\fontfamily{lmss}\selectfont} % Latin Modern Sans
\newcommand{\lmtt}{\fontfamily{lmtt}\selectfont} % Latin Modern Mono
\begin{document}
\[\mathrm{e}^{\mathrm{i}\pi}+1=0\]
{\lmr\[\mathrm{e}^{\mathrm{i}\pi}+1=0\]}
\end{document}

문자 e와 i가 여전히 기본 글꼴이 아닌 것을 볼 수 있습니다. Consolas와 같은 다른 글꼴을 사용하면 공식이 더욱 보기 흉해집니다.

해결하려면 어떻게 해야 하나요?

답변1

Latin Modern을 기본 텍스트 및 수학 글꼴로 유지하려면 \setmainfont지침을 실행하지 마세요. 반대로, 기본 텍스트 글꼴을 Linux Libertine O로 전환하려면 아마도 패키지를 로드 unicode-math하고 \setmathfont{Libertinus Math}. 반면에 텍스트 모드 자료로 Libertine을 원하고 수학 모드 자료로 Latin Modern을 원할 경우 \setmathfont{Libertinus Math}로 대체할 수 있습니다 \setmathfont{Latin Modern Math}[Scale=MatchLowercase].

여기에 이미지 설명을 입력하세요

%% execute this test file under XeLaTeX or LuaLaTeX

\documentclass{article}

\usepackage{unicode-math}
\setmainfont{Linux Libertine O}

\begin{document}

\setmathfont{Libertinus Math}
$\mathrm{e}^{\mathrm{i}\pi}+1=0$

\setmathfont{Latin Modern Math}[Scale=MatchLowercase] % or Scale=MatchUppercase
$\mathrm{e}^{\mathrm{i}\pi}+1=0$

\end{document}

부록: @cabohah가 의견에서 지적했듯이 \setmainfont{Linux Libertine O}일부 TeX 배포/운영 체제 조합에서는 작동하지 않을 수 있습니다. 이것이 문제가 되는 경우 지침을 실행하는 대신 , 또는 패키지를 로드하는 것이 더 나을 libertinelibertinus있습니다 .libertinus-otf\setmainfont\setmathfont

관련 정보