如何在XeLaTeX中输入外国unicode字符?
朋友们,
我正在处理 XeLaTeX 文档。我的文档即将完成,但我需要输入外语文本。我运行的是 Mac OS X。我转到“首选项”>“语言与文本,在那里我启用 Gurmukhi - QWERTY。这允许我输入旁遮普字符,我可以在 MS Word 中看到这些字符。我想输入以下 unicode 字符:
ਰੋਂਦਾ ਬੱਚਾ ਿੲਕ
但是,当我只是将其粘贴到我的 TeXworks 文件中时,当我编译 PDF 文件时它根本不会显示。我确实尝试过用谷歌搜索这一点,但除了在我的序言中添加其中一些陈述之外什么也没想到。此时我非常绝望。
我的序言已经是这样的:
\documentclass[a4paper,12pt]{article} %options: [a4paper, leqno, 11pt]
\usepackage{setspace}
\usepackage{fullpage}
\usepackage[cm-default]{fontspec}
\usepackage{amssymb}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage[utf8]{inputenc}
% -----Page Style-------------
\pagestyle{plain}
% -----Symbols----------------
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
Friends,
I am working on a XeLaTeX document. I am almost done with my document, but I need to input text from a foreign language. I am running Mac OS X. I go to Preferences > Language & Text and in there I enable Gurmukhi - QWERTY. This allows me to input Punjabi characters, which I am able to see in MS Word. I want to input the following unicode characters:
ਰੋਂਦਾ ਬੱਚਾ ਿੲਕ
However, when I simply paste it into my TeXworks file, it simply does not show up when I compile a PDF file. I have indeed tried to google this, but came up with nothing other than adding some of these statements to my preamble. I am pretty desperate at this point.
My preamble already looks like this:
\documentclass[a4paper,12pt]{article} %options: [a4paper, leqno, 11pt]
\usepackage{setspace}
\usepackage{fullpage}
\usepackage[cm-default]{fontspec}
\usepackage{amssymb}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage[utf8]{inputenc}
% -----Page Style-------------
\pagestyle{plain}
% -----Symbols----------------
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
字符是正确的,但 CM 字体不包含字形。您需要选择包含 Gurmukhi 字形的 OpenType 字体,我认为您必须在需要时明确选择该字体。在 Mac 上,您可以像这样使用“Gurmukhi MT”:(
FreeSans 和 FreeSerif 也包含字形。)
另外:
inputenc
包警告不应加载它,因为 XeTeX 已使用 UTF8。The characters are correct, but the CM fonts do not contain the glyphs. You need to select an OpenType font that contains Gurmukhi glyphs, and I think you have to explicitly choose the font when you need it. On Mac you can use “Gurmukhi MT” like this:
(FreeSans and FreeSerif also contain the glyphs.)
Also: The
inputenc
package warns that it should not be loaded as XeTeX already uses UTF8.