# How to do a proper Bibliography in Arabic language with XeLaTeX and Biblatex-Biber backend?

I want to add bibliography to a document mainly written with Arabic language but intervened with some English text. Therefore, I opted for arabxetex approach rather than polyglossia, becasue IMHO gives you more flexibility to switch between the two directions than when you have much text in English and few text in Arabic (I am open to other opinions as well).
Anyway, the problem is with bibliography and how to produce an Arabic counterpart to that of English without any transliteration or outright compromises. I came from this question trying to find an answer but it was in lualatex with a suboptimal output, and hence inadequate.

Questions

1. As you can see only the citation key did appear, how to fix that? How and to make the citation numbers appear in Hindi numbers (Waahid-red, Ithnaan-green, Thalaatha,etc) instead of Arabic (1,2,3,etc)?

2. No Bibliography section did appear at the end of the document? And if it appears how to make it appear in Arabic language like المراجع?

3. What is the best approach to enter the fields of information for references in Arabic text, what am I missing?

MWE Code

\documentclass[oneside,16pt]{scrartcl}
%=====================Graphics ===================================
\usepackage[demo]{graphicx}
\usepackage{xcolor}
\usepackage{tikz}
%=====================Floats =====================================
\usepackage{floatrow}
\usepackage{float}
\usepackage{scrhack}
\usepackage{caption}
\captionsetup[figure]{labelfont=bf,labelsep=period,format=plain,skip=0pt,font=small}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{subcaption}
%=====================Hyphenation ================================
\usepackage[none]{hyphenat}
\usepackage[protrusion = true,final]{microtype}
\emergencystretch=2em
%=====================Hyperref ===================================
\usepackage[hyperindex=true, hyperfootnotes=true]{hyperref}
\hypersetup{
citecolor={blue}, urlcolor={blue}
}
%=====================Font issues ===================================
\usepackage{fontspec}
\usepackage{csquotes}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{arabxetex}% default options are "novoc" and "fdf2alif";
% other options are "voc", "fullvoc", "utf", "trans" and "fdf2noalif"
\newfontfamily\arabicfont[Script=Arabic]{Amiri} % or put whatever open type Arabic font you have on your machine inside the two braces

%=====================Bibliography ===================================
\usepackage[style=verbose,backend=biber]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{ibnsina:shifa:physics:ar,
author = {ابن سينا},
year = {١٤١٧},
title = {السماع الطبيعى من كتاب الشفاء},
publisher = {دار المناهل},
location = {بيروت},
}
\end{filecontents}

%=====================End of Preamble ===================================
\begin{document}
\begin{arab}[voc]
وَهَذِهِ فِقرَةٌ بِالعَرَبِيَة مَعَ كَلِمَة اِنكلِيزِيَة رقم 1 او 2 باللغة اللعربية.

\noindent
(\textLR{Words in \textbf{English} with \textsc{small caps} or \textit{italics} are also possible}).

عند الحاجة الى المصدر باللغة العربية ‎‎‎‎\cite{ibnsina:shifa:physics:ar} ‎ تذهب الى باب المراجع فلا تجده.

\end{arab}
\printbibliography
\end{document}


MWE Output

Update 1
Based on the informative answer from PLK, some bugs are now fixed, what remains is the comma issue (circled in red), it is not in Arabic style (should be directed upwards instead of downwards).

\documentclass[oneside,16pt]{scrartcl}
\usepackage{fontspec}
\usepackage{csquotes}
\usepackage{polyglossia}
\setmainlanguage{arabic}
\setotherlanguage{english}
\setmainfont{Arial}
\usepackage[style=numeric,backend=biber]{biblatex}

\DefineBibliographyStrings{english}{%
references = {المراجع},
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{ibnsina:shifa:physics:ar,
author = {{ابن سينا}},
year = {1417},
title = {السماع الطبيعى من كتاب الشفاء},
publisher = {دار المناهل},
location = {بيروت},
}
\end{filecontents}

%=====================End of Preamble ===================================
\begin{document}

وَهَذِهِ فِقرَةٌ بِالعَرَبِيَة مَعَ كَلِمَة اِنكلِيزِيَة رقم 1 او 2 باللغة اللعربية.

\textenglish{(Words in \textbf{English} with \textsc{small caps} or \textit{italics} are also possible).}

عند الحاجة الى المصدر باللغة العربية ‎‎‎‎\parencite{ibnsina:shifa:physics:ar}‎ تذهب الى باب المراجع فتجده، لكن الفارزة ليست على الطراز العربي بل الافرنجي.

\printbibliography
\end{document}


Output

Question Updated:
How to fix the comma?

Update 2
Based on PLK's great help to fix the comma issue, the final code is below:

\documentclass[oneside,16pt]{scrartcl}
\usepackage{fontspec}
\usepackage{csquotes}
\usepackage{polyglossia}
\setmainlanguage{arabic}
\setotherlanguage{english}
\setmainfont{Arial}
\usepackage[style=numeric,backend=biber]{biblatex}

\DefineBibliographyStrings{english}{%
references = {المراجع},
}
\makeatletter
\def\abx@comma{\ifdim\lastkern>\z@\unkern\fi\abx@puncthook{،}}% \makeatother

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{ibnsina:shifa:physics:ar,
author = {{ابن سينا}},
year = {1417},
title = {السماع الطبيعى من كتاب الشفاء},
publisher = {دار المناهل},
location = {بيروت},
}
\end{filecontents}

%=====================End of Preamble ===================================
\begin{document}

وَهَذِهِ فِقرَةٌ بِالعَرَبِيَة مَعَ كَلِمَة اِنكلِيزِيَة رقم 1 او 2 باللغة اللعربية.

\textenglish{(Words in \textbf{English} with \textsc{small caps}, or \textit{italics} are also possible).}

عند الحاجة الى المصدر باللغة العربية ‎‎‎‎\parencite{ibnsina:shifa:physics:ar}‎ تذهب الى باب المراجع فأنك حتما ستجده و مع الفارزة  هذه المرة على الطراز العربي الاصيل.

\printbibliography
\end{document}


Output

• See the comment to my answer below for a way to fix this. – PLK Apr 21 '14 at 18:01

This seems to work for me (except that I can't really verify the Arabic) on OSX like this (I removed a lot of unnecessary packages for simplicity):

\documentclass[oneside,16pt]{scrartcl}
\usepackage{fontspec}
\usepackage{csquotes}
\usepackage{polyglossia}
\setmainlanguage{arabic}
\setotherlanguage{english}
\setmainfont{Arial}
\newfontfamily\arabicfont[Script=Arabic]{Geeza Pro}
\newfontfamily\arabicfontsf[Script=Arabic]{Geeza Pro}
\newfontfamily\arabicfonttt[Script=Arabic]{Geeza Pro}
\usepackage[style=verbose,backend=biber]{biblatex}

\DefineBibliographyStrings{english}{%
references = {المراجع},
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{ibnsina:shifa:physics:ar,
author = {ابن سينا},
year = {١٤١٧},
title = {السماع الطبيعى من كتاب الشفاء},
publisher = {دار المناهل},
location = {بيروت},
}
\end{filecontents}

%=====================End of Preamble ===================================
\begin{document}

وَهَذِهِ فِقرَةٌ بِالعَرَبِيَة مَعَ كَلِمَة اِنكلِيزِيَة رقم 1 او 2 باللغة اللعربية.

\textenglish{(Words in \textbf{English} with \textsc{small caps} or \textit{italics} are also possible).}

عند الحاجة الى المصدر باللغة العربية ‎‎‎‎\cite{ibnsina:shifa:physics:ar} ‎ تذهب الى باب المراجع فلا تجده.

\printbibliography
\end{document}


With the result:

Biber understands UTF-8 so you can enter it directly as you did as long as you are using XeLaTeX or LuaLaTeX. Biblatex has no arabic localisation at the moment (and no real RL support in general) so it is falling back on the "english" localisation for strings which is why I modified the "References" header in the english locale. Hopefully this will get you started ...

• informative answer. I built up on your answer to handle the small boxes (font family changed as in the update), unwanted flipping of fields can be preserved by extra braces (see author field in update), citation verbose is messy IMHO, so citations style made simpler (numeric is better, see update). One problem remains though, the comma not like in Arabic but English commas which is far from being a minor issue to any Arabic reader. – doctorate Apr 21 '14 at 14:11
• BTW, the small box in the bibliography between first name and last names of the author is actually a comma. One workaround is to put extra braces in the author field so to be one piece, one name instead of two. However, this is not a good way to do it, sooner or later one would need to enter first and last names but then the comma issue will pop up. So comma issue is critical now to be solved. I will wait for more input from the community to provide a fix for this problem. – doctorate Apr 21 '14 at 14:26
• Add this to your preamble: \makeatletter\def\abx@comma{\ifdim\lastkern>\z@\unkern\fi\abx@puncthook{،}}%\makeatother. This redefines the symbol used by \addcomma which is used many times in bib styles. A real solution for arabic would be an .lbx which did this sort of redefining. – PLK Apr 21 '14 at 17:51
• worked!, when these two lines were put nearly at the end of preamble, but not right after the class. Pls, do u know how to left-indent the English sentence inside the Arabic environment in the same MWE? – doctorate Apr 21 '14 at 18:03
• biblatex has a modular language localisation facility so that strings like "References" etc. can be localised automatically (by setting the language in polyglossia, for example). So, if you would like to make a .lbx for arabic, that would be very good. The RL support in biblatex is not really tested much so it might take some effort to get it right but making a new .lbx is not so hard. See here: sourceforge.net/apps/mediawiki/biblatex/… and also the main biblatex documentation. – PLK Apr 21 '14 at 18:24