3

I've updated today my miktex distribution, especially the bidi package (and others...) from the 19.6 version to the actually version, because of unwanted behaviour in writing the negative numbers. In the preceding version, I used \makeatletter\@Latintrue\makeatother command which enabled me to produce tabulars in the way I want (in RightToLeft or in LeftToRight mode)...

Now after the update, this command is not recognized and produces the error message "! Undefined control sequence. \makeatletter\@Latintrue..".

What happened and how can I fix it ?

I give the .tex file used:

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{arabic}
\setotherlanguage{english}
\setmainfont[Script=Arabic]{Arial}%%% May choose the arabic font you want


%\makeatletter\@Latintrue\makeatother
\begin{document}
\pagestyle{empty}
\raggedright  %% For writing "completely" in LTR mode..

\LR{The positive numbers are ok, like for 36.3 (Unlike the version 19.6 of bidi, which wrote 3.36 ... (}

\LR{The negative numbers are not ok: for example, for -55 , where the sign is written on the right}

\LR{For the tabulars too, the behavior is bad. It's written always in RightToLeft mode, even if I put it into 
$\backslash$LR\{ \{...}

\LR{\centering 
\begin{tabular}{|c|c|c|}
\hline
a&b&c\\
\hline
1&-1&-2.3\\
\hline
\end{tabular} 
\par}

\end{document}

and its compilation, using xelatex: enter image description here

  • bidi has changed and \if@Latin has been discarded. – egreg Feb 15 '17 at 10:17
  • so what's the similar command for doing the job now ? – Faouzi Bellalouna Feb 15 '17 at 10:20
2

In addition of @UlrikeFicher answer you can patch the definition of \LR to use the font without Script=Arabic feature with

\let\oldLR\LR
\renewcommand{\LR}[1]{\oldLR{\fontspec{Arial} #1}}

For negative sign on the left for numbers in RTL context here a workaround

\catcode`\-=\active
\def-{\ifmmode\char`\-\else\char`\-\char"200E \fi}  

It remains a statement of the bug to fontspec or bidi maintainers

Complete code

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{arabic}
\setotherlanguage{english}
\setmainfont[Script=Arabic]{Arial}

\catcode`\-=\active
\def-{\ifmmode\char`\-\else\char`\-\char"200E \fi}

\let\oldLR\LR
\renewcommand{\LR}[1]{\oldLR{\fontspec{Arial} #1}}


\begin{document}


\pagestyle{empty}
\raggedright  %% For writing "completely" in LTR mode..

\LR{The positive numbers are ok, like for 36.3 (Unlike the version 19.6 of bidi, which wrote 3.36 ... )}

\LR{The negative numbers are not ok: for example, for -55 , where the sign is written on the right}

\LR{For the tabulars too, the behavior is bad. It's written always in RightToLeft mode, even if I put it into 
$\backslash$LR\{...\}}

\begin{LTR}
\centering 
\begin{tabular}{|c|c|c|}
\hline
a&b&c\\
\hline
1&-1&-2.3\\
\hline
\end{tabular} 
\par
\end{LTR}


-55  $-55$

\end{document}

enter image description here

  • 1
    The solution is useful for the question about \LR. What about the question about the output of negative numbers where the sign -appears in the right of the numbers, when it's not inside \LR{ }...? his was not the case for the previous version ! – Faouzi Bellalouna Feb 15 '17 at 14:45
  • Thank you for your ingenious code. I have a last question: for your new \LR, the command \fontspec{Arial} disturb me a little... can I choose the font that I want? If I use it for a tabular containing arabic and english words, what happens'? – Faouzi Bellalouna Feb 16 '17 at 10:04
2

Not a complete answer but too long for a comment. The test \if@Latin has been removed. There seems to be now the test \if@nonlatin which can be set with \setlatin and \setnonlatin, but imho it won't help with your problem and you should better analyze your problem more carefully instead of using undocumented side effects and work-arounds which can always break.

I never use bidi, don't know arabic and have no idea how numbers should be input and printed. But your negative numbers have the sign on the right side with Arial not because of bidi or polyglossia but because you are using Script=arabic:

\documentclass{article}

\usepackage{fontspec}
\setmainfont[Script=Arabic]{Arial}
\setsansfont{Arial}
\begin{document}
 -55 -45   
 −55 −45


 \sffamily
 -55 -45    
 −55 −45

\end{document}

enter image description here

  • The numbers should be printed exactly like in the english mode. It was the case before my last update... I'm really perplexed about this update... what happen's ? – Faouzi Bellalouna Feb 15 '17 at 11:20
  • I tried the commands \makeatletter\@nonlatintrue\makeatother and \makeatletter\@nonlatinfalse\makeatother.. It's accepted but hasn't any effect – Faouzi Bellalouna Feb 15 '17 at 11:25
  • I get the wrong negative numbers with TeXLive 2015 too (and with \@Latintrue), so it is certainly not new. Perhaps you removed some relevant code while making the example. – Ulrike Fischer Feb 15 '17 at 11:28
  • So what about the tabulars, on which the command \LR{} has absolutely no effect ?.. in 2015 this command inverse the columns... so the last become the first, and so on ! – Faouzi Bellalouna Feb 15 '17 at 11:34
  • As I said: I don't use bidi. But I get a warning from your \LR (\endL or \endR problem (0 missing, 1 extra) ), so I would say that you are misusing the command. With \begin{LTR} ... \end{LTR} it seems to work fine. – Ulrike Fischer Feb 15 '17 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.