多语言 Overleaf Latex 问题

多语言 Overleaf Latex 问题

我使用 overleaf 并以英语为主要语言,但我需要在文章中添加一些阿拉伯语文本,我在 StackExchange 上搜索,找到了一些有用的主题,并将它们应用到我的文章中。阿拉伯语文本出现了,但在编译过程中出现了许多错误,这就是我所做的:

\documentclass[11pt,a4paper]{article}
\usepackage[colorlinks=true, linkcolor=blue]{hyperref}
%\usepackage[english]{babel}
%\selectlanguage{English}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script = Arabic]{Amiri}
\usepackage[svgnames]{xcolor}
\usepackage[toc,page]{appendix}
%\renewcommand{\baselinestretch}{1.5} %line spacing
\usepackage{longtable} % long table 
\usepackage[inline]{enumitem} % control enumerate
\usepackage{caption} 
\usepackage{placeins} % . It prevents your floats from being moved behind this barrier. 
\usepackage{nopageno} % remove page numbers
\captionsetup[table]{skip=1.5pt} % table caption
\usepackage[a4paper,left=2cm,right=2cm,top=2.5cm,bottom=1cm]{geometry}
\usepackage{tablefootnote}
%\setmarginsrb{3cm}{2.5cm}{2cm}{2cm}{11pt}{1.8cm}{11pt}{10mm}
\usepackage{multirow}
\usepackage[flushleft]{threeparttable} 
\usepackage{array}
\newlength\myfirstcol
\newlength\mysecondcol
\newlength\mythirdcol
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\usepackage[T1]{fontenc}
 % control the page margins
 \usepackage{xspace}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\usepackage{capt-of}
\hypersetup{
    colorlinks,
    linkcolor={red!50!black},
    citecolor={blue!50!black},
    urlcolor={blue!80!black}
}


%%
%%Arabic Language


%%
%\usepackage{polyglossia}
%\setmainfont{Times New Roman}
\usepackage[export]{adjustbox}
%\usepackage[most]{tcolorbox}
\usepackage{afterpage}
\pagestyle{plain}
\textheight=21cm
\textwidth=17cm
%\topmargin=-2.54cm
%\oddsidemargin=0cm
\parindent=0mm
%\pagestyle{plain}

%%%%%%%%%%%%%%%%%%%%%%%%%%
% La siguiente instrucción pone el curso automáticamente%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[many]{tcolorbox} % for COLORED boxMS (tikz and xcolor%
\newtcolorbox{boxD}{
    colback = sub, 
    colframe = main, 
    boxrule = 0pt, 
    toprule = 3pt, % top rule weight
    bottomrule = 3pt % bottom rule weight
}

\setmainfont{Times New Roman}[
    Kerning = On,
    Mapping = tex-text,
    Numbers = Uppercase
    %BoldFont =Times New Roman
]                           % setting the font as Noto Sans



\definecolor{main}{HTML}{5989cf}    % setting main color to be used
\definecolor{sub}{HTML}{cde4ff}     % setting sub color to be used

\tcbset{
    sharp corners,
    colback = white,
    before skip = 0.2cm,    % add extra space before the box
    after skip = 0.5cm      % add extra space after the box
} 

\begin{document}

\begin{titlepage}

\begin{center}
\begin{figure}[htb]
\begin{center}
\includegraphics[width=8cm]{logo.png}
\end{center}
\end{figure}


\vspace*{0.15in}


\vspace*{0.4in}
\begin{large}

\end{large}
\vspace*{0.5in}
\begin{Large}
\textbf{Title\\
Pre-Proposal for Thesis  
%Summary
} \\
\end{Large}
\vspace*{1.5in}
\begin{large}

Author  \\
\end{large}
\vspace*{1.5in}
\begin{large}

(Supervisor)  \\
\end{large}
\vspace*{0.3in}
\rule{80mm}{0.1mm}\\



\end{center}
\end{titlepage}

\newcommand{\CC}{C\nolinebreak\hspace{-.05em}\raisebox{.4ex}{\tiny\bf +}\nolinebreak\hspace{-.10em}\raisebox{.4ex}{\tiny\bf +}}
\def\CC{{C\nolinebreak[4]\hspace{-.05em}\raisebox{.4ex}{\tiny\bf ++}}}
\newpage

     
\section{Introduction}
\label{sec:intorduction}


  "\textarabic{يعد الرئيس الفلسطيني الراحل \underline{ياسر عرفات} أشهر سياسي كافح من أجل حق الفلسطينيين في تقرير مصيرهم}"    \textbf{\textarabic{"ياسر عرفات"}}. 
   





\FloatBarrier
\newpage
\bibliographystyle{plain}
 \bibliography{ref} 

\end{document}

错误示例:

在此处输入图片描述

请注意,我正在使用 LeLatex 编译器。

这是背面的链接: https://www.overleaf.com/project/60a5eaa5107406b923da3bb7

答案1

这不仅限于 Overleaf,因为在本地 TeX Live 安装上编译示例代码(减去丢失的 logo.png)时会出现相同的错误。

bidi需要加载该包某些软件包。hyperref通常也应该是最后加载的软件包。因此,将这些行移到之前\begin{document}应该会有所帮助:

\usepackage[colorlinks=true, linkcolor=blue]{hyperref}
%(delete the redundant \usepackage{hyperref}

\hypersetup{...}

\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script = Arabic]{Amiri}

相关内容