我今天更新了我的 miktex 发行版,特别是bidi
软件包(以及其他软件包……),从 19.6 版更新到了最新版本,因为写入负数时出现了不必要的行为。在之前的版本中,我使用了\makeatletter\@Latintrue\makeatother
命令,它使我能够以我想要的方式(从右到左或从左到右模式)生成表格……
现在更新后,此命令无法被识别并产生错误消息“!未定义的控制序列。\makeatletter\@Latintrue..”。
发生了什么事?我该如何解决?
我给出使用的.tex 文件:
\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}
答案1
除了@UlrikeFicher 的回答之外,您还可以修补使用不带功能的\LR
字体的定义Script=Arabic
\let\oldLR\LR
\renewcommand{\LR}[1]{\oldLR{\fontspec{Arial} #1}}
对于 RTL 上下文中数字左侧的负号,这里有一个解决方法
\catcode`\-=\active
\def-{\ifmmode\char`\-\else\char`\-\char"200E \fi}
它仍然是一个错误声明fontspec
或bidi
维护者
完整代码
\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}
答案2
答案不完整,但评论太长了。测试\if@Latin
已被删除。现在似乎有可以用和\if@nonlatin
设置的测试,但在我看来,它不会帮助你解决问题,你应该更仔细地分析你的问题,而不是使用未记录的副作用和总是会出错的解决方法。\setlatin
\setnonlatin
我从未使用过 bidi,不懂阿拉伯语,也不知道如何输入和打印数字。但是您的负数在 Arial 右侧有符号,这不是因为 bidi 或多语,而是因为您使用了 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}