在文本模式下使用拉丁现代罗马字体书写 μ (mu)

在文本模式下使用拉丁现代罗马字体书写 μ (mu)

有没有办法μ使用拉丁现代罗马字体或具有相同字体美感/特征的其他字体来书写文字字符?

以下导致我出现此错误

{C:/Users/Diaa/AppData/Local/MiKTeX/fonts/map/pdftex/pdftex.map} 缺少字符:字体 LatinModernRoman:mode=node;sc ript=latn;language=dflt;+tlig;family=rm;-liga;-dlig; 中没有 μ (U+03BC)!

\documentclass{article}

\tracinglostchars=3

\usepackage[english, bidi = basic, layout = lists]{babel}

\usepackage{fontspec}


% Set the main font
\setmainfont[
Ligatures = {NoCommon, NoRare},
Scale = 1.0,
Language = Default
]{Latin Modern Roman}


\babelfont{rm}
[Ligatures = {NoCommon, NoRare}, Scale = 1.0, Language = Default]
{Latin Modern Roman}

\babelfont{sf}
[Ligatures = {NoCommon, NoRare}, Scale = 1.0, Language = Default]
{Latin Modern Sans}

\begin{document}
    
    This is a text with μ
    
\end{document}

答案1

拉丁现代字母没有希腊语,但它有微字母 (U+00B5),这是拉丁字母中孤立 mu 的最常见用法。

在此处输入图片描述

\documentclass{article}

\tracinglostchars=3

\usepackage[english, bidi = basic, layout = lists]{babel}

\usepackage{fontspec}


% Set the main font
\setmainfont[
Ligatures = {NoCommon, NoRare},
Scale = 1.0,
Language = Default
]{Latin Modern Roman}


\babelfont{rm}
[Ligatures = {NoCommon, NoRare}, Scale = 1.0, Language = Default]
{Latin Modern Roman}

\babelfont{sf}
[Ligatures = {NoCommon, NoRare}, Scale = 1.0, Language = Default]
{Latin Modern Sans}

\begin{document}
    
    This is a text with µ
    
\end{document}

答案2

您可以使用替代字体\mu

\documentclass{article}
\usepackage[english, bidi = basic, layout = lists]{babel}
\usepackage{fontspec}
\usepackage{newunicodechar}

\babelfont{rm}[
  Ligatures = {NoCommon, NoRare},
  Scale = 1.0,
  Language = Default
]{Latin Modern Roman}

\babelfont{sf}[
  Ligatures = {NoCommon, NoRare},
  Scale = 1.0,
  Language = Default
]{Latin Modern Sans}

\newfontfamily{\substituterm}{CMU Serif}
\newfontfamily{\substitutesf}{CMU Sans Serif}

\AddToHook{cmd/rmfamily/before}{\let\substitutemu\substituterm}
\AddToHook{cmd/sffamily/before}{\let\substitutemu\substitutesf}
\AtBeginDocument{\let\substitutemu\substituterm}
\newunicodechar{μ}{{\substitutemu μ}}


\begin{document}

This is a text with μ

\textit{This is a text with μ}

\textbf{This is a text with μ}

\textsf{This is a text with μ}

\textsf{\textit{This is a text with μ}}

\textsf{\textbf{This is a text with μ}}

\end{document}

在此处输入图片描述

使用 U+00B5 MICRO 似乎不太有吸引力,因为很难想象在拉丁现代语中,mu 的渲染会比 micro 更糟糕。

答案3

Egreg 展示了如何在 LaTeX 中根据一个字符进行字体系列替换。为了进行比较,如何在 opTeX 中解决类似任务:

\fontfam[New CM]        % this family is accessible by \NewCM family selector
\fontfam[Latin Modern]  % current family is last loaded family: Latin Modern   

\adef μ{{\NewCM\fontsel \string μ}}  % substitution of μ by \NewCM μ

This is a text with μ

{\it This is a text with μ}

{\bf This is a text with μ}

{\sans\rm This is a text with μ}

{\sans\it This is a text with μ}

{\sans\bf This is a text with μ}

{\sans\bi This is a text with μ}

\bye

亩

似乎将 μ (U+03BC) 映射到 (μ U+00B5) 更容易\adef μ{µ}(受 David 的回答启发),或者最简单的方法是选择提供字符的字体系列。例如,\fontfam[NewCM]没有 Latin Modern。

相关内容