检查此代码:
\documentclass[crop]{standalone}
% \documentclass{article}
\usepackage{fontspec}
\newfontfamily\s[Script=Devanagari]{Noto Serif Devanagari} % Or any other Devanagari font
\usepackage[Devanagari,Latin]{ucharclasses}
\setTransitionTo{Devanagari}{\s}
\setTransitionFrom{Devanagari}{\rmfamily}
\setTransitionsForDevanagari{\s}{\rmfamily}
\begin{document}
English देवनागरी English देवनागरी ॥१॥ % last character is not appearing.
\end{document}
答案1
我发现直接使用字符类命令通常比通过界面更容易ucharclasses
,但无论如何,由于不清楚的原因,它会在字符之前切换到罗马字体,所以你会得到
Missing character: There is no ॥ (U+0965) in font
[lmroman10-regular]:mapping=tex-text;!
注释掉的部分\showthe
确认了 ॥ 是类 3,日志显示为
\DevanagariDanDaClass=\XeTeXcharclass3
因此我只是添加了另一行来断言应该对此类使用 Devanagari 字体(它应该由 Devanagari 元类覆盖,但显然这不起作用)。
\documentclass[crop]{standalone}
% \documentclass{article}
\usepackage{fontspec}
\newfontfamily\s[Script=Devanagari]{Noto Serif Devanagari} % Or any other Devanagari font
\usepackage[Devanagari,Latin]{ucharclasses}
\setTransitionTo{Devanagari}{\s}
\setTransitionFrom{Devanagari}{\rmfamily}
\setTransitionsForDevanagari{\s}{\rmfamily}
\setTransitionTo{DevanagariDanDa}{\s}%<<<< added
%\showthe\XeTeXcharclass"0965
%\showthe\XeTeXcharclass`१
%\showthe\XeTeXcharclass`॥
\begin{document}
English देवनागरी English देवनागरी ॥१॥ % last character is not appearing.
\end{document}