# How to write Quran via Latex?

I get this message when I compile it " ! Package inputenc Error: Unicode character ٰ (U+0670) (inputenc) not set up for use with LaTeX. "

\documentclass[11pt,a4paper]{report}
\usepackage{arabtex}
\usepackage[utf8]{inputenc}
\usepackage[LFE,LAE]{fontenc}
\usepackage[arabic]{babel}
\usepackage{quran}
\begin{document}
\quransurah[94]
\end{document}


The quran package is for preparing files compiled with xelatex (or, as Davislor notes, lualatex). That is, it uses latex macros with the xetex (or luatex) binary, which handles unicode natively. By contrast, arabtex uses latex macros with the pdftex binary, which works with older and more limited encodings. That’s why arabtex requires you to specify fontenc and inputenc — both things you should never do when using xetex or luatex.

Here’s a small example of the usage of quran. But be sure to read its manual, because it offers many options and commands.

\documentclass{article}
\usepackage{quran,polyglossia}
\setotherlanguage{arabic}
\setmainfont{Amiri}
\usepackage{bidi}
\begin{document}
\setRTL
\textarabic{\quransurah}
\end{document}


• Note that there is an Amiri Quran font. – Davislor Jun 27 at 0:11
• It is also possible to load babel and the \babelprovide[import, main]{arabic} along with fontspec. – Davislor Jun 27 at 0:13
• @Davislor The babel approach isn’ working for me: the letters appear in the right order, but disconnected. – Thérèse Jun 27 at 0:52
• Load \usepackage[bidi=basic]{babel} in LuaLaTeX. You might need bidi=default in XeLaTeX. – Davislor Jun 27 at 1:31
• Maybe I should do a separate answer. This is getting to the point where it doesn't belong in comments. – Davislor Jun 27 at 1:34

Here is an example using the babel package and the Amiri Quran font on LuaLaTeX.

\documentclass{book}
\usepackage[bidi=basic]{babel}
\usepackage{fontspec}
\usepackage{quran}

\babelprovide[import, main]{arabic}

\babelfont{rm}%
[Ligatures=Common]{Libertinus Serif}
\babelfont{sf}%
[Ligatures=Common]{Libertinus Sans}
\babelfont{tt}%
{Libertinus Mono}
\babelfont[arabic]{rm}%
[Contextuals={WordInitial, Inner, WordFinal},
BoldFont = {Amiri Bold},
ItalicFont = {Amiri Slanted},
BoldItalicFont = {Amiri Bold Slanted}]%
{Amiri Quran}

\begin{document}
\quransurah[94]
\end{document}


On XeLaTeX, you would need to change the option to \usepackage[bidi=default]{babel}.

You might also prefer to disable Contextuals.

In case you need to use more than one language, it sets up the Libertinus font family, an extension by the designer of Amiri of Linux Libertine, as the default font family. This is an excellent companion font.

• Do you get connected script with xetex and \usepackage[bidi=default]{babel}? I don’t, with an up-to-date TeX Live 2019. – Thérèse Jun 27 at 2:45
• @Thérèse Yes, if I also remove the Contextuals= feature. – Davislor Jun 27 at 2:50