用于编写波斯语的简单配置结果是:
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[farsi]{babel}
\author{S. M. Saadatmand}
\begin{document}
سلام %I've only added this
\end{document}
但它会导致这个错误:
line 133: Encoding scheme `LAE' unknown. ...ntencoding{LAE}\fi\selectfont\alefhamza}}
line 133: Command \alefhamza unavailable in encoding OT1. ...ntencoding{LAE}\fi\selectfont\alefhamza}}
line 135: Encoding scheme `LAE' unknown. ... \fontencoding{LAE}\fi\selectfont\Haa}}
line 135: Command \Haa unavailable in encoding OT1. ... \fontencoding{LAE}\fi\selectfont\Haa}}
line 137: Encoding scheme `LAE' unknown. ... \fontencoding{LAE}\fi\selectfont\damma}}
line 137: Command \damma unavailable in encoding OT1. ... \fontencoding{LAE}\fi\selectfont\damma}}
line 139: Encoding scheme `LAE' unknown. ... \fontencoding{LAE}\fi\selectfont\kasra}}
line 139: Command \kasra unavailable in encoding OT1. ... \fontencoding{LAE}\fi\selectfont\kasra}}
line 6: Package inputenc Error: Unicode character س (U+0633)(inputenc) not set up for use with LaTeX. س
line 6: Package inputenc Error: Unicode character ل (U+0644)(inputenc) not set up for use with LaTeX. سل
line 6: Package inputenc Error: Unicode character ا (U+0627)(inputenc) not set up for use with LaTeX. سلا
line 6: Package inputenc Error: Unicode character م (U+0645)(inputenc) not set up for use with LaTeX. سلام
我还认为有必要在 Babel 输入参数中添加英语。有什么想法吗?
答案1
只需加载请求的字体编码:
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[LAE]{fontenc}
\usepackage[farsi]{babel}
\author{S. M. Saadatmand}
\begin{document}
سلام %I've only added this
\end{document}
编辑。如果您使用的是 XeTeX 或 LuaTeX,则不应加载inputenc
或fontenc
。使用 LuaTeX:
\usepackage[bidi=basic]{babel}
\babelprovide[main,import]{persian}
\babelfont{rm}{FreeSerif}
\author{S. M. Saadatmand}
\begin{document}
سلام %I've only added this
\end{document}
对于 XeTeX,bidi 方法是bidi=bidi-r
。您需要最新版本的babel
。有关更多信息,请参阅手册(它提供了一些阿拉伯语脚本的示例)。另请参阅https://github.com/latex3/babel/tree/master/samples。
或者,您可以使用多语种(据我所知,仅限 XeTeX)。