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.

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
  • 1
    Your tex system is older. Try \PassOptionsToPackage{arabic,english}{babel} Feb 23, 2020 at 14:11

2 Answers 2

7

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}
6
  • your solution clashes when I incorporate it with the template I pointed out earlier.
    – randomname
    Feb 23, 2020 at 18:03
  • Sorry forgot to remove the arabic option when copying the code ... Feb 23, 2020 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)?
    – randomname
    Feb 23, 2020 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.) Feb 23, 2020 at 18:32
  • centering does not work unfortunately.
    – randomname
    Feb 23, 2020 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}
2
  • 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?
    – randomname
    Feb 23, 2020 at 14:47
  • @seq Are you sure that the class is compatible with minitoc?
    – egreg
    Feb 23, 2020 at 15:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .