仅在 newtxmath 中更改希腊字体

仅在 newtxmath 中更改希腊字体

\usepackage{cochineal}我有一个用和排版的文本和数学文档\usepackage[cochineal]{newtxmath}

我想使用该cochineal字体来表示文本和数学,但要替换希腊数学字体仅有的,来自usepackage[libertine]{newtxmath}。我尝试了以下操作(根据此答案:将数学字体更改为希腊字母),但没有成功。

\documentclass[10pt,a4paper]{article}

\usepackage{cochineal}
\usepackage{textcomp}
\usepackage[cochineal]{newtxmath}

\usepackage[T1]{fontenc}

\DeclareSymbolFont{Letters} {OML}{libertine}{m}{n}   %% how to access the [libertine]{newtxmath} here?
\DeclareMathSymbol\Gamma    {\mathalpha}{Letters}{"00}
\DeclareMathSymbol\Delta    {\mathalpha}{Letters}{"01}
% etc
\DeclareMathSymbol{\alpha}  {\mathalpha}{Letters}{"0B}
\DeclareMathSymbol{\beta}   {\mathalpha}{Letters}{"0C}
% etc

\begin{document}

$\alpha, \beta$

\end{document}

答案1

在您的示例中,您没有使用正确的 Libertine 字体编码。

以下是使用 Cochineal 和 Libertine 的希腊字母的示例。声明希腊字母的代码基于 的newtxmath代码。

\documentclass{article}
\usepackage{cochineal}
\usepackage[cochineal]{newtxmath}
\makeatletter
\newif\iflibus@sansmath
\makeatother
\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{libertinust1math}{m}{n}
\DeclareSymbolFont{LettersLibertinus}       {LS1}{libertinust1math}{m}{it}
\DeclareSymbolFont{OperatorsLibertinus}     {LS1}{libertinust1math}{m} {n}
\DeclareMathSymbol{\Gamma}     {\mathalpha}{OperatorsLibertinus}{"00}
\DeclareMathSymbol{\Delta}     {\mathalpha}{OperatorsLibertinus}{"01}
\DeclareMathSymbol{\Theta}     {\mathalpha}{OperatorsLibertinus}{"02}
\DeclareMathSymbol{\Lambda}    {\mathalpha}{OperatorsLibertinus}{"03}
\DeclareMathSymbol{\Xi}        {\mathalpha}{OperatorsLibertinus}{"04}
\DeclareMathSymbol{\Pi}        {\mathalpha}{OperatorsLibertinus}{"05}
\DeclareMathSymbol{\Sigma}     {\mathalpha}{OperatorsLibertinus}{"06}
\DeclareMathSymbol{\Upsilon}   {\mathalpha}{OperatorsLibertinus}{"07}
\DeclareMathSymbol{\Phi}       {\mathalpha}{OperatorsLibertinus}{"08}
\DeclareMathSymbol{\Psi}       {\mathalpha}{OperatorsLibertinus}{"09}
\DeclareMathSymbol{\Omega}     {\mathalpha}{OperatorsLibertinus}{"0A}
\DeclareMathSymbol{\alpha}     {\mathalpha}{LettersLibertinus}  {"0B}
\DeclareMathSymbol{\beta}      {\mathalpha}{LettersLibertinus}  {"0C}
\DeclareMathSymbol{\gamma}     {\mathalpha}{LettersLibertinus}  {"0D}
\DeclareMathSymbol{\delta}     {\mathalpha}{LettersLibertinus}  {"0E}
\DeclareMathSymbol{\epsilon}   {\mathalpha}{LettersLibertinus}  {"0F}
\DeclareMathSymbol{\zeta}      {\mathalpha}{LettersLibertinus}  {"10}
\DeclareMathSymbol{\eta}       {\mathalpha}{LettersLibertinus}  {"11}
\DeclareMathSymbol{\theta}     {\mathalpha}{LettersLibertinus}  {"12}
\DeclareMathSymbol{\iota}      {\mathalpha}{LettersLibertinus}  {"13}
\DeclareMathSymbol{\kappa}     {\mathalpha}{LettersLibertinus}  {"14}
\DeclareMathSymbol{\lambda}    {\mathalpha}{LettersLibertinus}  {"15}
\DeclareMathSymbol{\mu}        {\mathalpha}{LettersLibertinus}  {"16}
\DeclareMathSymbol{\nu}        {\mathalpha}{LettersLibertinus}  {"17}
\DeclareMathSymbol{\xi}        {\mathalpha}{LettersLibertinus}  {"18}
\DeclareMathSymbol{\pi}        {\mathalpha}{LettersLibertinus}  {"19}
\DeclareMathSymbol{\rho}       {\mathalpha}{LettersLibertinus}  {"1A}
\DeclareMathSymbol{\sigma}     {\mathalpha}{LettersLibertinus}  {"1B}
\DeclareMathSymbol{\tau}       {\mathalpha}{LettersLibertinus}  {"1C}
\DeclareMathSymbol{\upsilon}   {\mathalpha}{LettersLibertinus}  {"1D}
\DeclareMathSymbol{\phi}       {\mathalpha}{LettersLibertinus}  {"1E}
\DeclareMathSymbol{\chi}       {\mathalpha}{LettersLibertinus}  {"1F}
\DeclareMathSymbol{\psi}       {\mathalpha}{LettersLibertinus}  {"20}
\DeclareMathSymbol{\omega}     {\mathalpha}{LettersLibertinus}  {"21}
\DeclareMathSymbol{\varepsilon}{\mathalpha}{LettersLibertinus}  {"22}
\DeclareMathSymbol{\vartheta}  {\mathalpha}{LettersLibertinus}  {"23}
\DeclareMathSymbol{\varpi}     {\mathalpha}{LettersLibertinus}  {"24}
\DeclareMathSymbol{\varphi}    {\mathalpha}{LettersLibertinus}  {"27}
\begin{document}
\[
\alpha\beta\gamma\delta\epsilon
\varepsilon\zeta\theta\vartheta\eta\iota
\kappa\lambda\mu\nu\xi
\pi\varpi\rho\sigma\tau\upsilon
\phi\varphi\chi\psi\omega
\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Phi\Psi\Omega
\]
\end{document}

为了进行比较,这里有相同的例子,但没有希腊字母的新定义。

\documentclass{article}
\usepackage{cochineal}
\usepackage[cochineal]{newtxmath}
\begin{document}
\[
\alpha\beta\gamma\delta\epsilon
\varepsilon\zeta\theta\vartheta\eta\iota
\kappa\lambda\mu\nu\xi
\pi\varpi\rho\sigma\tau\upsilon
\phi\varphi\chi\psi\omega
\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Phi\Psi\Omega
\]
\end{document}

答案2

unicode-math如果您在 LuaLaTeX 或 XeLaTeX 中使用,或者在 XeLaTeX 中使用,这会容易得多。mathspec前者允许您使用 \setmathfont[range=it/{greek,Greek}, Scale=MatchLowercase]{Libertinus Math},后者 允许您使用\setmathsfont(Greek){Libertinus}

有些出版商在 2020 年仍强迫您使用传统的 8 位字体,但我的建议是,unicode-math在可以的情况下使用 LuaLaTeX,在必须的情况下使用 PDFTeX。

相关内容