2

I am using Ubuntu system. I use TexStudio editor which uses TeX Live 2017/Debian and the editor's compiler is configured to be pdflatex.

I am using this template. My main document is in English language. But I need to write some Arabic text in some lines. I use arabtex as in the following minimal script:

\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}

But I am getting the following errors when I compile the 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.

Can anyone help me figure out how to insert some Arabic lines of text (e.g. in the dedication or acknowledgement parts) in an English latex document?

  • 1
    Your tex system is older. Try \PassOptionsToPackage{arabic,english}{babel} – Ulrike Fischer Feb 23 at 14:11
4

The arabic.ldf of babel (and also the arabtex package) make many changes to various commands which can clash in various places (e.g. in the combination of minitoc and microtype). Both are also rather old and haven't been changed since many years as most people use xelatex or lualatex for such scripts.

If you need arabic only for a few works and want to stick to pdflatex, you should consider to avoid to load arabic.ldf and only manually switch the font and the direction:

\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}
|improve this answer|||||
  • your solution clashes when I incorporate it with the template I pointed out earlier. – seq Feb 23 at 18:03
  • Sorry forgot to remove the arabic option when copying the code ... – Ulrike Fischer Feb 23 at 18:04
  • Thanks. It seems working without errors. Just found two things I need. How to make the sentence centered? Also, can I change the font name (there are many different Arabic fonts)? – seq Feb 23 at 18:25
  • centering should work. And if you know the font family name you should be able to use \fontfamily{name}. (But I have no idea which fonts exists for pdflatex.) – Ulrike Fischer Feb 23 at 18:32
  • centering does not work unfortunately. – seq Feb 23 at 18:33
2

First off, you don't want the main language is Arabic, do you?

Second, arabtex does several redefinitions that clash with the document class; leave it out.

You also need to restore a Latin output encoding.

\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}
|improve this answer|||||
  • Thanks. This helped. But one more thing plz. When I add \dominitoc for mini table of content in each chapter, after the abstract and before the \end{romanpages} I get an error: Argument of \MT@res@a has an extra }. \flushbottom Can you see why and how to resolve it? – seq Feb 23 at 14:47
  • @seq Are you sure that the class is compatible with minitoc? – egreg Feb 23 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.