Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for Arabic math #633

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

khaledhosny
Copy link
Contributor

@khaledhosny khaledhosny commented Mar 31, 2024

Status

UNDER DEVELOPMENT

Description

Improve handling of Arabic math symbols.

  1. Allow Arabic math alphabets to be used when unicode-math is loaded, previously they would always be using CMMI fonts.
  2. Fix spacing of Arabic comma by making sure it gets punctuation math class.

Todo

  • Tests added to cover new/fixed functionality
  • Documentation added if necessary
  • 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}

Without this, even using Unicode literals does not work as it still
tries to use cmmi for them and we get the missing character warnings:

Missing character: There is no 𞸃 (U+1EE03) in font cmmi10!
Without this it does not seem to get \mathpunct class and has the wrong
spacing.
@khaledhosny
Copy link
Contributor Author

khaledhosny commented Mar 31, 2024

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.

@khaledhosny
Copy link
Contributor Author

khaledhosny commented Mar 31, 2024

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.

@davidcarlisle
Copy link
Member

@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
Copy link
Contributor Author

@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 #619 (comment)).

@wspr
Copy link
Collaborator

wspr commented Apr 1, 2024

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) ?

@khaledhosny
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants