% katibmath manual. Compile with XeLaTeX (or LuaLaTeX):  xelatex katibmath.tex
% The symbol table (katibmath-symbols.tex) is generated by
% scripts/build-ctan-package.ts in the الكاتب العلمي repository.
\documentclass[11pt]{article}
\usepackage[margin=2.2cm]{geometry}
\usepackage{katibmath}
\usepackage{longtable,booktabs}
\usepackage[hidelinks]{hyperref}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0.5em}

\title{\textsf{katibmath}: Arabic mathematical notation\\for XeLaTeX and LuaLaTeX\\[0.3em]
  \large\textarabic{الترميز الرياضي العربي}}
\author{Muhammad Nabeel Shaesha}
\date{Version 0.1.0}

\begin{document}
\maketitle

\section{Introduction}

\textsf{katibmath} provides the Arabic mathematical notation used in Arabic
school and university texts: Arabic function names ($\jaa\arSeen$, $\nihaya_{\arSeen \to 0}$),
the Arabic Mathematical Alphabetic Symbols of Unicode ($\arDsTah$, $\arDsSad$, $\arDsHah$),
mirrored operators for Arabic-style formulas ($\rsum$, $\rint$, $\rsqrt{x}$),
the Arabic-script math signs ($\arCubeRoot$, $\arPercent$) and Arabic number sets.

It ships the OpenType math font \emph{Katib Math}: XITS Math with the Arabic
script of Amiri, under the SIL Open Font License. Every command in this package
is the one used by the Arabic writing app \emph{\textarabic{الكاتب العلمي}}
(Scientific Writer), so documents exported from the app compile unchanged.

\section{Usage}

\begin{verbatim}
\usepackage{katibmath}            % Katib Math becomes the math font
\usepackage[nomathfont]{katibmath} % keep your math font
\end{verbatim}

The package needs a Unicode engine (XeLaTeX or LuaLaTeX) and loads
\textsf{amsmath}, \textsf{graphicx}, \textsf{fontspec} and \textsf{unicode-math}.

With \textsf{polyglossia} or \textsf{babel} loaded for Arabic, their
\verb|\textarabic| typesets the Arabic words in formulas. Without them,
\textsf{katibmath} defines \verb|\textarabic| itself, using the Arabic of Katib
Math, so the commands also work in English documents.

\subsection*{Example}

\begin{verbatim}
\[ \nihaya_{\arSeen \to 0} \frac{\jaa\arSeen}{\arSeen} = 1 \qquad
   \rsum_{\arKaf=1}^{\arNoon} \arKaf \qquad
   \rint_0^1 f \qquad \rsqrt{\arSeen} \qquad \arReals \]
\end{verbatim}
\[ \nihaya_{\arSeen \to 0} \frac{\jaa\arSeen}{\arSeen} = 1 \qquad
   \rsum_{\arKaf=1}^{\arNoon} \arKaf \qquad
   \rint_0^1 f \qquad \rsqrt{\arSeen} \qquad \arReals \]

Bare Arabic letters typed in math are not shaped by the math font: use the
alphabet commands (\verb|\arSeen|, \verb|\arKaf| … in section~\ref{sec:symbols})
or wrap words in \verb|\textarabic{...}|, which works in math mode too.

\subsection*{Helpers}

\begin{description}
  \item[\texttt{\textbackslash katibmirror\{x\}}] $x$ flipped horizontally in the
    current math style: \verb|\katibmirror{\sum}| gives $\katibmirror{\sum}$.
  \item[\texttt{\textbackslash katibglyphs}] Katib Math as a text font.
  \item[\texttt{\textbackslash katibarabic}] Katib Math's Arabic, shaped.
\end{description}

\subsection*{Limits}

Right-to-left formulas (the whole formula laid out from right to left) are not
supported by \TeX's math engine; \textsf{katibmath} gives Arabic \emph{symbols}
inside left-to-right formulas.

\section{Symbols}\label{sec:symbols}
\input{katibmath-symbols}

\section{Licence}

The package code is distributed under the \LaTeX\ Project Public License 1.3c or
later. The font \texttt{KatibMath-Regular.otf} is distributed under the SIL Open
Font License 1.1 (\texttt{OFL.txt}); it is derived from XITS Math and Amiri.

\end{document}
