使用 Sanskrit 2003 时出现“未找到字体”错误

使用 Sanskrit 2003 时出现“未找到字体”错误

.tex这是我的文件的开头

\usepackage{fontspec}
\makeatletter
\setmainfont[Script=Devanagari]{Sanskrit 2003}
\setsansfont[Script=Devanagari]{Sanskrit 2003}
\setmonofont[Script=Devanagari]{Sanskrit 2003}

但是当我编译时,出现以下错误:

\font\dev="Sanskrit 2003:script=deva" at 12pt\dev
! fontspec error: "font-not-found"
!! The font "Sanskrit 2003" cannot be found.
!! See the fontspec documentation for further information.
!! For immediate help type H<return>.
!...............................................
 ...ainfont[Script=Devanagari]{Sanskrit 2003}

答案1

This is what you want

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage[english]{babel} 
\newfontfamily\sanskrit[Script=Devanagari]{Sanskrit 2003}
\begin{document}
The main text is in English, and you can add sanskrit quote...
\begin{quotation}\sanskrit
सर्वधर्मान् परित्यज्य मामेकं शरणं व्र्ज
अहं त्वां सर्वपापेभ्यो मोक्षयिष्यामि मा शुचः
\end{quotation}
\end{document}

sans1

答案2

\documentclass[12pt]{article}
\usepackage{fontspec}
\newcommand\dn{\catcode`\~=12
\fontspec[Script=Devanagari,%
Mapping=velthuis-sanskrit]{Sanskrit 2003}}
\setlength\parindent{0pt}
 \begin{document}
 {\dn
namastu"n+ga"sira"scumbicandracaamaracaarave |\\
trailokyanagaraarambhamuulas+tambhaaya "sambhave || 1 ||\\
haraka.n.thagrahaanandamiilitaak.sii.m namaamyumaam |\\
kaalakuu.tavi.saspar"sajaatamuurcchaagamaamiva || 2 ||}
\end{document}

无

相关内容