![无法用阿拉伯语书写:软件包 babel 错误:未找到语言定义文件 main=arabic.ldf。\ProcessOptions*](https://linux22.com/image/408568/%E6%97%A0%E6%B3%95%E7%94%A8%E9%98%BF%E6%8B%89%E4%BC%AF%E8%AF%AD%E4%B9%A6%E5%86%99%EF%BC%9A%E8%BD%AF%E4%BB%B6%E5%8C%85%20babel%20%E9%94%99%E8%AF%AF%EF%BC%9A%E6%9C%AA%E6%89%BE%E5%88%B0%E8%AF%AD%E8%A8%80%E5%AE%9A%E4%B9%89%E6%96%87%E4%BB%B6%20main%3Darabic.ldf%E3%80%82%5CProcessOptions*.png)
我正在使用Ubuntu
系统。我使用TexStudio
的编辑器使用TeX Live 2017/Debian
并且编辑器的编译器配置为pdflatex
。
我的主要文档是英文的。但我需要在某些行中写一些阿拉伯语文本。我使用arabtex
以下最小脚本:
\PassOptionsToPackage{main=arabic}{babel}
\documentclass[a4paper,twoside]{ociamthesis}
\fancyfoot[C]{\emph{DRAFT Printed on \today}}
\correctionstrue
\newcommand*{\bibtitle}{References}
%---------- START FOR ARABIC ----------------------------
\usepackage{arabtex}
\usepackage[utf8]{inputenc}
\usepackage[LFE,LAE]{fontenc}
%---------- END FOR ARABIC ----------------------------
\title{Suitably impressive thesis title}
\author{Your Name}
\college{Your College}
\degree{Doctor of Philosophy}
\degreedate{Michaelmas 2014}
\begin{document}
\setlength{\textbaselineskip}{22pt plus2pt}
\setlength{\frontmatterbaselineskip}{17pt plus1pt minus1pt}
\setlength{\baselineskip}{\textbaselineskip}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\begin{romanpages}
\maketitle
\begin{acknowledgements}
\begin{otherlanguage}{arabic}
سلام
\end{otherlanguage}
\end{acknowledgements}
\begin{abstract}
My abstract here in English.
\end{abstract}
\end{romanpages}
\end{document}
但是我在编译文档时出现以下错误:
Package babel Error: Language definition file main=arabic.ldf not found. \ProcessOptions*
Package babel Error: Unknown language `arabic'. Either you have(babel) install it or just rerun the file, respectively. \begin{otherlanguage}{arabic}
\begin{alwayssingle} on input line 37 ended by \end{abstract}. \end{abstract}
\begin{abstract} on input line 37 ended by \end{romanpages}. \end{romanpages}
\begin{romanpages} on input line 28 ended by \end{document}. \end{document}
Font shape `LAE/lmr/m/n' undefined(Font) using `LAE/cmr/m/n' instead
Font shape `LAE/lmr/bx/n' undefined(Font) using `LAE/lmr/m/n' instead
Font shape `LAE/lmr/m/it' undefined(Font) using `LAE/lmr/m/n' instead
Some font shapes were not available, defaults substituted.
有人能帮我弄清楚如何在英文乳胶文档中插入一些阿拉伯语文字(例如在献词或致谢部分)吗?
答案1
babel arabic.ldf
(以及arabtex
包)对各种命令进行了许多更改,这些命令可能会在各个地方发生冲突(例如在 minitoc 和 microtype 的组合中)。两者都相当老旧,多年来一直没有改变,因为大多数人使用 xelatex 或 lualatex 来编写此类脚本。
如果您只需要使用阿拉伯语来完成一些工作并且想要坚持使用 pdflatex,您应该考虑避免加载 arabic.ldf 并且只手动切换字体和方向:
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[LAE,T1]{fontenc}
\TeXXeTstate=1
\begin{document}
Some arabic
\makeatletter
\bgroup\beginR\raggedleft\fontencoding{LAE}\selectfont سلام\endR\par\egroup
\end{document}
答案2
首先,您不希望主要语言是阿拉伯语,对吗?
其次,arabtex
进行了几次与文档类别冲突的重新定义;将其删除。
您还需要恢复拉丁输出编码。
\PassOptionsToPackage{arabic}{babel}% <---- CHANGE HERE
\documentclass[a4paper,twoside]{ociamthesis}
\fancyfoot[C]{\emph{DRAFT Printed on \today}}
\correctionstrue
\newcommand*{\bibtitle}{References}
%---------- START FOR ARABIC ----------------------------
%\usepackage{arabtex}% <---- CHANGE HERE
\usepackage[utf8]{inputenc}
\usepackage[LFE,LAE,T1]{fontenc}% <---- CHANGE HERE
%---------- END FOR ARABIC ----------------------------
\title{Suitably impressive thesis title}
\author{Your Name}
\college{Your College}
\degree{Doctor of Philosophy}
\degreedate{Michaelmas 2014}
\begin{document}
\setlength{\textbaselineskip}{22pt plus2pt}
\setlength{\frontmatterbaselineskip}{17pt plus1pt minus1pt}
\setlength{\baselineskip}{\textbaselineskip}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\begin{romanpages}
\maketitle
\begin{acknowledgements}
\begin{otherlanguage}{arabic}
سلام
\end{otherlanguage}
\end{acknowledgements}
\begin{abstract}
My abstract here in English.
\end{abstract}
\end{romanpages}
\end{document}