How to use Arabic symbols as mathematical variables?

so I am incredibly new to LaTex. Generally for my math writings and such, I just use MS Word's equation editor. However recently I was just playing around and I created my "own" equation set. I wanted to denote this with an unused symbol for my own satisfaction; unfortunately (I think) all the Greek letters have been used in some way, so I looked at the arabic letter و (waw) to suit my function needs. However, I have no idea how to work with it to make subscripts, equations, etc. Anyone have advice?

Also, what IDE do y'all use, because I've installed both TeXStudio and TexWork, and both are painfully slow/crash frequently

• Welcome to TeX.SE! The question about editors/IDEs is addressed at this question. Apr 23, 2017 at 19:29
• For the main question, about using a symbol other than Latin in Greek letters in equations and subscripts, a related question: What packages will let me use Cyrillic characters in math mode? Apr 23, 2017 at 19:30
• You probably want to check out Khaled Hosny’s work, starting here Nov 24, 2020 at 0:02
• In addition to XITS, Dr. Hosny has created Libertinus Math, which is a good match for Amiri and also supports Arabic and Persian math symbols. Nov 24, 2020 at 0:04

You can do it, but I don't think your readers will be happy.

\documentclass{article}
\usepackage{amsmath}

\DeclareRobustCommand{\waw}{{\text{\usefont{U}{xnsh}{m}{n}\symbol{240}}}}

\begin{document}

$\waw+3=x_{\waw}$

\end{document}


You can create a table of the font with

\documentclass{article}
\usepackage{fonttable}
\begin{document}
\xfonttable{U}{xnsh}{m}{n}
\end{document}

• I would agree :). Strange symbols make even easy stuff look complicated. Apr 23, 2017 at 22:47
• I couldn't get the table Nov 23, 2020 at 22:22
• @MamounMohammed Sorry, now it's fixed. Nov 23, 2020 at 22:28

If you can display the character in text mode, you can wrap the command in \textnormal to display it in math mode. It might be a good idea to additionally wrap it in \mathord to prevent ligatures in what should be a product of separate variables.

For example, you can support OpenType fonts this way, and display Arabic correctly simply by typing it in. This MWE is for recent versions of LuaLaTeX, but the definition of \mwaw ought to work with whatever method you use to display the character.

\documentclass{article}
\tracinglostchars=2
\usepackage[english, bidi=basic, layout=sectioning.tabular]{babel}
\usepackage{unicode-math}

\defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX, Renderer=HarfBuzz }

% You can substitute your fonts of choice here.  Any OpenType or TrueType
% font should work.
\babelfont{rm}
[Ligatures=Common, Language=Default, Scale=1.0]{Libertinus Serif}
\babelfont{sf}
[Ligatures=Common, Language=Default]{Libertinus Sans}
\babelfont{tt}
[Language=Default]{Libertinus Mono}

\babelprovide[import=ar, onchar=ids fonts]{arabic}
\babelfont[arabic]{rm}
[Ligatures=Common]{Amiri}
% Specify \babelfont[arabic]{sf} here, if needed.
\babelfont[arabic]{tt}
{ALM Fixed}
\setmathfont{Libertinus Math}

\newcommand\mwaw{\mathord{\textnormal{و}}}

\begin{document}
$\mwaw+3=x_{\mwaw}$
\end{document}