0

I am using this thesis template. I need to add some arabic text. I need to add this preamble:

\usepackage{arabtex}
\usepackage[utf8]{inputenc}
\usepackage[LFE,LAE]{fontenc}
\usepackage[arabic]{babel}

Which works for me in a simple article. But with this thesis template, it generates errors:

Option clash for package babel.

\begin{alwayssingle} on input line 166 ended by \end{abstract}. \end{abstract}

\begin{abstract} on input line 166 ended by \end{romanpages}. \end{romanpages}

\begin{romanpages} on input line 148 ended by \end{document}. \end{document}

Can you identify how to make these preamble not conflict with this template?

EDIT:

This code works in separate tex file.
\documentclass[11pt,a4paper]{report}
\usepackage{arabtex}
\usepackage[utf8]{inputenc}
\usepackage[LFE,LAE]{fontenc}
\usepackage[arabic]{babel}
\begin{document}
    \chapter{علوم الحاسوب}
    \section{تاريخ}
    \begin{otherlanguage}{arabic}
        سلام 
    \end{otherlanguage}
\end{document}

But the problems arise when I try to incorporate this in this thesis template.

1 Answer 1

3

The class file does \usepackage[greek,latin,english]{babel} (which in my opinion is not a thing a class should do).

This is such a common problem that the babel manual has a note telling you the way out. Page 6 of the manual to v3.40 says

Some classes load babel with a hardcoded language option. Sometimes, the main language could be overridden with something like that before \documentclass:

\PassOptionsToPackage{main=english}{babel}

In your case:

\PassOptionsToPackage{main=arabic}{babel}
\documentclass{ociamthesis}

and remove \usepackage[arabic]{babel}.

5
  • Still not working. Do you mean I write \PassOptionsToPackage{main=arabic}{babel} before the \documentclass{ociamthesis} ?? Also, shall I keep or remove the other packages (see my OP): arabtex, inputenc, fontenc? Please clarify I inserted the \PassOptionsToPackage{main=english}{babel} before the \documentclass and removed \usepackage[arabic]{babel} as you suggested but I got errors.
    – randomname
    Feb 23, 2020 at 13:01
  • I also added an edit.
    – randomname
    Feb 23, 2020 at 13:05
  • 1
    @seq yes, before \documentclass. your question was only about the option clash error. My solution worked in a MWE I created for myself since you didn't provide one. If you have different errors now, please open a new question and please include a MWE, then
    – cgnieder
    Feb 23, 2020 at 13:29
  • did you use the template I pointed for your MWE?
    – randomname
    Feb 23, 2020 at 13:43
  • @seq yes, of course I did.
    – cgnieder
    Feb 23, 2020 at 13:45

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.