How to write Quran via Latex?
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}
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}%
[BoldFont = {Amiri Bold},
ItalicFont = {Amiri Slanted},
BoldItalicFont = {Amiri Bold Slanted},
Renderer=HarfBuzz]
{Amiri Quran}
\begin{document}
\quransurah[94]
\end{document}
On XeLaTeX, you would need to change the option to \usepackage[bidi=default]{babel}
.
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.