我正在使用在 XeLaTeX 之上编写的包。这个包使用 fontspec 来指定不同部分的字体您的文本:拉丁语、非拉丁语、数学模式……
该软件包附带了几个示例文件。我能够 xelatex 其中大多数依赖于常规 ttf 或 otf 文件。然而,其中之一尝试将数学模式下的数字字体设置为某种字体,例如“非拉丁数字”。但是,该字体似乎不是常规字体。同一目录中有两个文件,名为“nonlatindigits.map”和“nonlatindigits.tec”。 TECkit 使用这些映射文件来生成 TeX字体。但是,由于某种原因,它无法创建文件,并且 xelatex 发出以下错误消息。
kpathsea: Invalid fontname `NonLatin Digits', contains ' '
! Font \zf@basefont="NonLatin Digits" at 10.0pt not loadable: Metric (TFM) file or
installed font not found.
kpathsea 程序抱怨空格,但删除空格确实解决了加载 TFM 文件的问题。
有什么线索我做错了吗?
I am using a package written on top of XeLaTeX. This package uses fontspec to specify fonts for different parts of your text: latin, non-latin, math mode, ...
The package comes with several sample files. I was able to xelatex most of them that depend on regular ttf or otf files. However, one of them tries to set the font of digits in math mode to some font, say "NonLatin Digits". But, the font doesn't seem to be a regular font. There are two files in the same directory called "nonlatindigits.map" and "nonlatindigits.tec". TECkit uses these mapping files to generate TeX fonts. However, for some reason it fails to create the files, and xelatex issues the following error message.
kpathsea: Invalid fontname `NonLatin Digits', contains ' '
! Font \zf@basefont="NonLatin Digits" at 10.0pt not loadable: Metric (TFM) file or
installed font not found.
The kpathsea program complains about the whitespace, but removing the whitespace does solve the problem with loading the TFM file.
Any clues what I am doing wrong?
发布评论
评论(4)
实际的字体文件名是什么?最近在 XeTeX 邮件列表上进行了讨论,涉及一个阻止在 Windows 上加载名称中带有空格的字体文件的错误(在 档案)。如果更改文件名对您有用,那么您可能刚刚遇到了这个错误。
您看到的 kpathsea 调用只是一个副作用:它表明 XeTeX 在 TeX 的默认字体查找系统之上使用的系统库尚未找到该字体,并且 XeTeX 会回退到查找 TFM 文件(最重要的是)。基本文件格式。
TECkit 与字体无关,它会动态转换字符;在你的情况下,我想你可以使用映射将阿拉伯数字转换为印度数字(这样你就不需要直接在源文件中输入后者)。但它不会以任何方式生成字体。
What's the actual font file name? There have been discussions recently on the XeTeX mailing-list, about a bug that prevented from loading font files with spaces in their names on Windows (look for it in the archives). If changing the file name works for you, you may have just run into this bug.
The kpathsea invocation you see is only a side effect: it indicates that the font hasn't been found by the system libraries that XeTeX uses on top of TeX's default font lookup system, and XeTeX falls back to looking up a TFM file, the most basic file format.
TECkit has nothing to do with fonts, it converts characters on the fly; in your case, I guess you could use a mapping to convert, say, Arabic numbers to Indic numbers (so that you don't need to input the latter in your source file directly). But it does not generate fonts in any way whatsoever.
正如其他人提到的,您应该尝试 XeTeX,并且应该确保安装了正确的字体。使用命令 xelatex 代替 pdflatex,以允许在 .tex 文件中使用非拉丁字符。
您没有说明您想要哪种字体编码,但以下两种应该可以很好地工作:Linux Libertine 和 Computer Modern Unicode。 OpenSuSE 软件包名称为 LinuxLibertine 和 cm-unicode;希望其他系统上也有类似的情况。
将以下内容添加为文档中的第一个导入:
并在所有其他导入之后添加以下内容(这样它就不会被旧包导入覆盖),
或者,如果您想要 Computer Modern 字体,
As others have mentioned, you should try XeTeX, and you should make sure you have the correct fonts installed. Use the command xelatex in place of pdflatex, to enable use of non-Latin characters in .tex files.
You didn't say which font encoding you want, but the following two should work pretty well: Linux Libertine, and Computer Modern Unicode. The OpenSuSE package names are LinuxLibertine and cm-unicode; hopefully it's similar on other systems.
Add the following as the first imports in your document:
and add the following after all other imports (so it won't be overridden by older package imports),
or, if you want Computer Modern fonts,
使用 xetex 或 xelatex 时,要点是您不必指定 tex 字体,您应该使用系统字体。
您应该发布出现错误的部分的代码和序言。就像 html+css 一样,不同的 tex 发行版可以呈现彼此略有不同的内容。
至少,您的序言应如下所示:
[Mapping=tex-text] 在加载字体时特别重要。
with xetex or xelatex, the poitn is that you don't have to specify tex fonts, you should use your system fonts.
you should post the code and preamble of the parts where you are getting an error. Much like html+css, different tex distros can render things slightly different from one another.
Minimally, your preamble should look something like this:
The [Mapping=tex-text] is particularly important when loading your fonts.
Parsi Digits 是您当前没有的字体,您收到的错误是因为您没有该字体。只需将
Parsi Digits' 替换为其他字体即可,一切都会顺利进行。 \setdigitfont 是一个将数字转换为波斯语数学模式的命令,它可以接受
Scale' 作为选项。Parsi Digits is a font that you currently do not have and the error, you are getting is because you do not have the font. Simply replace
Parsi Digits' with another font and it all should go fine. \setdigitfont is a command that makes digits in math mode Persian and it can accept
Scale' as an option.