0

I am writing my thesis and I've been using this template for my thesis.

I have two issues:

  1. When I try to use an Arabic word it always gives me errors in LaTeX.
  2. When I convert intro xelatex it won't generate the PDF because I think there are conflicts in packages, I didn't figure out yet where the errors come from.

I just added these packages in the main.tex

\usepackage{setspace}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.1]{Scheherazade}

then my code be like this

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Masters/Doctoral Thesis 
% LaTeX Template
% Version 2.5 (27/8/17)
%
% This template was downloaded from:
% http://www.LaTeXTemplates.com
%
% Version 2.x major modifications by:
% Vel (vel@latextemplates.com)
%
% This template is based on a template by:
% Steve Gunn (http://users.ecs.soton.ac.uk/srg/softwaretools/document/templates/)
% Sunil Patel (http://www.sunilpatel.co.uk/thesis-template/)
%
% Template license:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\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[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters

\usepackage{mathpazo} % Use the Palatino font by default

\usepackage{wrapfig}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{float}
\usepackage{adjustbox}


\usepackage{geometry}
\geometry{letterpaper}
\usepackage{setspace}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script = Arabic]{Simplified Arabic} % Replace 'Simplified Arabic' with a font from your system

\usepackage[nopostdot,toc,acronym,nomain]{glossaries}
\makeglossaries

% define an acronym style for the acronyms with a translation:

\newacronymstyle{acronymslang}%
{%
    \GlsUseAcrEntryDispStyle{long-short}%
}
{%
    \GlsUseAcrStyleDefs{short-long}%
    \renewcommand*{\genacrfullformat}[2]{%
        \glsentrylong{##1}##2\space
        (\protect\firstacronymfont{\glsentryshort{##1}}%
        \ifglshasfield{useri}{##1}%
        {, English: \glsentryuseri{##1}}{})%
    }%
    \renewcommand*{\Genacrfullformat}[2]{%
        \Glsentrylong{##1}##2\space
        (\protect\firstacronymfont{\glsentryshort{##1}}%
        \ifglshasfield{useri}{##1}%
        {, English: \glsentryuseri{##1}}{})%
    }%
    \renewcommand*{\genplacrfullformat}[2]{%
        \glsentrylongpl{##1}##2\space
        (\protect\firstacronymfont{\glsentryshortpl{##1}}%
        \ifglshasfield{useri}{##1}%
        {, English: \glsentryuseri{##1}}{})%
    }%
    \renewcommand*{\Genplacrfullformat}[2]{%
        \Glsentrylongpl{##1}##2\space
        (\protect\firstacronymfont{\glsentryshortpl{##1}}%
        \ifglshasfield{useri}{##1}%
        {, English: \glsentryuseri{##1}}{})%
    }%
}

\setacronymstyle{acronymslang}

\loadglsentries[acronym]{example-glossaries-acronyms-lang}

% glossary style for acronyms with a translation

\newglossarystyle{acronymslang}
{%
    \setglossarystyle{long}%
    \renewcommand*{\glsgroupskip}{}%
    \renewcommand{\glossentry}[2]{%
        \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
        \glossentrydesc{##1}\glspostdescription
        \ifglshasfield{useri}{##1}{ (English: \glsentryuseri{##1})}{}%
        \space ##2\tabularnewline
    }%
}

\usepackage[backend=bibtex,style=numeric,citestyle=numeric-comp,natbib=true]{biblatex} % Use the bibtex backend with the authoryear citation style (which resembles APA)


\addbibresource{LPRbibliography.bib} % The filename of the bibliography

\usepackage[autostyle=true]{csquotes} % Required to generate language-dependent quotes in the bibliography

%----------------------------------------------------------------------------------------
%   MARGIN SETTINGS
%----------------------------------------------------------------------------------------

\geometry{
    paper=a4paper, % Change to letterpaper for US letter
    inner=2.5cm, % Inner margin
    outer=3.8cm, % Outer margin
    bindingoffset=.5cm, % Binding offset
    top=1.5cm, % Top margin
    bottom=1.5cm, % Bottom margin
    %showframe, % Uncomment to show how the type block is set on the page
}

%----------------------------------------------------------------------------------------
%   THESIS INFORMATION
%----------------------------------------------------------------------------------------
\begin{document}
    \textarabic{السلام عليكم}
\end{document}

this gives me this error when i run it inside LATEX using text studio program

Fatal fontspec error: "cannot-use-pdftex" The fontspec package requires either XeTeX or LuaTeX. You must change your typesetting engine to, e.g., "xelatex" or "lualatex"instead of "latex" or "pdflatex". For immediate help type H <return>.

when i run it inside XeLaTeX

It gives me also error

But when i start an empty file like this template from this https://scholar.harvard.edu/dromney/arabic-latex it works great and when i tried to do the same in my thesis it gives me erros ithink there are something make a conflict

i use this line of code as test for arabic sentence

\textarabic{السلام عليكم}

or

\begin{arabic}{
السلام عليكم
}\end{arabic}
  • Welcome to TeX.SX! Please make your example code a complete but minimal document that can be used by others to reproduce the issue. – siracusa Jun 27 at 22:45
  • 1
    thanks @siracusa i just added some details hope it help a lot for explaining the issue – Andrei Jun 27 at 23:40
  • You cannot use pdflatex, you need to switch to a unicode engine like xe(la)tex or Lua(la)tex. There is a button in your editor somewhere. – Johannes_B Jun 29 at 4:33
  • @Johannes_B i yes used XeLaTeX for this but it show errors i think there are conflict of packages something like this i reorder the packages but it keeps gives me errors am worry about if i change something can do disaster and lead me to lose my effort – Andrei Jun 30 at 9:21
  • Please add the exact errors you are getting to the question. – Johannes_B Jun 30 at 9:51

Your Answer

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

Browse other questions tagged or ask your own question.