TransWikia.com

How to add Arabic contents to an english document in pdfLaTeX?

TeX - LaTeX Asked by Mardox on April 6, 2021

I’m trying to use this template for my work. The same template can be opened and modified in Overleaf using this link.
The work will be mainly in English/German text, however I would like to be able to add some Arabic "paragraphs/sentences/words/characters" to any part of the document. I tried out several solutions suggested in other questions here on Stackexchange. But unfortunately none of them worked for this particular template. I just need someone to point out what kind of modifications do I need in order to make this possible?

Please forgive me if the question doesn’t look to be appropriate or if the answer is very obvious, I’m just inexperienced latex user.

Appreciate any help!

One Answer

You can use the polyglossia package to write Arabic.

For that you need XeLaTex.

You also need to disable the hyperref package support in the documentclass, as this is loaded at the end, and hyperref must not be loaded after bidi (wich is the RL package that polyglossia loads).

So the changes are:

documentclass[
11pt, % The default document font size, options: 10pt, 11pt, 12pt
%oneside, % Two side (alternating margins) for binding by default, uncomment to switch to one side
english, % ngerman for German
singlespacing, % Single line spacing, alternatives: onehalfspacing or doublespacing
%draft, % Uncomment to enable draft mode (no pictures, no links, overfull hboxes indicated)
%nolistspacing, % If the document is onehalfspacing or doublespacing, uncomment this to set spacing in lists to single
%liststotoc, % Uncomment to add the list of figures/tables/etc to the table of contents
%toctotoc, % Uncomment to add the main table of contents to the table of contents
%parskip, % Uncomment to add space between paragraphs
nohyperref, % Uncomment to not load the hyperref package
headsepline, % Uncomment to get a line under the header
%chapterinoneline, % Uncomment to place the chapter title next to the number on one line
%consistentlayout, % Uncomment to change the layout of the declaration, abstract and acknowledgements pages to match the default layout
]{MastersDoctoralThesis} % The class file specifying the document structure


usepackage{hyperref}
hypersetup{pdfpagemode={UseOutlines},
bookmarksopen=true,
bookmarksopenlevel=0,
hypertexnames=false,
colorlinks=true,% Set to false to disable coloring links
citecolor=magenta,% The color of citations
linkcolor=red,% The color of references to document elements (sections, figures, etc)
urlcolor=mdtRed,% The color of hyperlinks (URLs)
pdfstartview={FitV},
unicode,
breaklinks=true,
}

usepackage{polyglossia}
    setdefaultlanguage{english}
        newfontfamilyenglishfont[Ligatures=NoCommon]{Linux Libertine O}
    setotherlanguage{arabic}
        newfontfamilyarabicfont[Script=Arabic]{Amiri}
        
usepackage[utf8]{inputenc} % Required for inputting international characters
usepackage[T1]{fontenc} % Output font encoding for international characters

Notice the nohyperref option. The hypersetup is the same as the document class, only loaded before the bidi.

now, anywhere in the document you may use textarabic{} To write in arabic

Correct answer by Elad Den on April 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP