Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Issue in numbers with period after update #11

Open
seloumi opened this issue Oct 31, 2019 · 7 comments
Open

Issue in numbers with period after update #11

seloumi opened this issue Oct 31, 2019 · 7 comments

Comments

@seloumi
Copy link

seloumi commented Oct 31, 2019

Brief outline of the issue

After some update (bidi,latex,xetex,...) I'm facing problem in numbers with . or - which is not happening previously, numbering direction is correct with maghrib form 0,1,2,...,9 but with mashriq form ٠,١,٢,٣,٤,٥,٦,٧,٨,٩ direction of numbering do not change with command (\setlatin - \setnonlatin)

I guess the problem come from this part (bidi) code do not work for mashriq form

bidi/bidi.dtx

Lines 2169 to 2178 in 3b57786

\newcount\bidi@digits
\XeTeXinterchartokenstate=\@ne
\newXeTeXintercharclass\bidi@digits@charclass
\newXeTeXintercharclass\bidi@sepmark@charclass
\XeTeXcharclass `\. \bidi@sepmark@charclass
\XeTeXcharclass `\- \bidi@sepmark@charclass
\bidi@digits=`\0 \loop \XeTeXcharclass \bidi@digits \bidi@digits@charclass \ifnum\bidi@digits<`\9 \advance\bidi@digits \@ne \repeat
\bidi@digits=` \loop \XeTeXcharclass \bidi@digits \bidi@digits@charclass \ifnum\bidi@digits<` \advance\bidi@digits \@ne \repeat
\XeTeXinterchartoks \bidi@sepmark@charclass \bidi@digits@charclass = {\DigitsDotDashInterCharToks}
\newcommand*{\DigitsDotDashInterCharToks}{\if@nonlatin\char"200F \fi}

Minimal example showing the issue

% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{bidi}
\setmainfont[Script=Arabic]{Amiri}
\parindent=0pt

\begin{document}

\setRTL
\setnonlatin

\section{text}
\subsection{text text}
\subsection{text text}

1.23 % change direction with \setnonlatin - \setlatin 

١.٢٣ % do not change direction with \setnonlatin - \setlatin

\end{document}

If we remove the loop for mashriq form the result is fine

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{bidi}
\setmainfont[Script=Arabic]{Amiri}
\parindent=0pt

\makeatletter
\newcount\bidi@digits 
 \XeTeXinterchartokenstate=\@ne 
 \newXeTeXintercharclass\bidi@digits@charclass 
 \newXeTeXintercharclass\bidi@sepmark@charclass 
 \XeTeXcharclass `\. \bidi@sepmark@charclass 
 \XeTeXcharclass `\- \bidi@sepmark@charclass 
 \bidi@digits=`\0 \loop \XeTeXcharclass \bidi@digits \bidi@digits@charclass \ifnum\bidi@digits<`\9 \advance\bidi@digits \@ne \repeat
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass 
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass     
 \XeTeXinterchartoks \bidi@sepmark@charclass  \bidi@digits@charclass = {\DigitsDotDashInterCharToks} 
\makeatother

\begin{document}

\setRTL
\setnonlatin

\section{text}
\subsection{text text}
\subsection{text text}

1.23 % change direction with \setnonlatin - \setlatin 

١.٢٣ % change direction with \setnonlatin - \setlatin

\end{document}

image

Log and PDF files

test.log
test.pdf

@seloumi seloumi changed the title Issue in numbers with periode after update Issue in numbers with period after update Oct 31, 2019
@davidcarlisle
Copy link
Member

@seloumi probably this was after I re synced from Vafa's latest version so that this repository matches ctan again. I can make technical TeX fixes to keep things working like

a825300

which just made the patch match the updated version of \begin in the last latex release.

But I can't actually read these scripts so I would need more than just a @ ping and two ?? to pinpoint the issue.

Vafa is in this group but may not be available at present. You might be better asking on stackexchange, if a user familiar with the bidi coding can see what the issue is.

I may look later but this is hard for me as I would not necessarily notice if the characters were in the wrong order.

If a fix is suggested I can apply it and arrange ctan uploads etc.

@seloumi
Copy link
Author

seloumi commented Nov 3, 2019

What puzzles me is the loop to add \XeTeXcharclass looks like it don't work

\bidi@digits=` \loop \XeTeXcharclass \bidi@digits \bidi@digits@charclass 
\ifnum\bidi@digits<` \advance\bidi@digits \@ne \repeat

Even though it was working before !
Without \loop it work fine

\XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass 
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass
 \XeTeXcharclass  ` \bidi@digits@charclass

@davidcarlisle
Copy link
Member

davidcarlisle commented Nov 3, 2019 via email

@davidcarlisle
Copy link
Member

@seloumi OK I can say why the loop and your expanded version differ.

the loop sets up a contiguous series of unicode slots from

U+06f0 EXTENDED ARABIC-INDIC DIGIT ZERO

to

U+06f9 EXTENDED ARABIC-INDIC DIGIT NINE

Your expanded list uses the same 0:

U+06f0 EXTENDED ARABIC-INDIC DIGIT ZERO

but then 1 to 9 are ١ to ٩

which is

U+0661 ARABIC-INDIC DIGIT ONE

U+0669 ARABIC-INDIC DIGIT NINE

I have no view on what digits should get which character class. Both sets?

@seloumi
Copy link
Author

seloumi commented Nov 4, 2019

Thanks, so I think another loop must be added for ARABIC-INDIC DIGIT

5mlK8

@davidcarlisle
Copy link
Member

davidcarlisle commented Nov 4, 2019 via email

@bykhov
Copy link

bykhov commented Jan 2, 2020

Since I have recently updated Latex distribution (probably since the change in polyglossia v1.46?), I have similar problems in Hebrew text with ordinary numbers when both numbers with period and section numbering reverted. Example follows.

\documentclass[12pt]{article}
\usepackage{polyglossia,bidi}
\setmainlanguage{hebrew}
\setotherlanguage{english}
\setmainfont{David}
\setmonofont{Courier New}
\begin{document}
 בדיקה 1.23
\begin{english}
Test 1.23
\end{english}
\section{א}
\subsection{א}
\subsection{א}
\end{document}

image

See also reutenauer/polyglossia#213

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

No branches or pull requests

3 participants