[Tex/LaTex] How to use Arabic text inside addcontentsline

arabictable of contentsxetex

I am using arabxetex package. I need my TOP be all in Arabic script including page numbers. \addcontentsline works with Latin [English] text, but not with Arabic.

\phantomsection
\addcontentsline{toc}{section}{-- TEXT-- }

When I use something like this inside the TEXT brackets:

\begin{arab}[utf]
ببي
\end{arab}

It gives me error.

Need your help. As per request, here I am adding complete working minimal code:

\documentclass[a4paper]{article}
\usepackage{hyperref}
\usepackage{multicol}
\usepackage{fancyhdr}
\makeatletter
\makeatother
\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}
\usepackage[margin=0.08in, paperwidth=3.56in, paperheight=5.95in]{geometry}
\usepackage{arabxetex}
\usepackage{setspace}
    \renewcommand*\contentsname{}

\begin{document}
\tableofcontents
\newpage

\phantomsection
\addcontentsline{toc}{section}{AAA} % Instead of AAA, I need Arabic text ننن
\begin{arab}[utf]
نتنتنهه
\end{arab}

\newpage
\phantomsection
\addcontentsline{toc}{section}{BBB} % Instead of BBB, I need Arabic text ههه
\begin{arab}[utf]
منسة
\end{arab}

\end{document}

Best Answer

Are you sure you need arabxetex? The following typesets without glitches:

\documentclass[a4paper]{article}

\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}


\usepackage{fontspec}
\setmainfont{Scheherazade}

\usepackage{polyglossia}
\setmainlanguage{arabic}

\begin{document}

\tableofcontents

\section{ننن}

نتنتنهه

\section{ههه}

منسة

\end{document}

enter image description here

Related Question