unicode-math
unicode-math copied to clipboard
Better support for Arabic math
Status
UNDER DEVELOPMENT
Description
Improve handling of Arabic math symbols.
- Allow Arabic math alphabets to be used when
unicode-mathis loaded, previously they would always be using CMMI fonts. - Fix spacing of Arabic comma by making sure it gets punctuation math class.
Todo
- [x] Tests added to cover new/fixed functionality
- [ ] Documentation added if necessary
- [x] Code follows expl3 style guidelines
Minimal example demonstrating the new/fixed functionality
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{XITSMath-Regular.otf}
\usepackage{ifluatex}
\begin{document}
\ifluatex\mathdir TRT\fi
\[
\mAlef + \mBeh = \minitialJeem
\]
\end{document}
I want to also implement math mapping for Arabic, so using regular Arabic letters in math mode would map to math alphanumerics like with Latin and Greek. I looked into um-code-mathmap.dtx and um-code-alphabets.dtx but I’m still not sure how this works.
I’d need new initial, tailed, looped, and extended math styles, as well as adding Arabic mapping to bb style.
I’m not sure what style to use for the first Arabic math alphabet; it is functionally equivalent to math italics, but it is not italic (there is not italic style in Arabic, but it it is not even slanted), so up would be a better fit, but what about the regular Arabic letters? (they are sometimes used in math, e.g. math dal is used for variables while regular dal is used for function, similar f()), so may be use it for the math alphabet and up for the regular one.
\mathnormal would map to regular Arabic letters, up if we go with the scheme above, to it except for heh (it has no it form) and jeem (initial form is used).
I appreciate any guidance on how to achieve this.
The last commit is my attempt to do the above (mostly copy/paste), but it does not seem to do any thing. I don’t actually think any of the code I added is being used.
@khaledhosny thanks for this, Possibly can't review this weekend, but will look later, also if there are any updates needed in TR25 that may also be possible.
@khaledhosny thanks for this, Possibly can't review this weekend,
Thanks.
also if there are any updates needed in TR25 that may also be possible.
I think MathClass-15.txt is missing an entry for 060C giving it a P class (as well as my comment in https://github.com/latex3/unicode-math/issues/619#issuecomment-2028785695).
Thanks @khaledhosny — and please don't hesitate to keep this on my radar if I seem to disappear for a while, it's a bit of a crazy year.
I would if we should we have this set up by default with all fonts, or is there more that needs to be done via OpenType features etc such that it would make sense to require an explicit option (which could use a heuristic to activate automatically) ?
Thanks @khaledhosny — and please don't hesitate to keep this on my radar if I seem to disappear for a while, it's a bit of a crazy year.
Thanks, no pressure.
I would if we should we have this set up by default with all fonts, or is there more that needs to be done via OpenType features etc such that it would make sense to require an explicit option (which could use a heuristic to activate automatically) ?
Typesetting Arabic math requires also right-to-left support in math mode, which is currently available in LuaTeX only and requires fiddling with low-level primitive. The changes here are prerequisite for further improvement in this area, as without this you can’t use Arabic math alphabets at all.